I'm developing an indicator that is either greater than 0, or less than 0. I'm using a universe selection, and not picking single stocks to trade. how can i set this up in OnData()?

pseudocode:

if indicator <= 0
    if not paused, pause trading
    if invested, liquidate
    return

if indicator > 0
     if paused, resume trading
 

Thanks!

   

Author