Hi All,
I am getting some what I would call anomalies within the backtesting strategy creator, and I was wondering if anyone could help?
The strategy I’m looking at is just a simple crossover system using a custom indicator that I have made. So if X > Y then long, Y > X then short. Always in.
However, when I run the backtest, very occasionally, the indicator crosses it’s MA (very slightly) and the on the next bar crosses immediately back – but the back-tester does not register this as a cross?
So my question is: Does the backtesting program work to a certain number of decimal places to the right or just whole numbers? For example; the indicator is calculating to 5 decimal places, but the crosses only seem to register within the program when the cross magnitude is greater than 1.
Can anyone please help clear this up for me?
Many Thanks as always.
Ross
This simple indicator will test whether tiny value crosses are recognised:
if barindex = 0 then
a = -0.0000000001
endif
if barindex = 1 then
a = 0.0000000001
endif
if a crosses over 0 then
flag = 1
endif
return flag
…..and they are as flag returns a value of 1. But when I code something similar as a dummy strategy at ten decimal places the cross is not recognised and flag = 0. Below ten decimal places flag = 1 and the cross is recognised.
if barindex = 0 then
a = -0.0000000001
endif
if barindex = 1 then
a = 0.0000000001
endif
if a crosses over 0 then
flag = 1
endif
buy at -close limit
graph flag
It depends on what you used as a term to identify a CROSSOVER, if you write:
IF close CROSSES OVER MyMA THEN
is because you want CLOSE to cross over. If HIGH does, but CLOSE doesn’t, then it’s not a crossover (the reverse for LOW), which, instead, would be true if you had written:
IF high CROSSES OVER MyMA THEN
As for decimals, I never happened to check that, but I think it uses ALL decimal places you see on your chart.
As for decimals, I never happened to check that, but I think it uses ALL decimal places you see on your chart.
I assumed the same until I ran the test in my post just before yours. It seems that the ProOrder engine does not recognise the same cross overs that the ProBuilder engine does.
Data showed on the chart seems to consider only 5 decimals.