Indicator scaling on chart

Hi Guys.
I have a simple problem, but I have no idea how to solve.It has bugged me for years! hahaha. I have tried to research this, and played around with custom scaling and automatic scaling, played with styleOwnScale and styleLeftAxisScale. But still cant solve this.

where I add Bollinger bands to a chart, especially when there is big volatility, the bands can be quite big. when this happens the chart compensates for these large bands, by "compressing" the scale of the chart.

Question, how do I stop this " scale compression", while having the bands on the chart. I'm not worried if the band value goes above or below my actual chart view.
I hope this is clear. Here is an example. Thanks for any help on this btw!

Normal view.
normal%20view
Compressed with bollinger bands.
compressed

Here is the simple code.

Plot(Close,"",colorWhite);

top = BBandTop(C,50,2);
bot = BBandBot(C,50,2);


if ( ParamToggle( "Bollinger Bands", "OFF|ON", 1 ) )
{
Plot(top,"",colorRed,styleLine,0,0,0,0,0);
Plot(bot,"",colorRed,styleLine,0,0,0,0,0);
}

Please study Plot documentation and take a look at dozens of style* options.

So there is styleNoRescale there which will do what you apparently intend to achieve.

Plot(Close,"",colorWhite);

top = BBandTop(C,50,2);
bot = BBandBot(C,50,2);

if( ParamToggle( "Bollinger Bands", "OFF|ON", 1 ) )
{
    Plot( top, "", colorRed, styleLine | styleNoRescale, 0, 0, 0, 0, 0 );
    Plot( bot, "", colorRed, styleLine | styleNoRescale, 0, 0, 0, 0, 0 );
}
2 Likes

Hi,
I have the same problem, I posted a while back, regarding indicator scaling, but now with a trailing stop. When I zoom in on the chart, the trailing stop's scale changes the chart scale. I have tried a few plot versions, but non are solving the problem.

/////////////////////////Trail STOP///////////////////////////////////////////
function vstop_func(trBull,trBear)
{
	trailArray[0]=C[0];
	for(i=1;i<BarCount;i++)
	{
		prev=trailArray[i-1];
 
		if(C[i]>prev AND C[i-1]>prev)
		{
			trailArray[i]=Max(prev,C[i]-trBull[i]);
		}
		else if(C[i]<prev AND C[i-1]< prev)
		{
			trailArray[i]=Min(prev,C[i]+trBear[i]);
		}
		else if (C[i]>prev)
		{
			trailArray[i]=C[i]-trBull[i];
		}
		else
		{
			trailArray[i]=C[i]+trBear[i];	
		}
	}
	return trailArray;
}
//////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
TimeFrameSet(inDaily);
LT_Bull_periods=Param("Daily_Trail_periods",100,1,150,1);
LT_multBull_dev=Param("Daily_Trail_dev",2,0.05,4,0.05);
LT_trBull_d=LT_multBull_dev*ATR(LT_Bull_periods);
LT_trBear_d=LT_multBull_dev*ATR(LT_Bull_periods);
LT_trailArray_d = vstop_func(LT_trBull_d,LT_trBear_d);
LT_ts_d=IIf(LT_trailArray_d>C,LT_trailArray_d,Null);
LT_tl_d=IIf(LT_trailArray_d<C,LT_trailArray_d,Null);
TimeFrameRestore();

LT_ts_d=TimeFrameExpand(LT_ts_d,inDaily,expandFirst);
LT_tl_d=TimeFrameExpand(LT_tl_d,inDaily,expandFirst);


//Plot(LT_tl_d , "", colorLightGrey,styleLeftAxisScale  ,0,0,0,5 );
//Plot(LT_ts_d , "", colorLightGrey,styleLeftAxisScale  ,0,0,0,5 );
//Plot(LT_tl_d , "", colorLightGrey,styleNoRescale,0,0,0,5 );
//Plot(LT_ts_d , "", colorLightGrey,styleNoRescale,0,0,0,5 );
//Plot(LT_tl_d , "", colorLightGrey,styleLine|styleNoRescale ,0,0,0,5 );
//Plot(LT_ts_d , "", colorLightGrey,styleLine|styleNoRescale  ,0,0,0,5 );
Plot(LT_tl_d , "", colorLightGrey,styleLine,0,0,0,5 );
Plot(LT_ts_d , "", colorLightGrey,styleLine,0,0,0,5 );

zoomed out
Zoomed in
zoomed in

Do you just want to draw that stop line without price?

If so then add

Plot( C, "", colorDefault, styleNoDraw );

or

Plot( C, "", colorDefault, styleNoLine );

at the top.

Hi @fxshrat, No, if you zoom out , when there is a trail short "part" and and trail long "part" in the chart, the scale of the chart is fine, but when you zoom in and there is only a trail short "part", like in the 2nd chart example, the scaling goes all strange.

Did you add one of the code lines I posted?
Yes or no?

Your picture does not show any price.
Add either of the two lines I posted above or add price plot.
If you add either line at top then scaling should be fine.

Watch carefully:
8

Your arrays contain Null elements so add standard plot at top to initialize scale.

I do not understand why people don't do what has been posted.

BTW, Is the code you posted the complete one?
Please do not waste people's time by not posting full code.

2 Likes

Apologies, I thought you misunderstood the problem, and I misunderstood, plotting

Would solve the scaling issues. So I have plotted the line and it works, so thanks very much. The problem here is complete code, anyway, I appreciate the insight, I would never have thought the plot another Close price to solve another issue, so thanks for that.