Forex Factory (https://www.forexfactory.com/forum.php)
-   Platform Tech (https://www.forexfactory.com/forumdisplay.php?f=69)
-   -   Recent Strength indicator (https://www.forexfactory.com/showthread.php?t=163158)

hanover Apr 12, 2009 3:26pm | Post# 1

Recent Strength indicator
 
9 Attachment(s)
NOTE: I have left Forex Factory, so don't expect replies to your posts. You can find an index to all my indicators and posts here.

Recent Strength indicator: Terms and Conditions

 All code is supplied FREE of charge. It may NOT be sold or distributed commercially. Unless otherwise shown, source code is not available.

 Software is offered on an 'as is' basis. I'm not offering a programming or troubleshooting service.

 There is no guarantee that the software is fit for purpose, or free of errors. Download and use the indicator(s) at your own risk; I accept no liability for computer damage or financial losses.
___________________________

The Recent Strength indicator was written and compiled using MT4 build 509. Some of the settings may not work exactly as described in build 600 or later. As explained below, the indicator requires a lot of computer resource, and it may take a long time for MT4 to load enough data to get it to plot correctly. If you're having problems running the indicator — the data plots are not appearing after several minutes — then you may find a solution in one of these posts: #70, #72, #81, #97, #116, #129. Otherwise, you'll need to find a different strength indicator**, or change to a different br0ker (there are more than 200 MT4 br0kers listed here).

** If you can't get the Recent Strength indicator to work (it can be difficult to set it up correctly), then perhaps try some of these:
CCFp (see here here and here). Several recent versions here.
FerruFX has developed an extremely versatile strength meter here.
There's a mix of line based strength indys, and histograms, in this thread.
There's also a line based strength indicator here ("2. Currency Slope Strength").
FiatFap has developed an amazing tool here, that includes a strength indicator (see post #4 for a screenshot).
Kang Gun has also developed a RSI-based strength plot. Try this post as a starting point.
More strength indicators and info in this thread, and even more by honestknave (and others) in this thread.
More strength dashboards, by GVC and others, in this thread.
Another currency meter (shows intraday strength/weakness) shared by Erebus here (and more links in the three posts following).....
.....and its big brother, the ProfitSupreme Meter, posted by jegas here.
CSW daily basket indicator here.
Strength indicator by Rafei here.
Pair Strength Analyzer here.
Latest version of CSM here, and 'Currency strength - Giraia' here.

Beyond MT4 indicators:
Oanda's strength heatmap here.
Finviz futures charts show currency strength at a glance (here). (also, click on chart to see COT data).
Another futures/COT alternative here (there are both free and commercial options on the same page).
MATAF currency index here.
Strength plot of 8 majors here.

Or if, after reading this, you still believe that spending money will buy you a higher quality product, here are some you might like to try:
News profiteer (Henry Liu's strength meter is apparently free, but it's a vendor-like sales page; see also video here)
Apollo by Mark Boardman
Accustrength by Tom Yeomans
PointZero (Arturo Perez is a very good programmer, IMHO)
Pitview strength heatmap

_______________________

INSTRUCTIONS

Latest update: version 1.09, uploaded July 17, 2010
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.

Attention programmers: it's now possible to use values from the Recent Strength plots in your EAs. For info on how to interface Recent Strength to an EA, see here.

Note: if you want the RS alerts indy, download and unzip RSsetup.zip and run RSsetup.exe. Provided that you select the 'Destination folder' as your br0ker's MT4 folder, the setup program will install ALL of the files needed to run Recent Strength in the correct folders. Then simply restart MT4 and you're good to go. For more info on RS alerts, please read post #323.

_____________________

Originally designed as a companion to the Recent Candles indicator, the Recent Strength indicator plots the relative strengths of each currency against each other, on any timeframe(s) that you choose. Each colored line represents the strength of a currency averaged across (potentially) all of the related pairs offered by your MT4 broker. You can use it to (1) trade the strongest, or most rapidly strengthening currency/ies, against the weakest ones; (2) establish which currency is 'driving' a pair (e.g. if GBPUSD is rising, ascertain whether it's because GBP is strengthening, USD is weakening, or both); and (3) observe correlations between currencies (e.g. ascertain the extent to which currencies move in unison, or whether certain currencies tend to lead/lag each other). For more information, please see posts #20 and #59 below.

The indicator can potentially be used as an adjunct to any trading system, helping you decide which pair(s) to concentrate your trading on. The screenshot below (settings: NumPoints = 25, SmoothingSMA = 3) illustrates how you could have maximized profit across the D1 timeframe recently, by simply trading the NZDJPY long, without any other TA. The W1 plot shows how JPY switched dramatically from being the strongest currency to the weakest currency (falling most strongly at the right of the plot). Read 'The calculation works....' paragraph below, experiment with the settings, form your own conclusions, and use the indicator however you see fit.

To install, copy the attached Presets---Recent Strength.TXT file into the ...../experts/files folder; copy the attached Recent Strength.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 Strength.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.

The calculation works as follows. Each colored line represents a given currency (see legend at right of chart). Take AUD as an example. Each 'constituent' AUD-based pair that you specify (and that is offered by your broker) – e.g. AUDCAD, AUDCHF, etc – has its closing price on each candle, expressed as a ratio of the closing price of the initial candle plotted (or the BasePoint candle, if specified), and multiplied by the weight you enter (see the 'PARAMETERS' section below for more info on weights). These values are all added together, and the total divided by the total of all the weights. The pair of the parent chart (the chart to which the indicator is attached) is used to align candle times of the constituent pairs, to help work around the potential problem of missing data. If a currency is 'inverted' (e.g. GBPAUD instead of AUDJPY), then the reciprocal (1/n) is summed, so that an upward plot will always indicate a strengthening AUD, and a downward plot a weakening AUD. If the SmoothingSMA parameter (see below) is set to a value > 1, then additional prior points are used to smooth the initial values being plotted. Finally the values are then re-scaled to a value between 0 and 100 (relative to ALL values being plotted in a given timeframe). See post #7 for more information.

Note that the accuracy of the plots is restricted to the pairs, and the data (on each pair/timeframe), provided by your broker. More pairs will result in a more comprehensive plot. Missing data will result in an inaccurate curve being plotted. Use MT4's history center (press F2) and/or temporarily view charts of constituent pairs/timeframes (use the PageUp key to add more data to the left of the chart) to gather more data for plotting. Amongst MT4 brokers, www.migfx.com is one candidate whose MT4 provides ALL possible 28 pair combos involving the major currencies (AUD, CAD, CHF, EUR, GBP, JPY, NZD, USD) from which to gather data (this is not necessarily an endorsement to trade with them, though).

Note that it might take 15-30 minutes to build the plots from your br0ker's servers. This is because the indicator must download and process data from up to 9 timeframes of each of 28 different currency pairs. This process needs to occur only once. If you want to ensure that all of the necessary data is loaded from your br0ker's servers, do the following**:
Load a new chart with no indys attached, and press the minus key to zoom out as far as possible. Then open the Market Watch window (press Ctrl-M) and drag the first pair onto the chart, i.e. changing the chart to that pair. Then cycle thru each timeframe (M1, M5, .... MN), and for each timframe hold the PageUp key down for a few seconds until the price window is full of candle data. Then repeat the whole process 28 times by dragging every one of the 28 pairs onto the chart, and loading data for each timeframe. (That means that you force MT4 to load data for each of 9 timeframes x 28 pairs = 252 times). The whole job took me about 10 minutes, a one-time setup process, i.e. once all the data has been loaded, the indy itself won't ever need to retrieve it from the servers. It ensures that the indy has plenty of data to work with, on all pairs and all timeframes, right from the outset.

[** Note: there is now an application (macro) that performs this task automatically]


PARAMETERS

  1. ParameterFile - if left blank, the parameter file Presets---Recent Strength.TXT will be used. Settings in this file will override those entered in the dialog window when the indicator is attached/edited. If you enter a value (e.g. XXX), then the parameter file Presets---Recent Strength.XXX will be used instead. This makes it easy to switch between a number of different settings. All parameter files must reside in the ....../experts/files folder. More info here
  2. 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. See note below on computer performance
  3. NumPoints – how many points (candles) back from the currently forming one, that you want to see. For example, to see the currently forming data point, and also the last 3 points, type 3. 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 NumPoints entry with the corresponding TimeFrames entry). The above creates a rolling window of the last 'n' candles. Alternatively, you can specify a fixed starting point, and thus have a progressively growing window of data points. To achieve this, enter the starting point in any of these forms: (1) YYYY.MM.DD HH:MM or (2) YYYY.MM.DD (this assumes starting from MT4 midnight at the specified date) or (3) HH:MM (this will start from the specified MT4 time, today, after it has been reached) or (4) any of these timeframes M5, M15, M30, H1, H4, D1, W1, MN (this will create a window that exists for the life of the timeframe, and then restarts over again, on the first tick of the next occurrence of that timeframe). As with the number of candles, you may specify a different starting point for each timeframe
  4. BasePoint – the 'anchor' point used as a reference, from which all ratios are calculated, counting back from the rightmost candle. A negative value means that BasePoint will be set equal to NumPoints, i.e. the leftmost point is also the base point. A zero value means that the rightmost point is the base point. Typing a single value will display that BasePoint for all timeframes. Typing multiple values, separated by commas, allows a different BasePoint for each timeframe (by matching the BasePoint entry with the corresponding TimeFrames entry). See the illustrative example screenshots below
  5. HistoricalShift – enter 0 to display the current plot. Enter a positive number to display the plot as it would have looked X points (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 plots 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
  6. SmoothingSMA – applies a simple moving average (SMA) to smooth the data being plotted. Default value of 1 effectively means no smoothing. The larger the value, the greater the smoothness (and the clearer the view), but the greater the lag. Applies to all selected currencies and timeframes. The sum of NumPoints + SmoothingSMA must NOT exceed 2,000
  7. SetBaseCurrency – leave blank for a 'normal' plot. Otherwise, type in the symbol of one of the currencies plotted, to have that currency's plot appear as a horizontal line (zero point), and all of the other currencies' plots re-scaled relative to that currency. In typing the symbol, upper/lowercase may be used interchangeably (e.g. USD or usd). 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 G or g instead of GBP, for example. If the currency name typed is not exactly 1 character, the abbreviation will not be recognized
  8. UseTickvolForWgt – if set to FALSE, this will cause the weights in the Cn_Pairs_Wgts to be used, to weight the plot according to each constituent pair. If set to TRUE, the tick volume for each constituent pair will be summed across the points that are being plotted, and this value will override the Cn_Pairs_Wgts value
  9. ShowPointCount – if set to TRUE, displays a counter above the plot, showing the number of candles from the BasePoint. If set to FALSE, the date/time of each data point will be displayed instead
  10. LegendValues – if non-blank, this will display the numeric values of all plots at the specified data point, in all timeframes (0 is the most recent point, 1 the second most recent, and so on leftwards; -1 means the leftmost point). To have the list ranked from the lowest to highest value, or highest to lowest, include an (upper or lowercase) A or D, for an ascending or descending sort by value
  11. LegendVertSpacing – a lower number means that the items will be squashed closer together vertically; a higher number widens the spacing between them. You can also include any of (upper or lowercase) T, B, L, or R, to have the legend display at the top, bottom, left or right of each timeframe window. Items are color-coded to match their respective plots. The TextFont and TextSize parameters determine the font that will be used
  12. Text Color/Font/Size – should be self-explanatory. Font name must be spelled correctly for Windows to recognize it. Color must be spelled correctly, but may contain embedded spaces, and upper/lower case may be used interchangeably. Colors in the parameter file may alternatively be entered in R###G###B### format, e.g. b255r255 will produce magenta
  13. 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 immediately a new candle appears on the 'parent' pair's chart (the chart to which the indicator is attached). See note below on computer performance
  14. OutputFile – if left blank, no output occurs. Otherwise, typing in the name of the file here will cause CSV output of all values plotted to be exported to the file name that you specify, in folder ...../experts/files, every time the indicator refreshes. The content of this file could then be imported by an EA, or by an application like Excel, for use in further analysis
  15. CurrencyN – the currency you want plotted in buffer# N. MT4 allows a max of 8 buffers, conveniently allowing all 8 major currencies to plot on the same chart. To disable a currency from being plotted, set this entry to blank. In typing the symbol, upper/lowercase may be used interchangeably (e.g. USD or usd). 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 G or g instead of GBP, for example. If the currency name typed is not exactly 1 character, the abbreviation will not be recognized. Reducing the currencies plotted to only those that you're interested in, makes the tangled mess more easily viewable
  16. Cn_Color, Cn_Style – the color and style for each plot. Color must be spelled correctly, but may contain embedded spaces, and upper/lower case may be used interchangeably. Valid values for style are: 10 = solid line of width 1; 11 = dashed line; 12 = dotted line; 13 = dash-dot; 14 = dash-dot-dot; 20, 30, 40, 50 = solid line of width 2, 3, 4, 5 respectively
  17. Cn_Pairs_Wgts – a list of the constituent pairs that will be summed to form the plot of a given currency, and the weight attached to each. A maximum of 20 pairs/weights may be included. The format MUST be <pair1>,<weight1>,<pair2>,<weight2>, etc, with ALL commas correctly in place. The entry may optionally be ended with a final comma. Embedded spaces may be used to aid readability. Pair IDs that are mis-spelled, spelled 'backward' (e.g. USDGBP instead of GBPUSD), or are otherwise not provided or recognized by your broker's MT4, will be ignored. However, upper/lowercase may be used interchangeably (e.g. USDCHF or usdchf), and you may also use the following abbreviations: 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 or gj instead of GBPJPY, for example. If the currency name typed is not exactly 2 characters, the abbreviation will not be recognized. A weight of 100 is 'normal'. To have a constituent pair contribute twice its own weight to the line being plotted, enter 200 after the pair name; 75% of its own weight, enter 75; and so on. To have a pair omitted from consideration, either set its weight to 0, or remove it from the list. Trimming the list of constituent pairs to only those offered by your broker, will improve computer performance (see note below)
  18. Cn_ScaleFactor – default values are 100, which mean that the indicator works exactly as before. Use this parameter to re-scale the currency's plot, aligning it more accurately with actual pip movement, as opposed to a percent average. A value of 200 would double the width of a plot, relative to the other currencies' plots; a value of 50 would halve it; and so on


COMPUTER PERFORMANCE

This indicator has the potential to slow your MT4 down dramatically, since it must gather data from several constituent pairs, and timeframes, to create the plotted curves. If performance becomes unacceptably slow, try the following –

  1. attach the indicator to one chart only
  2. avoid setting RefreshEveryXMins to 0. A value of 1 or 5 will ensure that the charts are only re-checked once every 1, or 5, minutes respectively
  3. reduce the number of timeframes being plotted, i.e. the TimeFrames parameter
  4. trim the list of constituent pairs to only those offered by your MT4 broker


AUTOMATED PARAMETER FILE BUILD

The Build Strength Preset File.MQ4 script can be used to automatically build your parameter file (Presets---Recent Strength.TXT).
Please note that this is a script, NOT an indicator, and should therefore be downloaded into folder ...../experts/scripts.

The parameter settings should be fairly self-explanatory. You can experiment and check the output, and then re-run the script as many times as necessary (the specified parameter file gets overwritten each time), until you get something that looks right. The key parameters are:

Currencies – the first eight of these become the eight colored lines on the chart. They are also used to find every combination of these that are being offered by your broker, to build the Cn_Pairs_Wgts parameter automatically, which is the major time saving that this script provides.

PairSuffix – your entry is appended to each pair, to make the pairs compatible with the symbols used by your broker. Some brokers (IBFX is an example) offer mini accounts where the pair is suffixed by an 'm', e.g. GBPJPYm instead of GBPJPY. Hence you would type m into this parameter. Some bokers (e.g. Latitude FX) append a period (.) after the pair names, e.g. GBPJPY. instead of GBPJPY. So you would type . into this parameter. And so on.

The Weight value is included multiple times across every Cn_Pairs_Wgts parameter. If you want to assign different weights, you'll need to adjust the values in the parameter file manually (use a text editor like Notepad).

The Colors, Styles, and Scale Factors correspond with their respective Currencies entries, and should likewise be separated by commas. Of course you can always edit these manually, also.

All of the other parameters (TimeFrames onward) can either be set here, or edited manually later.


CHANGE HISTORY

v 1.00: Initial release.

v 1.01: Fixed bugs described in post #9. Added BasePoint parameter.

v 1.02: Added ShowPointCount parameter (see post #17 for screenshot). Increased max NumPoints+SmoothingSMA value from 200 to 500.

v 1.03: Added Cn_ScaleFactor parameter.

v 1.04: Added UseTickvolForWgt, SetBaseCurrency and HistoricalShift parameters. Can have a different NumPoints, BasePoint, and HistoricalShift value for each timeframe. TimeFrames now display left-to-right in the order that you type them. Abbreviated currency/pair symbols (e.g. EU, GJ) can now be entered. Indicator ShortName has been abbreviated.

v 1.05: Added ParameterFile option, allowing multiple user-selectable parameter files. Date/time now displayed above each data point if ShowPointCount = FALSE

v 1.06: Added OuputFile option (see above for details)

v 1.07:
1. Fixed bug described in post #97.
2. Added Build Strength Preset File.mq4 script (see relevant section above).

v 1.08: Now displays currency names in Data Window. See notes/screenshot in post #142.

v 1.09:
1. In the parameter file, colors may now alternatively be entered in the form (e.g.) r255b0g127 i.e. specifying a red, blue and green value (0-255) for each primary color in the desired mix.
2. New parameters LegendValues and LegendVertSpacing now optionally allow a color-coded display of all plot values at any specified point, and their relevant currency, on each timeframe.
3. Instead of a rolling window of NumPoints candles, a fixed starting point may optionally be specified, for each timeframe. This means that the window will grow horizontally as more time points are progressively added. The starting point may be specified as either YYYY.MM.DD HH:MM, or as a timeframe identifier (M5, M15, etc), which means that the window will reset itself at the start of each such timeframe.
4. Increased max NumPoints+SmoothingSMA value from 500 to 2,000.


CSM and other strength indicators (written by hanover)

CSM (Currency Strength Meter) is an alternative strength indy, that plots a histogram instead of a line of continuous values.

  1. Latest version of CSM can be downloaded here.
  2. CSM calculations are explained here and here.
  3. J4D strength indicator, an offshoot of CSM, can be downloaded here. This uses a different set of calculations, based on weighted moving averages, to determine strength.
  4. Latest version of 'Currency strength - Giraia' indy can be downloaded here. More info here and here. This indy displays numeric values instead of a histogram. As the forerunner of CSM, it uses much the same calculations.
  5. Recent Oscillator Strength (ROS) indicator can be found here (download files plus instructions). Latest version (it now allows RSI, CCI to be plotted) available here.
  6. RS Alerts indicator can be found here. More info here.
  7. Recent Prices indicator here.
  8. Pair Strength Analyzer (PSA) indicator here.


Other useful posts in the thread

Post #428 — Info on Steve Hopwood's "hanover" EA that uses output from the Recent Strength indy.
Post #445, #447 — Links to how the calculations work for RS and CSM.
Posts #469, #484 — Ideas for trading approaches using currency strength.
Post #474 — Things to try if you're having trouble installing CSM.
Posts #491, #520 — Links to other strength indicators.
Post #480 — Screenshot EA. Writes snapshots of your screen every X minutes to a named series of files.
Click to Enlarge

Name: recent strength screenshot.jpg
Size: 133 KB
Click to Enlarge

Name: recent strength example 1.gif
Size: 59 KB
Click to Enlarge

Name: recent strength example 2.gif
Size: 62 KB
Recent Strength.ex4
Presets---Recent Strength.txt
Build Strength Preset File.mq4
RSsetup.zip


opie999 Apr 12, 2009 5:27pm | Post# 2

Thank you, David. You're a prince.

I'll toss it on the front porch tonight and see if any cats take a bite.

IBFX's new five digit format won't be a problem I trust.

fxprocessor Apr 12, 2009 6:33pm | Post# 3

Nice work. Thanks for sharing

cheers
fxp

hanover Apr 12, 2009 7:32pm | Post# 4

Thank you, David. You're a prince.

I'll toss it on the front porch tonight and see if any cats take a bite.

IBFX's new five digit format won't be a problem I trust.
The plots look like spaghetti rather than cat food. Or worse, a can of worms that's been opened.

I've tried it on Alpari, which uses 5 dp, and it seems to work OK. In any case, every component of each plotted point is the ratio between two prices, so the number of dp shouldn't matter. However, the accuracy of your broker's data is crucial; missing candles or inaccurate prices will affect the output accordingly.

Jigsaw Apr 12, 2009 9:17pm | Post# 5

1 Attachment(s)
Hello Hanover sir,

Firstly, congratulations and thanks, looks like an awesome piece of work.


Secondly, may I ask, what do the "spaghetti lines" actually represent ?
Take the M15 one, is that . . . Blue line a visual description of how price performed relative to everything in the last 15 minutes.

A blue line represents a "rolling" 15 minute period, or does it "update" every fifteen minutes ?

I think I am explaining what I mean here poorly but I hope you understand the question.


Thirdly, I have a few different computers and multiple screens set up for trading, however upon setting up the indicator on different computers. It "looks different" on the different computers. The feed is exactly the same in both cases ( SIGTrader (All 28 cross pairs available, 4dp) )

Just wondering what you think is causing this (The problem could probably is on my end, considering how poor I am at basic computer stuff, lol but I did put the indicator itself in /experts/indicators and the other word file in /experts/files . . .

I think its a problem with the weekly timeframe section, it appears to not be functioning on the second pc. . .

Screen from Computer One (Other screen to follow, let me just go log in on the other computer)
Click to Enlarge

Name: Screen One.jpg
Size: 160 KB

Jigsaw Apr 12, 2009 9:20pm | Post# 6

1 Attachment(s)
And heres the second one which does not look like it is functioning properly.

Regards,
Jig

EDIT - The screenshots were taken within 10 seconds of each other, but it seems to be the sort of . . . "history" of the lines is a bit skewed from one to the other.
Click to Enlarge

Name: Screen2.jpg
Size: 151 KB

hanover Apr 13, 2009 1:24am | Post# 7

Hello Hanover sir,

Firstly, congratulations and thanks, looks like an awesome piece of work.


Secondly, may I ask, what do the "spaghetti lines" actually represent ?
Take the M15 one, is that . . . Blue line a visual description of how price performed relative to everything in the last 15 minutes.

A blue line represents a "rolling" 15 minute period, or does it "update" every fifteen minutes ?

I think I am explaining what I mean here poorly but I hope you understand the question.


Thirdly, I have a few different computers...
What do the spaghetti lines represent?

The best way is to understand the underlying calculation.

Let's take the AUD line on the H1 timeframe, for example, and (hypothetically) assume that your broker allows you to trade just 3 AUD-based pairs, AUDUSD, AUDJPY and AUDNZD. Let's also assume that you've set NumPoints = 5, and that the 16:00 candle is currently forming on your H1 chart. First, the indicator looks at AUDUSD, and goes back 5 completed candles, i.e. to the 11:00 candle. It then calculates the closing price of each of the 11:00, 12:00, 13:00, 14:00, 15:00 and 16:00 (currently forming) candles as a ratio of the first (11:00) candle. It then repeats this exercise for the AUDJPY and AUDNZD. Then it adds the ratios for each candle, so for the 13:00 candle for example, the result is [AUDUSD(13:00) / AUDUSD(11:00)] + [AUDJPY(13:00) / AUDJPY(11:00)] + [AUDNZD(13:00) / AUDNZD(11:00)]. The same applies for each of the other candles.

Note that this assumes that you've set the weights for each pair the same, i.e. 100. But if you've set the weight of AUDUSD to 200, then the calculation becomes [200 x AUDUSD(13:00) / AUDUSD(11:00)] + [100 x AUDUSD(13:00) / AUDJPY(11:00)] + [100 x AUDNZD(13:00) / AUDNZD(11:00)]

The weights are then summed, i.e. 200+100+100 = 400, and the total of the ratio for the 13:00 candle divided by the total of the weights,for the 13:00 candle. Same for all of the other candles. So, to explain all of this simply, you have a weighted average of the percent price increase/decrease of all AUD-based pairs, since 11:00, at each point 11:00, 12:00, 13:00, 14:00, 15:00 and the currently forming 16:00 candle. It's like you took the closing prices of each one of these candles across all 3 pairs, averaged them, and then plotted this average result.

All of that was for the AUD currency, producing the green line, showing the ratio at 11:00, 12:00, 13:00, 14:00, 15:00 and 16:00 as the line moves from left to right. The process is repeated for each other currency, producing the diffrerent colored lines.

A couple of other points. Constituent pairs for the USD currency include GBPUSD and also USDJPY. In the case of GBPUSD, each ratio is inverted, beacuse an increasing ratio means that USD is weakening. So the 13:00 candle would be comprised of [GBPUSD(11:00) / GBPUSD(13:00)] + [USDJPY(13:00) / USDJPY(11:00)] + ......
In this way, a strengthening USD (relative to other currencies) will always show as a rising line, and a weakening USD as a falling line.

There is also a SmoothingSMA parameter. This takes all of the ratios, and uses a simple moving average to smooth the result. So if you set the SmoothingSMA = 3, then the plot at 13:00 (for example) is actually the average of the 11:00, 12:00 and 13:00 weighted averages that were calculated as described above. If you set SmoothingSMA = 1, then a 1 period SMA means that no smoothing is performed.

The final step in the process takes all of the points for each currency plot (AUD, CAD, CHF, EUR, GBP, JPY, NZD, USD) each timeframe, and simply re-scales them so that they fit within a 0 to 100 grid. That gives the end result.

So what does all of this mean? Let's suppose that AUD is getting stronger against every other pair, between 11:00 and 16:00. Then it will show as a rising line in the H1 plot. If it is getting weaker, it will plot as a falling line.

In writing this indicator, it drove home the fact to me that is that there is no such thing as 'absolute' price in forex. A pair's 'price' is actually nothing more than a constantly changing ratio of the values between the constituent currencies, e.g. EURUSD's 'price' is really the ratio of EUR's value changing, measured against USD (and/or vice versa).


A blue line represents a "rolling" 15 minute period, or does it "update" every fifteen minutes ?

It depends on your RefreshEveryXMins setting. If this is 0, the plots update with every tick on the parent chart (the chart to which the indicator is attached). Actually, it's only the final point (on the currently forming candle) whose weighted-average ratio is changing, but the act of re-scaling the values to fit the 0 to 100 grid can cause the whole plot (for a given timeframe) to move around. But, apart from the rightmost (currently forming) point, the shape of the plotted points relative to each other should remain exactly the same.

If your RefreshEveryXMins setting is 1, 5, 15 etc, then an update will only occur immediately a new 1, 5 or 15 minute candle starts to form on the parent pair's chart.


Why are you getting different results on your different computers?

The indicator is performing the same calculation in each case. If the results are different, then the data has to be different - it is the only possible explanation. Because of the way in which the ratios are calculated, and the way in which results are scaled, this indicator is VERY data-sensitive. Slight vagaries in the data can potentially cause very different plots. If you set the NumPoints to a low (e.g. < 20) value, then these plots can swing wildly, especially on lower timeframes, as each new tick arrives. If you feel that you must use the indicator on the M1 and M5 timeframes, then you need to keep this in mind.

I believe that the calculation is working 100%. I spent a long time exporting values of all of the constituent currencies to Excel, having the latter perform the same calculations, and comparing the result.

I will try to find ways of making the indicator more robust, in terms of dealing with spikes caused by 'fast-moving' incoming data, and also with missing data. Currently, the best way to obtain meaningful plots is to use several (>30) data points, and apply some smoothing (e.g. SmoothingSMA = 3). However, supposing you have 30 points and smoothing = 3, then there needs to be at least 30+3=33 immediately prior candles, with none missing - depending on your broker, this might be a problem on higher (e.g. monthly) timeframes. Inusfficient data on ANY constiutuent pair will cause one of the colored plots to run along the zero line, destroying the whole plot. Also, if you're going to set NumPoints to a high number, remember that the currency's most recent strength/weakness is reflected in the direction/slope of the line near the RH edge of the plot. The position on the plot (high or low) is simply the averaged price ratio relative to the price ratio of the leftmost point.

There is also one bug that I know of - the vertical lines separating the timeframes lose their alignment, as new candles get added to the parent chart. This will be fixed in the next release. In the meantime, toggle between timeframes to tidy/replot the indicator.

Jigsaw Apr 13, 2009 8:50am | Post# 8

Thankyou very much for expounding on that, I think I have solved the earlier problem by simply adding them again a the same time. I understanding more clearly now.

Best regards,
Jig

hanover Apr 13, 2009 5:15pm | Post# 9

Version 1.01 is now available...........
 
1 Attachment(s)
This version adds the BasePoint parameter, and also fixes a bug where occasionally (especially on the M1 plot) a single zero value, caused when one of the currencies hadn't yet received a tick in any of its constituent pairs, corrupted the plot. The result was the affected currency would plot as a value of 0, with all others plotting as 100. Hopefully this is now fixed. See screenshot below.

The alignment problem, when the parent pair starts a new candle (displacing the plots one candle leftward) has also been fixed.

See post #1 for more info (including two new explanatory screenshots), and also to download v 1.01.
Click to Enlarge

Name: recent strength screenshot 2.GIF
Size: 29 KB

ha-pattern Apr 13, 2009 8:55pm | Post# 10

a different NumPoints value for each microchart
 
Your approach to multiple-pairs charting has opened my eyes in daytrading. I've a suggestion and a nuisance.

A different NumPoints value and scale value for each microchart would help resolve several issues. You noted the microchart changes severely with a different time the indicator's put on the chart; it also changes depending on NumPoints's value, that is, on how much time is included in all of the indicator's microcharts; and, there's the potential work time on charts for eight currencies, since one often gets a completely different group of currencies to study for the same scale and different NumPoints.

Also, x scales gives x-1 microcharts, the last missing (as in R. Candles.)

Even if these suggestions don't work for you, thanks for the great new indicator.

hanover Apr 14, 2009 1:19am | Post# 11

Your approach to multiple-pairs charting has opened my eyes in daytrading. I've a suggestion and a nuisance.

A different NumPoints value and scale value for each microchart would help resolve several issues....
I could easily modify the indicator to allow a different NumPoints (and also BasePoint and SmoothingSMA, if required) values for each timeframe. My only reservation would be that it makes a conceptually complex indicator even more so.

I'm not sure what you mean about the scaling. Do you mean horizontally or vertically? If vertically, then the final results (weight-averaged ratios) are scaled to fit into a 0 to 100 enclosure. Even if this scaling were altered, the curve shapes, slopes, intersection points, etc would not change.

ha-pattern Apr 14, 2009 4:51am | Post# 12

Thanks for considering. Your info (hope this makes my post understandable):
NumPoints (settings at 15,50,100,150,195 on the 5' each; I guess there's little difference): http://i44.tinypic.com/120h3c4.jpg
TimeFrame (what I meant when said 'scales', as in chart scales):
http://i42.tinypic.com/2hprltg.jpg , http://i44.tinypic.com/2nc2jja.jpg

EDIT: An addition. My last seven (demo) trades, all to the good, have been based on the NumPoints picture above, that is, reading their 5' timeframes to trade the 1', a great, even relaxing way to get a majority view on which pair has a high-probability situatoin to trade in bringing the highest and lowest currencies (except aud, nzd) into a pair, before the usual PA study. Maybe this'll break the demo habit...

copi88 Apr 14, 2009 9:35am | Post# 13

Thanks
 
Thanks for the indicator. This is going to be very useful.

Currently I have a separate piece of software that does essentially the same thing and I have been on the look out for one in MT. It will be interesting to see how closely the two resemble each other.

I have found it helpful in gauging the strength of a move in a Pair.
It is also useful in gauging the likelihood of the pair moving through a point of Support or Resistance.
I would often watch the strongest currency vs. the weakest one and wait for a retracement to a point of S or R and enter. These turned out to be very high probability trades.


Supa

weekapaugh Apr 14, 2009 9:38pm | Post# 14

Anybody else having trouble getting this to work? The indicator shows up but does not plot any lines. I have MT4 with IBFX.

hanover Apr 15, 2009 6:02am | Post# 15

1 Attachment(s)
Anybody else having trouble getting this to work? The indicator shows up but does not plot any lines. I have MT4 with IBFX.
I just created a demo account with IBFX - see the result below.

Two possible causes:

1. Lack of data. Solution: you need to go to each pair (and then to each timeframe), and press the PageUp key a few times, to load data for every pair/timeframe, from IBFX's server(s). The indicator can only plot whatever data is available. Incomplete or inaccurate data is reflected in the plots. I can not stress this highly enough. You can press F2 to load MT4's history center, and check what data is available for each pair/timeframe.

2. If you type a single timeframe (e.g. H1) into the TimeFrames parameter, no data will plot - you need to include a comma, i.e. H1,. I have fixed this oversight in the latest release, which I'll post soon.

If neither of these appears to be the problem, please list the parameters you're entering, and I'll investigate further.
Click to Enlarge

Name: weekapaugh1.jpg
Size: 61 KB

hanover Apr 15, 2009 3:46pm | Post# 16

Recent Prices and Recent Strength
 
2 Attachment(s)
The Recent Prices indicator can be used to illustrate how the Recent Strength indicator operates.


First Screenshot:

The upper plots (Recent Prices) show how NZD is performing against each of other currency (note: an asterisk in the legend denotes that the pair has been inverted, to allow NZD to be the 'featured' currency in each case).

The highlighted blue line in the lower plots (Recent Strength) summarises all of the lines in the upper plot, i.e. is a weighted average of the NZD performance against all currencies.


Second Screenshot:

I'm posting this to illustrate how the weights can potentially operate. In the first screenshot, all of the weights for the NZD-based pairs were set to 100. Note how, on the first screenshot, at the red arrow, NZD falls relative to GBP (red line in the upper plot), but rises on average against all pairs (blue line in the lower plot).

For the second screenshot, I increased the weight of GBPNZD to 2000, i.e. to give it 20x the weight, and the result shows, as the NZD now falls on average against all pairs, on the red arrow day.

There's an even clearer example of the 'overweight' GBP, about 3 points in from the left of the W1 chart.


I don't know why anybody would want to apply anything other than equal weights across the board, but the facility is there just in case somebody finds a (profitable) use for it.
Click to Enlarge

Name: recent strength screenshot 3.jpg
Size: 206 KB
Click to Enlarge

Name: recent strength screenshot 3a.jpg
Size: 205 KB

hanover May 4, 2009 8:20pm | Post# 17

Version 1.02 is available.......
 
1 Attachment(s)
V 1.02 can be downloaded from post #1.

I made some minor modifications, and also added the ShowPointCount parameter. This displays a count of the number of candles left/right of the BasePoint, at the top of the plot. The BasePoint was set to 0 in the screenshot below.
Click to Enlarge

Name: recent strength screenshot 3.GIF
Size: 21 KB

availdollars May 8, 2009 2:12am | Post# 18

I use a mix of gbp,usd, jyp, eur, so how can i use the indi to show exclusive interrelation of the 4 pairs

hanover May 9, 2009 3:48am | Post# 19

2 Attachment(s)
I use a mix of gbp,usd, jyp, eur, so how can i use the indi to show exclusive interrelation of the 4 pairs
Cut and paste the parameters shown below into the Presets---Recent Strength.TXT file, and your plot should look something like the screenshot.

Or alternatively, simply download the attached file into your ...../experts/files folder.

The parameters in the file will override those entered when you attach the indicator.

Note that this is gathering data only from pairs EURGBP, EURJPY, EURUSD, GBPUSD, GBPJPY, USDJPY. THis assumes that all of these pairs are being offered by your broker. Any that are not supplied should be removed from the list below. Conversely, if you want to gather data from other pairs (e.g. USDCHF for the USD plot), then change

C8_Pairs_Wgts = "EURUSD,100, GBPUSD,100, USDJPY,100";

to read

C8_Pairs_Wgts = "EURUSD,100, GBPUSD,100, USDJPY,100, USDCHF,100";


If any of this is not clear, please feel welcome to post again.

Inserted Code
   ___Currency1___       = "";
   C1_Color              = Green;
   C1_Style              = 20;
   C1_Pairs_Wgts         = "";
;
   ___Currency2___       = "";
   C2_Color              = Chocolate;
   C2_Style              = 20;
   C2_Pairs_Wgts         = "";
;
   ___Currency3___       = "";
   C3_Color              = Yellow;
   C3_Style              = 20;
   C3_Pairs_Wgts         = "";
;
   ___Currency4___       = "EUR";
   C4_Color              = Yellow;
   C4_Style              = 20;
   C4_Pairs_Wgts         = "EURUSD,100, EURGBP,100, EURJPY,100";
;
   ___Currency5___       = "GBP";
   C5_Color              = Red;
   C5_Style              = 20;
   C5_Pairs_Wgts         = "GBPUSD,100, EURGBP,100, GBPJPY,100";
;
   ___Currency6___       = "JPY";
   C6_Color              = SkyBlue;
   C6_Style              = 20;
   C6_Pairs_Wgts         = "USDJPY,100, EURJPY,100, GBPJPY,100";
;
   ___Currency7___       = "";
   C7_Color              = DeepSkyBlue;
   C7_Style              = 20;
   C7_Pairs_Wgts         = "";
;
   ___Currency8___       = "USD";
   C8_Color              = Green;
   C8_Style              = 20;
   C8_Pairs_Wgts         = "EURUSD,100, GBPUSD,100, USDJPY,100";
Presets---Recent Strength.txt
Click to Enlarge

Name: avail.GIF
Size: 16 KB

hanover May 9, 2009 4:40am | Post# 20

One possible way of using the Recent Strength indicator
 
2 Attachment(s)
The following illustrates a possible strategy for using this indicator. Obviously there are dozens of other ways it could potentially be used. This is merely a suggestion; perform your own research to test the idea(s) further.

The leftmost screenshot shows how the D1 plot would have looked 8 days ago. This is with the parameter BasePoint = 0. Note how the white line is at the highest at the left of the chart, then it FALLS to the BasePoint. This means that USD had fallen, %-wise when measured against all other currencies, more than any other currency, in the previous 7 days. Conversely, the brown line is the lowest, and has RISEN the greatest distance to the BasePoint. This means that,8 days ago, CAD had been the high-flyer for the previous 7 days.

Note also the lower peaks shown by the white dashed line. This is bearish for USD. The rising peaks are bullish for CAD. Both are akin to entering when a trend resumes following a pullback.

Now look at the next screenshot. USD has continued its trend downward, and CAD its trend upward. Exactly what we were hoping for!

This is all borne out in the USDCSD,D1 chart (final screenshot). The yellow arrow shows the position 8 days ago. The yellow channel obviously highlights a heavy downtrend, and (as one possible strategy) one could have shorted the pair when the horizontal support line was broken. The resulting profit is obvious.


Used judiciously, Recent Strength is a great supporting indicator. It can tell you which pair(s) you should be focusing on, placing the probabilities further in your favor. And then you can apply your favorite technical strategy to trade those pairs. If, for example, your entries involve candle patterns, you'll frequently find similar patterns occurring simultaneously across many pairs. Recent Strength can help you decide which pair has the greatest potential to make the biggest move. In other words, by trading the strongest currency against the weakest.

Recent Strength is 'semi-independent', in that it brings data into the mix from other pairs, other than just a candidate pair's price (unlike indicators derived directly from that price). However, it is NOT a leading indicator any more than price itself is a leading indicator. But since all trend-following TA is based on the concept that prior trends will, on balance of probability, continue, then the trends occurring in Recent Strength are every bit as 'predictive' as those occurring on any price chart.

Here's another good reason to use Recent Strength. When you have two pairs moving in opposite directions as strongly as USD and CAD were in the example, then it would take BOTH lines to change direction, in order for price to reverse. Provided that one of the lines holds its direction, the worst that can happen is that price will move sideways. So, in one sense, you're effectively doubling your probability of making a successful trade.

If similar trends are confirmed on higher Recent Strength timeframes, then the probability of a successful trade increases even further. On lower timeframes, you can see microcosmically how momentum is shifting across the currencies, possibly alerting you to impending entry setups on your price charts.

And of course a good time to exit (or scale out) is when the relationship between the relevant currency plots starts to break down, complementing your favorite exit strategies.

Obviously you should avoid trading correlated currencies (plots moving in the same direction), or currencies whose plots are zigzagging above and below the waterline created by the BasePoint. A good time to stay out of the market altogether is when all of the currency plots are peforming this zigzag in a narrowing range (which frequently happens during market 'quiet times').

If you set BasePoint = 0, then you can look back any number of hours (set ShowPointCount = true to display a candle count), and see which currency has moved the most, upward or downward, %-wise averaged across all other currencies, from any given prior point.

I've been studying the moves in Recent Strength alongside price charts. You can see what caused a given candle (from close to close) to move the way that it did, i.e. which currency is 'driving' the pair. For example, if USD moves strongly upward, while CAD moves only weakly upward, then USDCAD will have risen across that period. If you know which is the driving currency, you can sometimes anticipate a move, and enter early (with suitable risk management, of course ). In the USDCAD example, USD's relative strength turns downward one day before CAD's does (from point -2 to point -1 in the plot). Aggressive traders could have used this info to enter on the close of the candle PRIOR to the yellow arrow in the final screenshot. (Well, I did say 'aggressive', LOL).

Students of Joel Rensink (TheRealThing) and Peter Crowns will know that their trading is based around 'aggregation of edges'. Peter talks about trading the 'hot hand' (strongest versus weakest currency) in the No Free Lunch (DIBS) thread. Recent Strength can provide a semi-independent edge that also helps you to ascertain the 'hot hand'.

You can also use Recent Strength to study correlation. Note how, in the screenshot, EUR and CHF are strongly correlated; USD and JPY likewise. The lines tend to follow each other, and also zig and zag in harmony, in similar places. Trading highly correlated pairs against each other (the 'cold hand') will lead to poor results, for obvious reasons. If you look at the last 20-30 days of a EURCHF chart, you'll see that it's maintained a tight channel, making the trading of large moves near impossible.

One final point. Remember that the plots are based on relative percentages, NOT pips. When viewed %-wise, the plots of the Asian pairs (esp JPY, and also NZD) tend to move in exaggerated fashion, relative to their 'pip potential', while EUR and CHF are understated. In other words, while the direction of the plot remains 100% good, you'll potentially gain just as many pips from a smaller move in EUR's or CHF's Relative Strength plot, as you would from a larger move in JPY's or NZD's plot. The next version of the indicator (due for realease tomorrow) will include a ScaleFactor parameter, to which you can assign your own arbitrary values to correct this imbalance.


NOTE: If the above sounded like a sales pitch, it wasn't intended that way. The indicator is provided free of charge, LOL. Use it if and however you see fit, and judge its value (or lack of) for yourself. The above example was obviously carefully chosen to illustrate the points I wanted to make.
Click to Enlarge

Name: recent strength USD and CAD.GIF
Size: 41 KB
Click to Enlarge

Name: recent strength usdcad.gif
Size: 18 KB


© Forex Factory