// Define the price for the buy stop order double buyStopPrice = NormalizeDouble(Tick.ask + Distance * _Point, _Digits); // Place a buy stop order trade.PositionOpen(_Symbol, ORDER_TYPE_BUY_STOP, InpLots, buyStopPrice, 0, sl, tp, TradeComment);
- ORDER_TYPE_BUY_STOP is used to specify a buy stop order.
- buyStopPrice is calculated based on the current ask price ( Tick.ask ) plus a specified distance ( Distance ) in points.
- NormalizeDouble is used to ensure the price is correctly formatted.
- The OrderSend function is replaced with trade.PositionOpen to open a buy stop order at the calculated price.
Good luck with your coding!

- www.mql5.com
To change the execution order to a buy stop order you need to modify the OrderSend function parameters accordingly.
- ORDER_TYPE_BUY_STOP is used to specify a buy stop order.
- buyStopPrice is calculated based on the current ask price ( Tick.ask ) plus a specified distance ( Distance ) in points.
- NormalizeDouble is used to ensure the price is correctly formatted.
- The OrderSend function is replaced with trade.PositionOpen to open a buy stop order at the calculated price.
Good luck with your coding!
Hello sir it is not work, I got many errors
Then learn to search, because there is practically nothing that has not already been programmed for MT4/MT5!
=> Search in the articles: https://www.mql5.com/en/articles
=> Search in the codebase: https://www.mql5.com/en/code
=> Search in general: https://www.mql5.com/en/search or via Google with: "site:mql5.com .." (forgives typos and variants)
BTW If you place the cursor on an MQL function and press F1, you will see the reference directly, many with examples to copy and paste - the fastest form to code!
Or you order you program here: https://www.mql5.com/en/job

You have only four choices:
-
Search for it (CodeBase or Market). Do you expect us to do your research for you?
- Try asking at:
- Coding help - MQL4 programming forum
- Requests & Ideas - MQL4 programming forum
- Make It No Repaint Please! - MQL4 programming forum
- MT4 to MT5 code converter - MQL5 programming forum
- Please fix this indicator or EA - General - MQL5 programming forum
- Requests & Ideas (MQL5 only!) - Expert Advisors and Automated Trading - MQL5 programming forum
- Indicator to EA Free Service - General - MQL5 programming forum
- I will write an advisor free of charge - Expert Advisors and Automated Trading - MQL5 programming forum
- I will write you an advisor for free - Trading Systems - MQL5 programming forum
- I will write the indicator for free - MQL4 programming forum
-
MT4: Learn to code it.
MT5: Begin learning to code it.If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
I need HEEEELP, please, it's URGENT...really ! - General - MQL5 programming forum (2017) -
Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2019)
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help (2017)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello friends please if anyone can help me i need to change this execution order to buy stop order.
trade.PositionOpen(_Symbol, RDER_TYPE_BUY,InpLots,last,Tick.ask,sl,tp,Tradecomment);