PureBytes Links
Trading Reference Links
|
/*HISTORICAL TRENDLINES and BREAKOUTS, by D. Tsokakis, Oct2003*/
x = Cum(1);
per = 3;// CALIBRATE THE ZIG() SENSITIVITY
s1=L;s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
endt=SelectedValue(ValueWhen( pS, x ,1));
startt=SelectedValue(ValueWhen( pS, x ,2));
dtS =endt-startt;
endS = SelectedValue((ValueWhen( pS, s1,1) ));
startS = SelectedValue(( ValueWhen( pS, s1 ,2)));
aS = (endS-startS)/dtS;bS = endS;
trendlineS = aS * ( x -endt ) + bS;//SUPPORT LINE
pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 2 ));
aR = (endR-startR)/dtR;bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;//RESISTANCE LINE
first=Min(startt,startt1);Last=Max(endt,endt1);
d=10;// INCREASE d TO EXTEND THE LINES
bullishbreakout=x>endt1 AND x<last+d AND Cross(C,trendlineR);
bearishbreakout=x>endt AND x<last+d AND Cross(trendlineS,C);
Plot(C,"Close",IIf(bullishbreakout,colorBrightGreen,IIf
(bearishbreakout,colorRed,colorBlack)),64);
Plot(IIf(x>=first -d AND x<=Last+d,trendlineS,-
1e10),"Support",colorBrightGreen,1);
Plot(IIf(x>=first-d AND x<=Last+d,trendlineR,-
1e10),"Resistance",colorRed,1);
Place the cursor in a previous bar and see the trendlines for this
period.
Move the cursor [to the left or to the right] to see the formation
changes.
The Resistance breakouts are painted green, the Support breakouts are
red.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> Select an empty IB window and paste the
>
> /*HISTORICAL TRENDLINES, v.2.*/
> x = Cum(1);per = 3;s1=L;s11=H;
> pS = TroughBars( s1, per, 1 ) == 0;
> endt=SelectedValue(ValueWhen( pS, x ,1));
> startt=SelectedValue(ValueWhen( pS, x ,2));
> dtS =endt-startt;
> endS = SelectedValue((ValueWhen( pS, s1,1) ));
> startS = SelectedValue(( ValueWhen( pS, s1 ,2)));
> aS = (endS-startS)/dtS;bS = endS;
> trendlineS = aS * ( x -endt ) + bS;//SUPPORT LINE
> pR = PeakBars( s11, per, 1 ) == 0;
> endt1= SelectedValue(ValueWhen( pR, x, 1));
> startt1=SelectedValue(ValueWhen( pR, x, 2 ));
> dtR =endt1-startt1;
> endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
> startR = SelectedValue( ValueWhen( pR, s11, 2 ));
> aR = (endR-startR)/dtR;bR = endR;
> trendlineR = aR * ( x -endt1 ) + bR;//RESISTANCE LINE
> first=Min(startt,startt1);Last=Max(endt,endt1);
> Plot(IIf(x>=first -10 AND x<=Last+10,trendlineS,-
> 1e10),"Support",colorBrightGreen,1);
> Plot(IIf(x>=first-10 AND x<=Last+10,trendlineR,-
> 1e10),"Resistance",colorRed,1);
> Plot(C,"Close",colorBlack,64);
>
> Place your cursor at the last bar and move it slowly to the left.
> Your graph will recall, one by one, the trendlines of the past.!!
> Dimitris Tsokakis
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/vhSowB/XP.FAA/3jkFAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|