Breakout Trading Strategies (Amibroker And Tradestation Code)

The strategy in plain English:

 

Strategy 1:

Buy at the close when the close is above yesterday’s 20 day high. Exit at the close after 20 days.

 

Strategy 2: Including a volume criteria

  1. The S&P 500 must make a new 20-day high.
  2. The volume must be 10% higher than the 50-day average.
  3. If one and two are true, enter at the close.
  4. Sell at the close after 20 days.

 

Strategy 3: Buy at the open in GDX

 

  1. The open must be above yesterday’s 20-day high.
  2. If 1 is true, short at the open.
  3. Exit at the close the same day (a day trade)

 

Click here for the original article.

 

Amibroker code:

 

Strategy 1:

Buy= Close>Ref(HHV(H,20),-1) ;//Close<Ref(LLV(L,20),-1)

BuyPrice=Close ;

Sell= RSI(90)>99; //unlikely to be triggered, thus n-bar exit as applystop (see below)

SellPrice=Close;

ApplyStop(stopTypeNBar,stopTypeNBar,20,1);

 

Strategy 2:

Buy= Close>Ref(HHV(H,20),-1) AND V>(MA(V,50)*1.1) ;

BuyPrice=Close ;

Sell= RSI(90)>99; //unlikely to be triggered, thus n-bar exit as applystop (see below)

SellPrice=Close;

ApplyStop(stopTypeNBar,stopTypeNBar,20,1);

 

Strategy 3:

Buy= Open>Ref(HHV(H,20),-1) ;

BuyPrice=Open ;

Sell= Close>0; //unlikely to be triggered, thus n-bar exit as applystop (see below)

SellPrice=Close;

 

Tradestation code:

 

Strategy 1:

If c>=highest(high,20)[1] then buy this bar at close;

If barssinceentry=20 then sell this bar at close;

 

Strategy 2:

If h>=highest(h,20) and v>1.1*average(v,50) then buy this bar at close;

If barssinceentry=20 then sell this bar at close;

 

Strategy 3:

If o>=highest(h,20)[1] then sell short next bar at open;

buy to cover this bar at close;

 

 

Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.