I'm a relative newbie to MQL4 (but not programming).
I have created a new EA. I find when I run the EA it somehow defaults to the symbol at the top of the Market watch window, in this case USDCHF. I.e. the Symbols() function returns USDCHF. The output in the Experts window also refers to USDCHF which is very confusing.
Then the EA opens up a new chart window with USDCHF.
All of this is before program control is handed to my code in the OnTick function.
I can of course specify a different ticker when I do OrderSend and anything else but how can I stop MQL opening the unwanted new chart window and defaulting to USDCHF in the background?
I noticed a few other people have the same problem but no one has ever written a clear answer.
I have created a new EA.
Did you create the EA yourself, writing all the code or copy and paste from another?
Show your code that is executed before OnTick().
Exactly, I am opening in the debugger! Is that just a debugger phenomenon I have no control oveR?
I borrowed bits of codes from others. There is no code executed before OnTick() as I only have an OnTick function, no other functions...
Yes. The debugger always launches the first symbol on the chart unless you otherwise specify in the Tools>Options>Debug menu.
Got it, that's incredibly helpful. To me it makes more intuitive sense that the debugger would pick up the symbol in whatever chart is currently in focus but so be it..