Hi all,
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?
Thank you!
Below you can see my code:
#include <profile.c>
vars Open, High, Low, Close, BarHeight;
var SignalEntry, SignalStop, SignalTakeprofit, Contract;
bool signal;
static var Time = 0;
function tick()
{
if(signal && !(TradeIsOpen))
{
enterLong((int)Contract,SignalEntry,SignalStop,SignalTakeprofit);
signal = false;
}
}
function run()
{
set(PLOTNOW);
if(is(INITRUN))
{
set(LOGFILE);
set(TICKS); // comment out when enter trade in run function
Time = timer();
StartDate = 20200101;
EndDate = 20201231;
StartMarket = 1330;
EndMarket = 2000;
setf(BarMode, BR_LEISURE);
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
asset("MNQ_2020_1sec");
}
Open = series(priceOpen());
High = series(priceHigh());
Low = series(priceLow());
Close = series(priceClose());
if (LongSignal)
{
plot("Bull k", (Low[0] - ATR10[0]*0.5), DOT|MAIN, BLUE);
SignalEntry = High[0]; // enter the trade on level of signal High
SignalStop = Low[0]; // stop on Low of the signal bar, ST is -1R
SignalTakeprofit = High[0] + BarHeight[0]; // 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
}
if (is(EXITRUN))
{
printf("\nTime needed: >>> %.3f sec <<<",(timer()-Time)/1000); // print time needed to complete the test
}
}