All_Stars_v01

Author: Inkov Evgeni ew123@mail.ru
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
All_Stars_v01
//+------------------------------------------------------------------+
//|                                                All_Stars_v01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Inkov Evgeni ew123@mail.ru"
#property link      "+7-918-600-11-33"
//+------------------------------------------------------------------+
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Green
#property  indicator_color2  Red
#property  indicator_width1  2
#property  indicator_width2  2
//--------------------
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(3);

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_NONE);
   
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);
   
   IndicatorDigits(0);

   return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
   return(0);
}
//+------------------------------------------------------------------+
int start()
{
   int    limit;
   int    counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   double oc;
   for(int i=0; i<limit; i++)
   {
      oc=MathAbs(Open[i]-Close[i]);
      if (oc==0.0)oc=Point;
      ExtBuffer2[i]=Volume[i]*(High[i]-Low[i])/oc;
   }

   double current,prev;
   for(i=limit-1; i>=0; i--)
   {
      current=ExtBuffer2[i];
      prev   =ExtBuffer2[i+1];
      if(current<prev)
      {
         ExtBuffer0[i]=0.0;
         ExtBuffer1[i]=current;
      }
      else
      {
         ExtBuffer0[i]=current;
         ExtBuffer1[i]=0.0;
      }
   }

   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 ---