I have been running a back testing efs for symbol EEV on 10min charts for the month of October 2008. I noticed that I was getting different results depending on whether I ran it while the market was open or closed for exactly the same function parameters. I then discovered that it was varying day by day irrespective of whether the market was open or closed.
I am using variable lot sizes based on a risk value, trade commission ($13.90) the previous bars ATR and an initial stop loss multiple as follows:
nLot = Math.round((Risk - 13.90)/(islMult * nATR1));
ATR is obtained from:
xATR = atr(14);
nATR1 = xATR.getValue(-1);
Risk and islMult are passed as function variables and do not change for each run.
On comparisson of the trades of each of the BTs run I noticed that for a few of the trades there was a slight difference between the nLot sizes e.g. 186 v 190. Since the only "variable" in the nLot calculation is the atr I started checking this through.
I also have an initial stop loss and trailing stop loss that are also based on the atr value. And this contributed to some variations depending on when the BT was run.
I displayed the builtin ATR study on my chart and checked the calculations for nLot and my stop losses against this and for each run through the calculations were correct.
However when I checked the values of nATR1 on the built in study for the trades where I had a discrepancy I noticed that the values were different depending on when I looked at the chart!! (beginning to sound like quantum mechanics)!!
To be specific, using the 10min chart for EEV on 29th October at 18:20 GMT, 14:20 Eastern and built in study ATR(14), looking at the ATR study on 12 Nov when the market was open the atr value was 2.944885. However when I looked at it on 13 Nov before the market opened its value was 3.258617!!!!!
How can the atr for the same bar of 2 weeks ago change from day to day?
If there is a problem with the atr study can you recommend an alternative method of obtaining it that doesn't have these inconsistancies?
I have attached my efs for completeness, however the problem appears to be in the raw data changing.
I am using variable lot sizes based on a risk value, trade commission ($13.90) the previous bars ATR and an initial stop loss multiple as follows:
nLot = Math.round((Risk - 13.90)/(islMult * nATR1));
ATR is obtained from:
xATR = atr(14);
nATR1 = xATR.getValue(-1);
Risk and islMult are passed as function variables and do not change for each run.
On comparisson of the trades of each of the BTs run I noticed that for a few of the trades there was a slight difference between the nLot sizes e.g. 186 v 190. Since the only "variable" in the nLot calculation is the atr I started checking this through.
I also have an initial stop loss and trailing stop loss that are also based on the atr value. And this contributed to some variations depending on when the BT was run.
I displayed the builtin ATR study on my chart and checked the calculations for nLot and my stop losses against this and for each run through the calculations were correct.
However when I checked the values of nATR1 on the built in study for the trades where I had a discrepancy I noticed that the values were different depending on when I looked at the chart!! (beginning to sound like quantum mechanics)!!
To be specific, using the 10min chart for EEV on 29th October at 18:20 GMT, 14:20 Eastern and built in study ATR(14), looking at the ATR study on 12 Nov when the market was open the atr value was 2.944885. However when I looked at it on 13 Nov before the market opened its value was 3.258617!!!!!
How can the atr for the same bar of 2 weeks ago change from day to day?
If there is a problem with the atr study can you recommend an alternative method of obtaining it that doesn't have these inconsistancies?
I have attached my efs for completeness, however the problem appears to be in the raw data changing.
Comment