Possible bug with ExecuteMarketOrder(...)?

Created at 04 Jan 2025, 20:19
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!
RI

rick2010

Joined 08.08.2024

Possible bug with ExecuteMarketOrder(...)?
04 Jan 2025, 20:19


When using ExecuteMarketOrder(…) and setting the stop and limit to a value of 100 the resulting opened market order has a limit value of only 10 and the stop doesn't load perhaps because 10 is too close to market. 

Stop and limit should be 100 from entry price so could this be a bug? 

Here is the code I am using…

double stop = 100; double limit = 100;

Print("sending market order " + type + " " + symbol.Name + " volume: " + volume + " stop: " + stop + " limit: " + limit);
TradeResult result = ExecuteMarketOrder(type, symbol.Name, volume, “”, stop, limit);

Algo output…

04-01-2025 19:39:20.483 | Info | sending market order Buy BTCUSD volume: 0.01 stop: 100 limit: 100
04-01-2025 19:39:20.498 | Trade | Executing Market Order to Buy 0.01 BTCUSD (SL: 100, TP: 100)
04-01-2025 19:39:21.014 | Trade | → Executing Market Order to Buy 0.01 BTCUSD (SL: 100, TP: 100) SUCCEEDED, Position PID111340582
 

Here is a pic of the position in cTrader…

 

One thing I noticed is that BTCUSD has a tick size of: 0.001… but shouldn't it be a tick size of: 0.01 … could it be the reason why 100 is calculated into 10?


@rick2010
Replies

firemyst
05 Jan 2025, 10:17 ( Updated at: 06 Jan 2025, 00:07 )

Each broker can set the size of a pip.

So yes, what you've shown in the size and number of decimals would have something to do with it.

Other people who are affected are those that trade indices. For instance, Pepperstone's pip size  on NAS/Dow/Dax is 0.1 points whereas other brokers like Fusion Markets have a pip size is 0.01 points. So 100 pips on Fusion Markets on the NAS is 10 pips for anyone using Pepperstone's platform to trade NAS.

 


@firemyst

rick2010
07 Jan 2025, 21:07

RE: Possible bug with ExecuteMarketOrder(...)?

firemyst said: 

Each broker can set the size of a pip.

Ok thanks for clarifying.


@rick2010