Forums › ProRealTime English forum › ProOrder support › Trend surfer DAX modified › Reply To: Trend surfer DAX modified
Okay, back from Berlin,
It’s 4:30 am, I spent the night, backtesting and optimising the strategy (on 100 000 candles 😉 ), I even broke it into pieces, optimizing each one and ….
it goes nowhere, ratios are not good or not good enough.
So I threw it away and started a new one. This is a trend surfer DAX too, so I think we can keep it in the same thread.
It’s 2min, 1pt spread, based on nicolas’ PRC_TTM SQUEEZE and Verdi’s Breakeven that I found in Grahal’s snippets.
It’s simple : buy when it turns from red to yellow and sell when it turn from blue to dark blue.
I’m close to get it right, I just got one problem, the system buys on every yellow (next candle of course) and sells on every blue (see the picture attached).
Here is 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 63 64 65 66 67 68 69 70 71 72 73 |
// Trend Surfer DAX Modified DEFPARAM CumulateOrders = False // code-Parameter DEFPARAM FlatAfter = 180000 DEFPARAM FlatBefore = 080500 // DAX trading window ONCE BuyTimeMorning = 090500 ONCE SellTimeMorning = 110000 ONCE BuyTimeAfternoon = 130000 ONCE SellTimeAfternoon = 173000 // trading parameter ONCE sl = a ONCE tp = b ONCE lengthKC=20 // position management during trading window IF (Time >= BuyTimeMorning AND Time <= SellTimeMorning) OR (Time >= BuyTimeAfternoon AND Time <= SellTimeAfternoon) THEN value = (Highest[lengthKC](high)+Lowest[lengthKC](low)+average[lengthKC](close))/3 val = linearregression[lengthKC](close-value) if val>0 and val<val[1] then IF LONGONMARKET THEN SELL 1 SHARES AT MARKET SELLSHORT 1 SHARES AT MARKET ELSE SELLSHORT 1 SHARES AT MARKET ENDIF ENDIF if val<0 and val>val[1] then IF SHORTONMARKET THEN EXITSHORT 1 SHARES AT MARKET BUY 1 SHARES AT MARKET ELSE BUY 1 SHARES AT MARKET ENDIF ENDIF StopdistanceBreakeven = c NormalStop = sl nb = barindex - tradeindex minprice = lowest[nb + 1](Low) maxprice = highest[nb + 1](High) If longonmarket then If maxprice >= positionprice + StopdistanceBreakeven then sell at (positionprice + 1) stop else sell at positionprice - NormalStop stop endif endif If shortonmarket then If minprice <= positionprice - StopdistanceBreakeven then exitshort at (positionprice - 1) stop else exitshort at positionprice + NormalStop stop endif endif // stop and profit //SET STOP pLOSS sl SET TARGET pPROFIT tp ENDIF |
My guess is I should define what is yellow and dark blue (this I think I can do) and then buy/sell on the change of color (this I have no idea, how do you say “buy if red then yellow ???)
Can you help ?
Also, when I do the backtest, I have MFE and MAE in the closed positions toggle, which one should I trust ? (Cause I like MAE 🙂 )
Should I do a “e-ratio” like I read somewhere on the internet ?