Posts: 3,664 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,359
|
SetExitOnClose only works in backtest, it will not work in live trading. Not the root problem, but something you should know.
Now, to your real issue, setexitonclose should work on backtest, but for the month you show, it is not.
I tried a few different things with different code:
buy next bar at market;
setexitonclose;
gives same result for May 2021 as your code (it closes trade the next month)
buy next bar at market;
sell this bar at close;
Worked just fine.
So, there appears to be some issue with setexitonclose.
I suggest you post your question at the Tradestation customer forum, in the Easy Language support section.
Just show this code as the simplest example
buy next bar at market;
setexitonclose;
and TS personnel will review it.
|