Currently, I have create a Long Market Order that invokes an ATM strategy. This ATM strategy has a set profit target and stop loss. The code is as follows.
NTClient.Command("PLACE", "Sim101", "$EURUSD", "BUY", 1, "MARKET", 0, 0, "GTC", "od1", "", "testATM", "");
My problem is, when I manually exit the position via my external application. In my application I send a ClosePosition command for the currency pair I have a position for. The code is as follows:
NTClient.Command("CLOSEPOSITION", "Sim101", "$EURUSD", "", 1, "MARKET", 0, 0, "GTC", "od1", "", "", "");
One way I was able to alleviate this error is by first canceling the target / stop with a CANCELALLORDERS command, Sleeping for 1.25 seconds, then commanding a CLOSEPOSITION command. The following code:
NTClient.Command("CANCELALLORDERS", "Sim101", "$EURUSD", "", 0, "MARKET", 0, 0, "GTC", "od1", "", "", ""); Sleep(1250); NTClient.Command("CLOSEPOSITION", "Sim101", "$EURUSD", "", 0, "MARKET", 0, 0, "GTC", "od1", "", "", "");
If you need anything from me let me know.
Thanks guys!
Comment