Subject changed from Inconsistent ExitAfter X Bars to MultiCharts sqx engine - Inconsistent ExitAfter X Bars
Status changed from New to Fixed
I have checked this issue. ExitAfterBars means the strategy will exit after n bars. However, there is a problem here.
For example, if the ExitAfterBars is 3 and this is the data we have
2022.12.12 1:00
2022.12.12 2:00
2022.12.12 4:00
2022.12.12 5:00
If the trade entered at 2022.12.12 1:00, it will exit at 2022.12.12 5:00. You can see the data for 2022.12.12 3:00 is missing.
If we calculate the time taken, it will be 4 hours instead of 3 hours.
Due to this function is ExitAfterBars, is not ExitAfterHours. I cannot update the function to detect the hours/bar hours instead of bars. This is because, in real life, it could be market closed down for few hours (missing few bars) which we couldn't detect it.
I hope I explained this well. Let me know if you have further question.
Thanks.