Forums › ProRealTime English forum › ProOrder support › Trend surfer DAX modified › Reply To: Trend surfer DAX modified
03/19/2018 at 2:31 PM
#65688
wow I didn´t know that, thank you !
I am sorry to waste your time with beginners problems,
The good thing is that I have an edge now ! Yeeeaahh ! I just need to optimise sp/tp
so here´s the code for now:
the code
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 |
// Trend Surfer DAX Modified DEFPARAM CumulateOrders = False // code-Parameter DEFPARAM FlatAfter = 173000 DEFPARAM FlatBefore = 090500 // DAX trading window ONCE BuyTimeMorning = 090500 ONCE SellTimeMorning = 110000 ONCE BuyTimeAfternoon = 130000 ONCE SellTimeAfternoon = 170000 ONCE lengthRSI = 13 ONCE lengthband = 34 ONCE lengthrsipl = 3 ONCE lengthtradesl = 7 ONCE lineup = 68 ONCE linemid = 50 ONCE linedown = 32 // trading parameter ONCE PositionSize = 1 ONCE sl = 50 ONCE tp = 50 // emergency stop IF STRATEGYPROFIT <-500 THEN QUIT ENDIF // position management during trading window IF (Time >= BuyTimeMorning AND Time <= SellTimeMorning) OR (Time >= BuyTimeAfternoon AND Time <= SellTimeAfternoon) THEN // calculate TDI indicator r = rsi[lengthrsi](close) ma = average[lengthband](r) offs = (1.6185 * std[lengthband](r)) blueup = ma+offs bluedn = ma-offs jaune = (blueup+bluedn)/2 vert = average[lengthrsipl](r) rouge = average[lengthtradesl](r) // open position // long IF Not ONMARKET AND rouge<bluedn AND vert CROSSES OVER rouge OR rouge<linedown AND vert CROSSES OVER rouge OR rouge>linemid AND vert CROSSES OVER rouge OR rouge CROSSES OVER jaune THEN BUY PositionSize CONTRACT AT MARKET ENDIF // short IF Not ONMARKET AND rouge>blueup AND vert CROSSES UNDER rouge OR rouge>lineup AND vert CROSSES UNDER rouge OR rouge<linemid AND vert CROSSES UNDER rouge OR rouge CROSSES UNDER jaune THEN SELLSHORT PositionSize CONTRACT AT MARKET ENDIF // stop and profit SET STOP pTRAILING sl SET TARGET pPROFIT tp ENDIF |