Buy The Dip Strategy (Amibroker And Tradestation Code)
The original article can be found here.
The strategy in plain English reads like this:
- The close must be higher than the 200-day moving average.
- The close today must be a seven-day low (of the close).
- If 1-2 are true, then go long at the close.
- We sell at the close when the close is higher than yesterday’s close.
The Amibroker code:
Buy= C>MA(C,200) AND Close<Ref(LLV(C,7),-1) ;
buyPrice=Close;
Sell= C>Ref(H,-1);
sellPrice=Close ;
Tradestation code:
{
Buy the dip strategy (no 148):
The close must be higher than the 200-day moving average.
The close today must be a seven-day low (of the close).
If 1-2 are true, then go long at the close.
We sell at the close when the close is higher than yesterday’s close.
}
Inputs:
LookbackTrend(200),
LookbackLow(7);
if (C > Average(C,LookbackTrend)) and (C < Lowest(C,LookbackLow)[1]) Then
buy this bar at close;
if C > H[1] then
Sell this bar at close;
