Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Indicators - Metatrader 4


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-19-2007, 05:43 PM
Junior Member
 
Join Date: Mar 2006
Posts: 4
jeepr94 is on a distinguished road
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;
         
         }

        
  }
Thanks in advance.

Last edited by jeepr94; 06-19-2007 at 05:48 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-19-2007, 09:15 PM
Junior Member
 
Join Date: Mar 2006
Posts: 4
jeepr94 is on a distinguished road
Duh

I figured out what i did wrong! i replaced the static numbers with i and i + 2 etc within the low and high and close numbers. Thanks for reading.

Cory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-20-2007, 10:39 PM
Junior Member
 
Join Date: Mar 2007
Posts: 20
EBTAFOLLOWER is on a distinguished road
I have been looking for this...

Hello,

Could you post the corrected version of the indicator?

Thanks

I have been looking for something like this, and would like to see if your attempt is what I have been searching for.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-21-2007, 01:35 AM
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 2,001
fxbs is on a distinguished road
there is dyn. pivot (floatpivot) will PivotMA perform differently?
http://www.forex-tsd.com/123742-post127.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-21-2007, 10:52 PM
Junior Member
 
Join Date: Mar 2006
Posts: 4
jeepr94 is on a distinguished road
Here is what i have so far

Hello, I have attached the indicator. I am still looking at it to see if my math is correct, i am novice when it comes to programming. Thanks..
Attached Files
File Type: mq4 PivotPtMA2.mq4 (2.7 KB, 148 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-21-2007, 10:54 PM
Junior Member
 
Join Date: Mar 2006
Posts: 4
jeepr94 is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-23-2007, 01:23 PM
Senior Member
 
Join Date: Sep 2005
Posts: 255
aelimian is on a distinguished road
Quote:
Originally Posted by jeepr94 View Post
Hello, I have attached the indicator. I am still looking at it to see if my math is correct, i am novice when it comes to programming. Thanks..

Does anyone have a MTF pivot MA?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-18-2008, 08:36 PM
Junior Member
 
Join Date: Sep 2006
Posts: 4
ayman_w72 is on a distinguished road
Quote:
Originally Posted by jeepr94 View Post
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.
Hi Jeepr
Would you kindly change the (5 avg) to (3 avg)
Thanks alot in advance
Awaiting
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
pivot point moving average


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

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


All times are GMT. The time now is 10:35 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.