problem to convert tick to double

To add comments, please log in or register
really koh
16
really koh  

Hello,  i'm creating a volume at price indicator.

but  after receiving the value I don't know how to convert ..


 MqlTick tick_array[]; 

 double volume1m [1]=0;

CopyTicks(_Symbol,tick_array,COPY_TICKS_TRADE,0,2000);



/////////the problem is here:
if (tick_array[0].last > 0)
  {
     volume1m[0] += tick_array[0].last;
  }
Print (volume1m[0]);

/////I get similar value to this:         4.654716935610645e-212


could someone help me ? 

Mladen Rakic
151135
Mladen Rakic  
really koh:

Hello,  i'm creating a volume at price indicator.

but  after receiving the value I don't know how to convert ..


 MqlTick tick_array[]; 

 double volume1m [10];

CopyTicks(_Symbol,tick_array,COPY_TICKS_TRADE,0,2000);


the problem is here:

volume1m[1] += tick_array[0].volume;

Print (volume1m[1] );

I get similar value to this:         4.654716935610645e-212


could someone help me ? 

You did not initialize volume1m[1] to 0 prior to adding some value to it
really koh
16
really koh  
Mladen Rakic:
You did not initialize volume1m[1] to 0 prior to adding some value to it

thanks for answering.
but, its works, its only an example, the problem is to convert like TimeToString, i need something like TickToDouble
William Roeder
19815
William Roeder  
really koh: , i need something like TickToDouble

Makes no sense. tick_array[0].last and volume1m[0]  are already doubles.

really koh
16
really koh  

I found the problem!

the problem is:

IF  tick_array[0].volume is 0  and the variable took it

if i use 

if (volume1m[0] > 0)
{
Print();  // it enters and returns encrypted value
}

volume1m should be 0, becouse it took the value 0 from tick_array.. BUT NO :(
So i change to >

if (tick_array[0].last > 0) 
{
 volume1m[0] =  tick_array[uz].last;
}

if (volume1m[0] > 0)
{
Print();
}

and solved my problem

thank you!

To add comments, please log in or register