Have some Problem on how to command program to use only once from either PositonOpenedEventArgs and PendingOrderFilledEventArgs

Created at 25 Nov 2020, 04:52
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!
IM

imrealfighter

Joined 09.11.2020

Have some Problem on how to command program to use only once from either PositonOpenedEventArgs and PendingOrderFilledEventArgs
25 Nov 2020, 04:52


Hello There 
I have some problem with how to command the cbot program to use just one way either from PositionOpenedEventArgs and PendingOrderFilledEventArgs when it about a limit or stop order get filled.

when limit or stop order gets filled it will invoke these two methods ( PositionOpenedEventArgs and PendingOrderFilledEventArgs )

 but I only want to use just one of them (PendingOrderFilledEventArgs) because it already has args.pendingOrder and args.Positon so I could transfers the data from pendingOrder to positon but when we run code I see that my information from pendingOrder doesn't move to postion and I think that because of I have PositionOpenedEventArgs too. 

 

so is it possible to select just PendingOrderFilledEventArgs to work while PositionOpenedEventArgs doesn't? 

Thank you. 


@imrealfighter
Replies

PanagiotisCharalampous
25 Nov 2020, 07:42

Hi imrealfighter,

It would be easier for us to understand what you need if you shared some code with us. For example, why do you replicate the code on both event handlers if you need it to be executed once?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

imrealfighter
28 Nov 2020, 03:23

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

It would be easier for us to understand what you need if you shared some code with us. For example, why do you replicate the code on both event handlers if you need it to be executed once?

Best Regards,

Panagiotis 

Join us on Telegram

PanagiotisCharalampous  like you've said I replicate the code so just delete PositionOpenedEventArgs  so it works ! 

Thank you. 


@imrealfighter