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

RE: [amibroker] Help coding double bottom



PureBytes Links

Trading Reference Links

Carl,

 

You might want to have a look at this code, supplied by Thomas Janeczko in the AFL library. It is for Double Tops, but you can modify it for the double bottoms.

Look at the function reference for PEAK, TROUGHS and ZIGZAG also.

 

Tom

 

/* Detecting double tops */

percdiff = 3; /* peak detection threshold */

fwdcheck = 5; /* forward validity check */

mindistance = 5;

validdiff = percdiff/400;

PK= Peak( H, percdiff, 1 ) == High;

 

x = Cum( 1 );

XPK1 =  ValueWhen( PK, x, 1 );

XPK2 = ValueWhen( PK, x, 2 );

 

peakdiff = ValueWhen( PK, H, 1 )/ValueWhen( PK, H, 2 );

doubletop = PK AND abs( peakdiff - 1 ) < validdiff AND (XPK1 - XPK2)>mindistance

AND High > HHV( Ref( H, fwdcheck ), fwdcheck - 1 );

Buy = Sell = doubletop;

 

//IIf(doubletop,PlotShapes( shapeSmallDownTriangle, colorGreen, 5 ),"");

PlotShapes( IIf( Buy, shapeDigit9 + shapePositionAbove, shapeNone ), colorAqua );

//GraphXSpace = 5;

 

WriteIf( Highest( doubletop ) == 1, "AmiBroker has detected some possible double top patterns for " + Name() + "\nLook for green arrows on the price chart.", "There are no double top patterns for " + Name() );

 

 

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Carl Vanhaes
Sent: Thursday, September 25, 2008 8:37 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Help coding double bottom

 

Hi,

I am still a newbie switching from easylanguage to AFL and am trying
to plot double bottoms that are separated only by a few bars.
Something must be wrong with my coding below because no signal is
generated despite I can see those patterns on the charts.
Basically the idea is: Price tries to break down a recent low but
fails and rebounds on or just after the breakdown bar (think it is
sometimes called a Vic2B pattern).

Can you please help me correct this code:

Condition1= Low = LLV(L,25);
Condition2= Ref(Sum(Condition1,7),-1)==0 AND Ref(Sum(Condition1,13),-
1)>0 AND Cross(Ref(ValueWhen(Condition1, L, 1),-1),L);
Condition3= (Cross(C, ValueWhen(Condition2, H, 1))) AND (ValueWhen
(Condition2,L,1) == LLV(L,30));

PlotShapes( IIf( Condition5, shapeUpArrow, shapeNone ), colorGreen );

Filter = Condition5 OR Condition6;
AddTextColumn(FullName(), "Company Name");
AddColumn(Condition5, "Dble_bot", 1);
AddColumn(C, "Close", 1.3);

Thank you in advance,
Carl

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___