How to access a specific m1 bar's high with only the data and time as given?

Created at 31 Jul 2020, 12:13
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!
FA

fang0092

Joined 08.06.2019

How to access a specific m1 bar's high with only the data and time as given?
31 Jul 2020, 12:13


I drew a rectangle and I have stored time1 of the rectangle into var t1 and time2 of the rectangle into var t2. Now I want to get the high of m1 bars at t1 and t2.

For example: t1 = July 29, 2020 12:00 and t2 = July 29, 2020 12:10. I want to get the high of July 29, 2020 12:00 m1 bar and July 29, 2020 12:10 m1 bar.

How do I do it?


@fang0092
Replies

PanagiotisCharalampous
31 Jul 2020, 12:21

Hi fang0092,

See below an example

            var mBars = MarketData.GetBars(TimeFrame.Minute);
            var h1 = mBars.HighPrices[mBars.OpenTimes.GetIndexByTime(t1)];

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

fang0092
31 Jul 2020, 12:41

RE:

PanagiotisCharalampous said:

Hi fang0092,

See below an example

            var mBars = MarketData.GetBars(TimeFrame.Minute);
            var h1 = mBars.HighPrices[mBars.OpenTimes.GetIndexByTime(t1)];

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you


@fang0092