I want to capture trade entry and exit into my script variable for future use.
I am able to do so using a strategy.position_size. The way I am doing this is -> when position size becomes 1, I assume that entry has happened and when it changes to 0 (from 1), exit has happened.
I came across a scenario during my backtesting wherein the entry and exit happens in the same bar and hence after the bar closing, the position_size is not impacted and still remains 0 (unchanged).
How can I capture this scenario?