Chart patterns scanner indicator

17 December 2019, 10:09
Jan Flodin
17
1 428

Due to the limitation of 3600 characters for the product description I have put the description of the input parameters in this blog. Links to the indicator: MT4 version - MT5 version

Input parameters

Parameters marked with an asterisk (*) in the beginning are only available in the MT5 version and parameters marked with two asterisks (**) in the beginning are only available in the MT4 version.
  • GENERAL SETTINGS
    • Panel width: For instance, if you are using a non-standard font size in windows, you could set this to a larger value in order for the whole text to be visible.
    • Custom panel title: If you put some text here this text will be shown instead of the default panel title.
    • Template name: The template you put here will be applied to the chart which will be opened when you click on a signal in the panel. The name must not include the file extension (.tpl). The purpose of this parameter is to make it easier for quick desicion if to take the trade or not. Or if to wait for real reversal confirmation. Typically you would then use your own template which for instance could contain a support/resistance indicator. Never the scanner itself.
    • Single chart modeWhen set to True the indicator will scan only patterns on for the chart where it has been installed. It will only draw future patterns and it will not redraw patterns when changing time frame.
    • Delay in seconds for applying chart template: Default is 1. Can be set to a higher value in case the lines will not be drawn on the chart which opens up when you click on a signal in the panel.
    • Scan for bullish and/or bearish: Drop down menu where you can select if to scan for only bullish or bearish signals.
    • Scanning interval in seconds: Default is 1. Can be set to a higher value in order to prevent possible performance issues on slower computers.
  • SIGNAL SETTINGS
    • Amount of signals to show in the panel:  The signals will be shown in descending order, i.e. the latest signal first. The panel can be moved around on the chart by dragging it with the top list. It can also be minimized. If closing it with the x button the indicator will be unloaded from the chart as well. You can set the last (XX) signals in the indicator settings. Default is 20 but you can change it to for instance 30. This value will be shown in the panel header. The panel height will then increase and in some cases it might not fit on your chart. To disable to panel you must set the value to 0.  
      The text on each row contains information about time (server time) when the signal was generated, symbol, time frame, type of alert and bar time for the first top/bottom and bar time for the neckline candle. For instance "18:00-USDJPY-H1-double top-2018.3.4 17:00-2018.3.5 14:00". When clicking on a row a new chart will be opened with the selected symbol and time frame. The opened chart will be opened with your chart template which you have defined in the indicator settings. The lines showing the pattern will will be drawn on the chart. For top/bottom and head and sholder also the the neckline will be drawn. Please note that the signals in the panel will be lost in case you reinitialize the indicator (change of input parameters, restart of the termial etc.)
    • ** Signal time offset: This is the server time which appears as first information in the panel, prior to the symbol name. This parameter could be set to something else in case you would like see see you local computer time instead. If you set this parameter to for instance -2 then the time will show 2 hours less than the server (terminal) time.
    • Where to write signals (For EA): Listbox with the following selections:
      • Disabled
      • File in data folder: The signals will be saved to a .csv (text) file for further usage. The file is located in the \MQL5\Files folder and the name of the file is "CHPS_symbol_timeframe.txt". For instance "CHPS_EURUSD_M5.txt". This file could be used by an Expert Advisor for automatical trading. The format in the file for top/bottoms is: [symbol],[timeframe],[price of first top],[price of neckline],[buy or sell (0=buy, 1=sell)],[time of first extremum],[time of neckline],[time of second extremum] + 3 additonal parameters which are prepared for future use. The values are always separated by a comma.
      • File in common folder: The file is stored in the common folder instead which is a folder shared by all Metatrader instances installed on the machine.
      • Global variables: The name of the global variable is divided into 5 parts. The first part (CHPS) is the short name of this indicator. The second part is the symbol name, the third part the time frame, the fourth part the trade direction (Bull or Bear) and the last part is the name of the formation/pattern. The value of the global variable is the time of the alert/signal in MQL format.
    • Amount of signals to save in file: When this value has been reached then older signals will be deleted.
  • GENERAL PATTERN SETTINGS
    • Depth: Depth is the minimum number of bars where there isn’t any second maximum or minimum Deviation from the bar.
    • Deviation (points): Deviation is the minimum number of points to be reached for a next valid high/low point after the previous high/low was formed.
    • Min. bars between 2 highs/lows (backstep): Reflects the minimum amount of bars between 2 highs or 2 lows. 
    • Max. bars to search for patterns: Default is 200. Will search for patterns xx bars back in time. The higher the value the more system resources will be needed.
    • Neckline/head max candles offset % (0=disabled): This setting is the max amount of bars in percentage the neckline (top/botttom) or head (head and shoulders) can deviate from the middle. This setting is used in order for the neckline/head to be somewhere in the middle of the 2 top/bottoms or the 2 shoulders. You can set how many percentage the neckline cande can deviate from the exact middle point of the 2 top/bottom candles (extremums). If there are for instance 20 candles between the 2 extremums then setting a value to 50 (percent) will mean that the neckline candle (candle number 10) cannot be more than 5 candles to the left or right of the middle which is 10. Using this option will make it a more clear U/V formation for those who desires that for their trading strategy.
  • TOP/BOTTOM (EXTREMUM) SETTINGS
    • Enable scanning: 'true' or 'false'.
    • RSI filter method: Drop down menu where you can select if to apply the RSI filter on first, second or both extremums. When used then the extremum candle(s) must close over/under the RSI levels set under the RSI FILTER SETTINGS section below.
    • Enable MA trend filter
    • Min. amount of bars between extremums: Default is 30. The higher the value the stronger the setup.
    • Offset from first extremum (<=10 = ATR, >10 = points): If set to a value lower than 11 then the ATR (period 14) will be used and multiplied with the value given here.
    • Use offset only when above/below first extremum: 'true' or 'false'. If set to 'true' then the second extremum's candle high/low price must exceed the first extremum.
    • Candle shift for last extremum (must be >0): Default is 1. If you will set it to for instance 3 (3 candles after the second top/bottom) you will get a stronger confirmation of a possible trend reversal.
    • Alert only at neckline breakout:  'true' or 'false'. If set to 'true' then you will be alerted at a possible neckline breakout (confirmed top/bottom). For this to work you will have to set the value in the 'Where to write signals' input parameter to 'File in data folder' In the MT5 version.
    • Max. bars to wait for neckline breakout: Default is 20. Only used if the parameter above has been set to 'true'. After this value has been reached the signal will be invalidated.
  • HEAD AND SHOULDERS SETTINGS
    • Enable scanning: 'true' or 'false'.
    • Enable RSI filter (measured on the head): 'true' or 'false'.
    • Enable MA trend filter
    • Min. shoulder height %: Minimum shoulder height in percent compared with the height between the neckline point and head. If for instance this distance is 100 points then setting a value of 25 would mean that the sholder must be at least 25 points in height.
    • Max. shoulder height %: Same logic as described above.
    • Max. vertical deviation % for right shoulder: If set to for instance 50 (percent) the 2nd shoulder can only deviate max 50% in height compared with the first shoulder.
    • Max. vertical deviation % for right neckline point: If set to for instance 25 (percent) then the second neckline point cannot be lower/higher than 25% compared with the first neckline point.
    • Enable strict mode:  'true' or 'false'. When enabled the second neckline point must be lower (higher for inverted head and shoulder) than the first neckline point.
    • Extremum prior to left shoulder must be lower/higher:  'true' or 'false'. Setting this to 'true' means that the extremum prior to the left shoulder must be lower (higher for inverse H/S) than the left neckline point. Please see screenshot #3 under the product description for visual explanation.
    • Candle shift for right shoulder (must be >0): Default is 2. You can set it to a higher value in order to wait for a confirmation of the possible reversal.
    • Alert only at neckline breakout: 'true' or 'false'. If set to 'true' then you will be alerted at a possible neckline breakout (confirmed head and shoulder). For this to work you will have to set the value in the 'Where to write signals' input parameter to 'File in data folder' In the MT5 version.
    • Max. bars to wait for neckline breakout: Default is 20. Only used if the parameter above has been set to 'true'. After this value has been reached the signal will be invalidated.
  • PENNANT AND TRIANGLE SETTINGS
    • Enable scanning:  'true' or 'false'. This type of pattern will be detected: https://www.mql5.com/en/market/product/23290#!tab=tab_p_overview
    • Ignore wicks:  'true' or 'false'.
    • Alert only at breakout (from mother candle)'true' or 'false'. For this to work you will have to set the value in the 'Where to write signals' input parameter to 'File in data folder' In the MT5 version.
    • Max. bars to wait for breakoutDefault is 10. Only used if the parameter above has been set to 'true'. After this value has been reached the signal will be invalidated.
  • FLAG SETTINGS
    • Enable scanning: 'true' or 'false'.
    • Enable RSI filter (measured on the pole top): 'true' or 'false'.
    • Enable MA trend filter
    • Maximum amount of bars: The pattern cannot contain more than this amount of bars
    • Maximum height %: The outer bottom point of the flag must not be closer to the pole bottom than this amount of percent. Let us take the example that the distance between the pole bottom and pole top is 100 pips. If you have set the value in this parameter to 50 (%) then the lowest point of the flag cannot be closer than 50 pips from the pole bottom.
    • Maximum inner vs. outer deviation %: This setting controls how much the flag trend lines can deviate from eachother measured in percent. I would like to point out though that due to the complexity of such calculation you cannot always expect an exact result. But close enough.
    • Alert only at flag pole breakout'true' or 'false'. For this to work you will have to set the value in the 'Where to write signals' input parameter to 'File in data folder' In the MT5 version.
    • Max. bars to wait for pole breakoutDefault is 20. Only used if the parameter above has been set to 'true'. After this value has been reached the signal will be invalidated.
  • RSI FILTER SETTINGS
    • RSI overbought/oversold levels: Default is 75/25.
    • RSI period: Default is 10.
    • RSI apply to price: The RSI level is calculated from this setting.
    • ** RSI time frame (current=scanned time frame): Will use this time frame regardless of which time frame is currently scanned.
  • MOVING AVERAGE (MA) TREND FILTER SETTINGS
    • MA period
    • MA shift
    • MA method
    • MA price type
    • MA time frame (current=scanned time frame): Will use this time frame regardless of which time frame is currently scanned.
      • SYMBOLS AND TIME FRAMES
        • Symbols to scan: Here you will put all symbols you would like to monitor. Every symbol must be entered in the exact way as it is visible in the Market Watch window and separated with a comma, without spaces. So if for instance your broker is offering EURUSD as EURUSD.pro or EURUSDe you will need to change all symbol names to XXXXXX.pro or XXXXXXe. By design in Metatrader 4 the amount of character in a text (string) parameter is limited to 255. You can put more characters in the Symbols parameter but when reading the value, Metatrader cuts at 255. 255 characters will allow for 36 symbols and 35 commas (,) if the symbol length is 6 characters. If you need more symbols you can always drag the indicator with the remaining symbols to another chart. To come around this limitation you can set the value in the 'Use symbols from Market Watch window instead' parameter below to  true. By doing this the indicator will use the symbols visible in your Market Watch window instead.
        • * Additional symbols to scan
        • Use symbols from Market Watch window instead: With this option set to True all visible symbols in your Market Watch window will be scanned instead of the symbols above. Due to performace reasons it is not recommended to use more than 40 symbols if you have a slower computer. This option is not supported in the strategy tester.
        • Time frames: Set to 'true' for each time frame you would like to monitor.
        • OBJECT SETTINGS
          • Here you can set the colors for different chart objects. It is also possible to set if the neckline should be shown as ray (continues to the right on the chart).
        • ALERTS
          • Alerts: Set to 'true' for each alert type you would like to receive.
          • Disable repeated alerts: Set to 'true' if you would not like to be alerted again in case the top/bottom or right shoulder gets extended ("repainted").
          • Sound file: If you would like to use another sound file than the default it must exist in the Sounds folder. For example: c:\program files (x86)\metatrader 4\sounds.
          • Custom alert text: Blank by default. The text you put here will be inserted after the time frame in the pop-up (on screen) alert. For example  'GBPUSD H1 (your custom text) reg H/S...'
          • Short alert: A shorter version of the alert. The format is: '[Symbol] - [Time frame] - [Formation]'





        Share it with friends: