ExecuteMarketOrder symbol warning

Created at 17 Mar 2020, 13:33
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!
TJ

Tj11

Joined 24.10.2019

ExecuteMarketOrder symbol warning
17 Mar 2020, 13:33


Dear Panagiotis,

Am I missing something with ExecuteMarketOrder :

1. code :  var result = ExecuteMarketOrder(TradeType.Buy, Symbol, 1000, "label", 0, 0, Slippage, "comment", false, StopTriggerMethod.Trade);

results in warning :  Error CS0618: 'cAlgo.API.Robot.ExecuteMarketOrder(cAlgo.API.TradeType, cAlgo.API.Internals.Symbol, double, string, double?, double?, double?, string, bool, cAlgo.API.StopTriggerMethod?)' is obsolete: 'Parameter 'Symbol symbol' was replaced with 'string symbolName'. More details here https://ctrader.com/forum/whats-new/#ToBeReplace'

 

2. code :   var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 1000, "label", 0, 0, Slippage, "comment", false, StopTriggerMethod.Trade);

results in error :   Error CS1502: The best overloaded method match for 'cAlgo.API.Robot.ExecuteMarketOrder(cAlgo.API.TradeType, cAlgo.API.Internals.Symbol, double, string, double?, double?, double?, string, bool, cAlgo.API.StopTriggerMethod?)' has some invalid arguments

Error CS1503: Argument 2: cannot convert from 'string' to 'cAlgo.API.Internals.Symbol'


@Tj11
Replies

Tj11
17 Mar 2020, 13:35

Is it possible to get rid of warning in code 1 ?

Thank you!


@Tj11

PanagiotisCharalampous
17 Mar 2020, 13:55

Hi Tj11,

When typing a method in cTrader code editor or Visual Studio, Intellisense will tell you which paramerers are required

 

You need to remove the Slippage parameter. If you need a market range order, use ExecuteMarketRangeOrder() method.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

Tj11
17 Mar 2020, 14:42 ( Updated at: 21 Dec 2023, 09:21 )

RE:

PanagiotisCharalampous said:

Hi Tj11,

When typing a method in cTrader code editor or Visual Studio, Intellisense will tell you which paramerers are required

You need to remove the Slippage parameter. If you need a market range order, use ExecuteMarketRangeOrder() method.

Best Regards,

Panagiotis 

Join us on Telegram

 

 

Dear Panagiotis,

Thank you a lot for fast and kind answer, it worked well.

.

As a side note, ExecuteMarketRangeOrder could be added here : https://help.ctrader.com/ctrader-automate/guides/trading_api .

.

Thanks a lot again !!!


@Tj11