How to get data from prev closed HeikenAshi bar

Created at 03 Aug 2023, 14:52
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!
V.

v.fiodorov83

Joined 24.07.2019

How to get data from prev closed HeikenAshi bar
03 Aug 2023, 14:52


Greetings. I want to get the OHLС data of the HeikenAshi bar at the opening of a new bar in the OnBar() method.
However, everything that I get was shown in the screenshot, on it I also showed what I still wanted to receive. Can you help with this?


@v.fiodorov83
Replies

ThomasSparrow
03 Aug 2023, 20:15 ( Updated at: 20 Aug 2023, 08:39 )

How to get data from prev closed HeikenAshi bar

Try this:

protected override void OnBar()
        {
           Bars hk = MarketData.GetBars(TimeFrame.HeikinMinute);
              Print("High: ", hk.HighPrices.Last(1));
              Print("Open: ", hk.OpenPrices.Last(1));
              Print("Close: ", hk.ClosePrices.Last(1));
              Print("Low: ", hk.LowPrices.Last(1));
        }


@ThomasSparrow