Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Currency Strength Indicator Based on MA - MetaTrader 4 Script | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

MA based Currency Strength Indicator - indicator for MetaTrader 4

MA based Currency Strength Indicator - indicator for MetaTrader 4

MA based Currency Strength Indicator - indicator for MetaTrader 4

Notes : New update March 30, 2020 - Added support for brokers using various prefixes/infixes/suffixes in their symbols. Scroll down for a more detailed description.

For example, when we determine that a certain currency pair (EUR/USD) is trending upward, we want to know how much the Euro is getting stronger, and how much the USD is getting stronger. weaken. Likewise, if the CADJPY is trending down, we want to know how much the CAD is weakening and how much the JPY is strengthening.

A simple way to measure the degree of strength/weakness is to look at multiple currency pairs and add up the time for each pair. Currency plays a certain role in each pair. Therefore, it makes sense to understand that CAD is strengthening across all currency pairs that contain it, and how many bars there have been.

Given that there are many currencies being traded, it would be wise to narrow down and focus on only 8 of the major currencies - USD, EUR, GBP, CHF, AUD, CAD, JPY and NZD. At least for now, the combination of these 8 currencies would be 28 pairs.

What this indicator does is scan all 28 currency pairs, determine the strength and weakness of each currency pair, and take the number - that is, the number of times each currency has strengthened and weakened - and express it as follows:

MA based Currency Strength Indicator - indicator for MetaTrader 4

From the screenshot above, we can easily conclude that the USD is strengthening and the AUD is weakening, so AUD/USD is heading south for maximum momentum!

Therefore, this indicator provides a simple way to see at a glance which currency pairs are worth monitoring closely on any selected time frame.

The inputs that the user can set are as follows:

MA based Currency Strength Indicator - indicator for MetaTrader 4

These inputs allow the user to change the properties of the moving average and the indicator will compare only the closing price of the candle with the moving average to determine whether the trend is up or down. The update uploaded on March 30, 2020 is support for prefix/infix/suffix brokers whose symbols have additional characters like "+" or "." for example. Additionally, some brokers may use lowercase letters. So all that is necessary is to fill in the "Full Symbol Name of EURUSD" input parameter (shown above) with the exact full name of EURUSD... Let's just say "cEuRuSd". or "eUR_USd++" etc (well, I just wanted to catch all possibilities...haha), this new version should be able to handle it.

To call this indicator from an EA, other indicators or scripts, you can use this function:

 boolean getCSBuffer( integer teff, integer bar, stringmoney , integer &numBulls, integer &numBears)
{
string name = "MAC Currency Strength" ;
string [] = { "USD" , "EUR" , "GBP" , "Swiss Franc" , "AUD" , "CAD" , "JPY" , "NZD" };
Integer quantity Cs = array size (CS);
for ( integer i = 0 ; i if(Cs[i]==currency)
      {
        Number of bulls = integer ( customized ( symbol (),tf,name,i* 3 ,bar)) - (numCs-i- 1 )*numCs;
        Number of bears = integer ( custom ( symbol (),tf,name,(i* 3 )+ 1 ,bar)) - (numCs-i- 1 )*numCs;
        The number of bulls = the number of bulls - the number of bears;
return ( true );
      }
  }
return ( false );
}

Here is an example of how to use the GetCSBuffer() function:

 integer bar = 1 ; // User can change this.
String c = "USD" ; // The user can change this value, but it must be one of the 8 currencies.
Integer bull market quantity, bear market quantity;
if (getCSBuffer( period (),bar,c,numBulls,numBears))
print ( "bulls=" , number of bulls, ",bears=" , number of bears);

When using this indicator, pay attention to the Expert tab in the terminal and make sure there are no error messages.

Finally, for those who are more adventurous, the function GetTrend() can be overridden (just make sure it takes the same parameters and returns the same range of values ​​(i.e. 1 for up, -1 for down, simple as that)) so that different criteria can be used to determine the trend. Of course, some changes may require some updates to the input parameters, but nothing too complicated - if you have basic knowledge of programming, you can customize it to call your own indicator.


Attachment download

📎 macurrencystrength.mq4 (28.91 KB)

Source: MQL5 #28330

Verification code Refresh