Modifying grammar doubt

Created at 20 Dec 2024, 08:57
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!
91

910247359

Joined 19.12.2021

Modifying grammar doubt
20 Dec 2024, 08:57


Hi,

public abstract TradeResult ModifyStopLossPrice(double? stopLoss)

In the new version, is this statement for modifying orders executed in asynchronous mode? If not, how should I write it to execute in asynchronous mode?because I have lots of orders to be modified at the same time,thank you!


@910247359
Replies

firemyst
23 Dec 2024, 01:01

No, because the API documentation clearly states, “Shortcut for Robot.ModifyPosition method to change the Stop Loss.” and “ModifyPosition” is not asynchronous.

Also, all their current API calls that work asynchronously are labelled as being asynchronous, such as “ModifyPositionAsync” and “ModifyPendingOrderAsync”.

 

If you need/want to modify the stop loss asynchronously, you'll probably want to use “ModifyPositionAsync”. Yes, that means you're going to have to provide all the required parameters, which you should be able to gather most of the information from your current position. 

Ex:

var position = Positions.Find("myLabel", Symbol, TradeType.Buy);

if (position != null)
    ModifyPositionAsync(position, position.StopLoss.GetValueOrDefault() + (Symbol.PipSize * 10), position.TakeProfit); 

@firemyst