Getting averages over multiple bars/days
3 replies
Threshold
8 years ago #114405
I want to get an average of the last 4 days high – open. Does EA Wizard have any shortcut to get things like this done without meticulously coding out a very long equation day1 day2 day3 day4… ? What if I wanted a 100 or 200 day average? Is there a short way to go about this?
Should be simplified.
Such as:
AVERAGE: bars 4 (with timeframe option): High-open
tomas262
8 years ago #133892
Will try to find a solution for this and let you know but this will probably require a custom function. Don’t know build-in function that could do this
tomas262
8 years ago #134013
Hi,
I made the function for you. You need to
1) copy code into Wizard / code / CustomFunctions.mq4
double averageHighOpenRange(int period) { double sum = 0; for (int i = 1; i <= period; i++) { sum += High[i] - Open[i]; } return(sum / period); }
2) use it in Wizard like I did on screenshot
Threshold
8 years ago #134022
Thanks, I’ll let you know when I try it out.
Viewing 3 replies - 1 through 3 (of 3 total)