Chart Pattern Helper (Trades based on manually drawn chart patterns) | FREE Forex Trading EA
Introduction
Chart Pattern Helper EA is not a trading robot that trades automatically. It does not have a trading plan in place. This expert advisor’s sole objective is to execute trades using pending orders based on chart objects such as trend lines, horizontal lines, and equidistant channels. In addition to conventional breakout trade execution, this EA can also execute a pull-back trade if the breakout point is missed for some reason.
The main advantage of Chart Pattern Helper is its ability to set and adjust pending orders according to a range of graphical objects placed on the Forex chart, including objects with slope. This allows easy trade execution for such popular patterns as triangles (ascending, descending, and symmetrical), channels, flags and pennants, rectangles, head-and-shoulders, double tops/bottoms, etc.
Breakout of a level is defined as a simple touch. Chart Pattern Helper will not wait for a price to close above/below the given line. It will place pending orders that get executed whenever the price first touches the set levels.
There is a range of input parameters to regulate the work of this expert advisor, but it can start functioning immediately after you attach it to the chart and add the properly named chart objects. The chart objects may be moved freely then. The expert advisor will continue detecting their position and will adjust orders’ parameters accordingly. By default, the EA outputs its current status to the chart comment.
Since all the chart objects are drawn at Bid price, the EA adjusts the entry, stop-loss, and take-profit levels by adding the current spread value in cases when Ask price is to be used. This behavior can be disabled via the input parameters, decreasing the number of modification orders sent to trading server.
Chart Pattern Helper is capable of calculating the position size based on a set of input parameters, stop-loss level, and account balance/equity — much like the Position Size Calculator for MetaTrader. You may turn this feature off by setting a fixed position size to the EA.
Operation Process
This expert advisor goes through the following steps after initialization:
- Detect the objects according to names given via input parameters.
- Entry level for Buy order is placed at Entry object + spread (Ask).
- Entry level for Sell order is placed at Entry object (Bid).
- Stop-loss level for Buy order is placed at the Low of the latest bar with the majority of its length below Border object.
- Stop-loss level for Sell order is placed at the High of the latest bar with the majority of its length above Border object; the spread is then added to that High.
- If UseDistantSL is set to true, the two previous steps are ignored and the farthest point of the opposite line is used. This works only with horizontal and trend lines.
- Take-profit level for Buy order is placed at TP object (Bid).
- Take-profit level for Sell order is placed at TP object + spread (Ask).
- Calculated values are on a constant display via chart comment unless Silent input parameter is set to true.
- Pending orders are positioned according to these calculated values. If either Buy or Sell Entry object is absent, only one order is placed. Orders expire automatically when the current chart bar ends. In MT4, the minimum expiration time is 11 minutes; in MT5, it is 2 minutes.
- If the current price is below the Buy entry and above the Sell entry, pending stop orders are used. If the current price is either below the Sell entry or above the Buy entry, only one pending limit order is used.
- Track current object values and adjust entry, SL and TP levels accordingly.
- If position size calculation is used, order’s volume is updated when needed. In this case, the order with old volume is deleted and the order with new volume is created. Warning: Be advised that this may cause significant flow of pending orders, which may be against your broker’s terms of service. To prevent such behavior, you need to set UpdatePendingVolume input parameter to false.
- Expired orders are recreated with new volume (if needed) and updated entry/SL/TP levels.
- If one stop order is triggered, the second (opposite) order is deleted (unless OneCancelsOther input parameter is set to false). All objects are renamed by appending EA’s Magic number to their initial names. This prevents creation of new pending orders.
- If PostEntrySLAdjustment is set to true, try to update stop-loss when a new candle opens following the breakout.
- Continue updating position’s take-profit level according to TP object.
- Cease activity once the position is closed.
- Go to step one once the controlling chart objects are renamed back to their initial names.
Input Parameters
Objects
- UpperBorderLine (default = “UpperBorder”) — the name of the object (horizontal line or trend line) used to define the upper border of a breakout pattern. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- UpperEntryLine (default = “UpperEntry”) — the name of the object (horizontal line or trend line) used to define the Buy entry level of a breakout pattern. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- UpperTPLine (default = “UpperTP”) — the name of the object (horizontal line or trend line) used to define take-profit level of a Buy order. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- LowerBorderLine (default = “LowerBorder”) — the name of the object (horizontal line or trend line) used to define the lower border of a breakout pattern. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- LowerEntryLine (default = “LowerEntry”) — the name of the object (horizontal line or trend line) used to define the Sell entry level of a breakout pattern. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- LowerTPLine (default = “LowerTP”) — the name of the object (horizontal line or trend line) used to define take-profit level of a Sell order. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- BorderChannel (default = “Border”) — the name of the equidistant channel object used to define both upper and lower borders of a breakout pattern. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- EntryChannel (default = “Entry”) — the name of the equidistant channel object used to define both Buy and Sell entry levels. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
- TPChannel (default = “TP”) — the name of the equidistant channel object used to define both Buy and Sell take-profit levels. You can either name the object to the value of this parameter or change the parameter to fit the name you have used when created the chart object.
Order Management
- OneCancelsOther (default = true) — if true, a triggered pending order will cancel the opposite pending order. If false, the opposite order will remain intact and may trigger after the first position hits stop-loss or take-profit.
- UseSpreadAdjustment (default = true) — if true, spread will be added to Buy entry level and Sell SL/TP levels. It compensates the difference when Ask price is used, while all chart objects are drawn at Bid level. Setting it to false will reduce the flow of order modification requests to the broker’s trading server.
- UseExpiration (default = true) — if true, pending orders will expire at the end of the current bar or in 11 minutes (MT4) or 2 minutes (MT5) after creation — whatever is further. Setting it to false may be required if a broker does not support order expiration.
- DisableBuyOrders (default = false) — if true, new Buy orders will not be created, existing Buy orders and positions will be ignored.
- DisableSellOrders (default = false) — if true, new Sell orders will not be created, existing Sell orders and positions will be ignored.
- PostEntrySLAdjustment (default = false) — if true, the EA will try to adjust the stop-loss as a new candle opens after the breakout one. It will check whether the High/Low of the breakout candle still qualifies for SL. It may potentially break the position sizing rules but will define stop-loss more precisely according to the trading strategy’s exit rules.
- UseDistantSL (default = false) — if true, the EA will set the stop-loss to the farthest point of the opposite line. This feature is intended to be used only with triangles and wedges.
Position Sizing
- CalculatePositionSize (default = true) — if true, position size is calculated based on given risk tolerance, account size (balance or equity), account currency and traded currency pair. The calculation process is the same as in Position Size Calculator. If false, a fixed position size is used.
- UpdatePendingVolume (default = true) — if true, pending order’s volume is updated whenever new position size gets calculated. This may cause excessively high amount of orders to the trading server because it is not possible to modify order’s volume; instead, it has to be deleted and then created with a new volume. If false, order’s volume remains constant until expiration and following recreation. This parameter is ignored if CalculatePositionSize = false.
- FixedPositionSize (default = 0.01) — if CalculatePositionSize = false, the expert advisor will use the value of this parameter as a volume of created pending orders.
- Risk (default = 1) — risk tolerance in percentage of account balance/equity. Works only if CalculatePositionSize = true. This input parameter is ignored if UseMoneyInsteadOfPercentage is set to true.
- MoneyRisk (default = 0) — risk tolerance in account currency. Works only if CalculatePositionSize = true. Requires UseMoneyInsteadOfPercentage to be set to true.
- UseMoneyInsteadOfPercentage (default = false) — if true, position size is calculated based on risk amount given in account currency (MoneyRisk) instead of balance/equity percentage risk (Risk). Works only if CalculatePositionSize = true.
- UseEquityInsteadOfBalance (default = false) — if true, position size is calculated based on account equity instead of balance. Works only if CalculatePositionSize = true. Ignored if UseMoneyInsteadOfPercentage = true.
- FixedBalance (default = 0) — if set to non-zero value, it is used instead of account balance/equity for position size calculation. Works only if CalculatePositionSize = true.
- LotDigits (default = 2) — number of decimal places allowed by your broker in order volume. For example, if your broker allows micro lots (0.01), then this parameter should be set to 2. If your broker allows only mini lots (0.1) this parameter should be set to 1. Required only if CalculatePositionSize = true.
Miscellaneous
- Magic (default = 20130116) — number used by the expert advisor to distinguish own orders (MT4 and MT5) and positions (MT4 only). You may need to change it only if you have other EAs running with the same Magic number or if you wish to add two or more instances of Chart Pattern Helper to one currency pair.
- Slippage (default = 30) — maximum tolerable slippage in broker’s pips.
- Silent (default = false) — if true, no status information will be output to the chart comment. This come helpful if you use some indicator or other EA that modify chart comment and want to give them priority.
- ErrorLogging (default = true) — if true, the EA will log all errors and other non-standard situations to a log file. It is named as “CPH-Errors-<date-time>” and can be found in /experts/files/ subfolder of MetaTrader 4 installation folder or /MQL5/Files/ subfolder of MetaTrader 5 installation folder (or a user application data folder designated for your MetaTrader 5 if you are on Vista or newer Windows version.)
Examples
MT4
The following example chart demonstrates the trading process of the Chart Pattern Helper. This descending channel pattern on M15 EUR/USD chart is marked with three channel objects: Border (yellow), Entry (turquoise) and TP (lime green.) The expert advisor has detected all objects and calculated entry, stop-loss and take-profit levels accordingly. The calculated values are displayed in the chart comment (top-left corner.) Pending stop orders have been placed, and their TP and SL levels are visible on the chart too.
- - - - - - - -
⭐The Best Cent Account To Test Your Forex Trading EA.⭐
- - - - - - - -
⭐Great Forex Broker With High Affiliate Commission For Your Forex Trading EA.⭐

MT5
The next chart shows how Chart Pattern Helper places a pending buy limit order to get into a trade missed on breakout of the double bottom pattern. The weekly GBP/JPY chart uses horizontal lines to define Border (yellow), Entry (turquoise) and Take-Profit (lime green.) The same as in the previous example, the chart comment in top-left corner of the screen shows the detected levels. Since the lower objects are absent, only buy-specific levels are calculated. One pending buy limit order has been placed because the current price is above the entry level.
This EA is ECN-safe. You can freely use this expert advisor with ECN (market execution) brokers as it either does not apply any stop-loss and take-profit levels in its trading orders or sends only pending orders.
FAQ
Is it safe to turn this EA off once the orders are placed?
Yes, but the orders will expire if not triggered. The running EA is required to recreate and update them.
Does it use any trailing stop?
No, stop-loss is fixed after order gets executed. But you can apply your own trailing stop, even in a form of a separate expert advisor.
Can I modify position’s stop-loss or take-profit once pending order is triggered?
Sure! You can start modifying stop-loss immediately and you can modify take-profit once you rename/delete the respective TP object or disable the expert advisor.
I use channels to draw the pattern but want the EA to trade only one side — either long or short. How do I do it?
You can prevent the expert advisor from using long (Buy) or short (Sell) orders by setting DisableBuyOrders or DisableSellOrders input parameters to true.
Can you change something for me, please?
No, sorry. There are hundreds of ways to modify this EA to trade differently and to comply with someone else’s trading style. I am not going to implement any of them as it is practically impossible to satisfy everyone. However, the source code is open and well commented — you are free to implement your own changes.
Downloads (ver. 1.09, 2020-12-13)
Changelog
1.09 — 2020-12-13
- Fixed position size calculation for pending orders when the currency pair’s base currency is the same as the account currency.
1.08 — 2020-11-30
- Fixed some stop-loss calculation errors.
1.07 — 2020-11-19
- Position size calculation update.
1.06 — 2020-06-24
- Further improvements for unit cost calculation in MT4.
1.05 — 2020-05-30
- Fixed a bug in MT5 version that caused incorrect pip value calculation in some cases.
1.04 — 2020-05-16
- Fine-tuning the changes introduced in version 1.03.
1.03 — 2020-05-15
- Improved accuracy of position size calculation.
- Fixed potential Error 131 (Invalid trade volume) in MT4 and return code 10014 (TRADE_RETCODE_INVALID_VOLUME) in MT5 due to position size not respecting the trading symbol’s volume step parameter.
1.02 — 2020-03-31
- Added adjustment for tick size granularity to prevent OrderSend Error 130 (Invalid stops) in MT4 and Error 4756 in MT5 when the trading instrument’s tick size is greater than 1 point. This is particularly useful when trading CFDs.
1.01 — 2019-02-11
- Added an option to set stop-loss to the farthest point of triangle/wedge.
- Fixed a bug that could cause incorrect stop-loss calculation in MT4.
1.00 — 2013-03-07
- Initial release.
You May Also Like ❤ :
Extreme Spike EA with Indicator | FREE Forex Trading EA
The extreme spike indicator is a Metatrader indicator that detects market trend extreme high and extreme low spikes. It is...
Heiken Ashi Naïve EA (Reverse Heiken Ashi strategy) | FREE Forex Trading EA
Heiken Ashi Nave is a MetaTrader expert advisor that uses the platform’s standard indicator of the same name to implement...

PersistentAnti EA (Measures persistence of price movements; trades against it) | FREE Forex Trading EA
PersistentAnti is a Forex expert adviser that takes advantage of the concept of trend persistence. The Forex market charts are...
Ichimoku Chikou Cross EA (Uses Ichimoku Kinko Hyo for signals, ATR for position sizing) | FREE Forex Trading EA
Ichimoku Chikou Cross is a MetaTrader expert advisor based on standard Ichimoku Kinko Hyo indicator with default settings. Specifically, it...