Posted on: 30 Apr, 2019
In this article, I will share a script via Tradingview that, with the help of a programmer, each one of you as Global Prime clients can use. Before I get into the nut and bolts, allow me to give you some background information. A while ago, I wrote* about the usefulness of using a currency strength meter and how you can build one from scratch.
To our Market Insights
In this article, I will share a script via Tradingview that, with the help of a programmer, each one of you as Global Prime clients can use. Before I get into the nut and bolts, allow me to give you some background information.
A while ago, I wrote* about the usefulness of using a currency strength meter and how you can build one from scratch. Now I've taken this little project to the next level by visually spotting, via color signals in a dashboard and alerts, when a potential new trend might be developing.
*It's critical that you first read that article before you jump into reading this one or else you could get easily lost.
This is what my 2 main charts when monitoring the performances of currency indexes (equally weighted) used to look like. However, that was just the first step, as I knew that with the help of a programmer I could build a script that gives a trigger every time two currencies show diverging flows via opposing moving average slopes.
The first chart is a currency strength meter, whereby I calculate, through a formula, currency indexes in various thin lines. Then I apply a moving average to each currency index so that I can smooth out the lines (what I call Micro moving averages – thicker lines -) and is usually a 4-5 period MA, with the key input to pay attention being the slope. One can perform their own tests on what works best for their particular trading style. The smaller the period in the moving average, the more responsive to changes in biases but the downside is that you will get a greater number of false moves. In the windows below the 1st chart, I calculate the stochRSI for each currency index (these values originate from the currency index and not from the applied MA). By default, a 25-period is applied to both RSI and Stoch length.
The 2nd chart looks at the same logic, but instead of checking the micro trend, it applies a 25MA to the currency index, so it looks at what I call the slope of the macro trend. In this case, by default, a 125-period is applied to both RSI and Stoch length.
I had in mind to transition from just eye-balling and monitoring these charts manually to build a script via Tradingview that makes calculations real time (whenever the change in the moving average slope first occurs, and not when the bar/line closes), so that one can decide whether or not its a signal worth trading as part of a new trend emerging. Note, this is not so much a signal-triggering indicator but rather a tool to constantly be on the lookout monitoring what currencies might start to develop trends.
Allow me to show you a screen grab of what the ultimate result looks like, so that I can refer to it as I provide further details. The 3rd chart on the right side is the actual script, which consists of a dashboard with different colored rectangles being triggered depending on the quality of the signal.
The script can be downloaded in the following link
To discuss it further, you just need to register to Global Prime Discord room in the following link and I will be happy to discuss it further with anyone who is interested in exploiting all the benefits that it can offer.
The way you add the script into your Tradingview chart is by first copy everything in the txt file. Then go to Pine editor (bottom middle-left) in your tradingview chart, delete everything there, then Paste the script. Then click Add to Chart (top right of the pine editor).
There are only 2 rules for the script to trigger a signal (see below). However, as I will elaborate further down, there are up to 6 different colors we can grade a signal
RULE 1 -> 2 moving averages, which are a calculation applied to a currency index as shown in the micro trend above, exhibit slopes in the opposite direction.
RULE 2 -> The Stoch RSI cannot be in overbought conditions if the slope of the moving average points higher or in oversold if the slope points lower.
Note 1: Even if the chart is a 60m timeframe by default (can be changed to any timeframe(, one gets the signal the moment the change of slope is identified, which means the indicator monitors changes in price tick by tick, and not on a candle close, otherwise one would get the trigger too late.
As an example of the highest-graded signal triggering (in green), a few hours ago we were given the visual cue that GBPCAD was experiencing a change of behavior. If we crosscheck the time the green-colored trigger was given with the actual GBPCAD chart, this is what we can observe. The pair is 30p higher since the trigger.
HOW TO SETUP ALERTS
One can easily setup a notification window each time the above rules are met, for example, if the EUR MA slope changes to bullish, and the AUD MA slope changes to bearish, and none of the 2 currency index values corresponding to these 2 moving averages (EUR and AUD) show a stoch RSI in overbought (above 80) in the case of the EUR, or oversold (below 20) in the case of the AUD, then the notification pop up would show a customized line: Long EURAUD
Note 1: Recording the slope of the macro moving average, which is usually a 25period MA applied to the currency index, is not included as part of the rules to trigger a signal, but it is taken into account to grade the quality of each signal.
Note 2: I recommend each signal to be triggered once or if you prefer, simply monitor the chart visually on the change of colors via the dashboard. The calculation resets and can appear again the moment that the slope changes to the opposite direction, so it’s a very dynamic indicator that will alert you the second a pair of currencies starts trending.
Note 3: When the signal is triggered, the indicator draws a colored rectangle. Each signal notification should be colored based on the following logic below.
LOGIC TO QUALIFY SIGNALS
-> Any long micro position with Macro MA in full agreement (ie/ Long EURAUD, Macro EUR up, Macro AUD down) is highlighted with green color
-> Any long micro position with macro moving averages in partial agreement (for example Long EURAUD, Macro EUR up AUD up) is highlighted with blue color
-> Any long micro position with macro moving averages in full disagreement (for example Long EURAUD, Macro EUR down AUD up) is highlighted with magenta color
-> Any short micro position with macro moving averages in full agreement (for example Short EURAUD, Macro EUR down AUD up) is highlighted with red color
-> Any short micro position with macro moving averages in partial agreement (for example Short EURAUD, Macro EUR up AUD up) is highlighted with orange color
-> Any short micro position with macro moving averages in full disagreement (for example Short EURAUD, Macro EUR up AUD down) is highlighted with purple color
PARAMETERS IN THE SCRIPT SETTINGS
Overbought/oversold: One can modify the stoch RSI level from which the indicator considers the value to be in overbought or oversold conditions. As a rule of thumb, consider 20/30 for oversold and 70/80 for overbought.
Slopes micro/macro MAs: One can edit the slope of the micro MA period (rule of thumb 4-5) and the macro MA (by default 25).
Value StochRSI: The default inputs are K 3, D 3, RSI Length 25, Stoch Length 25 for the micro and 125 period for the macro.
Change colors: One can edit the assigned colors in the signals dashboard.
Timeframe applied: The indicator has the flexibility to be applied to any timeframe, not just the 60m by default. Simply change the timeframe temporality.
CURRENCY INDEXES FORMULAS
It is the responsibility of the user to keep the values of the indexes updated. Find a recent sample below, as per values in early April. What this means is that at least once a week, in order to not let the values outdated, you should update the script with the latest valuations in the denominator.
NZD INDEX ->
EUR INDEX ->
JPY INDEX ->
USD INDEX ->
GBP INDEX ->
Remember, I have provided a manual on how to build a currency strength meter. That’s what you will need to do first if you want to obtain the actual currency indexes other than just the indicator, which is just the visual cue to get you alerted when the slopes turn. Once you’ve created your indexes via tradingview, you then apply a moving average to each index. Then apply the stochrsi 25 period to each index. For the macro trend, make the same calculations, but the period of the MA is 25, while the stoch rsi is 125.
This is a tool that should be interpreted as visual assistance, via the dashboard, in order to get that first cue when opposing micro slopes via the FX meter occur, which communicates a change of behavior in two currencies. However, you still need to check the technical context of the pair (levels marked, proj reached, etc.) even if I personally find such cue a major time saver to constantly spot what's trending in FX. The permutations u can play with, as part of this script, are significant, so don't think for a second that the values I provide are fixed in stone. You can tweak the timeframes you use, the periods of the moving averages, etc. I find the micro and macro trend combos when either a green or red signals triggered the most reliable, with positions to be exploited via 15m and hourly under the right technical context. I will be at your disposal in case you have feedback and/or further ideas we can bounce. It is my hope and desire that this tool can help you in your journey to trade the currency markets.
Feel free to get in touch with us to find out more about our service.