Discussing the strategy VECTORIAL DAX (M5)

Forums ProRealTime English forum ProOrder support Discussing the strategy VECTORIAL DAX (M5)

Viewing 15 posts - 826 through 840 (of 1,239 total)
  • #143035

    Dear Antonio

    This is an english channel so please write again but in english

    Cheers

    1 user thanked author for this post.
    #143039

    DEFPARAM CumulateOrders = false DEFPARAM Preloadbars = 50000 //Money Management MM = 1 // = 0 for optimization if MM = 0 then positionsize=.5 ENDIF if MM = 1 then ONCE startpositionsize = .5 ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etc ONCE margin = (close*.005) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverage ONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverage ONCE tier1 = 55 // IG first tier margin limit ONCE maxpositionsize = 550 //  IG tier 2 margin limit ONCE minpositionsize = .2 // enter minimum position allowed IF Not OnMarket THEN positionsize = startpositionsize + Strategyprofit/(factor*margin) ENDIF IF Not OnMarket THEN IF startpositionsize + Strategyprofit/(factor*margin) > tier1 then positionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 margin ENDIF IF Not OnMarket THEN if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN positionsize = minpositionsize //keeps positionsize from going below allowed minimum ENDIF IF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize then positionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limit ENDIF ENDIF ENDIF ENDIF   Ctime = time >= 010000 and time <= 230000   TIMEFRAME(2 hours) Period= 240 inner = 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 | indicator lengthRSI = 10//RSI period lengthStoch = 16//Stochastic period smoothK = 16 //Smooth signal of stochastic RSI smoothD = 3 //Smooth signal of smoothed stochastic RSI myRSI = RSI[lengthRSI](close) MinRSI = lowest[lengthStoch](myrsi) MaxRSI = highest[lengthStoch](myrsi) StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI) K = average[smoothK](stochrsi)*100 D = average[smoothD](K) c3 = K>D //c4 = K indicator4) //c2 = (close < indicator4)   //VECTEUR = CALCUL DE L’ANGLE ONCE PeriodeA = 5 ONCE nbChandelierA= 42 MMA = Exponentialaverage[PeriodeA](close) ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE CondBuy1 = ANGLE >= 31 //CondSell1 = ANGLE <= – 25     //VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE ONCE PeriodeB = 24 ONCE nbChandelierB= 50 lag = 4 MMB = Exponentialaverage[PeriodeB](close) pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB trigger = Exponentialaverage[PeriodeB+lag](pente) CondBuy2 = (pente > trigger) AND (pente < 0) //CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)       //ENTREES EN POSITION CONDBUY = 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 LONGUE IF CONDBUY THEN buy positionsize contract at market SET STOP %LOSS 1.7 SET TARGET %PROFIT 2.1 ENDIF   //POSITION COURTE //IF CONDSELL THEN //Sellshort positionsize contract at market //SET STOP %LOSS sls //SET TARGET %PROFIT tps //ENDIF   //Break even once breakeven = 1//1 on – 0 off   breakevenPercent = .22 PointsToKeep = 2 startBreakeven = tradeprice(1)*(breakevenpercent/100)   //reset the breakevenLevel when no trade are on market if breakeven>0 then IF NOT ONMARKET THEN breakevenLevel=0 ENDIF // — BUY SIDE — //test if the price have moved favourably of “startBreakeven” points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep*pipsize ENDIF //place the new stop orders on market at breakevenLevel IF breakevenLevel>0 THEN SELL AT breakevenLevel STOP ENDIF // — end of BUY SIDE — IF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep*pipsize ENDIF //place the new stop orders on market at breakevenLevel IF breakevenLevel>0 THEN EXITSHORT AT breakevenLevel STOP ENDIF endif   //**************************************************************************************** // trailing atr stop II once trailingstoptype     = 1    // trailing stop – 0 off, 1 on   once tsincrements = 0         // set to 0 to ignore tsincrements once tsminatrdist = 2   once tsatrperiod    = 14         // ts atr parameter once tsminstop      = 12         // ts minimum stop distance   once tssensitivity        = 0    // [0]close;[1]high/low   if trailingstoptype then if barindex=tradeindex then trailingstoplong     = 9   // ts atr distance trailingstopshort    = 9  // ts atr distance else if longonmarket then if tsnewsl>0 then if trailingstoplong>tsminatrdist then if tsnewsl>tsnewsl[1] then trailingstoplong=trailingstoplong else trailingstoplong=trailingstoplong-tsincrements endif else trailingstoplong=tsminatrdist endif endif endif if shortonmarket then if tsnewsl>0 then if trailingstopshort>tsminatrdist then if tsnewsl<tsnewsl[1] then=”” trailingstopshort=”trailingstopshort” else=”” endif=””  =”” tsatr=”averagetruerange[tsatrperiod]((close/10)*pipsize)/1000″ (forex)=”” tgl=”round(tsatr*trailingstoplong)” tgs=”round(tsatr*trailingstopshort)” if=”” not=”” onmarket=”” or=”” ((longonmarket=”” and=”” shortonmarket[1])=”” (longonmarket[1]=”” shortonmarket))=”” tsmaxprice=”0″ tsminprice=”close” tsnewsl=”0″ tssensitivity=”” tssensitivitylong=”high” tssensitivityshort=”low” longonmarket=”” tsmaxprice-tradeprice(1)=””>=tgl*pointsize then if tsmaxprice-tradeprice(1)>=tsminstop then tsnewsl=tsmaxprice-tgl*pointsize else tsnewsl=tsmaxprice-tsminstop*pointsize endif endif endif if shortonmarket then tsminprice=min(tsminprice,tssensitivityshort) if tradeprice(1)-tsminprice>=tgs*pointsize then if tradeprice(1)-tsminprice>=tsminstop then tsnewsl=tsminprice+tgs*pointsize else tsnewsl=tsminprice+tsminstop*pointsize endif endif endif if longonmarket then if tsnewsl>0 then sell at tsnewsl stop endif if tsnewsl>0 then if low crosses under tsnewsl then sell at market // when stop is rejected endif endif endif if shortonmarket then if tsnewsl>0 then exitshort at tsnewsl stop endif if tsnewsl>0 then if high crosses over tsnewsl then exitshort at market // when stop is rejected endif endif endif</tsnew

    DEFPARAM CumulateOrders = false DEFPARAM Preloadbars = 50000 //Money Management MM = 1 // = 0 for optimization if MM = 0 then positionsize=.5 ENDIF if MM = 1 then ONCE startpositionsize = .5 ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etc ONCE margin = (close*.005) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverage ONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverage ONCE tier1 = 55 // IG first tier margin limit ONCE maxpositionsize = 550 //  IG tier 2 margin limit ONCE minpositionsize = .2 // enter minimum position allowed IF Not OnMarket THEN positionsize = startpositionsize + Strategyprofit/(factor*margin) ENDIF IF Not OnMarket THEN IF startpositionsize + Strategyprofit/(factor*margin) > tier1 then positionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 margin ENDIF IF Not OnMarket THEN if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN positionsize = minpositionsize //keeps positionsize from going below allowed minimum ENDIF IF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize then positionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limit ENDIF ENDIF ENDIF ENDIF   Ctime = time >= 010000 and time <= 230000   TIMEFRAME(2 hours) Period= 240 inner = 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 | indicator lengthRSI = 10//RSI period lengthStoch = 16//Stochastic period smoothK = 16 //Smooth signal of stochastic RSI smoothD = 3 //Smooth signal of smoothed stochastic RSI myRSI = RSI[lengthRSI](close) MinRSI = lowest[lengthStoch](myrsi) MaxRSI = highest[lengthStoch](myrsi) StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI) K = average[smoothK](stochrsi)*100 D = average[smoothD](K) c3 = K>D //c4 = K indicator4) //c2 = (close < indicator4)   //VECTEUR = CALCUL DE L’ANGLE ONCE PeriodeA = 5 ONCE nbChandelierA= 42 MMA = Exponentialaverage[PeriodeA](close) ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE CondBuy1 = ANGLE >= 31 //CondSell1 = ANGLE <= – 25     //VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE ONCE PeriodeB = 24 ONCE nbChandelierB= 50 lag = 4 MMB = Exponentialaverage[PeriodeB](close) pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB trigger = Exponentialaverage[PeriodeB+lag](pente) CondBuy2 = (pente > trigger) AND (pente < 0) //CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)       //ENTREES EN POSITION CONDBUY = 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 LONGUE IF CONDBUY THEN buy positionsize contract at market SET STOP %LOSS 1.7 SET TARGET %PROFIT 2.1 ENDIF   //POSITION COURTE //IF CONDSELL THEN //Sellshort positionsize contract at market //SET STOP %LOSS sls //SET TARGET %PROFIT tps //ENDIF   //Break even once breakeven = 1//1 on – 0 off   breakevenPercent = .22 PointsToKeep = 2 startBreakeven = tradeprice(1)*(breakevenpercent/100)   //reset the breakevenLevel when no trade are on market if breakeven>0 then IF NOT ONMARKET THEN breakevenLevel=0 ENDIF // — BUY SIDE — //test if the price have moved favourably of “startBreakeven” points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep*pipsize ENDIF //place the new stop orders on market at breakevenLevel IF breakevenLevel>0 THEN SELL AT breakevenLevel STOP ENDIF // — end of BUY SIDE — IF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep*pipsize ENDIF //place the new stop orders on market at breakevenLevel IF breakevenLevel>0 THEN EXITSHORT AT breakevenLevel STOP ENDIF endif   //**************************************************************************************** // trailing atr stop II once trailingstoptype     = 1    // trailing stop – 0 off, 1 on   once tsincrements = 0         // set to 0 to ignore tsincrements once tsminatrdist = 2   once tsatrperiod    = 14         // ts atr parameter once tsminstop      = 12         // ts minimum stop distance   once tssensitivity        = 0    // [0]close;[1]high/low   if trailingstoptype then if barindex=tradeindex then trailingstoplong     = 9   // ts atr distance trailingstopshort    = 9  // ts atr distance else if longonmarket then if tsnewsl>0 then if trailingstoplong>tsminatrdist then if tsnewsl>tsnewsl[1] then trailingstoplong=trailingstoplong else trailingstoplong=trailingstoplong-tsincrements endif else trailingstoplong=tsminatrdist endif endif endif if shortonmarket then if tsnewsl>0 then if trailingstopshort>tsminatrdist then if tsnewsl<tsnewsl[1] then=”” trailingstopshort=”trailingstopshort” else=”” endif=””  =”” tsatr=”averagetruerange[tsatrperiod]((close/10)*pipsize)/1000″ (forex)=”” tgl=”round(tsatr*trailingstoplong)” tgs=”round(tsatr*trailingstopshort)” if=”” not=”” onmarket=”” or=”” ((longonmarket=”” and=”” shortonmarket[1])=”” (longonmarket[1]=”” shortonmarket))=”” tsmaxprice=”0″ tsminprice=”close” tsnewsl=”0″ tssensitivity=”” tssensitivitylong=”high” tssensitivityshort=”low” longonmarket=”” tsmaxprice-tradeprice(1)=””>=tgl*pointsize then if tsmaxprice-tradeprice(1)>=tsminstop then tsnewsl=tsmaxprice-tgl*pointsize else tsnewsl=tsmaxprice-tsminstop*pointsize endif endif endif if shortonmarket then tsminprice=min(tsminprice,tssensitivityshort) if tradeprice(1)-tsminprice>=tgs*pointsize then if tradeprice(1)-tsminprice>=tsminstop then tsnewsl=tsminprice+tgs*pointsize else tsnewsl=tsminprice+tsminstop*pointsize endif endif endif if longonmarket then if tsnewsl>0 then sell at tsnewsl stop endif if tsnewsl>0 then if low crosses under tsnewsl then sell at market // when stop is rejected endif endif endif if shortonmarket then if tsnewsl>0 then exitshort at tsnewsl stop endif if tsnewsl>0 then if high crosses over tsnewsl then exitshort at market // when stop is rejected endif endif endif</tsnewsl[1]>

    Hi All,

    I tested the 2 versions (Nonetheless and Grahal) with MM=0, spread2, tick by tick, 200K candles.

    Cf attached results. We should perforam a WF analysis.

    #143041

    Please avoid to quote entire codes, you pollute the topic unnecessarily.

    2 users thanked author for this post.
    #143042

    Hi Francesco,

    Yes, sorry for this – first time I quote someone. I was expecting that only the text would be copied.

    I tried to update my post but could not. Sorry Again.

    Alex.

    #143049

    Could you attach the two .itf files? 🙂

    Thank you very much.

    #143134

    Hi Danitutsa,

    cf attached.

    Regards

    #143556

    hello, 3min timeframe code can be improved, not by using pente > trigger, but using cross over, that together with pente setting > -xx and <xx as below and not using the breakeven.

    also for the atr trailing stop, I found a small bug which cause the trade to exit too early in a very few cases.

    I replace the last part with this. (first row is the change).

    however, using a % trailingstop works just as good, if not better.

    1 user thanked author for this post.
    #143565

    Hello,

    Vectorial DJI 3 minute

    After some further testing I have found that by changing the below three variables as follows, you are able to increase the returns of the strategy by 17%

    Variables:

    tsatrperiod – change from 14 to 12

    tsminstop – change from 12 to 10

    tsincrements – change from 0.05 to 0.1

     

    Testing Account Parameters:

    Account – IG Spread Betting

    Capital – 1,000

    Position Size – 1

    Original strategy on the left of the image, enhanced on the right.

    Thank you again to Balmora74 for sharing, and to everyone else for the numerous updates along the way!  Most enjoyable exercise.

    #143567

    tips are always nice

    here’s an other one, don’t use the mx/mx2 averages but use stochastic rsi | indicator

    curve is the same with 1% or 2% stoploss

    1 user thanked author for this post.
    #143569

    Hi Paul

    Would you be so kind as to share the section of code I should replace the mx/mx2 with the stochastic RSI please?

    Thank you

    #143570

    sure

    this is what I use

    and the code below above the code above

     

    2 users thanked author for this post.
    #143571

    Hi Paul, could you post your last .ITF file please? Thank you very much.

    1 user thanked author for this post.
    #143572

    and change nbchandelierb 40 to 41 and it looks better

    #143573

    here are the changes above made in the original. On the other one I’am still working.

     

    4 users thanked author for this post.
    #143574

    Hi Paul,

    Apologies, how do you define stochasticrsi please?

    //stochastic rsi | indicator
    if stochasticrsi then

    …….

     

    Thank you

Viewing 15 posts - 826 through 840 (of 1,239 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login