# ScreenBarsBack.pla

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
RobotMan
Posts: 375
Joined: 12 Jul 2006
Location: Los Altos, California, USA
Has thanked: 31 times
Been thanked: 12 times
Contact:

### ScreenBarsBack.pla

Hi folks,

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/2008Inputs:   MBB(Numeric) ;  // set 100 to 500 for intradayVars:      LeftDateTime(0) ;Value1 = Close[MBB] ; // sets MaxBarsBack to a minimum numberLeftDateTime = getappinfo(aiLeftDispDateTime);Value2 = FindBar(JulianToDate(LeftDateTime), DateTime2ELTime(LeftDateTime));  If Value2 > -1 then bpScreenBarsBak = value2    Else bpScreenBarsBak = MBB ;`

Lets say you have an oscillator variable named "OSC1", a MA of OSC1 named "OSC2", and 2 variables named "ScaleLen" and "ScaleLevel"

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: InvisiblePlot5(-ScaleLevel,"-SclLvl") ; // Properties: Invisible`

Of course, if you use NT, they already thought of this and it does it for you automatically. I like software that does that.

TJ
Posts: 7095
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 986 times
Been thanked: 2029 times
this solution is soooo elegant.

Good work.
Thanks !

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

### Re: ScreenBarsBack.pla

Of course, if you use NT, they already thought of this and it does it for you automatically. I like software that does that.

This feature should be considered for MC Gold.