Stop loss and Profit target disappearing
Posted: Oct 17 2011
I have a strategy which places an order using the code below. When the code executes the stop loss and profit target are placed on IB, but after 1 to 2 minutes they disappear but the position stays open.
Is there something that I'm doing wrong?
Is there something that I'm doing wrong?
Code: Select all
if MarketPosition = 0 then begin
print ("MarketPosition = 0");
print (OrderText);
if OrderText = "SELL" then begin
print ("SELL LIMIT SHORT");
SellShort ("Sell1") 1 Contracts Next Bar At (OrderEntryPrice) Limit;
SetProfitTarget(500);
Setbreakeven(60);
SetStopLoss(100);
print ("SELL LIMIT SHORT EXECUTED");
end;
if OrderText = "BUY" then begin
print ("BUY LIMIT LONG");
Buy("Buy1") 1 Contracts Next Bar At (OrderEntryPrice) Limit;
SetProfitTarget(500);
Setbreakeven(60);
SetStopLoss(100);
print ("BUY LIMIT LONG EXECUTED");
end;
end;