I am currently running a test using the sample SMA Strategy with CalculateOnBarClose set to False.
It seems to work as expected, but I noticed something was not consisent with the expected behavior.
A CrossBelow was fire, and the system went short. This was expected. Then after a few bars, the current bar with the issue spiked up thus causing a CrossAbove and getting Long, but then after the bar closed, you can see that it did not really CrossAbove (the sma) and it left the trade Long when it should clearly be straight. Only after a stop loss did it get out of the trade.
So again, position was Short.
Some bars go by and the SMA is slowly creeping up with the fast catching up to the slow.
A during one of the later bars, a spike up happened, firing a CrossAbove IntraBar and the Closed Current Position, and put the system Long 1.
(all fine up until this point).
Now intrabar we also didn't hold that spike and the downtrend continued, the SMA is clearly inversed to the downside and we did not get put back short again, instead it left us long even though it clearly crossed back below intrabar (fast cut down through the slow).
Could you elaborate in regards to how this might occur and propose a solution to preventing it other than COBC = True?
Thank you in advance,
Comment