How to handle Robot restart

Created at 07 May 2013, 12:38
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!
HI

hichem

Joined 17.12.2012

How to handle Robot restart
07 May 2013, 12:38


Hello Support,  This is possibly a bug.

If a robot creates some pending orders then it gets stopped without canceling his pending  orders.

Then it gets restarted, when the pending orders he created previously gets opened the  OnPositionOpened doesn't get called.

How can one handle resumling a robot after being stopped without loosing control over his positions?

 


@hichem
Replies

cAlgo_Fanatic
07 May 2013, 16:17

You can use Labels for this. Use the OnTick event to check for the positions with the label set when the order was created. Please see the examples here.


@cAlgo_Fanatic

hichem
07 May 2013, 16:24

RE:
cAlgo_Fanatic said:

You can use Labels for this. Use the OnTick event to check for the positions with the label set when the order was created. Please see the examples here.

That solve how to retrieve the previously created pendingOrders (by label). If those PendingOrders get opened, when their PriceLevel hit, the OnPositionOpened dosn't get called. How to know if a pending order has been opened ?


@hichem

cAlgo_Fanatic
07 May 2013, 16:35

If the label of the position is the same as the label of the pending order it means the pending order was filled.


@cAlgo_Fanatic

hichem
07 May 2013, 16:38

RE:
cAlgo_Fanatic said:

If the label of the position is the same as the label of the pending order it means the pending order was filled.

Ok thanks.


@hichem