Candle patterns scanner indicator

16 April 2018, 10:57
Jan Flodin
4
2 863

The main purpose of this blog is to describe and explain the input parameters of my Candle patterns scanner indicator (MT4 version / MT5 version).

Please also check out my other candle patterns product for MT4: Trend reversal dashboard

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
    • Scanning interval in secondsDefault is 1. Can be set to a higher value in order to prevent possible performance issues on slower computers.
    • Panel width: Default is 300. 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 titleIf 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 should 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.
    • Delay in seconds for applying chart template: This parameter can be set to a higher value in case objects from other indicators or an Expert Advisor are now drawn on the chart.
    • Single chart mode: When 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. The texts above/below the patterns are: E = Engulfing, T = Tweezer P = Pin bar, S = Morning/evening star, TL = Three line strike, IN = Inside bars, P/T = Pennant/triangle.
  • SIGNAL SETTINGS
    • Amount of signals to show in the panel: Default is 20. But you can set it to more if it will fit on your chart. 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. The panel does not support having font size set to for instance 125% in Windows. You can set the last (XX) signals in the indicator settings. Default is 15 but you can change it to for instance 20. 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, if bull or bear and type of alert. For instance "3.5 18:00-USDJPY-H4-Bear-PINBAR". The times are written like M.D hh:MM. 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 the chart template which you have defined in the indicator settings.
    • Write signals: Drop down menu with the following selections:
      • File in data folder: Will save the signals to a .CSV file. The file is located in the \MQL4\Files folder (MQL5 in Metatrader 5) and the name of the file is "CPS_symbol_timeframe.csv". For instance "CPS_EURUSD_M5.csv". This file could be used by an Expert Advisor for automatical trading. The format in the file is: [alert type];[symbol name];[time frame (text)];[date of signal candle];[Bull or Bear]. For example "P;EURUSD;M30;6.11.2019 12:30:00;Bear". Always separated by a semi colon. "P" in this case means pin bar.
      • 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.
      • Write to globals: Will write the signals as global variables. Can also be used by an Expert Advisor for automatical trading. The format global variable name is "CPS-[symbol]-[type of divergence]-[time frame]-[bullish or bearish]. For instance "CPS-AUDUSD-H1-Bull-E". E in this case stands for Engulfing. The value of the global variable is the time (in MQL5 format) of the trigger candle. 
    • Amount of signals to save in file: When this value has been reached then older signals will be deleted.
  • PIN BAR, STAR, TWEEZER AND ENGULFING
    • Scan for bullish and/or bearish: This is a drop down menu where you can select if to scan for only bearish or bullish pin bar, engulfing, tweezer and star formations.
    • Trend filter to use: Drop down menu where you can select the desired trend filter.
    • Trend filter time frame: If set to other value than 'current' (time frame for the current scanned time frame) then the trend values will be used for the selected time frame only.
  • PIN BAR SETTINGS
    • Enable pin bar scanning: 'true' or 'false'.
    • Minimum candle height in points: Makes it possible to filter out the smallest pin bars. If you for instance trade M1 and M5, you could set it to 20 points. Please be aware though that this setting is valid for all time frames. For this reason this setting will not be very useful if you are trading on all time frames.
    • Minimum candle body size % (0 = any body size): The scanner will filter out Dojis by default. Recommended setting is 0. But if you would like a larger body, you can set a higher value.
    • Minimum percent for tail: Default is 65. If you would like a larger tail you can set it to for instance 70 or 75. It will give fewer signals but higher quality.
    • Only strict pin bars: 'true' or 'false'. A strict pin bar means that the pin bar must have another color then the previous bar and that the pin bar's high must be higher then the previous bar's high and finally that the pin bar's body must be within the range of the previous bar. With this setting set to 'false' any pin bar will give a signal.
    • Use candle midpoint logic (0=disabled): See screenshot below.
    • Average body-size period (0 = any size)This can be used fo filter out small pin bars. The pin bar candle size must then be larger than the average candle size for the past xx candles.
    • Use trend filter: 'true' or 'false'. Enabled ('true') will give fewer signals but higher quality.
  • TWEEZER AND ENGULFING SETTINGS
    • Enable tweezer scanning: 'true' or 'false'.
    • Enable engulfing scanning: 'true' or 'false'.
    • Engulfing pattern to scan for: In this list you can select from 4 different engulfing patterns (only 1 can be selected):
      • RAnge candle B engulfs range candle A.
      • Body candle B engulfs range candle A.
      • Body candle B engulf body candle A.
      • Range candle B engulfs body candle A
    • * Min. amount of candles to engulf: This should normally be set to 1 in order to scan for classical engulfing formations. Setting it to a higher value will result in much fewer signals, but of higher quality. The rule is still that all candles to the left of the engulfing candle must be of another color, hence bearish candles if the engulfing candle is a bullish candle and vice versa
    • Min. candle body size % (0 = any body size): A higher percentage (larger body) will give higher quality signals.
    • Min. candle size in points (0 = any size): Only candles (second candle) larger or equal than this size will give an alert. Default is 0.
    • Max. engulfing candle size in points (0 = any size): Only candles (second candle) smaller or equal than this size will give an alert. Default is 0.
    • Use trend filter: 'true' or 'false'. Enabled ('true') will get fewer signals but higher quality.
    • Trend filter candle shift: Candle (shift) on which to calculate the trend indicator. 1 = engulfing candle, 2 = candle prior to the engulfing candle. You can also set this to a higher value. Default is 2.
  • MORNING/EVENING STAR SETTINGS
    • Enable morning/evening star scanning: 'true' or 'false'.
    • Use trend filter: 'true' or 'false'.
  • THREE-LINE STRIKE SETTINGS
A bearish three line strike is a buy opportunity and a bullish three line strike a sell opportunity. Therefore the text in the alerts will indicate the direction of which the trade should be opened.
    • Enable scanning: True or false. Set to true to enable scanning of these patterns (bearish and bullish).
    • Only strict formations: True or false. When set to True the following rules apply:
      • The bodies of each of the three candles prior to the reversal candle must have at least a body size according to the setting below.
      • Opening price is within the previous body.
    • Min. 3 line candles body size % (only used in strict mode): Minimum size in percentage of the candle bodies for the three candles prior to the reversal candle. If for instance lower and upper wicks together counts for 60% on any of the three candles then a body size setting larger then 40 will make the pattern invalid and no alert will be sent. Please note that this setting will not apply if strict is set to False.
    • Use trend filter (on candle prior to reversal candle): True or false. Applies to the candle (shift 2) prior to the reversal candle.
  • INSIDE BARS SETTINGS
    • Enable inside bars scanning: 'true' or 'false'.
    • Minimum amount of inside bars: Default is 3.
    • Maximum amount of inside bars: Default is 20.
    • Min. master candle size in points (0=any size): Only a mother (first) candle larger than or equal to this size will give an alert. Default is 0.
    • Max. master candle size in points (0=any size): Only a mother (first) candle smaller than or equal to this size will give an alert. Default is 0.
    • Ignore wicks (on inside bars): If set to 'true' then it is enough that the bodies (open/close) of the inside candles fit within the size of the mother bar.
    • Wait for breakout: If set to True then you will get alerted only when a breakout form the inside bars formation has occured.
    • Maximum candles signal is valid for: The maximum amount of bars to wait for a breakout.
    • Offset from master bar (<=10 = ATR, >10 = points)Offset is the distance from the high/low of the master bar which should be used to confirm a breakout.
  • PENNANTS AND TRIANGLES SETTINGS
    • Enable pennants and triangles scanning: 'true' or 'false'.
  • TREND FILTER SETTINGS
    • RSI overbought and oversold levels: The candle must form above/below these levels in order to give an alert.
    • RSI period
    • Bollinger shift
    • Bollinger deviation
    • Bollinger period
    • Apply to price
  • ADX SETTINGS
    • Enable ADX: 'true' or 'false'.
    • Maximum value: Maximum value for the main line
    • Period
  • MOVING AVERAGE (MA) FILTER SETTINGS
    • Enable MA'true' or 'false'.
    • 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 put in the exact way as it is visible in the Market Watch window and separated with a comma. If you put a symbol not visible in the Market Watch window, that symbol will not be scanned. By design in Metatrader 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.
    • 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.
    • Time frames: Set to 'true' for each time frame you would like to monitor.
  • OBJECT SETTINGS
    • Rectangle color for formation: Color for the rectangle which will highlight Engulfings, Tweezers, Stars and Three line strikes. You can set this value to 'None' in order to disable the drawing of the rectangle.
    • Line color: Here you can change the color of the lines which mark the Inside bars and Pennant/Triangle formation when opening the chart from the panel.
    • Panel background color
    • Panel text color
  • ALERTS
    • Alerts: Set to 'true' for each alert type you would like to receive. All types of alerts are supported.
    • Short alert: A shorter version of the alert. The format is: '[Symbol] - [Time frame] - [Bear/bull] - [Formation]'
    • Custom alert textBlank by default. The text you put here will be inserted at the end of the alert text.



Share it with friends: