values from volume_Real and volume_tick

 

hi, how are you??

 I want to obtain the values from

int volumenreal = iVolumes (_Symbol, PERIOD_CURRENT, VOLUME_REAL);

int  volumentics = iVolumes (_Symbol, PERIOD_CURRENT, VOLUME_TICK); 

 

this is the result I get in the chart... but I need a little help...    how I can return the values that show the indicators??

If I use Print(volumenreal);  that show 12..  and Print(volumentics); that show 13...   I'm confused

 

volume_Real  and volume_Ticks 

 

really thanks

 

Diego 

 

I already suggest you to read the iVolumes documentation, did you ? It's all explain with a code examples.

You have to use your indicator handle with CopyBuffer().

//--- fill a part of the iVolumesBuffer array with values from the indicator buffer that has 0 index
   if(CopyBuffer(ind_handle,0,0,amount,volume_buffer)<0)
     {
      //--- if the copying fails, tell the error code
      PrintFormat("Failed to copy data from the iVolumes indicator, error code %d",GetLastError());
      //--- quit with zero result - it means that the indicator is considered as not calculated
      return(false);
     }
 
angevoyageur:

I already suggest you to read the iVolumes documentation, did you ? It's all explain with a code examples.

You have to use your indicator handle with CopyBuffer().

hi again

 

yes, of course yes.. I read that...  

but I tried this... of course I think this is so wrong  :(

int buffer_num=0;

int star_pos=0; 

int count=0;

double    array[]; 

 

   int volumenreal = iVolumes (_Symbol, PERIOD_CURRENT, VOLUME_REAL);

   int precio= CopyBuffer(volumenreal,buffer_num, star_pos, count, array); 

   Print(precio); // this print -1 or 1 

 

really thanks

 

Diego 

pd. I'm trying to take this value in Expert Advisor  NOT in a indicator

 

yhoyo:

...

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

Ok you read but it seems you don't understood what your read.

int buffer_num=0;
int star_pos=0; 
int count=1;
double    array[]; 

int volume_handle = iVolumes (_Symbol, PERIOD_CURRENT, VOLUME_REAL);

int copied= CopyBuffer(volume_handle,buffer_num, star_pos, count, array); 

if(copied==-1)
   // error
else
   Print(array[0]); // this will print the volume of candle 0
 
yhoyo:

hi again

int count=0;

What is int count = 0 ?

If the variable count is the amount of bars from which you will copy the data, then no data will be copied .... try to set count = 1 or more to have anything copied into your array.

 
angevoyageur:

Ok you read but it seems you don't understood what your read.

Malacarne:

What is int count = 0 ?

If the variable count is the amount of bars from which you will copy the data, then no data will be copied .... try to set count = 1 or more to have anything copied into your array.

hi, how are you?  really thanks for all your help

 I was using int count=0 because I was thinking that was the first data in the array,  and yes!  I forget to create the array first...   I was thinking that all data was avalaible  directly

 

may be the answere for this next cuestion is "no".. but I need to ask...  

 

do you know if  I can discriminate between sales orders and purchase orders using the volume_real data or another information?

 

thanks again 

 

Please, could anyone help me?

I'm trying to use the code below, but always return 0


int vol_filter()
   {
    int volumes = iVolumes(_Symbol,PERIOD_M30,VOLUME_REAL);
    double vol_buffer[];
    int result;
    result = CopyBuffer( volumes ,0,0,1, vol_buffer );
    if (result == -1)
      return (0);
    else 
      result = vol_buffer[0];
      return (result);
         
         
   }
 
Guilherme Mendonca:

Please, could anyone help me?

I'm trying to use the code below, but always return 0


Hi there.


I had the same problems.

Try your code with VOLUME_TICK  , so i think it is working. At me only is working with VOLUME_TICK , if i take VOLUME_REAL  i get 0 like you