Back

Triangular Moving Average's Update Method expects IndicatorBasePoint input

I want to use Triangular Moving Average with S&P 500 Futures.

Since we are using Futures, we can't set up the Indicator to be automatically updated in the Initialize function because... Futures.

In the OnData method, we use the Update method to pump data into the Triangular Moving Average indicator.

The Update method expects an IndicatorDataPoint (yet, programatically, a TradeBar is more intuitive).

Once I get a TradeBar, I create an IndicatorDataPoint and pump the Triangular Moving Average with the IndicatorDataPoint.

My question is... Is there a better way? What is the "QuantConnect" (optimal) way to get the TradeBar of the front month and an IndicatorBasePoint for pumping indicators?

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.


Hi Michael,

What if you do it like this 

def OnData(self, data):
for chain in slice.FutureChains:
contracts = list(filter(lambda x: x.Expiry > self.Time + timedelta(45), chain.Value))
for contract in contracts:
if ('ES ' in str(contract.Symbol)) and (self.frontES is None):
self.frontES = sorted(contracts, key=lambda x: x.Expiry, reverse=False)[0] #True is lowest to highest
self.trima = self.TRIMA(self.frontFuturesContract.Symbol, 75, Resolution.Minute)

 

0

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