I would use copyticks or symbolinfotick.
BTW here is the list of all functions: https://www.mql5.com/en/docs/function_indices.
Documentation on MQL5: Timeseries and Indicators Access / CopyTicks
- www.mql5.com
CopyTicks - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Carl, thanks for the response. I assume you suggest using the alternatives for the ASK, BID prices
I have subsequently been using
ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK); bid = SymbolInfoDouble(_Symbol,SYMBOL_BID); spread = SymbolInfoInteger(_Symbol,SYMBOL_SPREAD);
This seems to work fine.
I'll take a read of the documentation
Peter Williams: I am developing the my use of MT5 and trying to get to grips with the libraries and have two questions:- 1. How do I get the bid and ask price using library SymbolInfo. The following code generates Zero 0.00000 for bid and ask but does appear to give a valid spread I am also trying to retrieve the 'Ticket # " following a trade and tried numerous variations / alternatives and appear to fail - i.e. Ticket = 0 the Trade actions and resB is true
I tried the ResultDeal option having seen code in article //https://www.mql5.com/en/articles/138 Any help appreciated
You set the ".Name()" but did not ".RefreshRates()" afterwards, so the current tick data wasn't available to you.
if( mysymbol.Name( _Symbol ) && mysymbol.RefreshRates() ) { double ask = mysymbol.Ask(), bid = mysymbol.Bid(); ulong spread = mysymbol.Spread(); };
Many thanks
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am developing the my use of MT5 and trying to get to grips with the libraries and have two questions:-
1. How do I get the bid and ask price using library SymbolInfo. The following code generates Zero 0.00000 for bid and ask but does appear to give a valid spread
I am also trying to retrieve the 'Ticket # " following a trade and tried numerous variations / alternatives and appear to fail - i.e. Ticket = 0
the Trade actions and resB is true
I tried the ResultDeal option having seen code in article //https://www.mql5.com/en/articles/138
Any help appreciated