GetBarsAsync example?

Created at 10 Feb 2020, 04:49
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
FI

firemyst

Joined 26.03.2019

GetBarsAsync example?
10 Feb 2020, 04:49


Hi everyone:

I have the following code. Would anyone be able to provide an example of how I can do this with the new method GetBarsAsync?

//some initializing code in the method.

_marketSeriesShortTimeFrame = MarketData.GetBars(MAShortTimeFrame, _symbols);
_marketSeriesMediumTimeFrame = MarketData.GetBars(MAMediumTimeFrame, _symbols);
_marketSeriesLongTimeFrame = MarketData.GetBars(MALongTimeFrame, _symbols);

//other code and calculations performed once we have the market data.

//How can I make sure this code from here down isn't run until all the above async calls have completed?

 

Thank you.


@firemyst