DeMarker Indicator Strategy (Amibroker Code)
The original article can be found here.
The code in plain English:
- We use a 3-day lookback period
- We buy when DeMarker indicator is below 5
- We sell when the close is higher than yesterday’s high
Amibroker code:
oddis=Optimize("Trading day",3,2,8,1);
setOption("holdminbars",1);
highm = IIF( H > Ref( H, -1 ), H - Ref( H, - 1), 0 );
lowm = IIF( L < Ref( L, -1 ), Ref( L, - 1 ) - L, 0 );
DeMarker = 100 * Sum( highm, oddis )/( Sum( lowm, oddis ) + Sum( highm, oddis ) );
graph0 = DeMarker;
Buy = Demarker <5;
BuyPrice= Close;
Sell = C>Ref(H,-1) ;
sellPrice=Close;
