Read help for some of the "Timeseries and Indicators Access" functions, for example CopyRates().
They all have this paragraphs:
When requesting data from the indicator, if requested timeseries are not yet built or they need to be downloaded from the server, the function will immediately return -1, but the process of downloading/building will be initiated.
When requesting data from an Expert Advisor or script, downloading from the server will be initiated, if the terminal does not have these data locally, or building of a required timeseries will start, if data can be built from the local history but they are not ready yet. The function will return the amount of data that will be ready by the moment of timeout expiration, but history downloading will continue, and at the next similar request the function will return more data.
In short, if the data is not available, MT4 will start download process and when the data is ready, you'll get it.
If you need symbol that is not in market watch, you need to call SymbolSelect() function to add that symbol to the market watch.
You need to code with this in mind because that is how things work.
Also, always check return codes for these functions so that you know what happened.