Login Page - Create Account

Support Board


Date/Time: Sat, 19 Jan 2019 21:58:01 +0000



[User Discussion] - Offering To The Community: Forex: Currency Decorrelation (and Currency Strength)

Support Request:
[2016-05-02 07:18:44]
bjohnson777 (Brett Johnson) - Posts: 251
Since "Forex: Currency Strength" relies on this program, I've compiled them together and posted them here. Please keep discussions about "Forex: Currency Decorrelation" here and "Forex: Currency Strength" at the separate link below.

For documentation on "Forex: Currency Strength" go here:
https://www.sierrachart.com/SupportBoard.php?ThreadID=22025

This currency decorrelation program is a little more advanced than most. Having the price scale in a currency is far easier to read and compare movements.

----------
From the "Display Study Documentation" button:

Forex: Currency Decorrelation. Also allows for calculating Cross Currencies/Minor Currencies. This program will form the base for my Forex currency strength programs. The Sierra Chart Data Service has the 8 major currencies decorrelated, but the scaling between each has diverged and is hard to compare. Other currency decorrelation programs are also like that. This program displays the price scale in the currency that is decorrelated. In settings, check "Display As Main Price Graph" to see this. There is also an option to convert the currency price scale to a different currency. This is helpful for those people wishing to see the index line(s) in their native currency.

This program includes a function to decorrelate other currencies and display them on the graph with the same scaling. This will show currency movement relative to the others and their highs and lows. This will help you select the best pair for trading. Since all currencies are proportionally scaled to each other, they will be normalized to 1.0 using the "Bars Back" option. A generally good number is 300 for this. You don't want the bars to be too far back or the index lines will separate and be hard to compare. This is discussed in the settings option below.

Note: The various calculations used to produce the index lines are a type of average. They are close but not exact. There is no absolute price for an index line. This is also true of other programs using these calculations. Multiple index lines will be properly scaled to each other. Expect them to move up and down a little. This is normal. The relationships between the index lines will still be the same. The distance relationships and patterns are what's important.
In physics, there are fixed known quantities that graph lines can be converted against. In finance, there is no such thing. Ideally one of the major commodities "should" fill that role, but over the past several years they all have moved around too much to be useful.

Default Example. To decorrelate USD and see the other 7 major currencies in scaled USD spacing, open any historical/daily symbol into a new chartbook, select Main Menu >> Chart >> Chart Settings and change "Use Number Of Days To Load" to greater than 500, load this program, change "Are you ready for MANY open windows?" to Yes, change "Decorrelate Other Currencies?" to Yes, select "Display As Main Price Graph", and hit OK. Go to Main Menu >> CW to select your original chart again. You may need to select Main Menu >> Chart >> Recalculate after the other charts finish loading their data (default keys: CTRL-INSERT or just INSERT). Select the graph region and hit the down arrow on the keyboard to bring the bar spacing down to 1. The white line will be USD. The colored lines are labeled at the top of the chart.

Note: This program will open a chart window for each symbol in the list. Sierra Chart requires an open window to get the symbol data. With a long symbol list, the number of windows will quickly become difficult to manage. It is recommended to run this program in its own chartbook so the extra windows are contained. The extra windows can be hidden or minimized. This is recommended to reduce the CPU load for drawing graphics that won't be seen. To return to your first window, use the CW menu to find your original symbol. The new index will be on this chart and not any of the others. If a source chart window gets closed, the program will have an internal error for that symbol. To bring the window back, go back into the study settings, exit the window, and everything should be recreated (or use Main Menu >> Chart >> Recalculate, CTRL-INSERT, or INSERT). If the chart's time frame is changed, new data chart windows will be opened for each symbol in the new time frame. This can create an excessive number of windows if you're not paying attention.

Note: The index lines will not be correctly drawn until all the other charts have finished downloading historical data. Sometimes malformed index lines get drawn until the other charts finish downloading. Sometimes those lines will be jumping around, too. This is normal behavior. If the index lines get stuck, either select Main Menu >> Chart >> Recalculate, hit CTRL-INSERT, hit INSERT, or go into the study settings and exit to manually force a redraw.

The symbol list format is discussed in the settings section below. Be careful that everything is typed in accurately. A malformed symbol list will have an undefined behavior. At the bottom of the settings window are 2 flags for number of symbols found and number of symbols used. If the used flag is less than found, there was an error loading one of the charts. A weight for each symbol is allowed for manipulation. Generally weights are not used in Forex, but the option is there. The symbol list was chosen to be a text string for ease of use, backup, and sharing. Once the graph loads, you can go back into settings and copy out a cleaned symbol list to a text editor to save as a backup or as a different version of an index you are working on. If you create an interesting index, you are encouraged to share it by copying and pasting the symbol list to a message board. If someone else posts an interesting symbol list, copy and paste it into the symbol list box in the settings window to see the new index.

Calculation. Equation: Index = 1.0 / ( sum(1.0/USDXXX) + sum(YYYUSD) )
Where: USDXXX is all the symbols with USD in the base currency position (like USD/JPY). YYYUSD is all the symbols with USD in the counter currency position (like EUR/USD).
For a USD index, calculating another currency keeping the scaling ratio: Base Currency Position: JPYi = USDi / USDJPY. Counter Currency Position: EURi = USDi * EURUSD.
Problem: None of the currencies are normalized in these equations. Some will have much greater weights than others. Solution: USD should be in the counter currency position (invert if not). Set a multiplier so that the USD currency value of the current bar equals $1.00 (USD in this example). Other currencies set to decorrelate are also set to 1.0 on the current bar when this program is loaded or recalculated. This essentially sets the high and low to a percentage value above and below 1.0. Each currency can be accurately compared internally to generate the decorrelated average. If data is missing, Sierra Chart might use the last completed bar to fill it in. If the bar is 0.0, this program will remove it from the average for that bar.

General Sierra Chart Notes. For each chart, Sierra Chart will try to load as many days as in Chart Settings >> Use Number Of Days To Load. Do NOT load an excessive number of days for an intra day chart. It will create a very heavy processing load and slow down Sierra Chart. With the way the index is calculated, I could not use Sierra Chart's internal moving averages to smooth the lines out. It is still easy to add one, though. Go into "Study Settings", select this study and mark it hidden, add a moving average study after this one, change "Based On" to "Forex: Currency Decorrelation", change "Input Data" to "XXX Index", and change "Scale" to "Independent". The same steps can be used for my Moving Average Ribbon or Bollinger Band Ribbon. To get rid of the source graph, use the "Display As Main Price Graph" settings option. Be sure to rename the graph tab to something meaningful. From there, studies like moving averages and Bollinger Bands (even MACD) will use the index as their data sources. SAR, trend, and Fibonacci lines can also be drawn. This offers some interesting index analysis options. Studies that depend on bars and volume will not work since the index is only a line.

Ideal Trading: Pick currencies that are moving opposite to each other. Less Ideal: pick one currency that's moving and the other is flat. Less Ideal: Pick both currencies moving the same direction but one is much faster than the other. Don't Trade: If the 2 currencies are flat, that is a bad trade. Don't Trade: If the 2 currencies are moving evenly with each other, that is a bad trade.

Observation: Open a 5min or 15min chart with the entire day visible on the screen and enable all the Other Currencies option. Change the Bars Back option if all the index lines are away from each other. It's easy to see when the market is active and dies off when the index lines go flat. Use this to determine the best time of day for your trading style.

Currency Lists. If you have the Sierra Chart Data Service, these can be copied and pasted into this program to generate an index for the listed currency.

Major Currencies:
AUD (Australian Dollar): AUDCAD (AUD CAD), AUDCHF (AUD CHF), AUDJPY (AUD JPY), AUDNZD (AUD NZD), AUDUSD (AUD USD), EURAUD (EUR AUD), GBPAUD (GBP AUD)
CAD (Canadian Dollar): AUDCAD (AUD CAD), CADCHF (CAD CHF), CADJPY (CAD JPY), EURCAD (EUR CAD), GBPCAD (GBP CAD), NZDCAD (NZD CAD), USDCAD (USD CAD)
CHF (Swiss Franc): AUDCHF (AUD CHF), CADCHF (CAD CHF), CHFJPY (CHF JPY), EURCHF (EUR CHF), GBPCHF (GBP CHF), NZDCHF (NZD CHF), USDCHF (USD CHF)
CHF (Swiss Franc extended): AUDCHF (AUD CHF), CADCHF (CAD CHF), CHFJPY (CHF JPY), CHFNOK (CHF NOK), CHFSEK (CHF SEK), EURCHF (EUR CHF), GBPCHF (GBP CHF), NZDCHF (NZD CHF), USDCHF (USD CHF)
EUR (Euro): EURAUD (EUR AUD), EURCAD (EUR CAD), EURCHF (EUR CHF), EURGBP (EUR GBP), EURJPY (EUR JPY), EURNZD (EUR NZD), EURUSD (EUR USD)
EUR (Euro extended): EURAUD (EUR AUD), EURCAD (EUR CAD), EURCHF (EUR CHF), EURCZK (EUR CZK), EURDKK (EUR DKK), EURGBP (EUR GBP), EURJPY (EUR JPY), EURNOK (EUR NOK), EURNZD (EUR NZD), EURSEK (EUR SEK), EURTRY (EUR TRY), EURUSD (EUR USD)
GBP (British Pound): EURGBP (EUR GBP), GBPAUD (GBP AUD), GBPCAD (GBP CAD), GBPCHF (GBP CHF), GBPJPY (GBP JPY), GBPNZD (GBP NZD), GBPUSD (GBP USD)
GBP (British Pound extended): EURGBP (EUR GBP), GBPAUD (GBP AUD), GBPCAD (GBP CAD), GBPCHF (GBP CHF), GBPDKK (GBP DKK), GBPHKD (GBP HKD), GBPJPY (GBP JPY), GBPMXN (GBP MXN), GBPNOK (GBP NOK), GBPNZD (GBP NZD), GBPSEK (GBP SEK), GBPSGD (GBP SGD), GBPUSD (GBP USD)
NZD (New Zealand Dollar): AUDNZD (AUD NZD), EURNZD (EUR NZD), GBPNZD (GBP NZD), NZDCAD (NZD CAD), NZDCHF (NZD CHF), NZDJPY (NZD JPY), NZDUSD (NZD USD)
JPY (Japanese Yen): AUDJPY (AUD JPY), CADJPY (CAD JPY), CHFJPY (CHF JPY), EURJPY (EUR JPY), GBPJPY (GBP JPY), NZDJPY (NZD JPY), USDJPY (USD JPY)
JPY (Japanese Yen extended): AUDJPY (AUD JPY), CADJPY (CAD JPY), CHFJPY (CHF JPY), DKKJPY (DKK JPY), EURJPY (EUR JPY), GBPJPY (GBP JPY), HKDJPY (HKD JPY), NOKJPY (NOK JPY), NZDJPY (NZD JPY), SEKJPY (SEK JPY), SGDJPY (SGD JPY), TRYJPY (TRY JPY), USDJPY (USD JPY), ZARJPY (ZAR JPY)
USD (US Dollar): AUDUSD (AUD USD), EURUSD (EUR USD), GBPUSD (GBP USD), NZDUSD (NZD USD), USDCAD (USD CAD), USDCHF (USD CHF), USDJPY (USD JPY)
USD (US Dollar extended): AUDUSD (AUD USD), EURUSD (EUR USD), GBPUSD (GBP USD), NZDUSD (NZD USD), USDCAD (USD CAD), USDCHF (USD CHF), USDCHN (USD CHN), USDDKK (USD DKK), USDHKD (USD HKD), USDJPY (USD JPY), USDMXN (USD MXN), USDNOK (USD NOK), USDRUB (USD RUB), USDSEK (USD SEK), USDSGD (USD SGD), USDTRY (USD TRY), USDZAR (USD ZAR)

Cross Currencies
NOK (Norwegian Krone): CHFNOK (CHF NOK), EURNOK (EUR NOK), GBPNOK (GBP NOK), NOKJPY (NOK JPY), USDNOK (USD NOK)
SEK (Swedish Krone): CHFSEK (CHF SEK), EURSEK (EUR SEK), GBPSEK (GBP SEK), SEKJPY (SEK JPY), USDSEK (USD SEK)
DKK (Danish Krone): DKKJPY (DKK JPY), EURDKK (EUR DKK), GBPDKK (GBP DKK), USDDKK (USD DKK)
TRY (Turkish Lira): EURTRY (EUR TRY), TRYJPY (TRY JPY), USDTRY (USD TRY)
HKD (Hong Kong Dollar): GBPHKD (GBP HKD), HKDJPY (HKD JPY), USDHKD (USD HKD)
MXN (Mexican Peso): GBPMXN (GBP MXN), USDMXN (USD MXN)
SGD (Singapore Dollar): GBPSGD (GBP SGD), SGDJPY (SGD JPY), USDSGD (USD SGD)
ZAR (South African Rand): USDZAR (USD ZAR), ZARJPY (ZAR JPY)

Observations:
Most decorrelations should have 3 or more currency pairs to start being accurate.
Some of the lightly traded cross currencies may be missing data and might skew the index line. This is a data source problem, not a problem with this program.
The Sierra Chart Data Service also has symbols like "^USDINR" for US Dollar / Indian Rupee. In the Symbol List it would be entered as "^USDINR (USD INR)". Note that some of the symbols starting with ^ are lightly traded and some are missing data. Check them carefully before using them. The symbols that are complete can be used to decorrelate many other currencies.
The GBPDKK 2015 spike problem throws off the calculation for both. DKK should normally be left out of a GBP decorrelation on higher time scales.
If you have XAUUSD, it is set up kind of like a currency. Gold: XAU, Currency: USD, USD per troy ounce of gold. Enter "XAUUSD (XAU USD)" in the Symbol List. The Sierra Chart Data Service also has other currencies paired up with gold.
The US Dollar Index (USDX) is a complex calculation with a couple dozen different currencies each of different weights that periodically get changed. Reproducing that index with this program is mostly possible but not really recommended. The USDX doesn't follow Forex actuality very well.

If you're running linux, you can use the command line to search for a symbol and generate a CSV list. For this program, the list will still need cleaning and the currency symbols split up, but this is much easier than manually searching through the "Find Symbol" scroll box. First go into the install directory and generate the symbol list:

cat GlobalSymbolSettings.xml | grep -i '<symbol>' | tr -d '\t' | tr -d ' ' | cut -d\> -f2 | cut -d\< -f1 > sc_symbols.lst

Search for the symbol (USD in this example):

grep -i 'USD' sc_symbols.lst | tr '\n' ' ' | sed s/' '/', '/g | sed s/', $'/''/ ; echo

----------------------------------------
Input Descriptions


Are you ready for MANY open windows?
Enables study. A window for each symbol must be open to get data from it. A long symbol list will create a lot of windows. It is recommended to put each index in its own chartbook for organization.

Currency To Decorrelate
This is the currency to decorrelate (extract) from the symbol list. If you want to create a graph of USD, then enter USD here.
Symbol List (sym1 (XXX YYY) 1.0, ...)
Enter a list of broker symbols containing the extraction currency that will be used to decorrelate that currency. Format: BrokerSymbolName (BaseCurrency CounterCurrency) Weight. BrokerSymbolName is the name of the symbol used by the broker to load the chart. It may be a complex name (as opposed to EURUSD) and capitalization may matter. BaseCurrency is the currency name of the symbol in the base currency position (for EURUSD, it would be EUR). CounterCurrency is the currency name of the symbol in the counter currency position (for EURUSD, it would be USD). Weight is a floating point number and is optional. A weight of 1.0 corresponds to 100%. A weight of 0.5 corresponds to 50%. Manually entering in BaseCurrency and CounterCurrency allows for a BrokerSymbolName that may not be easily automatically parseable. An invalid symbol list will produce undefined results.

Input Data
Usually "Last" for Close or "HLC Avg" for Typical Price.

Intraday: Load Weekend Data?
Load weekend intraday data if available. This does not load weekend data for historical daily bars.

Convert Scale To Another Currency?
If No, the price scale will be in the units of the extracted currency. If Yes, the price scale will be converted to the conversion currency below. You need to select "Display As Main Price Graph" to see the new scale.

Currency To Convert Scale To
If enabled, the price scale will be converted to this currency.

Currency Conversion Symbol (sym1 (XXX YYY))
This is the Broker Symbol that contains both the extraction currency and the conversion currency. The format is the same as the Symbol List above but without the weight.

Decorrelate Other Currencies?
Once the main decorrelated currency at the top is extracted, other currencies with the decorrelated currency in them can be extracted.

Other Currencies Bars Back
Number of bars back to go to set the other currencies equal to 1.0 for normalization. From that point forward, the other currencies will move normally proportional to each other. If there is no data, this function will hunt forward until it finds something so the index line won't be set to zeros. Set this to 0 for the first bar in the graph. The generally best setting would have all of the currencies in a roughly rectangular area without one going too high or too low beyond all the others. This gives a rough estimation of currencies that are overbought or oversold. Keep in mind that if a currency breaks past the rectangular area, it may not be in an over bought/sold condition if the Bars Back number is changed. The price numbers are not absolute (it will shift some), but all numbers are scaled properly to each other. 300 bars back seems to be a good choice for most time frames.

Other Currencies Symbol List (sym1 (XXX YYY), sym2 (XXX YYY), ...)
This format is the same as the Symbol List above. Enter symbols that contain the main decorrelated currency and the other currency will be graphed with the main decorrelated currency. The scales of the newly graphed currencies will be proportional to the main decorrelated currency for easy comparison. To see the numbers, you need to select "Display As Main Price Graph".

Limit Number Of Open Charts
Safety Setting. Opening different time frames will open matching charts for that time frame. The number of charts can quickly get out of hand and eat up all the system resources. Any chart above the given number will cause this program to disable itself and remove the index line. There is also a strange upgrade condition that might cause an infinite chart loop. This setting will stop that once the limit number is reached. Use "Close Charts" to close the unused charts. Set to 0 to disable (not recommended). If you do disable, make sure your symbol list and other charts in the chartbook are backed up because you will not be able to get back to them in an infinite loop.

Close All Other Charts?
If set to "One Shot", will close all other charts in the chart book except this one. This is used to close charts that are not part of the index and taking up resources. You will need to go back into settings and exit to redraw the index after this runs. WARNING: This will not save any data from an opened chart that gets closed.

Highest Chart Number To Close
Used with "Close All Other Charts". Sierra Chart does not have an open charts array, yet. This is the highest chart number you see open that will be closed. Default is 210. Higher is OK but will slow down the program call slightly.

FLAG: Number Of Symbols Found
This is a Flag reporting the number of symbols found in the Symbol List (not necessarily openable symbols). Changing it will not do anything.

FLAG: Active Symbols Used
This is a Flag reporting the number of symbols actively being used in the calculations. If this number is less than the found symbols above, then there were errors opening the missing charts. Changing it will not do anything.

FLAG: Other Active Symbols Used
This is a Flag reporting the number of symbols actively being used in the Other Currencies Symbol List calculations. Changing it will not do anything.

-----
Update: 2016-12-06. Added new Minimize window function from ACSIL.
Regular compiles moved to "Brett Johnson's Standard Tool Kit" DLL.
https://www.sierrachart.com/SupportBoard.php?ThreadID=18945
Date Time Of Last Edit: 2016-12-07 05:41:32
attachmentForex_CurrencyDecorrelationAndCurrencyStrength.cpp - Attached On 2016-12-07 05:41:17 UTC - Size: 125.82 KB - 264 views
attachmentForex_CurrencyDecorrelationAndCurrencyStrength.dll - Attached On 2016-12-07 05:41:24 UTC - Size: 178 KB - 232 views
[2016-07-20 09:16:19]
bjohnson777 (Brett Johnson) - Posts: 251
Update:

Added Currency Strength and made some minor modifications to Currency Decorrelation to make the 2 programs work together easier.

Remember that "Forex: Currency Decorrelation" depends on a bunch of extra charts that have to load. Given the delay, the initial chart may not look right and will need to be recalculated by:
Chart >> Recalculate
or
CTRL-INSERT
or
INSERT
[2016-10-15 06:44:40]
bjohnson777 (Brett Johnson) - Posts: 251
Today's DLL was compiled with the M$VC++ change over.
You may need to update your SC version.
Keep your previous DLL version until you've tested the new compile.
Most changes were made to shut up useless M$VC++ warnings when compiling.
There are a few compile warnings left about "argument" that can be ignored.
No real functionality changes have been made.
[2016-11-12 20:22:22]
bjohnson777 (Brett Johnson) - Posts: 251
Minor update now using the "Get Highest Chart Number In Chart Book" function simplifying the "Close All Other Charts" options in the Settings window. I also added a forced recalculate to reopen the needed data windows. Previously the other windows would not reopen like they should have.

Double check your settings window to make sure the options didn't get scrambled.
[2016-12-07 05:41:59]
bjohnson777 (Brett Johnson) - Posts: 251
Update:

Added new Minimize window function from ACSIL.
[2018-10-27 13:33:43]
Halco - Posts: 83
Hi. This is really great. Thanks for all your work.

A few questions:

Is it possible to view the index as candlesticks instead of a line?

I tried to put a Ratio study on one of the pairs compared to the index but it doesn't show up. Is there some setting I need to adjust to do this?

You write "Solution: USD should be in the counter currency position (invert if not)." Are we supposed to invert the individual charts ourselves or does your study already do this?

Thanks again. This can be extremely useful.
[2018-10-27 17:36:13]
Halco - Posts: 83
I was able to plot the Ratio study by using OPEN. I displaced the study -1. It seems to be accurate.
Date Time Of Last Edit: 2018-10-27 17:36:32
[2018-10-28 05:02:45]
bjohnson777 (Brett Johnson) - Posts: 251
1) Thanks :-)

2) Making these into candlesticks is far more difficult than it sounds... esp. in the limited execution environment of a chart study. For now, only line graphs are available.

3) I haven't tried Ratio, but thanks to Halco for the answer.

4) Inversion was more of a math argument about how things should be done internally. Some currency decorrelators are poorly written and don't do everything that they should. You don't have to do anything except enter the symbols and settings you want.
[2018-11-11 23:49:49]
Halco - Posts: 83
http://www.sierrachart.com/image.php?Image=1541979931449.png


Attached is a chart showing one way one might use Brett's excellent decorrelated indexes with Relative Strength (Ratio in Sierra Charts). First pane is a 4-hour price chart of the EURJPY; 2nd pane is the the EUR decorrelated index, composed of the major currencies; 3rd pane is relative strength, EURJPY/EUR INDEX with std dev bands on a 20 period EMA; 4th pane is relative strength, EUR INDEX/JPY INDEX (JPY INDEX not shown on this chart) with std dev bands on a 20 period EMA. I'm not going to get into a lot of technical analysis here, this is just a basic example of how one could use RS.

At point A the EURJPY goes into a tight trading range; B to C rising supports form an ascending triangle; B to C the EUR INDEX (2nd pane) is now uptrending while the EURJPY holds its own (mostly flat) against the EUR INDEX (3rd pane), as the EUR INDEX shows good relative strength against the JPY INDEX (4th pane), crossing the ema and then riding it.

Following C the EURJPY breaks out to new highs as the EUR INDEX, the EURJPY/EUR INDEX RS and the EUR INDEX/JPY INDEX RS all also make new highs, a very positive confirmation of the EURJPY breakout.

C to D EURJPY is in a nice uptrending channel with shallow pullbacks on mostly tight spreads. During this time the EUR INDEX also uptrending well; EURJPY/EUR INDEX RS rides its uptrending 20 period ema; EUR INDEX/JPY INDEX RS is trending very strong, staying well above its 20 period ema.

At E is the widest spread up bar in the EURJPY since around A, possibly climatic action, while the EUR INDEX has gone flat and both the RS lines have become over-extended as they both violate the upper std dev bands.

At F is a "change of character" in EURJPY as it's the deepest pullback on wider spreads, while the EUR INDEX is flat or possibly rolling over and both the RS lines have rolled over sharply and crossed below their 20 period ema's back to the bottom std dev band.

The EUR INDEX and the two RS indicators confirm the price behavior of the EURJPY very nicely in this chart.

Relative Strength lends itself to traditional technical analysis quite well - it trends, ranges, reverts to the mean, becomes overextended. For those interested in learning more about RS there is an excellent book called "Patterns of Relative Strength" by Isaac J. Israel, an oversized book of 200 pages with at least 100 charts that is an exhaustive study of RS. It can be found used on Amazon for a few bucks.
Date Time Of Last Edit: 2018-11-12 00:18:16
[2018-11-12 01:38:29]
Halco - Posts: 83
http://www.sierrachart.com/image.php?Image=1541986377840.png


Examining the chart again, the RS of EUR INDEX/JPY INDEX is very highly correlated with the EUR/JPY pair (makes sense) so it might be more useful to just put the JPY INDEX on the chart instead. Here we can see the JPY INDEX (4th pane) also helps to confirm EUR/JPY price behavior at the marked points on the chart.

Using these indexes along with RS is certainly something that I think merits further analysis for confirmations and divergences.
[2018-11-12 19:49:22]
bjohnson777 (Brett Johnson) - Posts: 251
Thanks for sharing. :-)

Expanding your explanation just a little... With JPY INDEX on the second image, it's pretty clear the Point E jump is due to JPY and not EUR. Then from E-F going down, it's mostly due to JPY INDEX coming back up while EUR INDEX is mostly flat then starts going down.

I really like how decorrelation splits out and shows what's happening under the hood.
[2018-11-13 04:29:42]
Halco - Posts: 83
Hey Brett, I having problems drawing lines on the indexes. They shift when you recalculate or when you close and re-open the chartbook. They can shift considerably. I've tried various tool settings but it hasn't helped. Any solution you know of? Thanks.
[2018-11-13 14:22:20]
Halco - Posts: 83
Hmmm. I think choosing "Interactive Scale Locked" might do it.
[2018-11-13 23:23:57]
bjohnson777 (Brett Johnson) - Posts: 251
Unfortunately that's to be expected without having a way to lock them down to a known fixed quantity of something. I mention that above in the first note.
[2018-11-14 00:03:50]
Halco - Posts: 83
Ok. Locking the scale does seem to help as far as when you close and re-open the chart. It seems to shift mainly now if you add/remove a study, so it's probably best to figure out which studies you want to use before you start drawing lines.

Not sure if this is useful but just experimenting, on this chart I was able to plot volume by adding the study "Sum Charts from List". I have a setting of 1 to avg it out between the charts. Then I added a spreadsheet study. There's also a 20 period simple moving avg of the volume.

http://www.sierrachart.com/image.php?Image=154215375368.png
[2018-11-15 02:15:42]
Halco - Posts: 83
Hi Brett. I had a couple ideas about drawing lines. BTW, I am NOT complaining here. I think your decorrelated FX indexes are the greatest thing since sliced bread. I'm surprised there haven't been more responses to this thread and your work here.

Anyway, I draw a lot of lines because it helps me to see the signals in all the noise. I was thinking of two possible solutions to the "shifting lines" issue but I have to do some reading of the documentation to figure out exactly how to go about it. I just thought I'd ask for your opinion first.

One solution might be to add the study "Write Bar Data to File" to the index and then open up that up in another chartbook. Second solution might be to attach a spreadsheet study to the index, have the spreadsheet duplicate the price data in one of the formula columns, attach the spreadsheet to a chart in another chartbook and plot that as the main price graph.

Any thoughts? Thanks!
[2018-11-15 03:25:18]
bjohnson777 (Brett Johnson) - Posts: 251
I understand. I like trend and SAR lines, too.

The problem boils down to multiple floating numbers (currencies, already mentioned) and the math used for decorrelation.

SC has decorrelated currencies that have been locked down to a common point some years ago, but they've diverged significantly since then. You can have a look at EUR-X and JPY-X as examples. Those might be a workaround for drawing chart lines.

The other lockdown problem is with scaling to each other. It's really hard to tell which one is moving more relative to the other. It may look like one currency is worth more than another when it really isn't.

To be fair to the SC devs, this is a very common problem in other decorrelation programs, too. There really isn't a good solution.

I made the choice to follow the relative path to get around these problems at the cost of the lock down. I default to 300 bars back as that will show overall movement (or lack of it) fairly well for a reasonably recent time period keeping all the currencies on screen (as in, not having 1000 point vertical distances between each of them). If you scroll the chart back a little, you can see where all the currencies cross at that point.

I also made the choice to try and keep all the decorrelated currencies properly scaled to each other in the chosen main currency (or a different chosen home currency). 2 years ago when I wrote this, I didn't see another like it. That may have changed by now. When I was studying FOREX back then, the lack of this information was driving me batty.

Your mentioned experiments won't work because anytime the main chart redraws/reloads, it will start from the 300 bars back and continue from there. That's why you're seeing vertical shifts on the chart. The data on the disk or spreadsheet would then show a large bar gap where none actually exists. That could make for some very confusing and possibly smashed indicators.

With my health problems, I don't have the math skills to try and figure out something around this problem. I haven't had the time to look recently, but I'm doubting anyone else has a solution, either. Even if there is one, it may be too much for a chart study running in a limited execution environment to handle. My decorrelation study running with my currency strength indicators are already a heavy load.

These are my immediate thoughts on the issue.
[2018-11-24 11:55:24]
Halco - Posts: 83
Thanks for the explanation. I understand now.

Been looking at the Diff from Primary study. This is great. I like bases and you can easily see what pairs are consolidating if they're running parallel. It's a great screening tool at a glance.
[2018-11-25 13:22:52]
Halco - Posts: 83
Attached is a 4-hr chart "Diff from Primary" study of the USD index against the other major currencies from early Dec '17 to late Jun '18. You can see the entire FX market against the USD at a glance. Note at the beginning of the chart all the other currencies are trending up against the USD. Then they all start to consolidate or roll over. Then they all do roll over and trend down against the USD. Then early/mid Apr '18 the behavior changes in most of the pairs.

Assuming I'm using and interpreting this study correctly, one only has to look at the USD pairs during this time period to see how powerful this information could be as far as gauging strength/weakness in the primary currency.

Brett, I know I keep gushing, but man, this is really great stuff.

http://www.sierrachart.com/image.php?Image=1543151856837.png
[2018-11-25 14:56:04]
bjohnson777 (Brett Johnson) - Posts: 251
Thanks, that's why I wrote it. Difference From Primary is one of my favorites for analysis, and it was easy to program. I'm surprised nobody else has done that.
[2018-11-25 22:18:19]
Halco - Posts: 83
Sorry to bother you again, but does this also work with daily bars? I'm trying it but it gets stuck in that loop. I limited the charts to 7, but the index doesn't show up and the log displays the msg "WARNING: Limit Number Of Open Charts exceeded. Disabling study. Either increase the value in study settings or close unused charts." I've tried Reload and Recalculate but the index still doesn't show. I'm using the latest SC version. Thanks.
Date Time Of Last Edit: 2018-11-25 22:19:21
[2018-11-26 10:55:03]
bjohnson777 (Brett Johnson) - Posts: 251
It works with intraday and daily. I normally use daily bars. The error you're seeing has to do with too many chart windows open in a chartbook. I'd recommend a fresh chartbook and then loading daily.
[2018-11-26 11:45:16]
Halco - Posts: 83
I've tried it with a new chartbook multiple times, I'm still getting the error msg after the loop stops and there is no index visible. Using the USD as an example, I'm using all the default settings except I'm changing "Limit Open Charts" to 7 to stop the loop. SC is disabling the study with that error msg. If you're not having this problem and I'm using the default settings, do you have any idea what the problem might be? Something in my chart settings perhaps? I am not having this issue with my intraday charts.

Thanks.

EDIT - I found a temporary solution at least. I loaded an intraday chart with 1440 minutes, one day, and used that.
Date Time Of Last Edit: 2018-11-26 11:53:16
[2018-11-26 15:31:42]
bjohnson777 (Brett Johnson) - Posts: 251
If you're not seeing anything, you need to execute a chart recalculation. Hit INSERT or select it from the Edit menu.

For any different time frame, SC will open new charts in the background for that time frame. It takes time for those charts to load, esp for tick by tick data. The main screen won't always be redrawn. There's nothing I can do about that except hit INSERT. If you keep Limit Open Charts really low, the study will just disable itself as you've seen.
[2018-11-26 17:22:11]
Halco - Posts: 83
Thanks Brett but this is some kind of glitch. Recalculate doesn't work because the study is always disabled. For instance if I input the AUD I have these charts in the symbol list:

AUDCAD (AUD CAD), AUDCHF (AUD CHF), AUDJPY (AUD JPY), AUDNZD (AUD NZD), AUDUSD (AUD USD), EURAUD (EUR AUD), GBPAUD (GBP AUD)

These are daily charts with only 501 days loading. Theses 7 charts open almost instantly, then after these charts open any additional charts are just these same 7 symbols over and over again.

It doesn't matter if I set it to limit 7 charts or leave it at 200, it disables the study after all the charts open and gives me that same error msg.

What I don't understand is why I'm having this looping/disable problem only with daily charts, and why you are not having the same problem if we are both using the latest version of SC.

I suppose I should ask SC support about it since you are not experiencing the same issue. Thanks again.
Date Time Of Last Edit: 2018-11-26 17:53:55
[2018-11-26 18:43:30]
bjohnson777 (Brett Johnson) - Posts: 251
I doubt SC support would even look at it. I'm on v1842 as of this post. Make sure you're not on a pre-release version. It sounds like old settings got stuck somehow. Also make sure you recompile any add on's for every new SC version.
[2018-11-26 19:49:22]
Halco - Posts: 83
He shoots, he scores! That was the problem, I was using the pre-release. I downgraded to 1842, deleted the dll, recompiled the cpp, all is well and good. Thanks!
[2018-12-08 11:42:49]
Halco - Posts: 83
USDCHF 4 HR chart with Relative Strength vs the USD index in the bottom pane. Note following A the downtrend in price continues but the RS starts going sideways. At B price makes a substantive low vs A but RS makes a higher low vs A. At C price makes a substantive low against B while RS makes a higher low vs B.

I haven't attached the chart but between C and D the USD index and CHF index are trending opposite each other and the DFP shows the majority of currencies weak against the USD and strong against the CHF.

And of course during this time the USDCHF RS is showing strength against the USD index as per this chart.

What follows is a nice uptrend.

Note also how RS gives early warnings of the ends both of the trends on this chart.

BTW, just to be clear, the label in the RS pane says "USD-X" but the RS is against the decorrelated USD index.

http://www.sierrachart.com/image.php?Image=1544269051982.png
Date Time Of Last Edit: 2018-12-08 13:16:05
[2018-12-15 21:40:19]
Halco - Posts: 83
Hey Brett, I'm back to bug you again. David Letterman used to do a bit called "Is This Anything?". So I'm wondering, is this anything:

It's kind of a breadth indicator, based on the closing slope of each of the 7 currency lines in the DFP study. In a spreadsheet study I sum the number of the down-sloping currencies and then I plot that as 7 and 21 period moving avgs on the chart. So if the ma is going up the primary currency is gaining strength because more of the other 7 currencies are weak against it and if it's going down the currency is getting weaker as more currencies are strong against it. Of course some may be flat, I haven't adjusted for that yet. This is crude at this point, experimental. And bear with me, I'm learning how to create spreadsheets studies while I'm doing this. I can do simple stuff in Excel so I know just enough to squeak by here. I think I've setup everything correctly.

This is a 20-min chart of the USD decorrelated index with the "breadth indicator" below it. A-B is a small trading range (within a larger range), at B the highs are equal to A in the currency while the indicator makes a lower high. At D the index springs C with a lower low but the indicator makes a higher low. At D to E there is a breakout and uptrend, confirmed by the indicator.

This is just one bit of one chart, but I'm intrigued. There are all kinds of refinements you could experiment with such as different ma periods or you could make the formula for the last 2 closes down, or 3, or the last 3 out of the last 5. Or maybe also make an up-sloping version, then plot them both as a ratio. Maybe apply some kind of standard deviation of the ma's.

It would certainly be better with more currencies, 10 would be nice, but this is still interesting.

Anyone have any thoughts? Thanks!

http://www.sierrachart.com/image.php?Image=1544909594427.png
Date Time Of Last Edit: 2018-12-16 09:10:50
[2018-12-17 10:02:15]
bjohnson777 (Brett Johnson) - Posts: 251
My health problems have given me a really bad weekend, but I think I've got a general idea about what you're talking about. Since I'm a C++ programmer, I've never bothered to learn the spreadsheet side of SC, so my responses will be more from the programming side.

This kinda sounds like an indirect measurement of the primary line from all the secondaries creating a forward looking indicator.

Instead of summing all the down slopes, a percentage would probably be better. A percentage won't care about about flat and up because it handles everything at once. Math:
Percent = Down / (Up + Down + Flat)
Simplified a little more, Percent = DownCount / TotalCount
This will give a range between 0.0 to 1.0, where 0.0 is 0% (all secondary lines are going up, very weak primary) and 1.0 is 100% (all secondary lines are going down, very strong primary).

The weakness in this is not accounting for distance each secondary line has travelled in the up or down direction. That accounts for some of the noise and strong smoothing requied to clean it up. If all the secondary lines blip up for a single bar, that would send the primary indicator to 0%.

Your comment about counting the last few closes would kinda add the missing distance calculation. Maybe each secondary line gets a percentage calculation like the one above and for the final primary indicator, all those secondary percentages get averaged together. The weakness in this is the bar back count. Count enough back and most of the lines would be wiggling around 50% instead of making larger moves. Maybe 10 bars back would be the max.

There's also a possiblity of skipping percents and going for pip movements since all my price lines are proportionally scaled to each other. In that case it would be counting pips up and down for all the secondary lines. Weakness: technically a percentage would be cleaner from the math purist perspective. That way scaling is always relative to some kind of percentage point count.

Something to look out for: Getting too much math in this might just recreate the primary line, which doesn't work so well for a forward looking indicator. This is a kind of over engineering gotcha.

Another thing to experiment with would be putting RSI's on each of the secondary currencies and averaging those together for the primary indicator line. In testing, compare that to an RSI against the primary indicator line to see if something stands out and really makes a difference.

Adding more currencies into the calculation really won't do too much more beyond the standard 7 since that's what everyone else uses. If you're trading some of the lesser currencies, then yes, it would be needed. For the time being, keep things simple with the major 7.

Keep playing with all this. When I was experimenting with the new indicators in my tool kit, I would watch them for weeks to see how they responded. There were many failures that I would just dump... and sometimes I would do a total gut and rewrite into something new before I found something I was happy with. The process starts out with something that looks good for historical data. Next it's taken into some kind of live trading (paper or actual money) to see how well it responds and indicates for real time. If real time starts giving good trading signals, then it's close to done.

Doing active trading right now for the next few weeks is a really good opportunity for seeing normal volume and low volume for the end of year holidays.

Open up a new text file and start taking notes about the possibilities I've mentioned, volumes, and the problems you haven't mentioned in the post. Also write down dates for interesting chart patterns and things that go right and pitfalls that go wrong. This text file will become your build journal. If you look at my various indicators, I'll mention the good and the bad. The journal is where this comes from and is very important. In the scattered notes in my journal, some of the separate variations of indicators were born out of this.
[2018-12-18 09:11:07]
Halco - Posts: 83
Thanks for the input, Brett. Very helpful. I changed it to percentage, looks better. Will keep working on it.
[2019-01-11 21:31:54]
Halco - Posts: 83
Hi Brett. I'm a bit confused. I compared the AUD-X and USD-X to your corresponding indexes on the weekly and 20-min charts and they appear to be exactly the same. I've attached the 20-min AUD. Shouldn't there be some differences? Am I misunderstanding something?

http://www.sierrachart.com/image.php?Image=1547241847908.png
[2019-01-12 12:58:02]
bjohnson777 (Brett Johnson) - Posts: 251
Bump up your screen brightness a little. Top left says AUD-X and middle left says AUD Index.

To post a message in this thread, you need to login with your Sierra Chart account:

Login


Login Page - Create Account