Forums › ProRealTime English forum › ProOrder support › Discussing the strategy VECTORIAL DAX (M5) › Reply To: Discussing the strategy VECTORIAL DAX (M5)
04/11/2019 at 1:57 PM
#96091
vonsai
True!!
I tested your code on nasdaq.
changed sl and tp and time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
// ROBOT VECTORIAL DAX v2 // M5 // SPREAD = 1 // by BALMORA 74 - APRIL 2019 DEFPARAM CumulateOrders = false DEFPARAM Preloadbars = 50000 //TRADING TIME CtimeA = time >= 150000 and time <= 220000 CtimeB = time >= 150000 and time <= 220000 //POSITION SIZE PositionSize = 1 //STRATEGY ONCE PeriodeA = 10 ONCE nbChandelierA= 15 ONCE PeriodeB = 20 ONCE nbChandelierB= 35 ONCE lag = 1.5 MMA = Exponentialaverage[PeriodeA](close) ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA ANGLE = (ATAN(ADJASUROPPO)) MMB = Exponentialaverage[PeriodeB](close) pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB trigger = Exponentialaverage[PeriodeB+lag](pente) //BUY CONDITIONS CondBuy1 = ANGLE >= 35 CondBuy2 = (pente > trigger) AND (pente < 0) CondBuy3 = average[100](close) > average[100](close)[1] CONDBUY = CondBuy1 and CondBuy2 and CondBuy3 and CTimeA //SHORT CONDITIONS CondSell1 = ANGLE <= - 40 CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1) CondSell3 = average[20](close) < average[20](close)[1] CONDSELL = CondSell1 and CondSell2 and CondSell3 and CtimeB //POSITION LONGUE IF CONDBUY THEN buy PositionSize contract at market SET STOP %LOSS 2 ENDIF //POSITION COURTE IF CONDSELL THEN Sellshort PositionSize contract at market SET STOP %LOSS 2 ENDIF //TRAILING STOP ONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ON ONCE trailingstoplong = 8 // Trailing Stop Atr Relative Distance ONCE trailingstopshort = 5 // Trailing Stop Atr Relative Distance ONCE atrtrailingperiod = 30 // Atr parameter Value ONCE minstop = 0 // Minimum Trailing Stop Distance // TRAILINGSTOP //---------------------------------------------- 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 |