Duh -- Sorry i figured it out. Was that i didn't use I within the high close and low deals. Thanx
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
//+------------------------------------------------------------------+ //| PivotPtMA.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Yellow double pivot1[]; double curAvg[]; int init() { SetIndexBuffer(0, pivot1); SetIndexStyle(0,DRAW_LINE, STYLE_SOLID, 1); SetIndexDrawBegin(0,4); SetIndexBuffer(1, curAvg); SetIndexStyle(1,DRAW_LINE, STYLE_SOLID, 1); SetIndexDrawBegin(1,4); } int start() { int counted = IndicatorCounted(); if(counted < 0) return (-1); if (counted > 0) counted --; int limit = Bars - counted; for (int i = 0; i < limit; i++) { double h1 = High[1]; double h2 = High[2]; double h3 = High[3]; double h4 = High[4]; double l1 = Low[1]; double l2 = Low[2]; double l3 = Low[3]; double l4 = Low[4]; double c1 = Close[1]; double c2 = Close[2]; double c3 = Close[3]; double c4 = Close[4]; pivot1[i] = (h1 + l1 + c1)/3; double pivot2 = (h2 + l2 + c2)/3; double pivot3 = (h3 + l3 + c3)/3; double pivot4 = (h4 + l4 + c4)/3; curAvg[i] = (pivot2 + pivot3 + pivot4)/3; } }