Heiken Ashi Trading System with RSI - Dax (mini)- Nasdaq (mini) - ITA40 (mini)

Category: Strategies By: Wolf Trades Created: June 14, 2021, 4:12 PM
June 14, 2021, 4:12 PM
Strategies
7 Comments

Hi guys, I would like to share with you this strategy I have implemented. Work with Heiken Ashi candles on the Dax H1, Nasdaq H1 and ITA 40 H1 indices.
I tried to do backtest on forex H1 and H1 commodities but it doesn’t work and also on indices in other timeframes besides H1 but I didn’t find good results. I share the code with you so that some of you more experienced can improve the drawdown or add some filters that improve the performance.
For me it is always a pleasure to compare myself with the most experts so feel free to comment to give your opinions.
Thank you all

PS This is the first time that I have published a strategy because I have started programming again after a long time, I have not been able to insert more photos of the results and the code file.

DEFPARAM PreLoadBars = 300
DEFPARAM CumulateOrders = False
//DEFPARAM FLATBEFORE = 070100 // Trading System doesn't open trade after 00:00 and before this time hhmmss
//DEFPARAM FLATAFTER = 205900  // Trading System doesn't open trade after  this time hhmmss

//Finestra Temporale
Finestra = CurrentTime > Prima and CurrentTime < Dopo

// HA - Definition Heikin-Ashi****************************
once xOpen = open
xClose = (open+close+high+low)/4
if barindex > 0 then
xOpen = (xOpen[1]+xClose[1])/2
endif
xLow = min(low,min(xClose,xOpen))
xHigh = max(high,max(xClose,xOpen))
xRange = abs(xHigh - xLow)
xBody = abs(XClose - xOpen)
//*******************************************************
//Indicator
MyRSI = RSI[14](close)

// Close Position on Friday after Time: hhmmss***********
TempoScaduto = OpenDayofWeek = 5 and CurrentTime > 205900

// Add "n" Point/Pips at MystopLoss
//Npips = 2 * pipsize

//Condizione BUY*******************************************
c2 = xRange < xRange[1]  // il range della candela che crea il segnale è minore di quello della candela precedente
c3 = xClose > xOpen // Candela Rialzista
c31= xClose[1] < xOpen[1] //la candela precedente è ribassista
c33 = MyRSI[1] < BuyRsi or MyRSI[2] < BuyRsi
//MyStop1 = abs((xClose - Lowest[2](xLow))- Npips) // il minimo tra 2 minimi fa - Npips
//MyProfit1 = TradePrice + (abs (MyStop1*2))

//Condizione SELL******************************************
c4 = xRange < xRange[1]  // il range della candela che crea il segnale è minore di quello della candela precedente
c5 = xClose < xOpen // Candela Ribassista
c51 = xClose[1] > xOpen[1] // la candela precedente è rialzista
c55 = MyRSI[1] > SellRsi or MyRSI[2] > SellRsi
//MyStop2 = abs((xClose + Highest[2](xHigh))+ Npips)  // il massimo tra due massimi fa + Npips
//MyProfit2 = TradePrice - (abs (MyStop2*2))

// Condizioni per entrare su posizioni long******************
IF NOT LongOnMarket  and c3 and  c31 and C33  and Finestra THEN
BUY 1 CONTRACTS AT MARKET
SET STOP pLOSS  sellstop  //se inserisco MySTop1 devo togliere la "p" prima di LOSS
SET TARGET pPROFIT gain   //se inserisco MyProfit1 devo togliare la "p" prima di PROFIT
ENDIF

// Condizioni per uscire da posizioni long**********************
If LongOnMarket AND TempoScaduto THEN
SELL AT MARKET
ENDIF

// Condizioni per entrare su posizioni short********************
IF NOT ShortOnMarket  and c5 and c51 and c55 And Finestra THEN
SELLSHORT 1 CONTRACTS AT MARKET
SET STOP pLOSS perditashort //se inserisco MySTop2 devo togliere la "p" prima di LOSS
SET TARGET pPROFIT gainshort  //se inserisco MyProfit2 devo togliare la "p" prima di PROFIT
ENDIF

// Condizioni per uscire da posizioni short************************
IF ShortOnMarket AND TempoScaduto THEN
EXITSHORT AT MARKET
ENDIF

//************************************************************************
//trailing stop function
trailingstart = x //trailing will start @trailinstart points profit
trailingstep = y //trailing step to move the "stoploss"
 
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
 
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
newSL = tradeprice(1)+trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
newSL = newSL+trailingstep*pipsize
ENDIF
ENDIF
 
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
newSL = tradeprice(1)-trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
newSL = newSL-trailingstep*pipsize
ENDIF
ENDIF
 
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
//******************************************************

Download
Filename: Sistema-HA-Dax-1-HOUR.itf
Downloads: 672
Download
Filename: Sistema-HA-Nasdaq-1-HOUR.itf
Downloads: 564
Download
Filename: Sistema-HA-ITA-40-1-HOUR.itf
Downloads: 310
Wolf Trades Average
I am a quantum trader who uses python for his analysis. Work in progress My Store: https://market.prorealcode.com/store/wolf-trades/
Author’s Profile

Comments

Logo Logo
Loading...