ModifyPendingOrder() Problem

Created at 17 May 2018, 16:15
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!
12

1222Ht

Joined 11.11.2017

ModifyPendingOrder() Problem
17 May 2018, 16:15


Hi , Thank you for reading my quesiton 

At the moment i have

OnTick() 

{

              PendingOrders.Created += OnPendingOrdersCreated;

}

to   ModifyPendingOrder()  when a pending order is created which changes its stoploss , takeprofit etc. 

However, a problem is this method causes 10+ modification on one pending order i believe which as a result makes the Notifications pop up 10+ times for that one order . and that takes out from top right of my screen to bottom right. 10 + pop out displaying the same message . 

Is it my pcs problem .

 

Many Thanks 

Henry


@1222Ht
Replies

PanagiotisCharalampous
17 May 2018, 16:42

Hi Henry,

Move this line of code in the OnStart() method. As it is, it subscribes again on every tick and that is why you are getting multiple executions.

Best Regards,

Panagiotis


@PanagiotisCharalampous

1222Ht
17 May 2018, 17:02

Panagiotis Thank you very much for your reply .

To my limited knowledge , OnStart() is only run once at the start of the cbot , would it mean that if i place another pending order e.g. 10 minutes later ,

without having to stop and start the cbot again , would this new second pending order be modified too .

Thank you very much

Henry

 


@1222Ht

PanagiotisCharalampous
17 May 2018, 17:09

Hi Henry,

OnPendingOrdersCreated will be executed after every order creation.

Best Regards,

Panagiotis

 


@PanagiotisCharalampous

1222Ht
17 May 2018, 17:11

I tried it out and it works thank you very much !!


@1222Ht