Stack 2 lines with styleownscale

I want to stack 2 plot statemeents in its so the histo are one above other. how can i do it? I am using styleownscale. can i have 2 of these?


wo = TimeFrameGetPrice( "O", inHourly*2, 0, expandPoint ); 
 wh = TimeFrameGetPrice( "H", inHourly*2, 0, expandPoint ); 
 wl = TimeFrameGetPrice( "L",inHourly*2, 0, expandPoint ); 
 wc = TimeFrameGetPrice( "C", inHourly*2, 0, expandPoint ); 

PlotOHLC( wo, wh, wl, wc, "2 Hour Close", colorWhite, styleCandle ); 
LineThickness = Param( "LineThickness", 2, 1, 8, 1 );
LineThickness1 = Param( "LineThickness", 3, 1, 8, 1 );
twentydayhigh = Ref( HHV( H, 20 ), -1 );
twentydaylow = Ref( llV( l, 20 ), -1 );
reallyHigh = H > twentydayhigh;
reallyLow = L < twentydaylow;
firstreallyHigh = reallyHigh AND Ref( BarsSince( reallyLow ) < BarsSince( reallyHigh ) , -1 );
firstreallyLow = reallyLow AND Ref( BarsSince( reallyHigh ) < BarsSince( reallyLow ) , -1 );
Plot( IIf( reallyHigh OR reallyLow , LineThickness, -1e10 ), "", IIf( reallyHigh, colorGreen, IIf( reallyLow, colorRed, colorPaleBlue ) )  , styleOwnScale | styleArea | styleNoLabel, -1, 90 );
Plot( IIf( firstreallyHigh OR firstreallyLow , LineThickness1, -1e10 ), "", IIf( firstreallyHigh, colorYellow, IIf( firstreallyLow, colorOrange, colorDefault ) )  , styleOwnScale | styleArea | styleNoLabel, -1, 90 );

Can you post a picture of what you want to do?

It is certainly possible to stack histograms, and you can use StyleOwnScale but you have to design the scale.
Using the same scale for both, assuming values are in same range in both Plots, then you will have an overlap.

So lets say plot 2 will stack over plot 1.
and Plot 1 range is from 0 to 100. The scale can be 0 to 500 ( 5X or 20% of Pane).

Plot 2 values are also 0 to 100. but here, the scale min will be -100 and max as 400.

The above is to explain how you can define two relative scales where you will shift the 0 base line up for 2nd plot and so on for more.

Now, all you have to do, is use HighestVisibleValue() and get the actual Upper range and use those to compute the actual ranges that you need.

something similar was described here

1 Like

I don't see any histogram's in your code but there were a few solutions about stacking histogram's in this older post

If you have two or more plots that are supposed to use "shared" scale that is separate from 'main' scale then the simplest way is to use styleLeftAxisScale.