get the updated data of a position
Created at 12 Aug 2024, 08:14
get the updated data of a position
12 Aug 2024, 08:14
Today the way to know if a positinon is closed is when Positions.Closed event is triggered. Unfortunately, the event is triggered late, after OnTick event which is the main event where the bot is running so the bot might act as if the position is still open while in fact it's closed which may cause wrong behavior.
I suggest that there will be a way/method that can be used from OnTick to get the updated data of a position.
More info can be found in the link below
cTrader Forum - How can I know when the stop loss is triggered
Thanks
cTrader Automate
@eynt
PanagiotisCharalampous
12 Aug 2024, 08:50
Hi eynt,
You need to understand how cTrader and trading works. The event is not triggered late. It's triggered as soon as the message arrives from the server. There will always be latency between the price closing the position and the execution of the order. You can't know that something happened before it happened.
Best regards,
Panagiotis
@PanagiotisCharalampous