| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Pivot Point Moving Average
Hello all. I am having some trouble creating a pivot point moving average indicator. This is my first indicator i am trying to create. This indicator should try a line on each day's pivot point and it should draw another line for the past 3 day's pivot point avg. Here is the code:
Code:
//+------------------------------------------------------------------+ //| 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 l1 = Low[1]; double l2 = Low[2]; double l3 = Low[3]; double c1 = Close[1]; double c2 = Close[2]; double c3 = Close[3]; pivot1[i] = (h1 + l1 + c1)/3; double piv1 = (h1 + l1 +c1)/3; double pivot2 = (h2 + l2 + c2)/3; double pivot3 = (h3 + l3 + c3)/3; curAvg[i] = (piv1 + pivot2 + pivot3)/3; } } Last edited by jeepr94; 06-19-2007 at 05:48 PM. |
|
|||
|
there is dyn. pivot (floatpivot) will PivotMA perform differently?
http://www.forex-tsd.com/123742-post127.html |
|
|||
|
Forgot to mention
Hey i forgot to mention this indicator's yellow line is an average of the past 5 pivot points and blue is the pivot point of the last candle. If you would like me to change the yellow line (5 avg) to 3 avg let me know. I read in some book you should use 3 but i am just expiermenting with it.
|
|
|||
|
Quote:
Would you kindly change the (5 avg) to (3 avg) Thanks alot in advance Awaiting |
![]() |
| Bookmarks |
| Tags |
| pivot point moving average |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is pivot point and how to use it on Forex? | KOHHOB | General Discussion | 16 | 06-13-2007 12:35 AM |
| How to calculate Moving Average of a Moving Average | babarmughal | Expert Advisors - Metatrader 4 | 2 | 05-15-2006 10:11 AM |
| End Point Moving Average | pete7 | Metatrader 4 | 6 | 04-30-2006 07:59 AM |