This is most probably going to be an easy question for you all, but I'm still a newbie in terms of programming for NT8.
For my indicator I want to load all tick replay data, so I use OnMarketData.
Inside I have a dictionary with data of current candle. When base.IsFirstTickOfBar is true - this dictionary is added to the main list of all data and cleared to gather new candle's data.
At base.IsFirstTickOfBar part, I send candle data to my external data source.
When all data is loaded - I have 2 collections:
1) All candles without the current one in the main list (sent externally)
2) Dictionary with current's candle data inside
So my problem is - I can successfully send 99,99% of candle data, but the current one (last one) is not being sent, because there is no next base.IsFirstTickOfBar occurence .
I don't want to send data on each OnMarketData event because that would be terrible during ticket replay data load. I want to enable it when all data is loaded and at the very end - it can start running on every OnMarketData occurence.
protected override void OnMarketData(MarketDataEventArgs e) { if (e.MarketDataType == MarketDataType.Last) { if (base.IsFirstTickOfBar) { previous candle is finished - send data and clear dictionary } if (e.Price >= e.Ask) { add to current's candle collection } else if (e.Price <= e.Bid) { add to current's candle collection } I wanted to add sending current's candle data here but during tick replay it would be executed countless times. } }
Comment