Automatic trading system DAX 1H mini 1€
Forums › ProRealTime English forum › ProOrder support › Automatic trading system DAX 1H mini 1€
- This topic has 113 replies, 12 voices, and was last updated 6 years ago by
JohnScher.
-
-
02/10/2017 at 4:24 PM #24708
By the way, in case someone does not like to use the pure martingale, this is the option to multiply by 1.5. You may not fully recover from previous losses, but most of them with less risk.
12IF PositionPerf(1) < 0 THENOrderSize = OrderSize*1.502/10/2017 at 4:26 PM #24709Raul – There is no difference in results from the exit day being 4 or 5. See attached, 4 on left and 5 on right. System 3 was the only code that had the exit day as 5 so I assume that’s what you wanted checked, the rest (including fixed contract) were already on day 4. This is probably because in-between Tuesday and Thursday there has always been a 50pt move up or down from the position entry level, hence no position left live when you get to Day 5.
I will post the 4 hr results shortly but they are worse than the 1hr ones so using this on a 1hr timescale is definitely better.
02/10/2017 at 4:29 PM #24712Hi Raul, and congratulation on your latest strategy. I’ve been following some of your posts and It seems like you are conscious about your money management and risk.
I have made these small tools in graph and added a small positionsize code, slightly changed from Nicolas’ original.
If I can suggest that you look at these together with you latest code- it would give some good information even though it’s still in development.
I hope to use this to make better risk analysis and position management. There is information both on market and off market.
Cheers Kasper
12345678910111213141516171819202122232425262728293031323334353637383940414243//REM Money ManagementReinvest=1if reinvest thenCapital = 10000Risk = 1//in % pr positionStopLoss = 100 // Could be our variable XREM Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))MAXpositionsize=625MINpositionsize=20ordersize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)/PointValue)*pipsize)))elseordersize=1Endif//===============Graphs RR, Winnings, Max recorded risk, Max risk%ONCE maxriskrecorded=0If onmarket thenmaxriskrecorded=ABS((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100)if maxriskrecorded<maxriskrecorded[1]thenmaxriskrecorded=maxriskrecorded[1]elsemaxriskrecorded=maxriskrecordedendifendifif not onmarket thenwinnings=StrategyProfit-StrategyProfit[1]elsewinnings=0endifriskprtrade=abs(COUNTOFPOSITION*stoploss*pipsize)RR=winnings/riskprtrade[1]graph abs((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100) COLOURED(255,20,147) AS "MAXRISK%"graph maxriskrecorded COLOURED(255,0,255) AS "MAXrisk%recorded"graph RR COLOURED(0,0,255) AS "RR"graph winnings COLOURED(0,0,0) AS "Winnings"02/10/2017 at 4:32 PM #2471502/10/2017 at 4:55 PM #24718Hello @kasper, I can not understand what you mean, sorry, it will be for the language. The first part is a risk manager, but I can not know that it is the second part, I do not know how to implement it in the code, copy and paste and does not perform any operation. Thank you
02/10/2017 at 6:32 PM #24728Attached are the 4hr results for system 2&3. Not much to say apart from results are not as good (partly due to less trades obviously) but also that the draw is quite big at 23% and 44% respectively. System 2 performs better in this timeframe as its more consistent with less draw and is also mostly positive in prior years to 2012 (except 2010).
1 user thanked author for this post.
02/10/2017 at 6:48 PM #2474202/10/2017 at 7:01 PM #24745Okay 🙂
It is a tool to know the:
- Maxrisk (for the whole backtest)
- Risk at each trade
- RR (Risk/Reward) at each trade
Optimize line 23 and 29 for risk management
I have made a complete code with the DAX-1H-system-1.itf
here it is:
If any questions just ask 🙂
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596DEFPARAM CumulateOrders = trueonce ordersize=1// ConditionsMA1 = Average [1]MA2 = Average [2]c1 = Ma1>MA2t1 = time >= 090000t2 = time = 180000d1 =dayofweek = 2d2 = dayofweek = 4//REM Money ManagementReinvest=1if reinvest thenCapital = 10000Risk = 1//in % pr positionStopLoss = 100 // Could be our variable XREM Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))MAXpositionsize=625MINpositionsize=20ordersize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)/PointValue)*pipsize)))elseordersize=1endifindicator13 = MACD[12,26,9](close)c13 = (indicator13 < 30)indicator11 = ExponentialAverage[20](close)c11 = (close >= indicator11)indicator1 = MACDline[12,26,9](close)indicator2 = ExponentialAverage[12](indicator1)c12 = (indicator1 > indicator2)If d1 And t1 and c1 and c11 and c12 and c13 THENif not onmarket thenIF c1 THENIF PositionPerf(1) < 0 THENOrderSize = OrderSize+2if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize = Ordersize-1if ordersize<1 thenordersize= 1ENDIFendifbuy ordersize Contract At MarketEndifIf d2 and t2 thensell at marketendifendifendifSet Stop Ploss 50 // from TradeSet Target PProfit 50 // from Trade//===============Graphs RR, Winnings, Max recorded risk, Max risk%ONCE maxriskrecorded=0If onmarket thenmaxriskrecorded=ABS((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100)if maxriskrecorded<maxriskrecorded[1]thenmaxriskrecorded=maxriskrecorded[1]elsemaxriskrecorded=maxriskrecordedendifendifif not onmarket thenwinnings=StrategyProfit-StrategyProfit[1]elsewinnings=0endifriskprtrade=abs(COUNTOFPOSITION*stoploss*pipsize)RR=winnings/riskprtrade[1]graph abs((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100) COLOURED(255,20,147) AS "MAXRISK%"graph maxriskrecorded COLOURED(255,0,255) AS "MAXrisk%recorded"graph RR COLOURED(0,0,255) AS "RR"graph winnings COLOURED(0,0,0) AS "Winnings"02/10/2017 at 7:18 PM #24748Yes, System 3 1Hr is looking consistent across all. I think there are a couple of things we can perhaps look to do around risk management but also we don’t want to over-tweak it to fit results either. It should be applicable to other markets as well. Next perhaps I would prefer to see a % stop/limit in the code and then we can really see if it is robust as that should help reduce the effect of the absolute index value and also the type of index itself.
02/10/2017 at 7:21 PM #2474902/10/2017 at 7:25 PM #24750On the other hand, it seems that you were right, attached the data. We see that in the first year of my backtest (end of 2012 to 2014) the average time of operations is higher than in the last years. They go from lasting about 16 hours on average to about 5 or 6 hours with the highest volatility in the market in recent years. That may be why it’s been 10 years running slower than these last years.
02/10/2017 at 7:27 PM #24755Happy you like it- for lower risk adjust line 29 for:
1MINpositionsize=1it will lower the gain, but only risk 1% pr position at each trade.
Hope it makes sense?
Br. Kasper
02/11/2017 at 9:44 PM #24814Attached are results for the CAC index for system 1-3 + fixed. Works quite well. Only change made to the code is that the sl/tp is changed to 30 from 50 due it having a much lower index value. System 3 still performs consistently with a max draw of 11.8%. I have tested tick by tick so I would think it means that the zero bar results are also accurate so no gains to adjust for, but am slightly puzzled why PRT did not return an error message while testing over this large timeframe as it did with the DAX.
1 user thanked author for this post.
02/11/2017 at 9:49 PM #2481902/12/2017 at 8:59 AM #24839Adapting Takeprofit on average daily range could be an idea to explore. I made this calculation in an indicator recently :
https://www.prorealcode.com/prorealtime-indicators/daily-atr-range-for-intraday-chart/
I let you test this Sunday morning idea for me 🙂
-
AuthorPosts
Find exclusive trading pro-tools on