Supposing to have set on the intrabar order Generation, I'm doing back testing on 5-min bar.
The current bar has the following values: O=8, L=5, H=15, C=12.
The strategy contains the following code:
if (close > =10) the buy this bar;
I would expect the order filled at 10, since when the condition is true, the close is almost equal to 10, instead of is filled at 12 ie the close value of bar. This behaviour could make sense if was not enabled the intrabar order generation, please could you explain the logic of intrabar order backtesting ?
Regards,
Understanding intrabar order backtesting
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Danilo,
I discussed the issue you're reporting with Andrew Kirillov. He misunderstood your question and the situation that you're describing is not a bug, but a normal backtesting behavior in both MultiCharts and TS.
In your case, if you wanted an order to be generated at the price of 10, you should have written
------------------------
buy next bar at 10 stop;
------------------------
The code would have generated the required order even without the IOG mode enabled.
OR
with the IOG mode enabled, you could have written
-----------------------
buy next bar at market;
-----------------------
But given the prices you cited, this condition wouldn't have been met.
Note: Buy this bar; is generated on bar CLOSE (both in MC and TS)
Regards.
I discussed the issue you're reporting with Andrew Kirillov. He misunderstood your question and the situation that you're describing is not a bug, but a normal backtesting behavior in both MultiCharts and TS.
In your case, if you wanted an order to be generated at the price of 10, you should have written
------------------------
buy next bar at 10 stop;
------------------------
The code would have generated the required order even without the IOG mode enabled.
OR
with the IOG mode enabled, you could have written
-----------------------
buy next bar at market;
-----------------------
But given the prices you cited, this condition wouldn't have been met.
Note: Buy this bar; is generated on bar CLOSE (both in MC and TS)
Regards.