i have no idea what the problem might be, but i ran a backtest last night after the markets closed on a 144T chart and i printed out the results of the backtest. this morning i ran the same backtest yet somehow the results are different, the number of trades that occured yesterday, the net profit for yesterday, everything. could anyone please explain what could be going on here?
Announcement
Collapse
No announcement yet.
inaccurate backtests
Collapse
X
-
kalzenith,
If the strategy efs did not change between backtest runs, then most likely the historical data was not identical.
You would have to insure the time template you are using is the same for both runs.
In the future if you post the strategy efs code then there is a greater chance that someone can offer asssistance.
GlenGlen Demarco
[email protected]
-
the time template is exact, i never change it, but here is the code, i apologize for it being uncommented, if you need help understanding something, just ask. (PS: i used the old way to use MACD because i wanted it to calculate using simple moving averages, not exponential)
PHP Code:var LastEntry = 0;
var StudyCount = 2;
var v1 = 0;
var v2 = 0;
var v3 = 0;
var v4 = 0;
var v5 = 0;
var vMACD115_116_39 = new MACDStudy(115, 116, 39, 'Close', true);
function main() {
setColorPriceBars(true);
setPriceStudy(false);
setStudyTitle('Formula Finder 1.2');
setCursorLabelName('Formula Finder', 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
setDefaultBarThickness(5, 0)
if (vMACD115_116_39.getValue(MACDStudy.HIST) > 0) v1 = 1
if (vMACD115_116_39.getValue(MACDStudy.HIST) < 0) v1 = -1
if (sma(84) < close()) v2 = 1
if (sma(84) > close()) v2 = -1
if(v1 + v2 + v3 + v4 + v5 == StudyCount && Strategy.isLong() == false) {
Strategy.doLong('', Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0)
}
if(v1 + v2 + v3 + v4 + v5 == StudyCount*-1 && Strategy.isShort() == false) {
Strategy.doShort('', Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0)
}
setPriceBarColor(Color.RGB(128, 128, 128))
if (Strategy.isShort() == true) setPriceBarColor(Color.RGB(255,0,0))
if (Strategy.isLong() == true) setPriceBarColor(Color.RGB(0,255,0))
setBarBgColor(Color.RGB(128, 128, 128))
if (Strategy.isShort() == true) setBarBgColor(Color.RGB(255,0,0))
if (Strategy.isLong() == true) setBarBgColor(Color.RGB(0,255,0))
return v1 + v2 + v3 + v4 + v5
}
Comment
-
kalzenith,
The code looks straight forward enoug, no problem with the comments at all, the code is easy to read.
What symbol and time interval did you experience the differing backtesting results?
Can you post the the time templates parameters?
If you still have the differing back tester reports check the report "settings" tab and see if the time span is identical for both, along with the other settings.
It's possible that you received a bad price that may have been corrected.
If that doesn't do it, you can email me at [email protected] as there are a few other possibilities that we can talk about after the close on the phone as things are getting too busy I won't be on the forum again today.
GlenGlen Demarco
[email protected]
Comment
-
the discrepency occurred on QQQQ with an interval of 144T with the default 24 hour time template (0 days, start time 0:00, end time 0:00) i unfortunately didnt print out the settings page last night, but i can be relatively certain it is the same since i didnt change anything myself. i would like to think that there was just one bad tick that has been corrected, but this is the second time it has happened to me on 2 different EFS studies. the first time being over this past weekend
Comment
Comment