Back

Using TRIX To Liquidate

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!

 

Update Backtest








0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hey Mike,

One way to approach this is to first create a SymbolData class to contain all the indicator data for each symbol. This organization makes it easier to keep track of indicators and also simpler to make calculations based on those indicators.

We create a TRIX indicator for each symbol and then in OnData, we can cycle through our symbols and liquidate any symbols which are overbought.

Note: I strongly discourage leaving personal information like phone numbers and email addresses in your post/backtest.

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed