how can i detect if a position close by stoploss or by takeprofits?

Created at 08 Apr 2014, 20:09
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Paulo_Lira's avatar

Paulo_Lira

Joined 12.02.2014

how can i detect if a position close by stoploss or by takeprofits?
08 Apr 2014, 20:09


that the question:

how can i detect if a position close by stoploss or by takeprofits?

i make this, but i not work so fine... any help?

 

private void OnPositionsClosed(PositionClosedEventArgs args)
{
    var closedPositionInfo = args.Position;
    
    if (lastposId == closedPositionInfo.Id) {
                
        if ((closedPositionInfo.StopLoss == Symbol.Bid) || (closedPositionInfo.StopLoss == Symbol.Ask)){
            Print ("last position closed by stoploss");
        } else if ((closedPositionInfo.TakeProfit == Symbol.Bid) || (closedPositionInfo.TakeProfit == Symbol.Ask)){
            Print ("last position closed by takeprofits");
        } else {
            Print ("we do not know why...");
        }
    
    }

    closedPositionInfo = null;
}

thanks for your help!!!


@Paulo_Lira
Replies

Spotware
09 Apr 2014, 11:07

It is not possible at the moment. You can post your feature request to vote.spotware.com.


@Spotware