Login Page - Create Account

Support Board


Date/Time: Sat, 10 May 2025 14:14:49 +0000



Post From: Is there a way to lock multiple indicators in a subgraph to a single zero line in the middle?

[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