Hot to store a price value?

 

Hi everyone,

I tried to store a price value into a variable:

double price = Ask;

and then

Print("price", price);

to check if it be stored properly, but it seems not be stored,

the result shows 0.

Who can help me find a way to store a price value into a variable?

Thanks a lot.

 
yy169168 wrote >>

Hi everyone,

I tried to store a price value into a variable:

double price = Ask;

and then

Print("price", price);

to check if it be stored properly, but it seems not be stored,

the result shows 0.

Who can help me find a way to store a price value into a variable?

Thanks a lot.

Try Ask[0] or Ask[1], current price, price of last full bar.

 
yy169168 wrote >>

Hi everyone,

I tried to store a price value into a variable:

double price = Ask;

and then

Print("price", price);

to check if it be stored properly, but it seems not be stored,

the result shows 0.

Who can help me find a way to store a price value into a variable?

Thanks a lot.

Use Print("Price",DoubleToStr(price,Digits));

 
kminler:

Try Ask[0] or Ask[1], current price, price of last full bar.

I think that would be a parse error.


Use Print("Price",DoubleToStr(price,Digits));

Agree that's a good way to show it, but not sure that's going to solve the issue if he's currently getting zero. Print should work just fine, I'd say it's something else here.

 

use :

double MarketInfo( string symbol, int type)