Author: m
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
v+=-
//+------------------------------------------------------------------+
//|                                                          v+-.mq4 |
//|                       
//|                                     
//+------------------------------------------------------------------+
#property copyright "m"
#property link      "m"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- input parameters
extern int KPeriod=14;
//---- buffers
double  Buffer[];
double vplus[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- 1 additional buffer used for counting.
   IndicatorBuffers(2);
//---- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Buffer);
   SetIndexBuffer(1,vplus);
//---- name for DataWindow and indicator subwindow label
   short_name="v+-";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,KPeriod);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|sum vplus                                             |
//+------------------------------------------------------------------+
int start()
  {
   int i,counted_bars=IndicatorCounted();
//----
   if(Bars<=KPeriod) return(0);

//----
   i=Bars-counted_bars-1;
   while(i>=0)
     {
      double high=High[i];
      double low =Low[i];
      double vol=Volume[i];
     
      double prevmd=(High[i+1] + Low[i+1])/2;
      double md=(High[i] + Low[i])/2;
         
         
     
   if(prevmd>=md) return(0);
   if(prevmd < md) vol ;////////////////
    }
//---
  
//----
{
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   for(i=0; i<limit; i++)
   
        vplus[i]=iMAOnArray(Buffer,Bars,KPeriod,0,MODE_SMA,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 ---