50 EMA Trading Strategy (Amibroker And Tradestation Code)

The original article can be found here.

Trading rules in plain English

  • The close must be higher than the 50-day EMA of the LOW.
  • The IBS indicator must be lower than 0.2.
  • If 1 and 2 are true, then buy the close.
  • Sell at the close when the close ends higher than yesterday’s high.

Amibroker code

ibs=(C-L)/(H-L)  ;

Buy=  C>EMA(L,50) AND ibs<0.2 ;  
buyPrice= Close;
Sell=C>Ref(H,-1);
sellPrice=Close;

Tradestation code

If ((C-L)/(H-L)) < 0.2 and Close > XAverage(Low,50)
then buy this bar at c;
If c>h[1] then Sell this bar at c;