Bull Market Trading Strategy (Amibroker And Tradestation Code)
The article can be found here.
The strategy in plain English:
- The close must be above the 200-day average.
- The 5-day RSI indicator of the 5-day Rate of Change indicator must be below 20.
- If 1 and 2 are true, then buy the close.
- We sell at the close when the 5-day RSI is above 50.
Amibroker code:
Buy= Close>MA(C,200) AND RSIa(ROC(Close,5),5)<20;
buyPrice=Close;
Sell= RSI(5)>40 ;
sellPrice=Close ;
Tradestation code:
{
Strategy 126 - Bull market trading strategy
The close must be above the 200-day average.
The 5-day RSI indicator of the 5-day Rate of Change indicator must be below 20.
If 1 and 2 are true, then buy the close.
We sell at the close when the 5-day RSI is above 50.
}
Inputs:
RegimeLookback(200),
RocLookback(5),
RsiLookback(5),
BuyTreshold(20),
SellTreshold(40);
if Close > Average(Close, RegimeLookback) and RSI(RateOfChange(Close, RocLookback), RsiLookback) < BuyTreshold Then
buy this bar on close;
if Barssinceentry(0) > 0 and RSI(Close, RsiLookback) > SellTreshold Then
sell this bar on close;
