Discussing the strategy VECTORIAL DAX (M5)
Forums › ProRealTime English forum › ProOrder support › Discussing the strategy VECTORIAL DAX (M5)
- This topic has 1,260 replies, 124 voices, and was last updated 1 month ago by Greger2346.
-
-
08/28/2020 at 7:21 PM #142858
where in the code does it calculate the ‘positionsize’ for which PositionSizeLong and PositionSizeShort are derived?
At line 7 you can have positionsize = any value you like. With MM= 0 it won’t change.
1234567// VECTORIAL MM - DJ 3mDEFPARAM CumulateOrders = falseDEFPARAM Preloadbars = 50000//Money ManagementMM = 0 // = 0 for optimizationif MM = 0 thenpositionsize=.5I have been running a 5m long version of this over the past couple of months. It’s basically a merger between Vectorial and MoD, so far fairly consistent with the back test.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248DEFPARAM CumulateOrders = falseDEFPARAM Preloadbars = 50000//Money ManagementMM = 1 // = 0 for optimizationif MM = 0 thenpositionsize=.5ENDIFif MM = 1 thenONCE startpositionsize = .5ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etcONCE margin = (close*.005) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE tier1 = 55 // IG first tier margin limitONCE maxpositionsize = 550 // IG tier 2 margin limitONCE minpositionsize = .2 // enter minimum position allowedIF Not OnMarket THENpositionsize = startpositionsize + Strategyprofit/(factor*margin)ENDIFIF Not OnMarket THENIF startpositionsize + Strategyprofit/(factor*margin) > tier1 thenpositionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 marginENDIFIF Not OnMarket THENif startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THENpositionsize = minpositionsize //keeps positionsize from going below allowed minimumENDIFIF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limitENDIFENDIFENDIFENDIFCtime = time >= 010000 and time <= 230000TIMEFRAME(2 hours)Period= 240inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULLa = weightedaverage[round(sqrt(Period))](inner)c9 = HULLa > HULLa[1]//c2 = HULLa < HULLa[1]TIMEFRAME(15 minutes)mx1 = average[16,1](close)c7 = mx1 > mx1[1]//c8 = mx1 < mx1[1]TIMEFRAME(10 minutes)mx2 = average[15,0](close)c5 = mx2 > mx2[1]//c6 = mx2 < mx2[1]//Stochastic RSI | indicatorlengthRSI = 10//RSI periodlengthStoch = 16//Stochastic periodsmoothK = 16 //Smooth signal of stochastic RSIsmoothD = 3 //Smooth signal of smoothed stochastic RSImyRSI = RSI[lengthRSI](close)MinRSI = lowest[lengthStoch](myrsi)MaxRSI = highest[lengthStoch](myrsi)StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)K = average[smoothK](stochrsi)*100D = average[smoothD](K)c3 = K>D//c4 = K<DTIMEFRAME(default)indicator4 = SuperTrend[1,7]c1 = (close > indicator4)//c2 = (close < indicator4)//VECTEUR = CALCUL DE L'ANGLEONCE PeriodeA = 5ONCE nbChandelierA= 42MMA = Exponentialaverage[PeriodeA](close)ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierAANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTECondBuy1 = ANGLE >= 31//CondSell1 = ANGLE <= - 25//VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILEONCE PeriodeB = 24ONCE nbChandelierB= 50lag = 4MMB = Exponentialaverage[PeriodeB](close)pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierBtrigger = Exponentialaverage[PeriodeB+lag](pente)CondBuy2 = (pente > trigger) AND (pente < 0)//CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)//ENTREES EN POSITIONCONDBUY = CondBuy1 and CondBuy2 and Ctime and c1 and c3 and c5 and c7 and c9//CONDSELL = CondSell1 and CondSell2 and Ctime and c2 and c4 and c6 and c8//POSITION LONGUEIF CONDBUY THENbuy positionsize contract at marketSET STOP %LOSS 1.7SET TARGET %PROFIT 2.1ENDIF//POSITION COURTE//IF CONDSELL THEN//Sellshort positionsize contract at market//SET STOP %LOSS sls//SET TARGET %PROFIT tps//ENDIF//Break evenonce breakeven = 1//1 on - 0 offbreakevenPercent = .22PointsToKeep = 2startBreakeven = tradeprice(1)*(breakevenpercent/100)//reset the breakevenLevel when no trade are on marketif breakeven>0 thenIF NOT ONMARKET THENbreakevenLevel=0ENDIF// --- BUY SIDE ---//test if the price have moved favourably of "startBreakeven" points alreadyIF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN//calculate the breakevenLevelbreakevenLevel = tradeprice(1)+PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENSELL AT breakevenLevel STOPENDIF// --- end of BUY SIDE ---IF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN//calculate the breakevenLevelbreakevenLevel = tradeprice(1)-PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENEXITSHORT AT breakevenLevel STOPENDIFendif//****************************************************************************************// trailing atr stop IIonce trailingstoptype = 1 // trailing stop - 0 off, 1 ononce tsincrements = 0 // set to 0 to ignore tsincrementsonce tsminatrdist = 2once tsatrperiod = 14 // ts atr parameteronce tsminstop = 12 // ts minimum stop distanceonce tssensitivity = 0 // [0]close;[1]high/lowif trailingstoptype thenif barindex=tradeindex thentrailingstoplong = 9 // ts atr distancetrailingstopshort = 9 // ts atr distanceelseif longonmarket thenif tsnewsl>0 thenif trailingstoplong>tsminatrdist thenif tsnewsl>tsnewsl[1] thentrailingstoplong=trailingstoplongelsetrailingstoplong=trailingstoplong-tsincrementsendifelsetrailingstoplong=tsminatrdistendifendifendifif shortonmarket thenif tsnewsl>0 thenif trailingstopshort>tsminatrdist thenif tsnewsl<tsnewsl[1] thentrailingstopshort=trailingstopshortelsetrailingstopshort=trailingstopshort-tsincrementsendifelsetrailingstopshort=tsminatrdistendifendifendifendiftsatr=averagetruerange[tsatrperiod]((close/10)*pipsize)/1000//tsatr=averagetruerange[tsatrperiod]((close/1)*pipsize) // (forex)tgl=round(tsatr*trailingstoplong)tgs=round(tsatr*trailingstopshort)if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thentsmaxprice=0tsminprice=closetsnewsl=0endifif tssensitivity thentssensitivitylong=hightssensitivityshort=lowelsetssensitivitylong=closetssensitivityshort=closeendifif longonmarket thentsmaxprice=max(tsmaxprice,tssensitivitylong)if tsmaxprice-tradeprice(1)>=tgl*pointsize thenif tsmaxprice-tradeprice(1)>=tsminstop thentsnewsl=tsmaxprice-tgl*pointsizeelsetsnewsl=tsmaxprice-tsminstop*pointsizeendifendifendifif shortonmarket thentsminprice=min(tsminprice,tssensitivityshort)if tradeprice(1)-tsminprice>=tgs*pointsize thenif tradeprice(1)-tsminprice>=tsminstop thentsnewsl=tsminprice+tgs*pointsizeelsetsnewsl=tsminprice+tsminstop*pointsizeendifendifendifif longonmarket thenif tsnewsl>0 thensell at tsnewsl stopendifif tsnewsl>0 thenif low crosses under tsnewsl thensell at market // when stop is rejectedendifendifendifif shortonmarket thenif tsnewsl>0 thenexitshort at tsnewsl stopendifif tsnewsl>0 thenif high crosses over tsnewsl thenexitshort at market // when stop is rejectedendifendifendif08/28/2020 at 7:32 PM #142863Welcome back nonetheless 🙂
1 user thanked author for this post.
08/28/2020 at 8:39 PM #142866Welcome back 🙂
I put Your last code above in PRT but my backtest is different from Yours. I also needed to add an “endif” in the end. I’m running version 10.3
Have I done something wrong?08/28/2020 at 8:39 PM #142868Hello nonetheless
Hope you are well. Many thanks for your reply. I just tried your suggestion with the code you posted above and it worked. I will try to incorporate this back into the version of the Vectorial code I had downloaded preciously.
Thanks
S
08/28/2020 at 9:37 PM #142869my backtest is different from Yours
hi Artemois, live forward tests will always vary from the back test for multiple reasons. Also, I think mine was stopped and restarted some time in August so the MM will have reset. But when I run a back test for those 2 months, I see v similar performance ~91%
and yes, it does need another endif – got lost in the copy/paste
08/28/2020 at 9:48 PM #142870Also, please note that i didnt do any WF or VRT for this; the straight back test looked good and I was curious about the basic concept so I put it on demo for a couple of months, that’s all. I’m sure it can be improved
08/28/2020 at 9:57 PM #14287308/29/2020 at 9:22 AM #14288308/29/2020 at 11:51 AM #142890This is well weird … I ran Nonetheless code above again 2 mins ago and got completely different results than I was getting last night!
Nearer / more comparable with None’s now … see attached. I still get far more drawdown though … mine dd at £947 vs None’s dd at £64
What do you get this morning @Artemois ??
08/29/2020 at 12:21 PM #142896I’m putting attached on Forward Test on Monday … MM turned off and Period = 55 at Line 37.
Above is all I explored, I’m sure there would be other beneficial changes?
It be great if we had a Short version or Long and Short in same System?
Thank You for sharing Nonetheless!
08/29/2020 at 1:22 PM #142907Hi Grahal
I get the same results today as yesterday
I made a backtest on the DJ 3m Vectorial V3 for the same period and it has been more succesfull.
I also made one of 200 kptsI find them both interesting!
Thank You @Nonetheless for sharing, it is very interesting as a beginner to se what the more experienced people are doing.
08/29/2020 at 4:31 PM #142921Hi Grahal, how’s it going?
No idea why you got such varying results from this. I have attached the itf, just in case something got corrupted in the copy/paste. Also the 200k back tests for long and short, with a comparison look at the 3m v3. Obviously the latter is only 13 months, as opposed to 32.
I also found some tests that I did back in the spring of the 5m long version … seems to check out. But as I said, I really did this out of curiosity to try marrying Balmora’s Vectorial with MoD … and then I kinda forgot about it.
1 user thanked author for this post.
08/29/2020 at 4:33 PM #14292308/29/2020 at 4:48 PM #142932Both the Vectorial and the MOD are very interesting codes. MOD has a slightly bigger problem with DD but apart from that it has potential. This, and especially the 3 min version is good.
Is there a chance of any further development ?08/31/2020 at 10:00 AM #143034 -
AuthorPosts
Find exclusive trading pro-tools on