ExecuteMarketOrder symbol warning
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'
Replies
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
@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
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
Tj11
17 Mar 2020, 13:35
Is it possible to get rid of warning in code 1 ?
Thank you!
@Tj11