n Modify Orders
Info
The n Modify Orders is a Library for MetaTrader 5 that modify_orders. mqh is intended for managing positions and orders in MetaTrader 5 Purpose Modify_Orders.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Library works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Libraries folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use n Modify Orders
1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.
2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.
3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.
4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.
Frequently Asked Questions
Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.
Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.
Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.
What this tool does
Modify_Orders.
Typical Use Case
This Library excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Library works on MetaTrader 5. Place the file in the MQL5/Libraries folder and restart the terminal.
Description & Settings
Related: Functions to simplify work with orders - another powerful library for MetaTrader 5 traders.
Modify_Orders.mqh is intended for managing positions and orders in MetaTrader 5 PurposeAlso recommended: n Close Orders - similar library with strong performance on MetaTrader 5.
Modify_Orders.mqhprovides two powerful functions for managing open positions and pending orders in Expert Advisors and indicators on the MetaTrader 5 platform. It is designed to automate routine operations for modifying Stop Loss, Take Profit levels and order prices.
Main features:
Modification of Stop Loss and Take Profit
for open positions
Modification of
pending order
prices
Flexible filtering
by position types, profitability and symbols
Support for different modes of
value calculation (in pips or absolute prices).
Structure Modify_Position() function
Designed to modify Stop Loss and Take Profit levels of open positions.
Parameters of position filtering: Examples of use: Modify_Order() function
Designed to modify pending orders (Stop and Limit orders).
Supported order types:
"Buy Stop"
- pending Buy Stop order
"
Buy Limit"
- pending Buy Limit order.
"Sell
Stop"
- pending Sell Stop order.
"Sell
Limit"
- pending Sell Limit order.
Examples of use: Working principle Modify_Position algorithm:
Searching all open positions
in reverse order
Filtering of positions
by symbol and Magic Number
Checking additional conditions
( position type, profitability)
Calculation of new
SL/TP
values
:
For "Value" mode : Price ± (Value × Point)
For "Price" mode : direct value assignment
Sending the modification command
via OrderSend()
Modify_Order algorithm:
Enumerates all pending orders
Filtering by symbol, Magic Number and order type
Modification of the specified parameter
( price, SL or TP)
Saving unchanged parameters
Sending modification command Implementation features Safety and reliability:
Double check of order types
- by string parameter and real type from the system
Complex filtering
- ensures that only target positions/orders are affected
Preservation of unchanged parameters
- when SL is changed, TP is preserved and vice versa
Mathematical calculations:
For
Buy positions
:
Stop Loss: Current Price - (Value × Point)
Take Profit: Current price + (Value × Point)
For
Sell positions
:
Stop Loss: Current Price + (Value × Point)
Take Profit: Current Price - (Value × Point)
Recommendations for use For trading experts: For manual scripts: Optimal parameters:
Timeframe
: any (functions are independent of timeframe)
Instruments
: any currency pairs, metals, indices.
Magic Number
: it is recommended to use unique values for each Expert Advisor.
Library advantages
Versatility
- works with any trading instruments
Flexibility
- 18 different modes of position filtering
Ease of use
- intuitive interface
Reliability
- comprehensive checks before modification
Efficiency
- minimal expenditure of computing resources
You may also like: MT4 Orders - excellent alternative for library users on MetaTrader 5.
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.