How get close price first candle of London trading session

Created at 23 Apr 2020, 13:33
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!
AN

anton.kovalchuk

Joined 01.03.2016

How get close price first candle of London trading session
23 Apr 2020, 13:33


Hi All,

I apologize, I'm not so strong in programming.
I'm trying to get close price first candle of London trading session.

cBot has to open Execute Market Order regards to close price first candle of London trading session according to selected time frame.

Could somebody help with example how it can be done?

 

Thanks in advance.


@anton.kovalchuk
Replies

PanagiotisCharalampous
23 Apr 2020, 13:49

Hi Anton,

Assuming you are referring to h1 bars and you are using GMT time, here is an example

            var bars = MarketData.GetBars(TimeFrame.Hour, Symbol.Name);          
            for (int i = 0; i < 24; i++)
            {
                if (bars.OpenTimes.Last(i).Hour == 8)
                    Print(bars.ClosePrices.Last(i));
            }

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

anton.kovalchuk
23 Apr 2020, 14:54

RE:

PanagiotisCharalampous said:

Hi Anton,

Assuming you are referring to h1 bars and you are using GMT time, here is an example

            var bars = MarketData.GetBars(TimeFrame.Hour, Symbol.Name);          
            for (int i = 0; i < 24; i++)
            {
                if (bars.OpenTimes.Last(i).Hour == 8)
                    Print(bars.ClosePrices.Last(i));
            }

Best Regards,

Panagiotis 

Join us on Telegram

This is exactly what I need

Thank you a lot PanagiotisCharalampous


@anton.kovalchuk