Hello ,
I have a simple plot of MACD, Stoch and price.
Price range is 50 to 6000
MACD range is -10 to +10
stoch range is 0 to 100.
How can i plot all the three in the same graph superimposed on each other.
I acheived plotting two but third one is a real twister for me
//Superimposing
_N(*Title* = StrFormat("{ {NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo
%g, Close %g (%.1f%%) Vol " +WriteVal( *V*, 1.0 ) +" {{VALUES}}", *O*, *H*,
*L*, *C*, SelectedValue( ROC( *C*, 1 )) ));
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
m1=MACD(r1, r2);
s1=Signal(r1,r2, r3);
Diff= m1 - s1;
Plot(Diff, "\nDiff MACD" + _PARAM_VALUES( ), *colorPink*, *styleNoLine* );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"( %g,%g)", r1, r2),
ParamColor(" MACD color", *colorPink* ), ParamStyle(" MACD style") );
Plot( sl = Signal(r1,r2, r3), "Signal" + _PARAM_VALUES( ), ParamColor("
Signal color", *colorYellow* ), ParamStyle(" Signal style") );
//Plot( ml-sl, "MACD Histogram", ParamColor(" Histogram color", colorBlack
), styleNoTitle | ParamStyle(" Histogram style", styleHistogram |
styleNoLabel, maskHistogram ) );
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
K=StochK( periods , Ksmooth);
D=StochD( periods , Ksmooth, DSmooth );
Difference= K - D;
//Plot(ml, "\nm1" + _PARAM_VALUES( ), colorBlue, styleLine );
//Plot( sl, "\ns1" + _PARAM_VALUES( ), colorRed, styleLine );
Plot( StochD( periods , Ksmooth, DSmooth ), _DEFAULT_NAME(),
ParamColor( "StochD
Color", *colorYellow* ), ParamStyle("stochD Style") );
Plot( StochK( periods , Ksmooth), _DEFAULT_NAME(), ParamColor( "Stochk
Color", *colorPink* ), ParamStyle("Style") );
Plot(Difference, "\nDifference Stoch" + _PARAM_VALUES( ), *colorPink*, *
styleNoLine* );
Col=IIf(diff *AND* difference, 5,4) ;
Plot( *C*, "Close", Col, 64 | *styleOwnScale* );
_SECTION_END();