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.
-
-
10/19/2020 at 3:01 PM #147761
Here’s the code I was thinking about. In general I don’t like to keep a position over the weekend, but if there is one. Put the gap 50 to 0 to have it always active with or without positionperformance.
12345678910if onmarket thenif dayofweek=0 and (hour=0 and minute>=57) and abs(dopen(0)-dclose(1))>50 and positionperf(0)>0 thenif shortonmarket and close>dopen(0) thenexitshort at marketendifif longonmarket and close<dopen(0) thensell at marketendifendifendif10/19/2020 at 3:37 PM #147770I think this could be very useful! This fraiday I had an order that starts at 20:10 and was about to get an over weekend position so I cuted i in the positive as I didn’t want to keep it!
@Paul, do you have any ideas that you’d like to test or changes to make that you think of and that I could try and give you feedback on to get more gain. I run out of ideas…10/19/2020 at 4:37 PM #147779well atm I ran out of idea’s too. What I wonder instead of increasing the gains, not to prevent a bad entry, but how to react to a bad entry such as today. Just to watch the market going opposite and al you can do is hope it will reverse course.
Something like if there are no certain gains made after the position is entered, close after xx bars=time.
here’s something to test 🙂
So you need to see a gain of atleast 20 points in 3 hours after a position is taken or else close it.
I don’t know if I want to go down this road with curvefitting. There’s already plenty!
123456if longonmarket and highest[barindex-tradeindex(1)](high)-tradeprice(1)<20 and barindex-tradeindex>80 thensell at marketendifif shortonmarket and tradeprice(1)-lowest[barindex-tradeindex(1)](low)<20 and barindex-tradeindex>80 then//exitshort at marketendif10/19/2020 at 4:50 PM #14778210/19/2020 at 4:56 PM #14778310/19/2020 at 5:47 PM #147786I tried this, bit better ratio but less gain obviously….
123456789101112131415//SL above 0 if more than X hours and positiveSLafterXhours=0if longonmarket and barindex-tradeindex>60 thenif close-tradeprice(1)>=2 thensell at SLafterXhours STOPendifendifif shortonmarket and barindex-tradeindex>40 thenif tradeprice(1)-close>=2 thenEXITSHORT at SLafterXhours STOPendifendif10/19/2020 at 9:48 PM #147802I would refrain from using stop orders and use market, especially on fast timeframe. Then you don’t have to mess with rejections etc.
Actually there is already an already exit available in the code but it wasn’t used. (spreaking v3p5)
Maybe this one can be improved? Short was already active but for long was not used. If it was active with value minrangedistL=1 it would h’ve exit long way earlier.
Using it as is, with addition that if there is not enough gains, the minrangedistance gets reduced. So start at 3 and reducing it to 1.
1234567891011121314151617181920212223242526// reversal exitonce longexit =1once shortexit=1if longexit thenif longonmarket thenminrangedistL=1cl1=close<open and close[1]<open[1] and close[2]<open[2]cl2=(close=low or close[1]=low[1] or close[2]=low[2])cl3=(range>(close/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL)if cl1 and cl2 and cl3 thensell at marketendifendifendifif shortexit thenif shortonmarket thenminrangedistS=1.5cs1=close>open and close[1]>open[1] and close[2]>open[2]cs2=(close=high or close[1]=high[1] or close[2]=high[2])cs3=(range>(close/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS)if cs1 and cs2 and cs3 thenexitshort at marketendifendifendif10/19/2020 at 10:35 PM #147803Just replaced the trailing stops with an ordinary trailing stop, and added a new profit taking routine to the old version Vectorial Dax V3 (04/13/2019, #96328). Code is shorter, and after some nice curve fitting, gain has doubled.
10/19/2020 at 11:22 PM #14780810/20/2020 at 8:10 AM #147826123LR = LinearRegression[1]LRslope = LR[0] - LR[1]LRslopebuy = LRsplope > 0I added this condition for the uptrend. Yesterday’s trade was really catastrophic..
It’s another version of Vectorial .. but maybe an idea around that
10/20/2020 at 8:43 AM #147837The yesterdays SL was the 4th full SL (2%) and the 8th SL bigger than 1% this year. Actually the profit rate in October is bad. To many small winners on one side, and to many loosing trades on the other side. But up to now, this month ist not negativ. But also, it don´t needs one more big looser again.
10/20/2020 at 9:53 AM #147866Hello Paul,
You mean like that? Because implementing it this way didn’t get pretty good results…
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155//-------------------------------------------------------------------------// Code principal : Vectorial DJ 3 min V3//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Code principal : DJ 3m Vectorial V3//-------------------------------------------------------------------------// VECTORIAL MM - DJ 3mDEFPARAM CumulateOrders = falseDEFPARAM Preloadbars = 50000//Money ManagementMM = 0 // = 0 for optimizationif MM = 0 thenpositionsize=1ENDIFif MM = 1 thenONCE startpositionsize = .2ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etcONCE margin = (close*.05) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE margin2 = (close*.05)// 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 limitENDIFENDIFENDIFENDIF//HORAIRES DE TRADINGCtime = time >= 153000 and time < 210000//STRATEGIE//VECTEUR = CALCUL DE L'ANGLEi1 = HistoricVolatility[10](close)c1 = (i1 >= 0.06)ONCE PeriodeA = 4ONCE nbChandelierA= 30MMA = Exponentialaverage[PeriodeA](close)ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierAANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTECB1 = ANGLE >= 32CS1 = ANGLE <= - 44//VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILEONCE PeriodeB = 30ONCE nbChandelierB= 35lag = 0MMB = Exponentialaverage[PeriodeB](close)pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierBtrigger = Exponentialaverage[PeriodeB+lag](pente)CB2 = (pente > trigger) AND (pente < 0)CS2 = (pente CROSSES UNDER trigger) AND (pente > - 0.5)mx = average[110,0](close)CB3 = mx > mx[1]mx2 = average[20,0](close)CS3 = mx2 < mx2[1]//ENTREES EN POSITIONCONDBUY = CB1 and CB2 and CB3 and CTime and c1CONDSELL = CS1 and CS2 and CS3 and Ctime and c1//POSITION LONGUEIF CONDBUY THENbuy positionsize contract at marketSET STOP %LOSS 2.6ENDIF//POSITION COURTEIF CONDSELL THENSellshort positionsize contract at marketSET STOP %LOSS 0.6ENDIF//SET TARGET %PROFIT 2//Break evenbreakevenPercent = .13PointsToKeep = 1startBreakeven = tradeprice(1)*(breakevenpercent/100)once breakeven = 1//1 on - 0 off//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// reversal exitonce longexit =1once shortexit=1if longexit thenif longonmarket thenminrangedistL=1cl1=close<open and close[1]<open[1] and close[2]<open[2]cl2=(close=low or close[1]=low[1] or close[2]=low[2])cl3=(range>(close/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL)if cl1 and cl2 and cl3 thensell at marketendifendifendifif shortexit thenif shortonmarket thenminrangedistS=1.5cs1=close>open and close[1]>open[1] and close[2]>open[2]cs2=(close=high or close[1]=high[1] or close[2]=high[2])cs3=(range>(close/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS)if cs1 and cs2 and cs3 thenexitshort at marketendifendifendif10/20/2020 at 10:07 AM #14787010/20/2020 at 10:34 AM #14787710/20/2020 at 10:36 AM #147878 -
AuthorPosts
Find exclusive trading pro-tools on