Candlestick Pattern – Doji (Amibroker And Tradestation Code)

The strategy in plain English:

 

The Doji is a candlestick pattern mostly used on stock indices or stocks. It’s hard to quantify a doji, but we believe the code below does reasonably well to resemble it:

  1. The IBS must be below 0.2.
  2. The absolute value of the close minus the open must be lower than 0.15 times the high minus low range.
  3. If one and two are true, then go along at the close.
  4. Sell when the close is higher than yesterday’s high.

 

Click here for the original article.

 

Amibroker code:

 

setOption(“holdminbars”,1);

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

 

Buy= ibs<0.2 AND abs(C-O) < (H-L)*0.15;

buyPrice= Close;

Sell= C>Ref(H,-1) ;

sellPrice= Close ;

 

 

Tradestation code:

 

If ABSValue (OpenD(1)-CloseD(1)) <= .15*(HighD(1) – LowD(1))

and IFF((H-L)<>0,((C-L))/(H-L),1)< 0.2

then buy this bar at close;

If c>h[1] then sell this bar at close;

 

Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.