[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Historical trendlines



PureBytes Links

Trading Reference Links




8 bars ago CSCO broke the support trendline.
2 bars ago broke the resistance line in the new [parallel] 
channel.
Since we can not remember everything, it is better to use the 
memory of the 
/*HISTORICAL TRENDLINES and BREAKOUTS*/x = Cum(1);per 
= 3;// CALIBRATE THE ZIG() SENSITIVITYs1=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 LINEpR = 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 LINESbullishbreakout=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);
 
Just move your cursor to the left, it will help to study the 
recent behavior.
The same procedure may be used for indicators [some slight per 
changes are necessary]
 
/*HISTORICAL TRENDLINES and BREAKOUTS for INDICATORS*/x = 
Cum(1);per = 1;// CALIBRATE THE ZIG() 
SENSITIVITYs1=RSI();s11=RSI();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 LINEpR = 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 LINESbullishbreakout=x>endt1 AND x<last+d AND 
Cross(s1,trendlineR);bearishbreakout=x>endt AND x<last+d AND 
Cross(trendlineS,s1);Plot(RSI(),"RSI",IIf(bullishbreakout,colorBrightGreen,IIf(bearishbreakout,colorRed,colorBlack)),8);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);
 
It was VERY useful for CLZ03, two days ago.
Dimitris Tsokakis
 






Yahoo! Groups Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.



Attachment:
CSCO.gif

Attachment: Description: "Description: GIF image"