dgts=MarketInfo(SYM,MODE_DIGITS); if (GetLastError()>0){ //SYM is not on Market Watch SymbolSelect(SYM,true); dgts==MarketInfo(SYM,MODE_DIGITS); SymbolSelect(SYM,false); }
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Sorry, this is the right code:
if (GetLastError()>0){
//SYM is not on Market Watch
SymbolSelect(SYM,true);
dgts==MarketInfo(SYM,MODE_DIGITS);
SymbolSelect(SYM,false);
}
Guys, hello.
I am trying to grab prices, using iClose() basically, from other symbols only under D1, but no data is loaded.
I just tried using the example from Carl (https://www.mql5.com/en/forum/159114#comment_3813774) but it continues running non-stop without data.
Debugging another code I am working on, I could see that it raises error 4073 (NO HISTORY DATA)
Considering this, I wonder what is the point that iClose() allows Symbol and Timeframe as parameters if it does not load data?
Does it work also when market is closed?
Maybe quite easy to try.
Does it work also when market is closed?
The symbol has to present in the MarketWatch - use SymbolSelect() for that.
If it is an indicator Sleep doesn't work, so you only can leave OnCalculate() and either wait for the next tick or restart the indicator..
According to tests I did, here goes my findings:
1. Market has to be opened in order to load history. This is very bad, IMHO.
2. Symbol has to be loaded in a chart at least once in target timeframe.
I am only building code in script due to nature of how indicator works.
I really don't understand why this has to be this way, it raises many limitations in the platform this way.
No its not you can press F2 and download any available symbol in history center even when markets closed.
No its not you can press F2 and download any available symbol in history center even when markets closed.
Not from broker, but from metaquotes. Not sure it is a good idea.