Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 22:45:33 +0000



[User Discussion] - Is there a way to lock multiple indicators in a subgraph to a single zero line in the middle?

View Count: 1149

[2015-07-19 14:45:35]
bjohnson777 (Brett Johnson) - Posts: 284
Is there a way to lock multiple indicators in a subgraph to a single zero line in the middle?

Example: If I have MACD and Up/Down Volume Ratio on a single subgraph, their zero lines will float based on their overall visable scale. Can the zero lines be locked to the middle of the subgraph? If I also layer Stochastic and RSI, their "zero lines" are essentially 50.0. Can their 50's be locked into the previous zero lines? and vice versa if Sto and RSI are first on the subgraph?

I ask because the graphs are getting hard to read when they float up and down a lot.

It would also be useful to see the multiple indicators above or below the true midline of the subgraph to help indicate if price movement is positive or negative.

Thanks
[2015-07-19 15:57:21]
Sierra Chart Engineering - Posts: 104368
When you make reference to "subgraph" in this case we think you are referring to a Chart Region instead. Sierra Chart refers to a Subgraph as a drawing within a Graph/Study.

It is possible for multiple studies within the same Chart Region to share the same scale and therefore the same zero level if the Scale Range for them is set to "Automatic". The zero level cannot be fixed within the middle of the scale.

Can their 50's be locked into the previous zero lines?
No. Definitely not. It will be up to you to figure out how to accomplish this with custom study programming.
Sierra Chart Support - Engineering Level

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

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-07-19 15:58:11
[2015-07-19 16:58:38]
SgtJ - Posts: 154
If you add as the first study of the subregion the "line" study, set to zero it may help...just gotta play w/it.
[2015-07-19 21:19:16]
Sawtooth - Posts: 3993
You could use multiple instances of the Study Subgraph Subtract study subtract 50 from the Sto and RSI studies so that their center line is zero. Be sure to set Draw Zeros to Yes.

You can force the zero line to remain in the center of the chart region by adding the Horizontal Lines study, (or 3 instances of the Line study) with levels set to 50, 0 and -50.

You can use the Study Subgraph Multiply study to make the MACD expand into the 50/-50 chart region.

You can do all of the above with a single instance of the Spreadsheet Study study.

Hide all of the original studies, except the Up/Down Volume Ratio study.
[2015-07-20 07:43:45]
bjohnson777 (Brett Johnson) - Posts: 284
Thanks for all the replies. Tomgilb's is the closest, but it still comes down to a varying multiplier that will shrink or expand the graph based on what's visible.

This is the code I used in my scratch pad graph output program I've been working on the past couple years. I was hoping something similar could be added to the "Scale" button since it is simple.

Note that I prefix local function variables with 'f' since I've got some global variables I want to make sure I don't interact with.

//Scale plot to 100 range, mainly used for chart combining.
double TAScale100Auto(const int fIndexStart, const int fIndexEnd, double *fArray) {
int i;
double fLow, fHigh, fMultiplier;
fLow = fArray[fIndexStart];
fHigh = fArray[fIndexStart];
//find the lowest and highest numbers.
for(i=fIndexStart; i<=fIndexEnd; i++) {
if(fLow > fArray[i]) {fLow = fArray[i];}
if(fHigh < fArray[i]) {fHigh = fArray[i];}
}
//scale the range, 50.0 center point.
fMultiplier = 100.0 / (fHigh - fLow);
for(i=fIndexStart; i<=fIndexEnd; i++) {
fArray[i] = (fArray[i] - fLow) * fMultiplier;
if(fArray[i]>100.0) {fArray[i]=100.0;}
if(fArray[i]<0.0) {fArray[i]=0.0;}
}
return fMultiplier;
} //end double TAScale100Auto

[2015-07-20 08:11:01]
bjohnson777 (Brett Johnson) - Posts: 284
Just a sec, posted the wrong code. That's the generic fit to 100 scale. This is the auto center one.

I'm also going to have a look at sc.IndexOfFirstVisibleBar and sc.IndexOfLastVisibleBar and see if I can create a filter study.

//Auto-scale plot to 100 range with 50 middle, mainly used for chart combining.
double TAScale100PlusMinusAuto(const int fIndexStart, const int fIndexEnd, double *fArray) {
int i;
double fLow, fHigh, fMultiplier;
fLow = fArray[fIndexStart];
fHigh = fArray[fIndexStart];
//find the lowest and highest numbers.
for(i=fIndexStart; i<=fIndexEnd; i++) {
if(fLow > fArray[i]) {fLow = fArray[i];}
if(fHigh < fArray[i]) {fHigh = fArray[i];}
}
//select the largest number
if(fLow < 0.0) {fLow *= -1.0;}
if(fLow > fHigh) {fHigh = fLow;}
//make the range.
fMultiplier = 100.0 / (2.0 * fHigh);
//scale the range
for(i=fIndexStart; i<=fIndexEnd; i++) {
fArray[i] = (fArray[i] * fMultiplier) + 50.0;
}
return fMultiplier;
} //end double TAScale100PlusMinusAuto

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

Login

Login Page - Create Account