Author:
VSpread2
Price Data Components
Series array that contains close prices for each barSeries array that contains tick volumes of each bar Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Indicators Used
Indicator of the average true range
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
VSpread2
//+------------------------------------------------------------------+
//|                                     VSA        mich99@o2.pl      |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
//----
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 White


#property indicator_level1 0

extern int TimeFrame = 0;



//---- buffers
double P1;
double P2;
double K1;
double K2;
double S1;
double S2;
double D1;
double D2;

double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];



//----
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0, P1Buffer);
   SetIndexBuffer(1, P2Buffer);
   SetIndexBuffer(2, P3Buffer);
   SetIndexBuffer(3, P4Buffer);
  
//----
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 3);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 1);
   
   IndicatorShortName("Vol/Spr("+TimeFrame+")");
//----
   IndicatorDigits(1);
   
   Comment(" Are You identifying Yourself with Your mind? ");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   Comment("");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   int i,ii;
   static int pii=-1;
   
   for(i = 0; i <3000 ; i++)//iBars(Symbol(),TimeFrame)
     {
       ii = iBarShift(Symbol(), Period(), iTime(Symbol(),TimeFrame,i), true);
       //----
       if (pii!=ii)
       {
         P1=0;
         P2=0;
         K1=0;
         K2=0;        
         S1=0;
         S2=0;
         D1=0;
         D2=0;
         
         
         P1Buffer[ii]=0;
         P2Buffer[ii]=0;
         P3Buffer[ii]=0;
         P4Buffer[ii]=0;
         
       }
       
       if (ii != -1)
       {
         if (iVolume(Symbol(),TimeFrame,i)>0 && iClose(Symbol(),TimeFrame,i)-iClose(Symbol(),TimeFrame,i+1)>0)
         {
           P1 = P1+iVolume(Symbol(),TimeFrame,i)/((MathAbs(iHigh(Symbol(),TimeFrame,i)-iLow(Symbol(),TimeFrame,i)+0.000001))/Point);
         }
                
         if (iVolume(Symbol(),TimeFrame,i)>0 && iClose(Symbol(),TimeFrame,i)-iClose(Symbol(),TimeFrame,i+1)<=0 )
         {
           P2 = P2-iVolume(Symbol(),TimeFrame,i)/((MathAbs(iHigh(Symbol(),TimeFrame,i)-iLow(Symbol(),TimeFrame,i)+0.000001))/Point);//MathAbs(iClose(Symbol(),TimeFrame,i)-iClose(Symbol(),TimeFrame,i+1));High[Highest(NULL,TimeFrame,MODE_HIGH,MA_per,i)]
         }
         
         
         
         
        
        
         
         if (iVolume(Symbol(),TimeFrame,i)==iVolume(Symbol(),TimeFrame,i+1)   &&  iATR(Symbol(),TimeFrame, 2, i)==iATR(Symbol(),TimeFrame, 2, i+1) )
         {
           P1 = 0;//P1+(iVolume(Symbol(),TimeFrame,i)/2);
           P2 = 0;//P2-(iVolume(Symbol(),TimeFrame,i)/2);
         }
       }
       P1Buffer[ii]=P1+P2;
       P2Buffer[ii]=0;
       P3Buffer[ii]=0;
       P4Buffer[ii]=0;
       
       pii=ii;
    }
//----
   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 ---