I need some help please.
Here is the basic idea:
I'm trying to write a algo that uses ticks , heikin ashi and a rolling window as the data.
For this currently I'm running a consolidator set to 2 minutes, as I can't get the ticks work.
After the consolidator is set I add the heikin ashi indicator and then I add it to the rolling window.
This will enable me to compare the open value of the current bar with the open / close of the previous bars.
My questions are as follows:
1 - am i adding the indicator correctly, using the consolidated data, and how do i know the data being used is the data that was processed by the indicator?
2 - how do i change the consolidator to run on ticks instead of time?
2 - how can i add a candle stick graph / plot of this data (the consolidated, heikin ashi processed data) to the output?
Here is my current code that should be doing this.
ha = HeikinAshi
def Initialize(self):
self.window = RollingWindow[QuoteBar](2)
def OnData(self,slice):
consolidator = QuoteBarConsolidator(timedelta(minutes=2))
consolidator.DataConsolidated += self.OnDataConsolidated
self.SubscriptionManager.AddConsolidator(contract.Symbol, consolidator)
self.RegisterIndicator(contract.Symbol, self.HA, consolidator)
def OnDataConsolidated(self, sender, data):
if not (self.HA.IsReady): return
self.window.Add(data)
if(currBar.Close > pastBar.Close + 1):
#do some stuff