25 March 2012

STOCH K CROSS STOCH D +- TREND LINE SHOW

_SECTION_BEGIN("stoch k cross stoch d +ve");
/*Slow Stochastic and Trendlines
for Indicator Builder,
by Dimitris Tsokakis*/
D1=14;
MaxGraph=8;
ST3=StochK(D1);
ST33=StochD(D1);
Graph0=ST3;
Graph1=ST33;
Title=Name()+" - %K="+WriteVal(st3,FORMAT=1.2)+", %D="+
WriteVal(ST33,FORMAT=1.2)+
WriteIf(Cross(st3,st33)," POSITIVE CROSS"," ")+
WriteIf(Cross(ST33,ST3)," NEGATIVE CROSS","");
x = Cum(1);
per = 0.1;
s1=st33;
s11=st33;
pS = TroughBars( s1, per, 1 ) == 0;
endt= LastValue(ValueWhen( pS, x, 1 ));
startt=LastValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = LastValue(ValueWhen( pS, s1, 1 ) );
startS = LastValue( ValueWhen( pS, s1, 2 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
Graph6 = IIf(x>startt-1 AND TRENDLINES>0 AND TRENDLINES<100,trendlineS,-1e10); Graph6Style = 1; Graph6Color = 1; pR = PeakBars( s11, per, 1 ) == 0; endt1= LastValue(ValueWhen( pR, x, 1 )); startt1=LastValue(ValueWhen( pR, x, 2 )); dtR =endt1-startt1; endR = LastValue(ValueWhen( pR, s11, 1 ) ); startR = LastValue( ValueWhen( pR, s11, 2 )); aR = (endR-startR)/dtR; bR = endR; trendlineR = aR * ( x -endt1 ) + bR; Graph7 = IIf(x>startT1-1 AND TRENDLINER>0 AND
TRENDLINER<100,trendlineR,-1e10);
Graph7Style = 1;
Graph7Color = 1;
_SECTION_END();

No comments:

My Blog List

Total Pageviews

Search This Blog

Followers