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

[amibroker] Re: AFL for Trend Line Touch and Breakouts Available Anywhere?



PureBytes Links

Trading Reference Links

Thanks for posting this code !!!   I added some things to the scan 
like C > 5  V > V -1 V > Avg Volume *2 and added the volume spike 
colume so you can rank on volume spike.

One thing I would like to know sinds I´m a newbi with AB coding.  
How can I extend the trendlines to draw longer trendlines AND how I 
can adjust the ANGLE of the lines so I can scan only for horizontal 
lines or nearly etc.

Thanks


/*TRENDLINES BREAKOUT*/

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 ));
endS = LastValue(ValueWhen( pS, s1, 1 ) );
startS = LastValue( ValueWhen( pS, s1, 2 ));
dtS =endt-startt;
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS; 

Graph1 = IIf(x>startt-10,trendlineS,-1e10);
Graph1Style = 1;
Graph1Color = 8;

PR = PeakBars( s11, per, 1 ) == 0;
endt1= LastValue(ValueWhen( pR, x, 1 ));
startt1=LastValue(ValueWhen( pR, x, 2 ));
endR = LastValue(ValueWhen( pR, s11, 1 ) );
startR = LastValue( ValueWhen( pR, s11, 2 ));
DTR=ENDT1-STARTT1;
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR; 

 
VolPct = (V - MA(V,50)) / MA(V,50) *100;

Graph2 = IIf(x>startT1-10,trendlineR,-1e10);
Graph2Style = 1;
Graph2Color = 8;

Filter=(Cross(C,trendlineR) AND X>ENDT1 AND C > 5 AND MA(V,10) > 
10000 AND V > MA(V,50)*2 AND V > Ref(V,-1)) OR (Cross(trendlineS,C) 
AND X>ENDT AND C > 5 AND MA(V,10) > 10000 AND V > MA(V,50)*2 AND V > 
Ref(V,-1));

NumColumns=3;

Column0=Cross(C,trendlineR);
Column1=Cross(trendlineS,C);
Column2=VolPct;
Column0Name="BULLISH BREAKOUT";
Column1Name="BEARISH BREAKOUT";
Column2Name="Vol %";
Graph0BarColor=IIf(Filter,7,1);

Title=Name()+" " +WriteVal(dts,format=1)+" Bars";

--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxxx> 
wrote:
> MessageTom,
> 
> Load this same formula in AA  , n last quotations and n=1 , and 
click explore, also load this formula in Indicator builder to see 
the visual presentation.
> 
> This was presented by Dimitri...
> 
> /*TRENDLINES BREAKOUT*/
> 
> 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 ));
> 
> endS = LastValue(ValueWhen( pS, s1, 1 ) );
> 
> startS = LastValue( ValueWhen( pS, s1, 2 ));
> 
> dtS =endt-startt;
> 
> aS = (endS-startS)/dtS;
> 
> bS = endS;
> 
> trendlineS = aS * ( x -endt ) + bS; 
> 
> Graph1 = IIf(x>startt-10,trendlineS,-1e10);
> 
> Graph1Style = 1;
> 
> Graph1Color = 8;
> 
> PR = PeakBars( s11, per, 1 ) == 0;
> 
> endt1= LastValue(ValueWhen( pR, x, 1 ));
> 
> startt1=LastValue(ValueWhen( pR, x, 2 ));
> 
> endR = LastValue(ValueWhen( pR, s11, 1 ) );
> 
> startR = LastValue( ValueWhen( pR, s11, 2 ));
> 
> DTR=ENDT1-STARTT1;
> 
> aR = (endR-startR)/dtR;
> 
> bR = endR;
> 
> trendlineR = aR * ( x -endt1 ) + bR; 
> 
> Graph2 = IIf(x>startT1-10,trendlineR,-1e10);
> 
> Graph2Style = 1;
> 
> Graph2Color = 8;
> 
> 
> Filter=(Cross(C,trendlineR) AND X>ENDT1) OR (Cross(trendlineS,C) 
AND X>ENDT);
> 
> 
> NumColumns=2;
> 
> Column0=Cross(C,trendlineR);
> 
> Column1=Cross(trendlineS,C);
> 
> Column0Name="BULLISH BREAKOUT";
> 
> Column1Name="BEARISH BREAKOUT";
> 
> Graph0BarColor=IIf(Filter,7,1);
> 
> Title=Name()+" " +WriteVal(dts,format=1)+" Bars";
> 
>   ----- Original Message ----- 
>   From: Clarkson, Tom 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Friday, July 11, 2003 2:16 PM
>   Subject: [amibroker] AFL for Trend Line Touch and Breakouts 
Available Anywhere?
> 
> 
>   Has anyone developed any afl code that finds trend breakouts in 
a similar way to what this program 
(http://www.nebadawn.com/ramphome.htm) finds? I don't find anything 
similar in the library but then again i could be missing something 
somewhere.
> 
>   http://www.nebadawn.com/ramphome.htm
> 
>   Thanks in advance for any help.
> 
>   Tom
> 
>   Some examples from that web site are:
> 
>                        
> 
> 
> 
>                       
> 
> 
> 
>       
> 
> 
>         Yahoo! Groups Sponsor 
>               ADVERTISEMENT
>              
>        
>        
> 
> 
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   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. 
> 
> 
>   ---
>   Outgoing mail is certified Virus Free.
>   Checked by AVG anti-virus system (http://www.grisoft.com).
>   Version: 6.0.498 / Virus Database: 297 - Release Date: 7/8/2003


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sOykFB/k9VGAA/ySSFAA/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/