Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 06:01:34 +0000



Post From: ACSIL - Getting the relative X position(1-150) of a specific bar

[2017-06-01 16:57:53]
Zosimus - Posts: 345
Whenever you have time for this:

As far as I understand the sc.BarIndexToRelativeHorizontalCoordinate(int BarIndex) function does not give the correct values when there is a space on the right edge of the chart (when the last bar is not at the most right edge of the chart).

This is illustrated in the 2 attached images.
One image shows that when the last bar is at the right edge the Relative Horizontal coordinate seems reasonable (147).
The second image shows that when the last bar is around the middle of the horizontal scale the value seems wrong (145 while it should be around 75).

The code I used to check this is:

int RelHorzPosBar = sc.BarIndexToRelativeHorizontalCoordinate(sc.Index);  
  SCString str;
  str.Format("RelCoordinate = %i", RelHorzPosBar);
  sc.AddMessageToLog(str, 0);

Release 1564.
Date Time Of Last Edit: 2017-06-01 17:03:57
imageRelBarXCoordinate__1.png / V - Attached On 2017-06-01 16:55:29 UTC - Size: 59.86 KB - 335 views
imageRelBarXcoordinare_2.png / V - Attached On 2017-06-01 16:55:35 UTC - Size: 59.15 KB - 307 views