MQL Programming logo and header image

Custom Pattern Detector Indicator

custom pattern detector indicator

This indicator lets you define your own custom pattern instead of other common candlestick patterns which everyone knows about like the Doji pattern. Once the indicator knows the pattern you want it to look for then it will go through past and future bars on the chart, make them visible to you, and gather statistics. These statistics include the percentage of bullish and bearish candles that immediately followed the pattern. So the user will have a statistical advantage in knowing what type the next candle will be and can trade accordingly.

  • As a supplement to an existing trading system. For example, only placing a buy trade if the bullish percentage is above 50%.
  • It can be used in binary options trading since the outcome of the candle is known in advance.
  • For your own statistical analysis or record keeping. For example, if you want to make your own EA using a certain reliable pattern.

  • Shift
    This input is used to make the indicator recognize where on the chart it needs to look for a pattern. This is the shift relative to the current open candle that the pattern ended on. Or in other words, how many candles ago that the pattern starts going from right to left.
  • Date_Time
    This does the same as the 'Shift' input except that you can define the pattern by MT4 date/time instead of a shift. For example, if you plot a vertical line on the chart, you will see that the line has a date and time on the bottom. This is the same format that this input will use. So as an example, you could input '2014.04.22 08:30' or something like this. Just keep the format the same with no extra characters or spaces.
  • Num_Candles
    This input is used to make the indicator know the duration in candles after the starting point that the pattern is. So if you input 3, then this means that the pattern you want to use is 3 candles long. This input needs to be greater than 0.
  • Max_Upper_Tail_Deviation, MaxBody_Deviation, Max_Lower_Tail_Deviation
    These inputs control the maximum deviation allowed in finding past and future patterns. These inputs are based in percentages and not pips or points. A zero will disable each one. Anything greater than 0 is telling the indicator to be strict in recognizing patterns. The higher the number for each then the more deviation you are allowing. For example, let's say your pattern has a candle with an upper tail of 100 points and you have the input 'Max_Upper_Tail_Deviation' set to 50. You would be allowing a deviation for the upper tail(s) to be 50% bigger/smaller than 100 points. So if a tail was 50 points up to 150 points then it could still be used since it has an allowable deviation. If you set all 3 inputs to 0 then this is ok too. This would mean that you only care about candle type formations excluding body and tail pips/points. For example, let's say your pattern consists of 7 candles like bullish, bearish, bearish, bearish, bullish, bullish, bullish. If there is a group of 7 candles like this somewhere else on the chart then this group of 7 candles would be considered a match and included in the statistics.
  • Color
    This is the color of the boxes drawn by the indicator.
  • Width
    This is the width of the boxes drawn by the indicator. Set this greater than 0.

  • You must either use 'Shift' or 'Date_Time'. There is no other option for telling the indicator where to start on the chart. There is no need to use both. Just use one method.
  • DLL imports must be enabled for this indicator to work.


  • The official forum to post your comments, questions, concerns, or bug reports about the Custom Pattern Detector Indicator can be found at Forex Zone Forum.


Custom Pattern Detector Indicator Example 1 Custom Pattern Detector Indicator Example 2 Custom Pattern Detector Indicator Example 3 Custom Pattern Detector Indicator Example 4

  • The current version is v1.00. Updates will be made based on customer feedback.
  • This indicator is FREE with no restrictions! Just use the link below to download instantly.
  • Post your questions or feedback on the official Custom Pattern Detector Indicator forum page.
  • Please SHARE this indicator to support our work!

Instant Download

Trade Forex with LMFX


Copyright © 2010-2023 EA CODERS LLC