Problem when use PlaceStopOrderAsync and ClosePositionAsync

Created at 12 Aug 2018, 09:12
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!
NG

nguyenbaocuong

Joined 16.09.2017

Problem when use PlaceStopOrderAsync and ClosePositionAsync
12 Aug 2018, 09:12


Dear cTrader,

My robot use use PlaceStopOrderAsync and ClosePositionAsync to place orders and close positions when coditions met.

I notice that the time that these command run between live trade and back tect are difference. If in back test, the command for all orders or all positions opened or closed will be issued in same time, but in live trade, it's not same

For back test:

20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,32151)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32438)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,32121)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32468)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,32091)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32498)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,32061)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32528)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,32031)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32558)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,32001)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32588)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31971)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32618)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31941)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32648)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31911)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32678)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31881)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32708)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31851)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32738)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31821)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32768)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31791)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32798)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31761)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32828)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31731)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32858)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31701)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32888)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31671)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32918)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31641)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32948)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31611)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,32978)
20/07/2018 19:29:27.255 | Placing Stop Order to Sell 41000 USDCAD (Price: 1,31581)
20/07/2018 19:29:27.255 | Placing Stop Order to Buy 41000 USDCAD (Price: 1,33008)
20/07/2018 19:30:04.372 | Closing position PID4
20/07/2018 19:30:04.372 | Closing position PID8
20/07/2018 19:30:04.372 | Closing position PID12
20/07/2018 19:30:04.372 | Closing position PID16
20/07/2018 19:30:04.372 | Closing position PID84
20/07/2018 19:30:04.372 | Closing position PID88
20/07/2018 19:30:04.372 | Closing position PID92
20/07/2018 19:30:04.372 | Closing position PID96
20/07/2018 19:30:04.372 | Closing position PID100
20/07/2018 19:30:04.372 | Closing position PID104
20/07/2018 19:30:04.372 | Closing position PID108
20/07/2018 19:30:04.372 | Closing position PID112
20/07/2018 19:30:04.372 | Closing position PID116
20/07/2018 19:30:04.372 | Closing position PID120
20/07/2018 19:30:04.372 | Closing position PID20
20/07/2018 19:30:04.372 | Closing position PID24
20/07/2018 19:30:04.372 | Closing position PID28
20/07/2018 19:30:04.372 | Closing position PID32
20/07/2018 19:30:04.372 | Closing position PID36
20/07/2018 19:30:04.372 | Closing position PID40
20/07/2018 19:30:04.372 | Closing position PID44
20/07/2018 19:30:04.372 | Closing position PID48
20/07/2018 19:30:04.372 | Closing position PID52
20/07/2018 19:30:04.372 | Closing position PID56
20/07/2018 19:30:04.372 | Closing position PID60
20/07/2018 19:30:04.372 | Closing position PID64
20/07/2018 19:30:04.372 | Closing position PID68
20/07/2018 19:30:04.372 | Closing position PID72
20/07/2018 19:30:04.372 | Closing position PID76

 

For live trade:

20/07/2018 19:29:27.013 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,32140)
20/07/2018 19:29:27.013 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32445)
20/07/2018 19:29:27.013 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,32100)
20/07/2018 19:29:27.013 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32485)
20/07/2018 19:29:27.013 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,32060)
20/07/2018 19:29:27.013 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32525)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,32020)
20/07/2018 19:29:27.029 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32565)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31980)
20/07/2018 19:29:27.029 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32605)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31940)
20/07/2018 19:29:27.029 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32645)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31900)
20/07/2018 19:29:27.029 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32685)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31860)
20/07/2018 19:29:27.029 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32725)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31820)
20/07/2018 19:29:27.029 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32765)
20/07/2018 19:29:27.029 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31780)
20/07/2018 19:29:27.060 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32805)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31740)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32845)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31700)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32885)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31660)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32925)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31620)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,32965)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31580)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,33005)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31540)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,33045)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31500)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,33085)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31460)
20/07/2018 19:29:27.076 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,33125)
20/07/2018 19:29:27.076 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31420)
20/07/2018 19:29:27.091 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,33165)
20/07/2018 19:29:27.091 | Placing Stop Order to Sell 3000 USDCAD (Price: 1,31380)
20/07/2018 19:29:27.091 | Placing Stop Order to Buy 3000 USDCAD (Price: 1,33205)
20/07/2018 19:30:04.453 | Closing position PID16702410
20/07/2018 19:30:04.453 | Closing position PID16702412
20/07/2018 19:30:04.453 | Closing position PID16702408
20/07/2018 19:30:04.453 | Closing position PID16702461
20/07/2018 19:30:04.469 | Closing position PID16702459
20/07/2018 19:30:04.469 | Closing position PID16702463
20/07/2018 19:30:04.485 | Closing position PID16702434
20/07/2018 19:30:04.500 | Closing position PID16702432

I have 2 questions:

1. Why PlaceStopOrderAsync and ClosePositionAsync NOT issued command same time in live trade? Does cTrader prevent  robot open or close too many positions in one time?

2. Beside PlaceStopOrderAsync and ClosePositionAsync, have another method that has same problem?

Thanks!


@nguyenbaocuong
Replies

PanagiotisCharalampous
13 Aug 2018, 10:04

Hi nguyenbaocuong,

Time difference between placing orders is natural and expected as there is processing time involved. You cannot expect instant order placement in a live environment. Backtesting is just a simulation, there is no trading taking place, there is communication with the server, neither time progression can be simulated in millisecond accuracy, therefore processing time might not be represented accurately. 

Best Regards,

Panagiotis


@PanagiotisCharalampous