Last active
January 23, 2016 21:07
-
-
Save matthewkastor/a570b9cd1b294f7d17de to your computer and use it in GitHub Desktop.
functions for getting the MACD indicator in metatrader 4
This file contains hidden or 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
input int MovingPeriod = 12; | |
input int MovingShift = 0; | |
double GetMacd(int mode, int period, int shift) { | |
int fastEmaPeriod = period / 2.1555; | |
int slowEmaPeriod = period; | |
int signalPeriod = (period / 2.1555) * 0.75; | |
return iMACD(Symbol(),0,fastEmaPeriod,slowEmaPeriod,signalPeriod,PRICE_TYPICAL,mode,shift); | |
} | |
double GetMacdMain() { | |
return GetMacd(MODE_MAIN, MovingPeriod, MovingShift); | |
} | |
double GetMacdSignal() { | |
return GetMacd(MODE_SIGNAL, MovingPeriod, MovingShift); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment