How to calculate the date of the centre of the trend line.

Created at 26 Sep 2023, 04:44
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!
yomm0401's avatar

yomm0401

Joined 11.04.2020

How to calculate the date of the centre of the trend line.
26 Sep 2023, 04:44


Does anyone know how to calculate the date of the centre of the trend line?

If the period when the trendline is drawn is an odd number, the centre date can be found from the Bar index.
But how can the centre date be calculated if the period is an even number?
If the date skips dates such as weekends, the correct date will not be calculated by subtracting the period and dividing by two.

Can someone please tell me how to do this?


@yomm0401
Replies

firemyst
02 Oct 2023, 08:04

Take the date of the opening time of the bar before, and the first bar after.

 

then find the difference between the two, divide by 2, and add that to the opening time of the bar before the midpoint.

 

Ex:

open time to bar before is Sept 15, 6pm

open time of bar after is Sept 15, 8pm

Difference between them is 2 hours

2 / 2 == 1

6pm + 1 == 7pm.

 


@firemyst