Usually, when plotting one oscillator on top of another the "zero lines" don't match up unless you go in and manually dink around with the scaling. You might remember this post:
http://forum.tssupport.com/viewtopic.ph ... ght=#20394
Well, I kept thinking about it and during the Christmas break wrote a function that seems to find how many bars back to the left edge of your chart. Then it is merely a question of finding the max absolute hi/low of your indicator and plot a + and - invisible plot. Now the zero line will always be in the center.
Code: Select all
// Bob Perry 12/2008
Inputs: MBB(Numeric) ; // set 100 to 500 for intraday
Vars: LeftDateTime(0) ;
Value1 = Close[MBB] ; // sets MaxBarsBack to a minimum number
LeftDateTime = getappinfo(aiLeftDispDateTime);
Value2 = FindBar(JulianToDate(LeftDateTime), DateTime2ELTime(LeftDateTime));
If Value2 > -1 then bpScreenBarsBak = value2
Else bpScreenBarsBak = MBB ;
Code: Select all
ScaleLen = bpScreenBarsBak(200) ;
ScaleLevel = Maxlist(AbsValue(highest(OSC1,ScaleLen)), AbsValue(Lowest(OSC1,ScaleLen)), AbsValue(highest(OSC2,ScaleLen)), AbsValue(highest(OSC2,ScaleLen)) );
Plot1(OSC1,"OSC1") ;
Plot2(OSC2,"OSC2") ;
Plot3(0,"ZERO") ;
Plot4(+ScaleLevel,"+SclLvl") ; // Properties: Invisible
Plot5(-ScaleLevel,"-SclLvl") ; // Properties: Invisible