Backtest results change when I stop using variables
Forums › ProRealTime English forum › ProOrder support › Backtest results change when I stop using variables
- This topic has 56 replies, 3 voices, and was last updated 5 years ago by Mike.
-
-
09/29/2019 at 10:57 AM #108743
When I back test with 5 variables I get a profit of £130k. When I change the variables to their optimised absolute values within the code (ready to Automatic Trade) I get £18k. When I change 1 absolute value back to a variable (which I have left “sitting” in the variable optimisation section) I get £130.
Can anyone advise me what I might be doing wrong.
Thanks
Mike
09/29/2019 at 12:02 PM #108746This is a tick by tick mode “problem”. Even with variables set to fixed values the tick by tick mode does not activate.
I thought clicking on each line of the optimisation report was supposed to activate tick by tick mode. It seems not. Can anyone advise how to get reliable test results?
Thanks
Mike
09/29/2019 at 2:13 PM #10875109/29/2019 at 2:17 PM #10875209/29/2019 at 2:24 PM #108754I thought that clicking on the apparently optimal set of variables would “drill down” into a tick by tick test.
You are correct.
I bet you feel like you are going mad / why does stuff like this happen to me?? 🙂 I often think the same when weird stuff happens to me!
I can’t think of anything else to offer, but I would test your code if you post it on here and then we can see if I get the same result as you?
I’ll keep thinking also.
09/29/2019 at 2:28 PM #108755Thanks
I’ll quadruple check my settings and then assuming I’ve not been a total twat I’ll post the code. Yes – thought I was losing it 🙂 All problems solved on Saturday and all back today! Great!
Thanks for taking the time to reply on Sunday.
Code to follow
09/29/2019 at 2:28 PM #108756Is the 130k read only from the Opti Table and then when you click on that line you get 18K on the equity curve?
You also get 18K when you put values in the code and then run the Backtest?
EDIT /PS
Just thought of this … Optimisation does not take account of a final Open trade, but running a Backtest and seeing the equity curve does take account of an Open Trade.
Unless you are using huge Lot Size I cannot see an Open trade losing 112K??
09/29/2019 at 2:40 PM #108757£130 was top of the opti list. When I click that line it shows £130 on the Detailed Report and on the Equity Curve. This is consistent for any line I select.
When I replace the variables in the code with the absolute values of the optimised test I get 18k. This is with tick by tick selected. When I de-select tick by tick witht the absolute values hard coded I get…..yep £130
This is where I concluded that it was a tick by tick problem…
Still quadruple checking the setup 🙂
09/29/2019 at 2:48 PM #108759In response to your PS – no, the equity curve looks great as it’s a nice steady uptrend, on the tick by tick and on the £130. Trade size is £400 – £600. Just that the tick by tick appears to get stopped out way sooner than the opt result (just based on looking at the first few trades)
09/29/2019 at 2:55 PM #108762This is the Hard Coded version with the variables as absolutes. Gets £18k
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768//DM system code//--------------//ParametersDEFPARAM CumulateOrders = True//VariablesDIThreshold1 = 26DIThreshold2 = 7//ATRMultiple =ATRM//ADXLevel = ADXLADXDays = 11DIDays = 4TradeSize = 10//(Risk/(AverageTrueRange[DIDays][1]*ATRMultiple))//Risk = 1000//ConditionsADXDownTurn = ADX[ADXDays][1] > DIPlus[DIDays][1] and ADX[ADXDays][1] > DIMinus[DIDays][1] and ADX[ADXDays][1] > ADX[ADXDays][2] and ADX[ADXDays][1] > ADX[ADXDays]EnterLongonX = (DIplus[DIDays][1] crosses over DIminus[DIDays][1] and close > close[1] and DIplus[DIDays](close) > DIThreshold1)EnterLongonCH = (DIplus[DIDays][1] > DIPlus[DIDays][2] and DIplus[DIDays][1] > DIplus[DIDays](close) and DIplus[DIDays](close) > DIThreshold2) and (ADX[ADXDays] > DIPlus[DIDays] or ADX[ADXDays] > DIMinus[DIDays])//and ADX[ADXDays] > ADXLevel)EnterShortonX = (DIminus[DIDays][1] crosses over DIplus[DIDays][1] and close < close[1] and DIminus[DIDays](close) > DIThreshold1)EnterShortonCH = (DIminus[DIDays][1] > DIminus[DIDays][2]) and (DIminus[DIDays][1] > DIminus[DIDays](close) and DIminus[DIDays](close) > DIThreshold2) and (ADX[ADXDays] > DIPlus[DIDays] or ADX[ADXDays] > DIMinus[DIDays])//and ADX[ADXDays] > ADXLevel)//InstructionsIF EnterLongonX or EnterLongonCH thenBUY TradeSize PERPOINT AT MARKETENDIFIF EnterShortonX or EnterShortonCH thensellshort TradeSize PERPOINT AT MARKETENDIF//IF EnterLongonCH then//BUY TradeSize PERPOINT AT MARKET//ENDIF//IF EnterShortonCH then//sellshort TradeSize PERPOINT AT MARKET//ENDIFIF ADXDownTurn or EnterShortonX THENSELL AT MARKETENDIFIF ADXDownTurn or EnterLongonX THENEXITSHORT AT MARKETENDIF// Stops and targetsSET STOP pTRAILING 40 // AverageTrueRange[DIDays][1]*ATRMultiple//Alternative ADX Downturn calculations//These replace each other for testing//Testing on a Daily timescale over 3 years (10/16-09/19) produced a marginal gain for the simpler system//ADXDownTurn = ADX[ADXDays][1] > DIPlus[DIDays][1] and ADX[ADXDays][1] > DIMinus[DIDays][1] and ADX[ADXDays][1] > ADX[ADXDays][2] and ADX[ADXDays][1] > ADX[ADXDays]//ADXDownTurn = ADX[ADXDays][1] > DIPlus[DIDays][1] and ADX[ADXDays][1] > DIMinus[DIDays][1] and ADX[ADXDays][2] > ADX[ADXDays][3] and ADX[ADXDays][2] > ADX[ADXDays][4] and ADX[ADXDays][2] > ADX[ADXDays][1] and ADX[ADXDays][2] > ADX[ADXDays]//Peaks (I cannot yet code this)//if DIMinus[DiDays][1] > DIMinus[DiDays][2] and DIMinus[DiDays][1] > DIMinus[DiDays] then//DMP = DIMinus[DIDays]09/29/2019 at 3:05 PM #108763If you export (to an .itf file) the code with all the Opti values still set up etc and post that then I can import with all yuor settings and I can pop it on my Platform in less than 1 minute and it ensures I get all settings same as you.
09/29/2019 at 3:09 PM #10876409/29/2019 at 3:10 PM #10876609/29/2019 at 3:14 PM #108768Just that the tick by tick appears to get stopped out way sooner than the opt result (just based on looking at the first few trades)
Above sounds like it is blowing your account??
I imported your hard coded version and it is doing just that … using all 10k starting capital.
You have not said what market, timeframe etc?
Why don’t you try below …
1DEFPARAM CumulateOrders = FALSE //(instead of True)09/29/2019 at 3:23 PM #108770Sorry – I did not make my comment clear. My account (£10k) doesn’t get blow. I just meant that, eg Trade number 2 makes much more on Opt than it does in hard code as the tick by tick takes it out during day 1, whereas on Opti it runs for 3 days for a nice wee profit.
Dow Jones Industrial on Daily
I set “True” because I started testing this from 2014 and the DJI was trending up, so adding to my positions produced more profit. I’m now testing in choppy waters so I’ll re-run with False
Thanks
False = =£125 and £18 (False makes more sense logically in choppy market and it may be a way to simplify the manual testing that I seem to be destined to do). No pressure but I’m hoping for some magic 🙂
-
AuthorPosts
Find exclusive trading pro-tools on