Help me how to show range bar time for second time scale.

Created at 04 May 2024, 13:48
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!
MongolTrader's avatar

MongolTrader

Joined 12.02.2015

Help me how to show range bar time for second time scale.
04 May 2024, 13:48


I coding as below. It work well show previous period bar time by seconds.  But problem is that can't show real time last index bar accumulation total seconds. When i try it with last bar index and compare with server time utc than indicator breaks work and show below code.  Help me get trick for code. Best & Regards.

            TimeSpan TimerA = Bars.OpenTimes.Last(0) - Bars.OpenTimes.Last(1);
            if (TimerA.TotalSeconds < Save)
            {
                Green[index - 1] = TimerA.TotalSeconds;
            }
            if (TimerA.TotalSeconds > Save)
            {
                Red[index - 1] = TimerA.TotalSeconds;
            }


@MongolTrader
Replies

PanagiotisCharalampous
05 May 2024, 15:30

Hi there,

I do not understand what the problem is with the specific code sample. Can you please share the complete cBot code so that we can reproduce it and explain to us how we can see this?

Best regards,

Panagiotis


@PanagiotisCharalampous