Search code examples
mql4

Calculate Pivot D1 W1 M1


How can I calculate the Pivots D1, W1 and M1?

Can you provide me some ready to use formula?


Solution

  • It depends on the type of Pivot of course. The easiest, standard pivot should look like this one: high,low,close are High(_Symbol,PERIOD_D1,1) etc. double values[] is a buffer of 9 pivot values

         double p = (high+low+close)/3;
         values[0+4] = p;
         values[1+4] = 2*p-low;
         values[2+4] = p+high-low;
         values[3+4] = 2*p+high-2*low;
         values[4+4] = 2*p-high;
         values[5+4] = p+low-high;
         values[6+4] = 2*p+low-2*high;
         values[7+4] = p + 2 * (high-low);
         values[8+4] = p - 2 * (high-low);