______________________
TERMS AND CONDITIONS
Please note that all code in this thread is supplied FREE of charge. Therefore the following conditions apply:
1. You agree that, if you download and use the code, it is ENTIRELY AT YOUR OWN RISK. I accept NO LIABILITY for any financial losses or computer related damage, caused by either the correct or incorrect use of the code.
2. Feel welcome to share the code freely, and modify any MQ4 source. However, you may NOT sell, or otherwise distribute, any part of the code commercially, without my prior written consent.
3. The code may not run correctly on Windows 7, Windows 8 or Vista, probably for the reasons given here.
4. I'm sorry, but due to my current work commitments, I am no longer modifying code to suit people’s personal requirements, nor posting replies to individual questions in this thread. (If you can’t get the code to work, you may find solutions already posted somewhere in the thread; otherwise, you’ll need to find another indicator).
_______________________
INSTRUCTIONS
Latest update: version 1.15, uploaded February 14, 2011
Latest changes to this post in red typeface
Disclaimer: The attached indicator is supplied 'as is', free of charge. No warranty or obligation of support is implied. Download and use it at your own risk. I hope that you find it useful. It's the initial v1.0 release, please feel welcome to post questions, and report any bugs or shortcomings in this thread.
Note: "Recent Candles" now plots the candles using a histogram. The original version of the indicator is no longer supported.
Note (May 25, 2010): Please take the opportunity to download this indicator while it's still available for free. I will soon be applying to become a commercial member.
_____________________
This indicator will show the most recent X candles in any pair/timeframes on your current chart. It can update itself every tick (warning: could slow computer performance), or once per candle on any timeframe that you specify. It allows you to see trend/momentum/patterns in all timeframes simultaneously, without having to move between charts, as shown in the attached screenshot. Trade with the thrust provided by the longer term trends; and/or use as a kind of 'currency strength meter' to trade with the strongest and cleanest trending pairs.
Or, if you prefer, edit the indicator and go to the 'Levels' tab. You could add levels at (for example) 25 and 75, just like with an oscillator, and then place countertrend trades when price is oversold or overbought on multiple timeframes, and/or across correlated pairs. Note that the 'indicator' values always range between 0 and 100 (just like RSI or stochastic), across all timeframes. Adjust the NumCandles parameter to plot quartile (or whatever) lines for any given number of candles.
If you set the NumCandles parameter to 0, and compress the window size vertically, you effectively get a 'traffic light' indicator, that simply shows a green or red symbol, highlighting whether price is currently bullish or bearish in each timeframe.
To display different pairs all on the one chart, simply attach the indicator multiple times (see the screenshot).
To invert the process (i.e. pairs in the one sub-window, a separate sub-window for each timeframe), attach multiple occurrences of the indicator, each for a single timeframe and the same group of currency pairs (see post #46 for screenshot). Or attach one occurrence of the indicator, with multiple pairs, but leave the timeframe blank; then switch timeframes on the chart to show the candles for all pairs, for the selected timeframe.
To install, copy the attached Presets---Recent Candles.TXT file into the ...../experts/files folder; copy the attached Recent Candles.ex4 file into the ...../experts/indicators folder, and then restart MT4. Press Ctrl-N to open the Navigator, and drag the indicator (under the 'Custom Indicators' tree) onto your chart. Set the parameters to suit (see the 'PARAMETERS' section below), and click OK.
You can set the parameters either by using MT4's built-in dialog, when you attach the indicator; or by overriding these settings using the Presets---Recent Candles.TXT file (use a text editor like Notepad to view/edit the file). Using the file allows you to save preset values, retaining them for each future time you attach the indicator. To disable an entry in the file, start the line with two slashes (//). To re-enable it, remove the slashes. You may use any number of embedded spaces or underscores, and/or any combo of upper or lower case, to aid readability, however you wish. Every line MUST end with a semi-colon (; ). To save typing and improve accuracy, copy/paste the sample lines in the file. To disable the entire file, rename it, or delete its content; if the file doesn't exist, the Parameter Dialog entries (when you attach/edit the indicator) will be used. To have any changes take immediate effect, either (1) re-attach the indicator to your chart; (2) edit the indicator (press Ctrl-I); or (3) toggle between timeframes.
To expand/compress the plot(s) horizontally, zoom in/out using the +/– keys.
To expand/compress the plot(s) vertically, drag the window separator upward/downward.
PARAMETERS
- CurrencyPairs - leave blank to default to the current chart's pair. Otherwise type in up to 30 pairs (e.g. GBPUSD or simply GU), separated by commas. Pairs will display in the left-to-right order in which you type them. Spaces are optional, and may be included for clarity. Upper/lowercase may be used interchangeably (e.g. USDCHF or usdchf). Permissible abbreviations are: A=AUD; C=CAD; E=EUR; F=CHF; G=GBP; J=JPY; N=NZD; U=USD; H=HKD; S=SGD; Z=ZAR. So you could type gj instead of GBPJPY, for example. If the pair name typed is not exactly 2 characters, the abbreviation will not be recognized. You can type a valid pair symbol followed by an asterisk (*), to have its inverted pair's candles plotted, e.g. typing AU* will plot USDAUD instead of AUDUSD candles.
- TimeFrames - select the timeframes you wish to see, separated by commas. If displaying only one timeframe, a trailing comma is not required. Leaving this parameter blank defaults to the timeframe of the chart to which the indicator is attached. The spaces are optional, and are included merely for clarity. Upper/lowercase may be used interchangeably (e.g. H1 or h1). Time frames will display in the left-to-right order in which you type them
- NumCandles - how many candles back from the currently forming one, that you want to see. For example, to see the currently forming candle, and also the last 3 candles, type 3. Typing 0 (or leave blank) causes only the currently forming candle to display, creating a 'traffic light' indicator. Typing a single value will display that number of candles for all timeframes. Typing multiple values, separated by commas, allows a different number of candles for each timeframe (by matching the NumCandles entry with the corresponding TimeFrames entry)
- HistoricalShift – enter 0 to display the current plot. Enter a positive number to display the plot as it would have looked X candles ago. Typing a single value will display that HistoricalShift for all timeframes. Typing multiple values, separated by commas, allows a different HistoricalShift for each timeframe (by matching the HistoricalShift entry with the corresponding TimeFrames entry). This will likely be necessary, e.g. to see the candles as they were 4 hours ago, you'd need to type 1,4,8,16,48 for the H4,H1,M30,M15,M5 timeframes, respectively
- CandleWidth - set to a value between 2 and 5. Default is 5. A higher value means wider candle bodies. Experiment until you find a value that suits
- SpacingBetweenCandles - set to 1, 2 or 3. Higher number means wider spacing between candles, and is preferable when the main chart is 'zoomed out' to smaller candles. Experiment until you find a value that suits
- Colors, TextColor/Font/Size should be self-explanatory
- DisplayInfo - if set to TRUE, this will display the last Bid/Ask price, Tick time, Long/short swap rates, Spread (and spread as a % of average daily move) and Pip Value (dollar value your acount will change per pip, for each full lot traded) at the left of the window
- DisplayCcyName - if set to TRUE, <pair> will be included in the labels displayed along the bottom of the window
- DisplayTF - if set to TRUE, <timeframe> will be included in the labels displayed along the bottom of the window
- RefreshEveryXMins - if set to 0, this will cause the window to update itself immediately a new tick occurs. If set to 1, 5, 15, 30, 60, or 240, this will cause the window to update itself every time a new candle appears on the M1, M5, M15, M30, H1 or H4 chart, respectively
- HeikinAshiCandles - if set to TRUE, this will plot Heikin Ashi candles, instead of conventional ones.
CHANGE HISTORY
v 1.01: fixed division by zero error, caused by zero height candle (high = low) in any timeframe. Tidied up text alignment. Added new parameters DisplayInfo and RefreshEveryXMins (see above)
v 1.02: fixed anomalies with the alignment, where a 'foreign' currency was being added to the chart. Moved and centered <pair>,<timeframe> text to bottom of window. Added new 'Last Tick' display time to Display Info. Added Parameter Settings File facility. Updated the screenshot below.
v 1.03: Enhanced DisplayInfo options. Parameter entry (CurrencyPair, TimeFrames) is now more lenient.
v 1.04: Text font/size now user-selectable. Can also select display of <pair>,<timeframe>, or just <timeframe>, along bottom of window. Parameter file operation upgraded to Recent Strength/Recent Prices 'technology'/mode of operation.
v 1.05: Timeframes now display, left-to-right, in the order you type them. Can now have a different number of candles for each timeframe.
v 1.06: Can now display candles for up to 30 pairs x all 9 timeframes, or any subset/combo thereof, all across the same sub-window. New parameters DisplayTF (replaces DisplayTFOnly) and DisplayCcyName.
v 1.07: Added HistoricalShift parameter.
v 1.08: Fixed bug in 'Spread' info display. It now displays the correct percent figure (spread as a % of avg daily move) for brokers with 5/3 decimal places in their quotes.
v 1.09: (Hopefully) fixed bug described in post #81.
v 1.12:
1. Fixed "ArrayInitialize function internal error" bug reported in post #104.
2. Added inverted pairs facility, e.g. can now plot USDGBP candles from GBPUSD data. See CurrencyPairs in PARAMETERS section above, for details.
3. Should now work correctly for GBPUSDm pairs, provided that the full symbol (GBPUSDm) is typed into the CurrencyPairs parameter instead of the abbreviation (GU).
4. Included a zip file of templates (see post #108 for screenshot).
v 1.13:
1. Fixed bug reported in post #110.
v 1.14:
1. New parameter CandleWidth addresses request in post #123.
v 1.15:
1. New parameter HeikinAshiCandles allows plotting of Heikin Ashi candles instead.
___________________________
MT4 Indicators/EAs by Hanover:
Recent Strength — display line-based plot of weighted average of currency (as opposed to pair) strength
Recent Prices — display line-based plots of any combo of pairs/timeframes on your current chart, to compare their relative strength
Recent Candles — display candles of any combo of pairs/timeframes on your current chart
Recent SR — auto-plot horizontal support/resistance lines based on a wide variety of settings
Recent News — display upcoming and/or historical news announcements from FF calendar; countdown/alert upcoming announcements
Daily Lines/Boxes — auto-plot horizontal or vertical lines, boxes, symbols on user-defined times, days of the week, etc
Display Info all pairs — display spread, daily range, dollars/pip, swap rates etc for all pairs
Spaced Lines — auto-plot horizontal lines on your charts
Stealth Master EA — hide your SL and TP from unscrupulous br0kers!
Do-it-yourself alerts builder kit — code template that you can copy/paste that will add pop-up and/or e-mail alerts to most 'standard' indicators