Discussing the strategy VECTORIAL DAX (M5)
Forums › ProRealTime English forum › ProOrder support › Discussing the strategy VECTORIAL DAX (M5)
- This topic has 1,263 replies, 125 voices, and was last updated 8 months ago by  VinzentVega. VinzentVega.
- 
	
		
- 
		
			
				
05/29/2024 at 2:30 PM #23324106/18/2024 at 10:12 AM #234034I prefer Vectorial-US100-v2-WFE you are using this one ? 06/18/2024 at 11:35 AM #234036I prefer Vectorial-US100-v2-WFE you are using this one ? No i found this one thats for free trial right now. 
 https://market.prorealcode.com/product/nordicalgos-dax5m/Im impressed so far 10/12/2024 at 10:20 AM #238887Here is a one for Dax 15m thats been live since February 2024 and has worked good for me. //————————————————————————- 
 // Main code : DAX_15M_VECTORIAL_LIVE
 //————————————————————————-
 // M15
 // SPREAD 3
 // Optimize date – FEB 2024DEFPARAM CumulateOrders = false 
 DEFPARAM Preloadbars = 50000// Variabler för handelstid 
 ONCE zz = 36.0
 ONCE dd = 64.0
 ONCE bb = 41.0
 ONCE xx = 8.0
 CtimeA = time >= 080000 and time <= 220000
 CtimeB = time >= 080000 and time <= 220000
 ONCE BarLong = 350 // Avslutar lång position efter detta antal barer
 ONCE BarShort = 350 // Avslutar kort position efter detta antal barer// Positionstorlek 
 ONCE PositionSizeLong = 0.5 // Storlek på lång position
 ONCE PositionSizeShort = 1 // Storlek på kort position// Strategi – Vektorberäkning av vinkel 
 ONCE PeriodeA = xx // Period för exponentiellt glidande medelvärde (öka för mer stabilitet) (kortsiktig trend)
 ONCE nbChandelierA = zz // Antal ljus för vinkelberäkning (öka för att jämna ut beräkningen)MMA = Exponentialaverage[PeriodeA](close) 
 ADJASUROPPO = (MMA – MMA[nbChandelierA] * pipsize) / nbChandelierA
 ANGLE = (ATAN(ADJASUROPPO)) // Beräkning av vinkelCondBuy1 = ANGLE >= 20 // Köpvillkor baserat på vinkel 
 CondSell1 = ANGLE <= -45 // Säljvillkor baserat på vinkel// Vektorberäkning av lutning och dess glidande medelvärde 
 ONCE PeriodeB = dd // Period för exponentiellt glidande medelvärde av lutning (öka för att fånga längre trender)
 ONCE nbChandelierB = bb // Antal ljus för lutningsberäkning (öka för att jämna ut beräkningen)lag = 6 // Fördröjning av signalen (öka för att fördröja signalen) MMB = Exponentialaverage[PeriodeB](close) 
 pente = (MMB – MMB[nbChandelierB] * pipsize) / nbChandelierB
 trigger = Exponentialaverage[PeriodeB + lag](pente)CondBuy2 = (pente > trigger) AND (pente < 0) // Köpvillkor baserat på lutning 
 CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1) // Säljvillkor baserat på lutning// Ingångar i position 
 CONDBUY = CondBuy1 and CondBuy2 and CTimeA // Villkor för köp
 CONDSELL = CondSell1 and CondSell2 and CtimeB // Villkor för sälj// Lång position 
 IF CONDBUY THEN
 buy PositionSizeLong contract at market
 SET TARGET %PROFIT 5.0 // Mål för vinst i procent
 ENDIF// Kort position 
 IF CONDSELL THEN
 Sellshort PositionSizeShort contract at market
 SET TARGET %PROFIT 1.5 // Mål för vinst i procent
 ENDIF// Variabler för trailing stop 
 ONCE trailingStopType = 1 // Trailing stop – 0 AV, 1 PÅ
 ONCE trailingstoplong = 10 // Trailing stop för lång position (öka för att skydda vinst)
 ONCE trailingstopshort = 7 // Trailing stop för kort position (öka för att skydda vinst)
 ONCE atrtrailingperiod = 30 // Period för ATR (justera för marknadsvolatilitet)
 ONCE minstop = 0.8 // Minsta avstånd för trailing stop (öka för större avstånd)// Trailing stop-logik 
 atrtrail = AverageTrueRange[atrtrailingperiod]((close / 10) * pipsize) / 1000
 trailingstartl = round(atrtrail * trailingstoplong)
 trailingstartS = round(atrtrail * trailingstopshort)
 if trailingStopType = 1 THEN
 TGL = trailingstartl
 TGS = trailingstartS
 if not onmarket then
 MAXPRICE = 0
 MINPRICE = close
 PREZZOUSCITA = 0
 ENDIF
 if longonmarket then
 MAXPRICE = MAX(MAXPRICE, close)
 if MAXPRICE – tradeprice(1) >= TGL * pointsize then
 if MAXPRICE – tradeprice(1) >= minstop then
 PREZZOUSCITA = MAXPRICE – TGL * pointsize
 ELSE
 PREZZOUSCITA = MAXPRICE – minstop * pointsize
 ENDIF
 ENDIF
 ENDIF
 if shortonmarket then
 MINPRICE = MIN(MINPRICE, close)
 if tradeprice(1) – MINPRICE >= TGS * pointsize then
 if tradeprice(1) – MINPRICE >= minstop then
 PREZZOUSCITA = MINPRICE + TGS * pointsize
 ELSE
 PREZZOUSCITA = MINPRICE + minstop * pointsize
 ENDIF
 ENDIF
 ENDIF
 if onmarket and PREZZOUSCITA > 0 then
 EXITSHORT AT PREZZOUSCITA STOP
 SELL AT PREZZOUSCITA STOP
 ENDIF
 ENDIF// Exit zombie trade 
 IF POSITIONPERF < 0 THEN
 IF shortOnMarket AND BARINDEX – TRADEINDEX(1) >= barshort THEN
 EXITSHORT AT MARKET
 ENDIF
 ENDIFIF POSITIONPERF < 0 THEN 
 IF LongOnMarket AND BARINDEX – TRADEINDEX(1) >= barlong THEN
 SELL AT MARKET
 ENDIF
 ENDIF10/12/2024 at 11:31 AM #23889410/12/2024 at 11:34 AM #238897Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. Thanks 🙂 10/12/2024 at 11:36 AM #238898You are likely to have translated the code. Copy it without any translation. 10/12/2024 at 11:45 AM #23889910/16/2024 at 8:41 AM #239038can you tell me what the backtest period was? 10/16/2024 at 10:57 AM #23904610/16/2024 at 9:20 PM #239113What do you mean with positionsize = 1? The code have 0.5 when long and 1 when short. I havent optimized it since i started it in february. 10/16/2024 at 9:25 PM #239114Here you have the code with english comments: //————————————————————————- 
 // Main code : DAX_15M_VECTORIAL_LIVE
 //————————————————————————-
 // M15
 // SPREAD 3
 // Optimize date – FEB 2024DEFPARAM CumulateOrders = false 
 DEFPARAM Preloadbars = 50000// Variables for trading time 
 ONCE zz = 36.0
 ONCE dd = 64.0
 ONCE bb = 41.0
 ONCE xx = 8.0
 CtimeA = time >= 080000 and time <= 220000
 CtimeB = time >= 080000 and time <= 220000
 ONCE BarLong = 350 // Closes long position after this number of bars
 ONCE BarShort = 350 // Closes short position after this number of bars// Position size 
 ONCE PositionSizeLong = 0.5 // Size of long position
 ONCE PositionSizeShort = 1 // Size of short position// Strategy – Vector calculation of angle 
 ONCE PeriodeA = xx // Period for exponential moving average (increase for more stability) (short-term trend)
 ONCE nbChandelierA = zz // Number of bars for angle calculation (increase to smooth out the calculation)MMA = Exponentialaverage[PeriodeA](close) 
 ADJASUROPPO = (MMA – MMA[nbChandelierA] * pipsize) / nbChandelierA
 ANGLE = (ATAN(ADJASUROPPO)) // Angle calculationCondBuy1 = ANGLE >= 20 // Buy condition based on angle 
 CondSell1 = ANGLE <= -45 // Sell condition based on angle// Vector calculation of slope and its moving average 
 ONCE PeriodeB = dd // Period for exponential moving average of slope (increase to capture longer trends)
 ONCE nbChandelierB = bb // Number of bars for slope calculation (increase to smooth out the calculation)lag = 6 // Signal delay (increase to delay the signal) MMB = Exponentialaverage[PeriodeB](close) 
 pente = (MMB – MMB[nbChandelierB] * pipsize) / nbChandelierB
 trigger = Exponentialaverage[PeriodeB + lag](pente)CondBuy2 = (pente > trigger) AND (pente < 0) // Buy condition based on slope 
 CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1) // Sell condition based on slope// Entry conditions for positions 
 CONDBUY = CondBuy1 and CondBuy2 and CTimeA // Buy conditions
 CONDSELL = CondSell1 and CondSell2 and CtimeB // Sell conditions// Long position 
 IF CONDBUY THEN
 buy PositionSizeLong contract at market
 SET TARGET %PROFIT 5.0 // Profit target in percentage
 ENDIF// Short position 
 IF CONDSELL THEN
 Sellshort PositionSizeShort contract at market
 SET TARGET %PROFIT 1.5 // Profit target in percentage
 ENDIF// Variables for trailing stop 
 ONCE trailingStopType = 1 // Trailing stop – 0 OFF, 1 ON
 ONCE trailingstoplong = 10 // Trailing stop for long position (increase to protect profits)
 ONCE trailingstopshort = 7 // Trailing stop for short position (increase to protect profits)
 ONCE atrtrailingperiod = 30 // Period for ATR (adjust for market volatility)
 ONCE minstop = 0.8 // Minimum distance for trailing stop (increase for larger distance)// Trailing stop logic 
 atrtrail = AverageTrueRange[atrtrailingperiod]((close / 10) * pipsize) / 1000
 trailingstartl = round(atrtrail * trailingstoplong)
 trailingstartS = round(atrtrail * trailingstopshort)
 if trailingStopType = 1 THEN
 TGL = trailingstartl
 TGS = trailingstartS
 if not onmarket then
 MAXPRICE = 0
 MINPRICE = close
 PREZZOUSCITA = 0
 ENDIF
 if longonmarket then
 MAXPRICE = MAX(MAXPRICE, close)
 if MAXPRICE – tradeprice(1) >= TGL * pointsize then
 if MAXPRICE – tradeprice(1) >= minstop then
 PREZZOUSCITA = MAXPRICE – TGL * pointsize
 ELSE
 PREZZOUSCITA = MAXPRICE – minstop * pointsize
 ENDIF
 ENDIF
 ENDIF
 if shortonmarket then
 MINPRICE = MIN(MINPRICE, close)
 if tradeprice(1) – MINPRICE >= TGS * pointsize then
 if tradeprice(1) – MINPRICE >= minstop then
 PREZZOUSCITA = MINPRICE + TGS * pointsize
 ELSE
 PREZZOUSCITA = MINPRICE + minstop * pointsize
 ENDIF
 ENDIF
 ENDIF
 if onmarket and PREZZOUSCITA > 0 then
 EXITSHORT AT PREZZOUSCITA STOP
 SELL AT PREZZOUSCITA STOP
 ENDIF
 ENDIF// Exit zombie trade 
 IF POSITIONPERF < 0 THEN
 IF shortOnMarket AND BARINDEX – TRADEINDEX(1) >= barshort THEN
 EXITSHORT AT MARKET
 ENDIF
 ENDIFIF POSITIONPERF < 0 THEN 
 IF LongOnMarket AND BARINDEX – TRADEINDEX(1) >= barlong THEN
 SELL AT MARKET
 ENDIF
 ENDIF1 user thanked author for this post.10/17/2024 at 9:07 AM #23911910/17/2024 at 10:40 AM #239131Ahh then i understand 🙂 Regarding you comment about precise parameters, you can also test with even numbers and you still get “ok” results with a good equity curve. Example: 
 ONCE zz = 40.0
 ONCE dd = 60.0
 ONCE bb = 40.0
 ONCE xx = 8.010/17/2024 at 11:19 AM #239137Regarding you comment about precise parameters, you can also test with even numbers and you still get “ok” results with a good equity curve. Optimizing is ok but the point is how often are you going to re-optimize the system ? I am testing it live but based on the backtest results you need to run it for 3-6 months at least before doing any evaluation since it’s not very active (less than 1 trade a day on average) thank you ciao 
- 
		AuthorPosts
			Find exclusive trading pro-tools on 



 
		 
		 
		