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'm a newbie on this forum and MQL4 (build 950) and i hope that someone can help me to push me in the right direction!
So, I am trying to create a script to find the horizontal resistance/support lines, but have an issue.
There seems to be nothing wrong with my basic code, still i encounter an annoying behavior when testing/compiling from Editor.
It seems that on compiling the chartID=0, with means that the first chart (in my case AUDCAD) in my "Market Watch" is activated/shown even before the OnInit() and even before the Input window comes up.
So, I want to change in code, this chart to my chart of choice, lets say "EURUSD".It is clearly and needless to say, that this EA is loaded on this chart. When i close this chart manually the EA is unloaded with it.
I can coding the "OnInit()" event with :
long CId=ChartOpen("EURUSD",PERIOD_H1);
that opens a new instance of this chart ("EURUSD") which i can manipulate in code. But for some code-snippets this seems to be useless, because all 'current chartid' functions (exp. Comment() ) keeps pointing to the current Chartid=0 namely "AUDCAD".Perhaps there is a way to setting a certain "property" to this EA?
I can do this manually in the tester by starting up this script with "EURUSD".
The basic question is: Is there a way to change the "current chart" programmatically so that all current chart functions can point to the coded chart say : "EURUSD" ?
I searched around but found no topic that questioned this issue.
Thx to taking the time to review this!
DeMike