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
You must be logged in to post a comment.
il semble que cette stratégie ne fonctionne pas avec des stop loss : y a t'il un moyen de limiter les pertes ? merci
Chez IG markets, on est effectivement plus limité.
C'est pourquoi j'utilise ProRealTime CFD. Il suffit de passer de 100000 unités (affichées par défaut) à 250000 (si je me rappelle bien).
Voilà, pas de secret !
Bonjour,
Merci pour cette stratégie, mais je ne comprends pas comment vous faites pour tester depuis 2008 à 2016 en 15min alors que PRT en 15min ne fourni que 10000 unités et donc la période démarre mi-décembre.
De plus, j'ai pris exactement le code de la stratégie et l'ai appliquée sur le même support (DAX Mini en 15min), les résultats sont totalement différents et catastrophique (-13%).
Une subtilité que je n'ai pas perçue ?
Cordialement
The first time that the system open a position it should buy or sell one contract, after the number of the contracts shoul be two in order to close and reverse the position. thanks