Hi,
I have an issue with improper order entry when using scalein. My program enters at the open and sells at the close. When I'm not scaling in, I have found that if I add setoption(settlement delay, 1), I can avoid improper trades where I had max positions at the beginning of the day and not have new trade entries if I sold something at end of day.
Now with scale-in, the setoption(settlement delay, 1) is not helping as the program is still entering new trades as long as there are funds available. So beginning of day I have max open position, 1 exits at end of day, the program still enters a new position at open that day.
I guess this is similar to the setoption(applystopimmediately, true/false) which controls order of signal processing.
Can I avoid the erroneous entries (when already at max open positions) or does this require something more complicated like custom backtest.