Login Page - Create Account

Support Board


Date/Time: Tue, 31 Mar 2020 03:05:26 +0000



RegionValueToYPixelCoordinate question

[2014-10-09 16:00:08]
onnb - Posts: 558 | Ending Date: 2020-11-29
is the RegionValueToYPixelCoordinate to be used as the value to draw when using relative values?


float reversalPrice = 1300.25;
....
Tool.UseRelativeValue = 1;
Tool.BeginValue = sc.RegionValueToYPixelCoordinate(reversalPrice, 0);
....


[2014-10-09 16:04:16]
onnb - Posts: 558 | Ending Date: 2020-11-29
i can see that its not and that the % can be calculated using GetMainGraphVisibleHighAndLow?

[2014-10-09 17:15:55]
Sierra Chart Engineering - Posts: 82871 | Ending Date: 2020-06-09
Yes, to the previous post.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
[2014-10-09 17:22:46]
onnb - Posts: 558 | Ending Date: 2020-11-29
i'm not sure this works either. GetMainGraphVisibleHighAndLow will return the high/low of the visible bars.
1. if i am using custom chart, this should return the basedata bars high/low or the custom bars high/low?

2. in order to draw relative, i need the highest visible price and the lowest visible price on the axis so i can get a % of that to place the tool drawings - right?
Date Time Of Last Edit: 2014-10-09 17:23:02
[2014-10-10 16:36:40]
Sierra Chart Engineering - Posts: 82871 | Ending Date: 2020-06-09
1. It would be for the custom chart but it is not an entirely reliable function due to the fact that it cannot know exactly what the price range is until the study function returns and the chart is drawn.

2. We are not sure what you need to do. According to the documentation it is a number from 1 to 100


If UseRelativeValue is set to 1 or a nonzero value, then BeginValue is a relative value. It is a percent. Where 1 = 1%. The whole height of the chart region is 100%. 0 = the bottom side of the chart. 100 = the top side of the chart.

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
[2014-10-10 19:15:12]
onnb - Posts: 558 | Ending Date: 2020-11-29
I'll explain

I need to draw a line at some price value. I want to draw it using relative coordinates. I need to convert price value to %'s.


[2014-10-10 19:52:58]
Sierra Chart Engineering - Posts: 82871 | Ending Date: 2020-06-09
If you are creating a custom chart, you should therefore know what the high and low is for the displayed bars and you can do the calculations.

You may want to be aware of these:

sc.IndexOfFirstVisibleBar;
sc.IndexOfLastVisibleBar;
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
[2014-10-10 20:04:25]
onnb - Posts: 558 | Ending Date: 2020-11-29
Yes, but the input to the drawing is % of the total screen height which is different than the range of the visible bars. The visible bars might take up only part of the vertical screen.
In order to calculate I'd need the price at the top and bottom of the visible scale on the right hand side.

Hope this makes sense ;)

On the same subject, looking for a possible workaround, on Custom charts, if I want to add extra bars (in the projection or extended area on the right hand side of the chart), I recall that there is an api for that. I searched the docs but for some reason couldn't find it. Can you kindly paste a link?
[2014-10-15 00:22:35]
Sierra Chart Engineering - Posts: 82871 | Ending Date: 2020-06-09
In order to calculate I'd need the price at the top and bottom of the visible scale on the right hand side.
This is hard to arrive at. There are some calculations involved in this, but we do not have time to go into those.

if I want to add extra bars (in the projection or extended area on the right hand side of the chart),

Refer to this code example:
/studies6.cpp/ scsf_ForwardProjectionBars

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.

To post a message in this thread, you need to login with your Sierra Chart account:

Login

Login Page - Create Account