Is this system too good to be true?
Forums › ProRealTime English forum › ProOrder support › Is this system too good to be true?
- This topic has 12 replies, 5 voices, and was last updated 5 years ago by Thally.
-
-
08/27/2019 at 7:59 PM #105669
Hello all,
I have developed a simple trend following system which I apply to USDJPY. The system is very simple. It marks out the opening price at 22:00 (UK time). It then buys or sell an m5 close either side of this line in the sand. The initial stop loss is behind the most recent swing high/low and the position size is determined from the distance to the stop and the max risk percentage of equity (1% in this example). There is a breakeven stop loss which kicks in after price has moved in our favour by a certain multiple of the 10 period ATR. Positions are then held until 20:00 (1 hour before the futures markets close) or until they are stopped out.
The backtest delivers incredible returns – >4000% between 2016 and 2019 from a 5k initial equity and 0.8 point spread (average spread from IG is 0.79 for USDJPY) – see attached performance report. It has the typical drawdowns expected from a trend following system, but nevertheless the system performance in the 200k backtest is pretty incredible. I have done no optimisation so the performance can’t be driven by overfitting (or at least I think it can’t). So my question for you is… is this system too good to be true? Surely anything that looks this good has to be wrong somehow? If its not then merry Christmas here’s a new trend following system for your Arsenal.
Thally
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100// strategy looks for break above or below previous days 20:00 price// stop loss behnind swing high or low// position size is 1% risk based on distance to stop loss// positions managed with a breakeven stoploss after an ATR multiple move in our favour// positions are exited at 20:00DEFPARAM CumulateOrders = False // Cumulating positions deactivatedDEFPARAM FlatAfter = 200000// SpreadONCE sp = 0.8// money managementONCE Capital = 5000ONCE Risk = 0.01equity = Capital + StrategyProfitmaxrisk = round(equity*Risk)PositionSizeL = abs(round((maxrisk/StopLossL)/PointValue)*pipsize)PositionSizeS = abs(round((maxrisk/StopLossS)/PointValue)*pipsize)// window for calculating yesterdays 22:00 priceONCE starttime = 220000ONCE endtime = 220500if opentime = starttime thenop = openendifif opentime = endtime thenlastop = opendifgraphonprice lastop as "op"// Trade CounterONCE TradeCount = 0IF INTRADAYBARINDEX=0 thenTradeCount = 0ENDIF// Time FiltersExitPos = Time >= 200000// LongIF Not ONMARKET AND close CROSSES OVER lastop AND TradeCount < 10 THENBUY PositionSizeL PERPOINT AT MARKETTradeCount = TradeCount + 1StopLossL = abs(close - LOWEST[10](low)) + spSET STOP LOSS StopLossLENDIF// exit longsIF LONGONMARKET AND ExitPos THENSELL AT MARKETENDIF// shortIF Not ONMARKET AND close CROSSES UNDER lastop AND TradeCount < 10 THENSELLSHORT PositionSizeS PERPOINT AT MARKETTradeCount = TradeCount + 1StopLossS = abs(close - HIGHEST[10](high)) + spSET STOP LOSS StopLossSENDIF// exit shortsIF SHORTONMARKET AND ExitPos THENEXITSHORT AT MARKETENDIF// Breakeven stop loss//reset the stoploss valueIF NOT ONMARKET THENnewSL = 0ENDIF// Parameters for determining when BE stop kicks inTrailingStart = 4 * AverageTrueRange[10] * pipsizeTrailingStep = 1 * AverageTrueRange[10] * pipsize// LongsideIF LONGONMARKET THEN// move to breakevenIF newSL = 0 AND CLOSE - TRADEPRICE(1) >= TrailingStart THENnewSL = TRADEPRICE(1) + TrailingStepENDIFENDIF//ShortsideIF SHORTONMARKET THEN// move to breakevenIF newSL = 0 AND TRADEPRICE(1) - CLOSE >= TrailingStart THENnewSL = TRADEPRICE(1) - TrailingStepENDIFENDIF//stop order to exit the positionsIF newSL > 0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF08/27/2019 at 8:09 PM #10567108/27/2019 at 8:25 PM #105673Thanks for the comment. The risk per trade is always 1% of the current account equity. Those large drawdowns only occur late on in the time series when the account size is much much larger than the initial equity. Because the system uses a % of equity the position sizing grows as the account size grows. How is that risky?
08/27/2019 at 10:20 PM #10567608/27/2019 at 10:31 PM #10567908/27/2019 at 10:55 PM #105683Its the spread. I also get shite results for spread = 2. I guess the question is whether a spread of 0.8 is reasonable. The strategy won’t trade between 20:00 and 00:00 (UK time) so that should avoid periods like now when the spread is large.
IG quote 0.79 as the average UJ spread (https://www.ig.com/uk/help-and-support/spread-betting-and-cfds/fees-and-charges/what-are-igs-forex-spread-bet-product-details). However I have not monitored it meticulously over 24h and IG say they can’t give the numbers broken down over 24h. Given that UJ is quite volatile after 00:00 I’d imagine the spreads come down to the average after Sydney and Tokyo open. My live (demo) testing is in line with the backtest which suggests spreads of 2 are unrealistically large.
1 user thanked author for this post.
08/27/2019 at 10:57 PM #10568408/27/2019 at 11:25 PM #105689Have you tried to do some math, as someone suggested?
My rule is to have in my account a least (MaxDrawDown * 3)+RequiredMargin. In your case you should have about £ 80,000 on your account, while you decided to backtest with just £ 5,000! Try again entering £ 80,000 to spot the difference, then spread it over 2 and a half years.
That’s what you are going to gain per year, provided you have £ 80,000 and the future performs like the past!
08/27/2019 at 11:58 PM #105691Hi Roberto,
attached is backtest starting with 80k. It still does very well, but of course the % gain is lower. I chose 5k because it is more representative of my reality. Perhaps Im not understanding yours and Magifina’s logic, but I fail to see the logic behind setting your account relative to the max drawdown in a system that capitalises on compounding? The position size function always risks a fixed % of equity so as the account equity grows the risk (in $ terms) grows too. The max drawdown in the strategy backtest does not happen when the account size is 5k, it happens when the account size more like 50k, so in % terms that’s a 50% drawdown. Unless the system lost continuously I think an account blowout risking 1% of equity on each trade is very unrealistic. As you can see the win rate is about 40%, which is pretty good for a trend following system.
I guess it would be a useful addition for PRT to give max drawdown in percentage rather than absolute terms to avoid these misunderstandings.
Cheers for the comments though…
08/28/2019 at 2:01 PM #105739So… it turns out the results were too good to be true. The bug was in the position size calculation. As Nicolas kindly pointed out in another thread, because I call the position size function before the stop loss function the position size is always delayed by one bar and therefore calculated incorrectly. When we calculate positions size correctly the results are more modest, but still pretty good – not tradable yet in my opinion but not bad. Here’s the results with the correct position size calculation.
08/28/2019 at 2:41 PM #105743I would suggest always developing, back testing and forward testing with a fixed position size. If a strategy is profitable then position size is irrelevant. Once you are happy that a strategy is capable of making profit – even if it is only small due to low position size then run a back test with some more dynamic position sizing to see how things like draw down would have been affected.
Throwing position sizing in at the beginning is just throwing an extra spanner in the works from the start. The only time that position sizing should be included at the start of development is if you are trying to build a casino strategy that uses position sizing to create its profit or if you are trying to use dynamic position sizing based on calculated probability of return.
1 user thanked author for this post.
08/28/2019 at 2:45 PM #10574408/28/2019 at 2:47 PM #105745 -
AuthorPosts
Find exclusive trading pro-tools on