I want to get the info for a symbol using:
what is wrong with my code?
it prints: 7.0
but it must print : price of the last deal which is: 3588
you are getting a little lost....
this will do what you require:
double Price = SymbolInfoDouble(_Symbol,SYMBOL_BID);
notice I used SYMBOL_BID just to get the current bid price, SYMBOL_LAST gets the last deal price so LAST may return a non-meaningful number if a trade has not taken place since terminal start.
you are getting a little lost....
this will do what you require:
notice I used SYMBOL_BID just to get the current bid price, SYMBOL_LAST gets the last deal price so LAST may return a non-meaningful number if a trade has not taken place since terminal start.
??? Do you have any evidence of that ?
SYMBOL_LAST gives the price of the last deal on the market you are trading. Nothing to do with your terminal. Of course, it's only significant for centralized market, not for Forex.
??? Do you have any evidence of that ?
SYMBOL_LAST gives the price of the last deal on the market you are trading. Nothing to do with your terminal. Of course, it's only significant for centralized market, not for Forex.
from the MT5 documentation.. "It may well be that not a single quote has appeared yet since the terminal is connected to a trading account. In such a case, the requested value will be indefinite."
https://www.mql5.com/en/docs/marketinformation/symbolinfodouble
- www.mql5.com
from the MT5 documentation.. "It may well be that not a single quote has appeared yet since the terminal is connected to a trading account. In such a case, the requested value will be indefinite."
Can you provide a link when you quote documentation please.
done
but on second read I think that statement actually applies to the quotes not the deals, either way at least he now has the correct line of code to do as he wishes.
done
Thank you.
However you mixed different thing. You can be right that "SYMBOL_LAST may return a non-meaningful number", but it's not because "a trade has not taken place since terminal start", but because "not a single quote has appeared yet since the terminal is connected".
So to answer the question of the OP, the best solution is :
MqlTick tick; double last=0; if(SymbolInfoTick(_Symbol,tick)) last=tick.last;
as your link to documentation say :
It is recommended to use SymbolInfoTick() if the function is used for getting information about the last tick.
Please do not double post. Your other topic has been deleted.
Please do not double post. Your other topic has been deleted.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to get the info for a symbol using:
what is wrong with my code?
it prints: 7.0
but it must print : price of the last deal which is: 3588