CTrade Buy execution price vs. Buy Stop

 

Hello,

I have a trading system and so far I am using the CTrade buy function to open orders. Since the buy function is a market order it is executed immediately (as far as I understood) and thus the position can be opened away from the current price. To prevent this scenario, one can use a Buy Stop order placed slightly above the current price (we think the price will rise) and when the price hits the price specified the order is executed. I know it can happen, that limit orders are not executed at all in fast moving markets when the price basically jumps over your defined buy limit price. My question now is, I saw in the documentation of the buy market order that there is a parameter called "execution price" (double price) and I do not understand what this is used for? I mean if I enter a price here which is slightly above the current market price and the price hits this price level, is it then executed? If so, how is this different to the buy stop order? This is not clear to me. Thank you! 

 

hello, I just tested market order (without execution price) and limit order to compare each other:


double LP=SymbolInfoDouble(_Symbol,SYMBOL_LAST);
double LP_Limit=NormalizeDouble(LP+(LP*0.1/100),2);

CT.Buy(100);
CT.BuyStop(100,LP_Limit);

Print("LP: ", LP);
Print("LP_Limit: ", LP_Limit);

2023.04.27 10:41:07.974 exchange buy 100 DIS at 97.88 (97.86 / 97.88 / 97.87)
2023.04.27 10:41:07.974 deal #2 buy 100 DIS at 97.88 done (based on order #2)
2023.04.27 10:41:07.974 deal performed [#2 buy 100 DIS at 97.88]
2023.04.27 10:41:07.974 order performed buy 100 at 97.88 [#2 buy 100 DIS at 97.88]
2023.04.27 10:41:07.990 CTrade::OrderSend: exchange buy 100.00 DIS [done]
2023.04.27 10:41:08.037 buy stop 100 DIS at 97.97 (97.86 / 97.89 / 97.87)
2023.04.27 10:41:08.052 CTrade::OrderSend: buy stop 100.00 DIS at 97.97 [done]
2023.04.27 10:41:08.052 LP: 97.87
2023.04.27 10:41:08.052 LP_Limit: 97.97
2023.04.27 10:42:07.879 order [#3 buy stop 100 DIS at 97.97] triggered
2023.04.27 10:42:07.879 deal #3 buy 100 DIS at 98.00 done (based on order #3)
2023.04.27 10:42:07.879 deal performed [#3 buy 100 DIS at 98.00]
2023.04.27 10:42:07.879 order performed buy 100 at 98.00 [#3 buy stop 100 DIS at 97.97]

The last price before execution of the orders was 97.87 and the market order was executed at 97.88.

For the limit order I set a price 0.1% above the current last price of 97.87 which is LP_Limit: 97.97. However, this order is then executed at a price of 98.00 instead of 97.97. I thought that this is exactl the advantage of a limit order that the order is only executed and a position opened, when the specified price is guaranteed?

 
If the price of a pending order is triggered this order becomes a market order which can cause huge gaps in fast markets.
 
Hi Carl, are you saying that the CT.Buy function with execution price is such a pending order?
 
eatrader1231231231231233r5235134:

Hello,

I have a trading system and so far I am using the CTrade buy function to open orders. Since the buy function is a market order it is executed immediately (as far as I understood) and thus the position can be opened away from the current price. To prevent this scenario, one can use a Buy Stop order placed slightly above the current price (we think the price will rise) and when the price hits the price specified the order is executed. I know it can happen, that limit orders are not executed at all in fast moving markets when the price basically jumps over your defined buy limit price. My question now is, I saw in the documentation of the buy market order that there is a parameter called "execution price" (double price) and I do not understand what this is used for? I mean if I enter a price here which is slightly above the current market price and the price hits this price level, is it then executed? If so, how is this different to the buy stop order? This is not clear to me. Thank you! 

A buy stop is not a limit order. It will not help you with slippage.

Use real limit order.

See this article to understand how it works https://www.mql5.com/en/articles/1683

How to Secure Your Expert Advisor While Trading on the Moscow Exchange
How to Secure Your Expert Advisor While Trading on the Moscow Exchange
  • www.mql5.com
The article delves into the trading methods ensuring the security of trading operations at the stock and low-liquidity markets through the example of Moscow Exchange's Derivatives Market. It brings practical approach to the trading theory described in the article "Principles of Exchange Pricing through the Example of Moscow Exchange's Derivatives Market".
 

Even stop loss are pending orders that become a market order (to close the open position) in case the SL price is triggered.

That was one of the reason for the disaster for many when the Swiss Central Bank stopped their program to support the Swiss Frank:


Another problem in such situations is that the broker (liquidity provider) stop putting prices. So the trades placed their SL just below 1.20 and were stopped out at 1,04.