Code Library / Indicators

Pivot Points

Daily pivot point calculator.

Language: MQL5 · Category: Indicators · Tags: pivot points, support, resistance, MQL5

Source code

struct Pivots{double PP,R1,S1;};
Pivots CalcPivots(){
   MqlRates d[];ArraySetAsSeries(d,true);CopyRates(_Symbol,PERIOD_D1,1,1,d);
   Pivots p;p.PP=(d[0].high+d[0].low+d[0].close)/3;
   p.R1=2*p.PP-d[0].low;p.S1=2*p.PP-d[0].high;
   return p;
}

How to use this snippet

This is a building block, not a finished trading system. Paste it into your own MQL5 project, compile it, and test it on a demo account with your broker's real spreads before relying on it. If MetaEditor reports errors, the compilation error fixer can help.

Related snippets