Forums › ProRealTime English forum › ProOrder support › On the subject of curve-fitting › Reply To: On the subject of curve-fitting
Well there’s a Sunday evening I’ll never get back. Did a whole lot of number crunching, see attached Excel page which I hope is self explanatory.
Tried 3 modes of re-optimizing; monthly for 30 days, monthly for 90 days and quarterly for 90 days. The second option gave a slightly better result. The only notable thing is that the last 4 months are much better than the 4 months OOS of the 75/25 at the top. Maybe that says something, maybe not.
This is the code, run on DJI 5m, €1. It’s a very simple example, chosen a) because there’s not much to optimize, and b) because it’s clearly not v robust; the point is surely to try to make a weak strategy better. Would still need masses of forward testing to see if that can be achieved.
|
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 |
// Definition of code parameters DEFPARAM CumulateOrders = false // Cumulating positions deactivated daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 TIMEFRAME(120 minutes) indicator1 = SuperTrend[mult,nbr] c1 = (close > indicator1) c2 = (close < indicator1) TIMEFRAME(5 minutes) IF C1 AND not daysForbiddenEntry THEN BUY 1 CONTRACT AT MARKET SET STOP %LOSS stl ENDIF // Conditions to exit long positions IF C2 THEN SELL AT MARKET ENDIF // Conditions to enter short positions IF C2 AND not daysForbiddenEntry THEN SELLSHORT 1 CONTRACT AT MARKET SET STOP %LOSS stl ENDIF // Conditions to exit short positions IF C1 THEN EXITSHORT AT MARKET ENDIF //trailing stop function trailingstart = trstr //trailing will start @trailinstart points profit trailingstep = trst //trailing step to move the "stoploss" //reset the stoploss value IF NOT ONMARKET THEN newSL=0 ENDIF //manage long positions IF LONGONMARKET THEN //first move (breakeven) IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN newSL = tradeprice(1)+trailingstep*pipsize ENDIF //next moves IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN newSL = newSL+trailingstep*pipsize ENDIF ENDIF //manage short positions IF SHORTONMARKET THEN //first move (breakeven) IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN newSL = tradeprice(1)-trailingstep*pipsize ENDIF //next moves IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN newSL = newSL-trailingstep*pipsize ENDIF ENDIF //stop order to exit the positions IF newSL>0 THEN SELL AT newSL STOP EXITSHORT AT newSL STOP ENDIF //************************************************************************ |