Is there any way to detect existing/pending Sell Stop and BuyToCover stop orders?
For example, let's say a signal executed this:
Code: Select all
if (MarketPosition(0) = -1) and eventBreakevenCoverTrigger then begin
BuyToCover ("BreakEven Stop") next bar at EntryPrice STOP;
end;
Is there any way that I can detect the existence of ANY stop loss order inside the same strategy (preferably in another signal)? What I mean by the distinction "ANY stop loss order" is that I do not need to detect the specific order itself. I just want to find out if any stop loss exists.
To illustrate the use case, let's say I wanted to put the above code in the strategy to enforce breakeven covers in certain situations. Then, as the last signal in the strategy, I want to enforce a stop loss value if no other stop loss order exists, so I write a simple signal:
Code: Select all
inputs:
inputDefaultStopLoss (20);
variables:
conditionStopOrderExists (False),
pipsOnePipBroker (MinMove/PriceScale * 10);
conditionStopOrderExists= *** [This is what I do not know how to do] ***
if MarketPosition(0) = -1 and conditionStopOrderExists=False then begin
BuyToCover ("Default Stop") next bar at EntryPrice + (pipsOnePipBroker * inputInitialStopLoss) STOP;
end;