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

[amibroker] Trendlines of the past II



PureBytes Links

Trading Reference Links




Last July trendlines for DISH were defined by the H1, H2, 
L1,L2 and their [dotted red] extensions.
The HISTORICAL TRENDLINES SEGMENTS do not include the valuable 
extensions.
The breakouts usually occur in the trendline extension [red 
circle]
In indicator builder, we may see today the [lost] pattern of 
July by shifting the whole pattern.
Just add the lines
 
shift=<FONT 
size=2>51;
<FONT 
size=2>C=Ref(C,-shift);H=Ref(H,-shift);L=Ref(L,-shift);O=Ref(O,-shift); 

before the pattern code and you will have the pattern of 
July17.
In AA you may also search for breakouts of the past without 
using the From/To Range
[which would not 
help, because the trendlines of the past are lost and replaced by some 
next].
<FONT face="Times New Roman" 
size=2> 
A full example 
is
// Shifted 
trendlines
<FONT face="Times New Roman" 
size=2>shift=55;C=Ref(C,-shift);H=Ref(H,-shift);L=Ref(L,-shift);O=Ref(O,-shift); 
MaxGraph=8;Graph0 = C;Graph0Style=64;x = Cum(1);per = 
3;s1=L;s11=H;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; Graph1 = 
IIf(x>startt-10,trendlineS,-1e10);Graph1Style = 1;Graph1Color = 9;pR = 
PeakBars( s11, per, 1 ) == 0;endt1= LastValue(ValueWhen( pR, x, 1 
));startt1=LastValue(ValueWhen( pR, x, 2 ));firstt1=LastValue(ValueWhen( 
pR, x, 3 ));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; 
Graph2 = IIf(x>startT1-10,trendlineR,-1e10);Graph2Style = 
1;Graph2Color = 9;breakup=(Cross(C,trendlineR) AND X>ENDT1) 
;breakdown=(Cross(trendlineS,C) AND 
X>ENDT);Graph0BarColor=IIf(breakup,5,IIf(breakdown,4,1));Title=Name()+", 
SHIFT="+WriteVal(SHIFT,1.0);Filter=breakup OR breakdown;// explore for the 
n=1 last quotations to see the breakouts 55 bars 
agoAddColumn(breakup,"breakup",1.0);AddColumn(breakdown,"breakdown",1.0);
<FONT face="Times New Roman" 
size=2> 
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:
SHIFT2.gif

Attachment: Description: "Description: GIF image"