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' for each line.
It does not apply the same EA settings to each line the same way. This is why there are very few inputs in this EA. This allows for a single EA on a single chart that can manage many lines and settings at the same time.
This makes the EA more user-friendly.
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 by standard EA inputs.
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.
Format: TL=1, TL=2, TL=3, etc...
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.
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.
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.
Format: Timer=08:00-15:45 (hours:minutes-hours:minutes)
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.
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.
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.
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.
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"
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"
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"
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"
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.
The official forum to post your comments, questions, concerns, or bug reports about the MQL Trendline EA can be found at Forex Zone Forum.
The current version is v1.20. Updates will be made based on customer feedback.
This EA is FREE with no restrictions! Just use the link below to download instantly.