Not logged in

Forums

Viewing 4 posts - 1 through 4 (of 4 total)

Forums>EA Wizard>General Discussion>Getting averages over multiple bars/days

  • #114405 |
    Customer
    734 Posts

    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
     

    #133892
    Moderator
    2349 Posts

    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

    #134013
    Moderator
    2349 Posts

    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 - Open;
       }
       return(sum / period);
    }
    

    2) use it in Wizard like I did on screenshot

    Attachments in this forum are visible only for registered users.
    #134022
    Customer
    734 Posts

    Thanks, I’ll let you know when I try it out.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.