Last active
May 13, 2017 20:25
-
-
Save currencysecrets/7394133 to your computer and use it in GitHub Desktop.
Determining the strength of a trend can be utilised with this simple function. More details of this indicator found here: http://www.currencysecrets.com/882/identifying-weakest-strongest-currencies-measuring-trend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double trendStrength( int b = 52, int per = 0, string sym = "" ) { | |
if ( sym == "" ) { sym = Symbol(); } | |
if ( b * 2 < iBars( sym, per ) ) { b = MathFloor( iBars( sym, per ) * 0.5 ); } | |
double maDiff = iMA( sym, per, b, 0, MODE_SMA, PRICE_CLOSE, 0 ) - iMA( sym, per, b, 0, MODE_SMA, PRICE_CLOSE, b ); | |
double strVal = maDiff / iATR( sym, per, b, 0 ); | |
double result = strVal * MarketInfo( sym, MODE_TICKVALUE ); | |
return ( result ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment