Basic question
Created at 07 Apr 2021, 12:55
AN
Basic question
07 Apr 2021, 12:55
I understand that the "OnBar" method executes on each bar close. I could not find which bar close it refers to.
How do I go about specifying that I want it to be called on every "m1" or "h1" bar close. Can I use multiple "OnBar" methods in the same robot and have them be called on different timeframe candles.
amusleh
07 Apr 2021, 13:17
Hi,
OnBar/Tick methods are called based on current chart symbol and time frame, if you want to receive on bar/tick events of other timeframes or symbols yopu have to first get that symbol/timeframe Bars object by calling the MarketData.GetBars method and passing the time frame and symbol name.
After you got the Bars then you can subscribe to its BarOpened and Tick events:
Getting Bars of another timeframe/symbol:
@amusleh