Hello Guys,
This is a simple code for trading the Heiken Ashi.
We just buy or sell according to the Heiken Ashi, when it changes color.
We also trade according to the trend.
For this simple backtest, I did set a simple moving average of 130 periods, but of course you can use more efficient filters.
The test was done on the DAX, timeframe M15, with spread 1 point.
This strategy can be improved, the results are encouraging !
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
c1 = xClose>xOpen AND xClose[1]<xOpen[1]
c2 = xClose<xOpen AND xClose[1]>xOpen[1]
if c1 AND Not LongOnMarket and close > average[130] then
BUY 2 SHARE AT MARKET
endif
if c2 AND Not ShortOnMarket and close < average[130] then
SELLSHORT 2 SHARE AT MARKET
endif