Skip to content

Instantly share code, notes, and snippets.

@matthewkastor
Last active January 23, 2016 20:54
Show Gist options
  • Save matthewkastor/d58e6be6190c37a93307 to your computer and use it in GitHub Desktop.
Save matthewkastor/d58e6be6190c37a93307 to your computer and use it in GitHub Desktop.
function for analyzing whether the candle body is at least 30 percent of its height in metatrader 4
// bool candleIsStrong = CandleIsStrong(1);
bool CandleIsStrong(int index) {
bool output = false;
double totalHeight = High[index] - Low[index];
double bodyHeight = MathAbs(Open[index] - Close[index]);
if(totalHeight != 0 && bodyHeight != 0) {
output = ((totalHeight / bodyHeight) > 1.3);
}
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment