Stairs Trading Strategy (Amibroker And Tradestation Code)
The original article can be found here.
The trading rules in plain English:
- The close must be above the 200-day moving average.
- The close must be below the 25-day moving average.
- If 1 and 2 are true, then enter at the close.
- Exit at the close when the close crosses above the 25-day moving average.
Amibroker code:
Buy= Close>MA(C,200) AND Cross(MA(C,25),Close) ;
buyPrice=Close;
Sell= Cross(Close,MA(C,25)) ;
sellPrice=Close ;
Tradestation code:
{
Strategy - Stairs Trading
https://www.quantifiedstrategies.com/lessons/stairs-trading-strategy-amibroker-code/
}
Input:
SlowLookback(200),
FastLookback(25);
if Close > Average(Close, SlowLookback) AND Close < Average(Close, FastLookback) Then
buy this bar on close;
if Close > Average(Close, FastLookback) Then
sell this bar on close;
