I came across a weird occurrence where a print statement of mine (placed directly after my order entry statement, so as to generate the date and time of orders) was triggered in instances in which no trade showed up at that date and time on the backtest.
Such an occurrence was very rare given the number of times I ran this code over a large number of individual symbols, so I decided to investigate deeper by simply running the following print statement and nothing else to see how many lines of output would be generated for the minutes in which these mystery trades absent from the backtest occurred:
Code: Select all
if barstatus(2)<>2 and not(barstatus(1)=2 ) then #return;
Normally, each minute printed will have 3 entries, as my first data stream is of the 20-second interval and my second data stream is of the 1-minute interval, meaning that because there are 3 20-second bars in each 1 minute bar, there will therefore be 3 lines of identical output.
However, the minutes where these strange trades showed up in the output but not in the backtest, there were maybe 50 lines of identical output instead of the normal 3. I have no idea why this would be, as I examined that minute of data in QuoteManager, and nothing looked out of the ordinary.
Does anyone have any idea what could be causing this strange occurrence so that I can figure out what happened with these trades for myself?