Line Order Management Expert Advisor
Info
The Line Order Management Expert Advisor is a Expert Advisor for MetaTrader 4 that introduction:this expert advisor (ea) facilitates quick and easy order management using horizontal lines. It utilizes the object description to store variables such as stop losses and lot sizes.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Experts folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use Line Order Management Expert Advisor
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
Introduction:This Expert Advisor (EA) facilitates quick and easy order management using horizontal lines.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 4. Place the file in the MQL4/Experts folder and restart the terminal.
Description & Settings
Related: E-Close by Time: Automated Position and Order Management - another powerful expert for MetaTrader 4 traders.
Introduction:Also recommended: Trade from Lines (e-tfl) - Advanced Line Trading Expert Advisor - similar expert with strong performance on MetaTrader 4.
This Expert Advisor (EA) facilitates quick and easy order management using horizontal lines.It utilizes the object description to store variables such as stop losses and lot sizes.
External Variables:
lo_prefix = The prefix string the EA looks for in object names. Default is "#".
lo_order_clr = Color of the open price line for trades.
lo_order_style = Line style for the order price. (0 = Solid, 1 = Dash, 2 = Dash Dot).
lo_stoploss_clr = Color of the stop loss line.
lo_takeprofit_clr = Color of the take profit line.
lo_stoploss_style = Line style for the stop loss.
lo_takeprofit_style = Line style for the take profit.
lo_lots = Default trade lot size. If no value is entered in the line's description, this value is used.
lo_stoploss = Default stop loss in pips. For 5-digit brokers, decimals are allowed (e.g., 20.5).
lo_pipprofit = Default take profit in pips. For 5-digit brokers, decimals are allowed (e.g., 20.5).
lo_piptrail = Default trailing stop in pips. A value of 0 disables trailing stops.
lo_alarm = Activates an alert when no trade is open. (Functionality requires testing).
magic_number = The magic number associated with orders placed by the EA.
lo_ecn = Set to 1 if trading with an ECN broker. The EA will initially send orders without stop loss or take profit, then modify them immediately.
Line Variables:
Use the following in the object name box (using the default lo_prefix of "#"):
#buy = Creates a market buy order with defined stop loss and take profit levels.
#sell = Creates a market sell order with defined stop loss and take profit levels.
#buypend = Creates a buy pending order at the current value of the horizontal line. The EA determines the pending order type.
#sellpend = Creates a sell pending order at the current value of the horizontal line. The EA determines the pending order type.
Use the following in the object description box (without quotes):
"sl=" = Stop loss in pips.
"sq=" = Stop loss as quote currency value.
"tp=" = Take profit in pips.
"tq=" = Take profit as quote currency value.
"lo=" = Lot size for the order. (To be implemented: handle closing correct lot amount when changing after order open).
"ts=" = Trailing stop in pips.
"alarm=" = Set alarm.
Order Modification:
After an order is opened, three horizontal lines will be created: one for the open price, one for the stop loss level, and one for the take profit level.
Moving these lines will modify the stop loss, take profit, and (for pending orders) the open price.
After modifying your order, the EA will update the description of the main line (named "#" + ticket number) with the new stop loss and take profit values.
You can also modify these values directly in the description, and they will update on the next tick.
To-Do List:
Test alarm functionality.
Add OCO (One-Cancels-the-Other) orders.
Support multiple lines for take profit and stop loss.
Allow setting exit orders at indicator values (e.g., SMAs).
Thank you to Erich Pribitzer for the inspiration; this EA was developed loosely based on a similar tool found on this forum. The core functionality was a feature I had wanted to implement for some time.
I hope this EA proves beneficial for your trading. Please report any issues or suggest potential features for future enhancements.
You may also like: exaccount: visualize order activity on chart - excellent alternative for expert users on MetaTrader 4.
Source Code
#property copyright "robotfx"
#include <stderror.mqh>
#include <stdlib.mqh>
extern string lo_prefix="#";
extern color lo_order_clr=gray;
extern int lo_order_style=style_dash;
extern color lo_stoploss_clr=red;
extern int lo_stoploss_style=style_dashdot;
extern color lo_takeprofit_clr=green;
extern int lo_takeprofit_style=style_dashdot;
.......
⚠ 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.