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
- The S&P 500 must make a new 20-day high.
- The volume must be 10% higher than the 50-day average.
- If one and two are true, enter at the close.
- Sell at the close after 20 days.
Strategy 3: Buy at the open in GDX
- The open must be above yesterday’s 20-day high.
- If 1 is true, short at the open.
- 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.
