Download MetaTrader 5
To add comments, please log in or register
Publish your article and win recognition from thousands of traders!
yalewang
577
yalewang 2014.12.07 17:33 

where can i  find the souce code of  iVolume function ?

Carl Schreiber
5938
Carl Schreiber 2014.12.07 18:32  
There is no source code, no formular! It's the number of orders (?) the broker has got not the amount of money.
yalewang
577
yalewang 2014.12.08 07:58  

how to identify the up and down values ,they have different colors on chart .

Carl Schreiber
5938
Carl Schreiber 2014.12.08 10:21  

That is not caused by iVolume(..) the internal function of mt4. On my (mt4-) charts the volume is just a little vertical line in th colore I define in the chart-properties.

It seems you have an separate indicator - in this case you have to gogle for it or search here in the code base of this indicator.

yalewang
577
yalewang 2014.12.08 10:35  

the volume indicator is in     navagator---->indicator---->volume---->volumes 

the indicator has  only  one  line  index, but has two color ,very puzzle.

Carl Schreiber
5938
Carl Schreiber 2014.12.08 10:49  
Oh - I see, but this as well takes only the tick-volume-number of the broker and paints a red vertical line if this volume is smaller than the prev. one and green if the tick-vloume has increased.
Keith Watford
Moderator
7888
Keith Watford 2014.12.08 10:53  
YALEWANG:

where can i  find the souce code of  iVolume function ?


You asked for the source code for iVolume function

Now you are referring to an indicator

YALEWANG:

the volume indicator is in     navagator---->indicator---->volume---->volumes 

the indicator has  only  one  line  index, but has two color ,very puzzle.


I don't know where you can view the code for this indicator 

The colours are dependant on whether the bar's volume is higher or lower than the previous bar's 

Edward Hirsch
683
Edward Hirsch 2014.12.08 17:08  

I found an old copy. Call it "Vol" so as to preserve the current version.

//+------------------------------------------------------------------+
//|                                                          Vol.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property indicator_minimum 0
#property indicator_buffers 3
#property indicator_color1  Black
#property indicator_color2  Green
#property indicator_color3  Red
#property indicator_width2  2
#property indicator_width3  2
//---- indicator buffers
double ExtVolumesBuffer[];
double ExtVolumesUpBuffer[];
double ExtVolumesDownBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtVolumesBuffer);       
   SetIndexBuffer(1,ExtVolumesUpBuffer);
   SetIndexBuffer(2,ExtVolumesDownBuffer);
//---- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
//---- sets default precision format for indicators visualization
   IndicatorDigits(0);   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Volumes");
   SetIndexLabel(0,"Volumes");      
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
//---- sets drawing line empty value
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);       
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Volumes                                                          |
//+------------------------------------------------------------------+
int start()
  {
   int    i,nLimit,nCountedBars;
//---- bars count that does not changed after last indicator launch.
   nCountedBars=IndicatorCounted();
//---- last counted bar will be recounted
   if(nCountedBars>0) nCountedBars--;
   nLimit=Bars-nCountedBars;
//----
   for(i=0; i<nLimit; i++)
     {
    double dVolume=Volume[i];
      if(i==Bars-1 || Open[i]<Close[i])
        {
         ExtVolumesBuffer[i]=dVolume;
         ExtVolumesUpBuffer[i]=dVolume;
         ExtVolumesDownBuffer[i]=0.0;        
        }
      else
        {
         ExtVolumesBuffer[i]=dVolume;
         ExtVolumesUpBuffer[i]=0.0;
         ExtVolumesDownBuffer[i]=dVolume;        
        } 
     }        
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
yalewang
577
yalewang 2014.12.09 03:56  

thank  you ,

it seems the color has changed its rule .

in old version ,color is detemined by OPEN and CLOSE price , now is by volume itself .

/
To add comments, please log in or register