Skip to main content

4 Breakout System for Amibroker (AFL)

radiosilk about 12 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 2)
  • Tags:
    Donchian, turtle, trading system, amibroker

The system buys when price crosses previous 4 bar high and sells when price crosses low of previous 4 bar low.

Needs more work, though.

Indicator / Formula

Copy & Paste Friendly
Buy = 	( 
		Ref( Close , -1 ) > Ref( High , -4 )
		OR Ref( Open , -1 ) > Ref( High , -4 )
		OR Ref( High , -1 ) > Ref( High , -4 )
		OR Ref( Low , -1 ) > Ref( High , -4 )
	);

Sell = 	( 
		Ref( Open , -1 ) < Ref( Low , -4 )
		OR Ref( High , -1 ) < Ref( Low , -4 )
		OR Ref( Low , -1 ) < Ref( Low , -4 )
		OR Ref( Close , -1 ) < Ref( Low , -4 )
	);

Short = 	( 
		Ref( Open , -1 ) < Ref( Low , -4 )
		OR Ref( High , -1 ) < Ref( Low , -4 )
		OR Ref( Low , -1 ) < Ref( Low , -4 )
		OR Ref( Close , -1 ) < Ref( Low , -4 )
	);

Cover = 	( 
		Ref( Open , -1 ) > Ref( High , -4 )
		OR Ref( High , -1 ) > Ref( High , -4 )
		OR Ref( Low , -1 ) > Ref( High , -4 )
		OR Ref( Close , -1 ) > Ref( High , -4 )
	);

4 comments

about 12 years ago

I have modified the code to generate buy sell signals on screen. I cannot post it
without the permission of author.The code is reasonably good, but is giving
more number of buy signals on down trend. signals on up trend are ok.

about 12 years ago

Hi,

Please do pose.. the code is open source to do anything you feel like..
i am just a novice!

about 12 years ago

This is a Surgical Strike Strategy or “Shoot and Run” type strategy.
CLOSE ALL POSITIONS ON THE SAME DAY.

DO NOT CARRY FORWARD BASED ON THIS SYSTEM.

Use this AFL on EOD and select your targets. Then on next trading
day (ie, Intraday) Buy if Price goes above High of Buy Signal Bar.
Sell – If price falls below Low of Sell Signal Bar.
hope this helps.

This is how far my learning goes..
pls try this new Modified AFL..
========

_SECTION_BEGIN("Radiosilk's N-Cross Breakout");
Buy = Cover =   ( 
        Ref( Close , -1 ) > Ref( High , -4 )
        OR Ref( Open , -1 ) > Ref( High , -4 )
        OR Ref( High , -1 ) > Ref( High , -4 )
        OR Ref( Low , -1 ) > Ref( High , -4 )
    );
 
Sell = Short=  ( 
        Ref( Open , -1 ) < Ref( Low , -4 )
        OR Ref( High , -1 ) < Ref( Low , -4 )
        OR Ref( Low , -1 ) < Ref( Low , -4 )
        OR Ref( Close , -1 ) < Ref( Low , -4 )
    );
 
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Cover = ExRem( Short, Cover );
Short = ExRem( Cover, Short );

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorTurquoise, colorTurquoise),0, IIf( Buy, Low, High ) );
_SECTION_END();

Leave Comment

Please login here to leave a comment.