Scale-In Trading Strategy (Amibroker Code)
The original article can be found here.
The strategy in plain English:
- The 5-day RSI must be below 50.
- The difference between yesterday’s 5-day RSI and today’s must be at least 5.
- If 1 and 2 are true, we go long at the close with 49% of our equity.
- We buy another position of 49% of the equity if 1 and 2 are true (again).
- We sell the whole position at the close when today’s close is higher than yesterday’s high.
Amibroker code:
SetTradeDelays( 0, 0, 0, 0 );
SetOption( “InitialEquity”, 100000);
SetOption(“RefreshWhenCompleted”,True);
SetOption( “AllowPositionShrinking”, True );
enter = Ref(RSI(5),-1) – RSI(5) ;
exit =RSI(5) – Ref(RSI(5),-1) ;
size = setPositionSize(49.75,spsPercentOfEquity);
BuyPrice=close;
SellPrice=close;
ShortPrice=close;
CoverPrice=close;
Buy= IIf(enter>5 AND Ref(RSI(5),-1)<50,sigScaleIn,0);
BuyPrice=Close;
Sell= C>Ref(H,-1);
SellPrice=Close;
