I'm trying to backtest one signal just to get an information about accuracy of backtesting. For that I use 1 year of MNQ data, the bars in dataset have 1 second bar period (the dataset is in t6 format).
I ran two tests. In the first one I entered the trades in the run function, in the second I used tick function to enter the trades. As I understand from manual, when I have 1sec data and I use 1 minute bar period there will be 60 ticks, so Zorro will step into tick function 60 times during the completion of the run function. (I hope I didn't misunderstood that, please correct me if yes
The test is about place a trade with 10000USD, set up the Stop to -1R and the TP to +1R and check in the log how much of the trades are wrong. Wrong trades means they are out from the +9900 -> +10100 or -9900 -> -10100 zones.
1.4% of the trades are wrong In tests where I enter the trades in run function.
In case of using the tick function I get 13% wrong trades.
Am I missing something? I think this should be otherwise, when I use just the 1 minute bars (when enter trades in run function) I should get worst accuracy then with the tick function.
Does someone have statistics about the accuracy, and can give me a hint how can I reach the highest accuracy with tick mode?
Below you can see my code:
vars Open, High, Low, Close, BarHeight;
var SignalEntry, SignalStop, SignalTakeprofit, Contract;
static var Time = 0;
if(signal && !(TradeIsOpen))
signal = false;
set(TICKS); // comment out when enter trade in run function
Time = timer();
StartDate = 20200101;
EndDate = 20201231;
StartMarket = 1330;
EndMarket = 2000;
signal = false;
PlotScale = 8;
LookBack = 100;
ColorUp = 0x00BC0A;
ColorDn = 0xDE0505;
Slippage = 0;
Spread = 0;
PIP = 25./1;
PIPCost = 50./1;
BarPeriod = 1; //use 1min bars to test, get around 7000 signals in a year
Open = series(priceOpen());
High = series(priceHigh());
Low = series(priceLow());
Close = series(priceClose());
plot("Bull k", (Low - ATR10*0.5), DOT|MAIN, BLUE);
SignalEntry = High; // enter the trade on level of signal High
SignalStop = Low; // stop on Low of the signal bar, ST is -1R
SignalTakeprofit = High + BarHeight; // add the signal bar height to the signal bar, TP is +1R
Contract = 10000/((SignalEntry - SignalStop)*2); // calculate enough contracts to get the best accuracy
signal = true; // used when backtest with tick function
//enterLong((int)Contract,SignalEntry,SignalStop,SignalTakeprofit); // comment out when enter trade in tick function
printf("\nTime needed: >>> %.3f sec <<<",(timer()-Time)/1000); // print time needed to complete the test