Get info if position has been closed by stop loss or take profit
Created at 24 Aug 2022, 21:07
Get info if position has been closed by stop loss or take profit
24 Aug 2022, 21:07
I have code that listens to all trading messages. I`m checking if given message is: PROTO_OA_EXECUTION_EVENT and order ClosingOrder and order type STOP_LOSS_TAKE_PROFIT. But I cannot find which of these 2 closed position. Was it by stop loss or take profit? I`m trying to use code:
var executionEvent = ProtoOAExecutionEvent.CreateBuilder().MergeFrom(msg.Payload).Build();
var byStopLoss = executionEvent.Order.HasStopLoss
var byTakeProfit = executionEvent.Order.HasTakeProfit
but they are always false.
PanagiotisCharalampous
25 Aug 2022, 08:59
Hi noob7,
Did you try checking executionEvent.Position.HasStopLoss and executionEvent.Position.HasTakeProfit?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous