I am using MultiCharts as my platform and Rithmic as my broker. Currently I am having issues of duplicate stoploss orders being placed when shutting down my automated strategy on Friday afternoon and restarting it on Sunday evening when holding a position over the weekend. I have two options when shutting down a strategy.
Cancel Stoploss on shutdown:
If I do this then I do not have the duplicate stoploss order when the market starts trading on 830 Monday morning but I am without a stoploss from Sunday afternoon until Monday 830. I do not like this because my positions are without a stoploss for about 16 hours.
DO NOT Cancel Stoploss on shutdown:
If I do not cancel stoploss on shutdown I will have my stoploss when Globex open on Sunday afternoon but when the market open on Monday morning at 830 then I get a duplicate stoploss order.
Is there any way, within my strategy code, to make a stoploss conditional within a strategy to look to see if the strategy is in a position and if it is then see if it has a stoploss and it if does do not send stoploss order and if it does not then send stoploss order.
Has anybody come across this problem and come up with a solution.