ma_Navel_price

Author:
ma_Navel_price
Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
ma_Navel_price
//+------------------------------------------------------------------+
//|                                                   ma Navel price |
//|                                                                  |
//+------------------------------------------------------------------+
//ideas: Bookkeeper (08.01.2009) BO.mq4 NavelSMA.mq4   
//http://codebase.mql4.com/ru/5115 
//2009fxtsd     ki

#property copyright ""
#property link      ""

#property indicator_chart_window
#property indicator_buffers    1
#property indicator_color1     Green
#property indicator_width1     1




extern int ma_period  =  14;
extern int ma_method  =  0;
extern int ma_shift   =  0;
extern int ma_price   =  8;


extern string   note__Price   ="0C 1O 2H 3L 4Md 5Tp 6WghC: 4Md(HL/2),5Tp(HLC/3),6Wgh(HLCC/4)";
extern string   _______       ="7 HA close: haC =(O+H+L+C)/4";
extern string   ___           ="8 Navel SMA price: nvC =(2O+H+L+5C)/9";




double buffer1[];
double price[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+


int init()
{

      IndicatorBuffers(2); 

      SetIndexStyle(0,DRAW_LINE);
      SetIndexShift(0,ma_shift);


      SetIndexBuffer(0,buffer1);
      SetIndexBuffer(1,price);
  
   
   string shortnme;
   shortnme = "MA Navel Price ("+ma_period+","+ma_method+", pr "+ma_price+") ";
   
   IndicatorShortName(shortnme);  
   SetIndexLabel(0,shortnme);


   return(0);
}

int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+


int start()
{
   int counted_bars=IndicatorCounted();
   int limit,i;
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;




   for(i=limit; i>=0; i--)
     
    {                                                 
         if (ma_price<0 || ma_price>8)    ma_price=0;
    
      
         if (ma_price==7)       price[i]=(Close[i]+Open[i]+High[i]+Low[i])/4;  
         if (ma_price==8)       price[i]=(Close[i]*5+Open[i]*2+High[i]+Low[i])/9;

    }
      
         for(i=limit; i>=0; i--) 
         {
      
  
            if (ma_price<7)   buffer1[i] = iMA(NULL,0,ma_period,0,ma_method,ma_price,i);
            else              buffer1[i] = iMAOnArray(price,0,ma_period,0,ma_method,i);
             
         }
         


  
   return(0);
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---