Skip to content

Instantly share code, notes, and snippets.

@matthewkastor
Created January 23, 2016 21:04
Show Gist options
  • Save matthewkastor/5a141f1b8494f0d07048 to your computer and use it in GitHub Desktop.
Save matthewkastor/5a141f1b8494f0d07048 to your computer and use it in GitHub Desktop.
function for knowing whether the adx indicator is above or below the given threshold level in metatrader 4
// int adxIndicator = AdxIndicator(20, 14, 0);
int AdxIndicator(int adxThreshold, int period, int shift) {
double adx = iADX(Symbol(),PERIOD_CURRENT,period,PRICE_TYPICAL,MODE_MAIN,shift);
//double adxDiPlus = iADX(Symbol(),PERIOD_CURRENT,period,PRICE_TYPICAL,MODE_PLUSDI,shift);
//double adxDiMinus = iADX(Symbol(),PERIOD_CURRENT,period,PRICE_TYPICAL,MODE_MINUSDI,shift);
int output = 0;
if(adx > adxThreshold) {
output = 1;
}
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment