MQL Trendline EA
MQL Trendline EA
$
0
Summary
This EA will trade semi-automatically based on trend lines or horizontal lines that are manually plotted on the chart by the user.
It can handle any number of lines per chart and each line can have its own adjustable settings. This EA manages every line separately based on specific user 'keywords' set for each line.
Since each line has it's own independent settings, this is why there are very few shared inputs in this EA. Doing it this way allows for a single EA to manage many lines and combinations of settings at the same time.
This makes the EA more user-friendly.
Inputs
- See_Example_Lines - If true, the EA will draw 2 example lines on the chart to help you understand how to set the keywords for lines.
You can drag the lines to where you want to see them trade, change their keywords, or even delete them and draw your own lines. They are merely example lines. Example lines will automatically be set in backtesting mode too, even if this input is false.
- The EA has all standard inputs that should be self-explanatory, such as Magic Number, max. slippage, and so on. Main EA settings are controlled with 'keywords' and not standard EA inputs.
Keywords
As mentioned above in the summary, each line can have it's own adjustable settings.
These are controlled by set 'keywords' that the EA looks for. These keywords are entered into the 'name' field for each line. You can find and edit the name field for a trend line or horizontal line by highlighting the line by double clicking on it, then right clicking on the line, and then selecting either 'Horizontal Line properties' or 'Trendline properties'.
You should remove the default name assigned by MetaTrader and replace it with your keywords and any values. Some keywords are mandatory and some are optional. It depends on the situation.
Below is a list of the available keywords.
- TL
Format: TL=1, TL=2, TL=3, etc...
Necessity: Mandatory
Description: This keyword is what is used to assign a unique trend line number to each trend line. The EA will use this number to categorize and manage the lines separately. For example, if you have 10 lines on the chart and each have their own settings, then the EA will not get confused since each will have its own TL identifier. This TL is also used for the order comments. So, this will help in your own analysis as well.
- Trade
Format: Trade (by itself)
Necessity: Mandatory (if trading)
Description: This is the keyword to use if you want the EA to trade the trend line.
- Alert
Format: Alert (by itself)
Necessity: Mandatory (if alerting)
Description: This is the keyword to use if you want the EA to alert for the trend line. There are 4 types of alerts possible which are in the EA's inputs.
- Timer
Format: Timer=08:00-15:45 (hours:minutes-hours:minutes)
Necessity: Optional
Description: This represents the allowable time period that new trades can be opened and for alerts to occur.
Existing trades will not be closed out if the current time goes outside the timer limits. They would still close out normally.
Only new trades will not be made outside the allowed times. And new alerts will not occur outside the allowed times.
This input must be in a valid format in order to be used properly. Do not add any strange characters or spaces to the input string.
For example, 08.00, 0800, and 08 00 are not the same as 08:00. The timer is based on the broker's operating time as seen in the MetaTrader platform.
The timer is not based on GMT time or your PC's time. Both hours and minutes can be used in the timer.
- Lots
Format: Lots=0.10
Necessity: Mandatory (if trading)
Description: This is the keyword to use to set lot size of the trade. It is not used if trading is disabled.
- SL
Format: SL=10
Necessity: Optional
Description: This is the keyword to use to set the stop loss of the trade. This input is based in Points and not Pips.
This input is only used if the line will be traded. If trading and this keyword is not used, SL will simply be 0.
- TP
Format: TP=20
Necessity: Optional
Description: This is the keyword to use to set the take profit of the trade.
This input is based in Points and not Pips. This input is only used if the line will be traded. If trading and this keyword is not used, TP will simply be 0.
Keyword Examples
- Example 1
Let's say price is below a trend line and you expect price to go up, bounce off, and reverse down. You want to set a TP of 200 Points and a SL of 400 Points.
You could use this keyword string: "TL=1,Trade,Sell,Lots=0.25,TP=200,SL=400"
- Example 2
Let's say you see a market range and expect there to be a breakout once one of the horizontal lines is reached. You do not want a TP or SL.
You could use these two keyword strings: "TL=1,Trade,Buy,Lots=1.50" & "TL=2,Trade,Sell,Lots=1.50"
- Example 3
Let's say price is currently below a certain important level and you simply want to receive an alert once a certain price is reached, so you can place a buy order manually.
You could use this keyword string: "TL=1,Alert,Buy"
- Example 4
Let's say you want to trade a certain line but only after price has breached the line by 100 Points.
You could draw a parallel line above/below the important line you want to trade by 100 Points and use this as the actual trading line. Then you could use this parallel line and set this string: "TL=1,Trade,Buy,Lots=0.01"
Notes
- The keywords are NOT case sensitive. So, the keywords 'Trade', trade, and TRADE are recognized as the same.
- All alerts are standard MetaTrader alerts. Some of them will require you to input your details in the MetaTrader terminal in order for them to work.
- Screenshots are optional and meant to help with your records and analysis since they are taken before the lines are deleted. Screenshots are taken only when trading is done, but not when alerting only. They are saved in your platform's 'Files' folder. The file names are named by the order's ticket number.
- Keep in mind that once a trade or alert occurs, the EA will delete the line since it did its job already.
- This EA can be tested in the back tester in visual mode the same way as in live trading. Just draw your lines on the chart as normal.
- The lines can be adjusted or moved on the chart even during EA operation. You do NOT need to remove, pause, or reset the EA in order to adjust or move the lines.
- Keywords must be separated by a comma (",") but the order of keywords does not matter.
- DLL imports should be enabled for this EA to work.
- Source Code Available: If you would like the source code of this to make your own modifications or for other reasons, please contact us for the fee.
Forum
- The official forum to post your comments, questions, concerns, or bug reports about the MQL Trendline EA can be found at Forex Zone Forum.
Example
Download
- The current version is v1.30 released on June 05, 2024. Updates will be made based on customer feedback.
- This EA is FREE with no restrictions! Just use the link below to download instantly.
- Post your questions or feedback on the official MQL Trendline EA forum page.
- Please share this EA or buy some merch from our store to support our work!
|