The first time you access a symbol, the terminal has to get the data. Then it will be continuously updated for 10 minutes after the last request before being unloaded.
You are seeing price data because you are continuously requesting it. Stop for 15 minutes and try then.
This is incorrect information. In order to access SymbolInfoDouble...bid/ask you need to have the Symbol selected in the MarketWatch. It won't matter if you have history downloaded because if it's not selected then it won't return any value.
Just a shame there's not a simple, intuitive programmatic way to do this.
There is, now... no need to worry about history or whether the symbol is in the market watch - this handles all that automatically. Save the mqh file I posted into your include folder and call it like this. It really doesn't get any easier.
#include <multi_symbol_timeframe.mqh>
voidOnStart()
{
//---// easy call double bid = iBid(_Symbol);
// fail-safe callif(!iBid(bid,_Symbol))
Print("FAILED TO GET BID");
}
[in] Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open orders for this symbol. To get symbol data using functions for accessing timeseries and indicators, make sure that the symbol exists in...
Nice, but surely only going to work for an EA not an Indicator
Why not indicator?
While the indicator is running, nothing else in the terminal can happen.
While the indicator is running, nothing else in the terminal can happen.
This is pretty fail-safe. Tested and working
This is incorrect information. In order to access SymbolInfoDouble...bid/ask you need to have the Symbol selected in the MarketWatch. It won't matter if you have history downloaded because if it's not selected then it won't return any value.
#include <SymbolInfoFailSafe.mqh>Where do you find that in MT4?Here is a more simplified (non-OOP) lib that will also work.
Here is a more simplified (non-OOP) lib that will also work.
I'll take a look, I see the idea.
TBH I'm simply working with "Show All" in MarketWatch which guarantees access to a complete list of priced symbols.
Just a shame there's not a simple, intuitive programmatic way to do this.
E.g. GetTotalNumberOfSymbols() (regardless of what's displayed in MarketWatch or the GUI)
GetListOfAllSymbols() (Regardless of what's displayed in MarketWatch or the GUI)
GetPriceOfSymbol() (Regardless of what's displayed in MarketWatch or the GUI)
etc.
Seems like the functions are too tied in with what's going on on the screen, rather than directly linking to the underlying market data...
Just a shame there's not a simple, intuitive programmatic way to do this.
There is, now... no need to worry about history or whether the symbol is in the market watch - this handles all that automatically. Save the mqh file I posted into your include folder and call it like this. It really doesn't get any easier.
...and for future reference...
https://docs.mql4.com/marketinformation/symbolselect