Created a list of speculative ETF's (many of them have triple leverage) that reallocates on the first day of the month.  Now, I'd like to use some trigger to "liquidate" the portfolio if we get an overbought situation as defined by the TRIX.

Defined some overbought and oversold TRIX indicator levels, and thought the condition for an overbought condition could be placed in the OnData method.  When I run a backtest it doesn't seem to "liquidate" the portfolio during the backtest period that I chose.  Is the OnData method the proper place to put an early exit trigger?  Is the indicator updated with each new bar of data?

My goal is to be able to "test" a variety of early exit signals to side step market drawdowns.  Looking to get the TRIX indicator properly programed so I can test early exit strategies.  From my backtest it doesn't appear the TRIX overbought situation is happening.

Any other suggestions on how to "test" for an overbought situation?  Appreciate all insights!