ma_VininI_V_v2

Author: Victor Nicolaev
ma_VininI_V_v2
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
ma_VininI_V_v2
//+------------------------------------------------------------------+
//|                                                            V.mq4 |
//|                                                  Victor Nicolaev |
//|                                                    vinin@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Victor Nicolaev"
#property link      "vinin@mail.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow

extern int MAPeriod=13;
extern int mode=0;

double MA[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,2*MAPeriod);
   SetIndexBuffer(0,MA);
   IndicatorShortName("V");
   
//----
   return(0);
   
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() { return(0); }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int   i,j,
         counted_bars=IndicatorCounted(),
         limit=Bars-counted_bars-1;
   double Value[5];
   for (i=limit;i>=0;i--)  {
      for (j=0;j<5;j++) Value[j]=iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_CLOSE,i+j);
      if (mode==0) MA[i]=Value[0]+(((Value[0]-Value[1])+(Value[0]-Value[2])/2.0+(Value[0]-Value[3])/3.0+(Value[0]-Value[4])/4.0)/4.0);
      if (mode==1) MA[i]=Value[0]+(2.0*Value[0]-Value[3]-Value[4])/4;
   
   }
   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 ---