Download MetaTrader 5

values from volume_Real and volume_tick

To add comments, please log in or register
Articles can help you to solidify your knowledge. Come and read them!
yhoyo
48
yhoyo 2014.08.16 19:54 

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 

Alain Verleyen
Moderator
30688
Alain Verleyen 2014.08.16 21:49  

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);
     }
yhoyo
48
yhoyo 2014.08.18 21:37  
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

Alain Verleyen
Moderator
30688
Alain Verleyen 2014.08.18 21:49  

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
Rodrigo Malacarne
Moderator
9888
Rodrigo Malacarne 2014.08.18 21:52  
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.

yhoyo
48
yhoyo 2014.08.19 21:33  
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 

To add comments, please log in or register