This is an extract from production library of EAs "Graalino-Pro" and "Ocean Breeze".
There is a dosen of general math functions here.
Everything in this library is PUBLIC DOMAIN (and free).
Example:
//______________________________________________________________________________________ // | // Array_Mean_Harmonic () | //___________________________________________________________________| double Array_Mean_Harmonic ( double & Array[], int Start_Bar, int Array_Size ) { int i; double Average ; Average = 0.0 ; for (i = 0; i < Array_Size; i++) { if (Array [i + Start_Bar] != 0.0) { Average = Average + 1.0 / Array [i + Start_Bar]; } } Average = Array_Size / Average; return (Average); }
Files:
OBz-Math-Lib.mq4
23 kb