I'd suggest moving the logic into the algorithm and out of pipeline definition. Separate the data from the logic (though here it's still mixed together a bit).
I like using the 'query' method to easily perform logic. Add the SMA factors to the pipeline definition then maybe change your 'before_trading_start' method to something like this.
def before_trading_start(context, data):
context.pipe_output = pipeline_output('fundamentals_pipeline')
#high roic stocks for longs
context.longs = (context.pipe_output.
query('longs == True and sma_50 > sma_200').
# low roic stocks to short
context.shorts = (context.pipe_output.
query('shorts == True and sma_50 < sma_200').
Attached is a backtest with that change (note that I shortened the backtest timeframe to reduce run time).