Symbol()
you can use SymbolName(position,1)Depending on the position where the instrument is in market place.
Hi everybody,
I am developing my first EA and maybe some of you could help me.
What I want to do is quite simple but I dont know how to write itin mql5.
I just want to get the latest price as quickly as possible (here every 16ms for example). This my current code :
But this code is always collecting data from EURUSD with H1 period, even if this chart is not displayed before running the code.
So how to change it to get data from Google (#GOOG) for example or another share on a minute basis (M1).
Thank you very much for your help !
Not true, it reads the data from the chart that your EA is dropped on. (current chart), and from M1 bars.
read about Symbol(), TimeSeries, and Copy...() functions.
to read other symbols, (other instruments), change the first parameter.
like this : iTime("ANOTHER_NAME", PERIOD_M1, ...);
by the way, you probably don't need to retrieve these data with such high frequency refresh rate. (every 16ms ???!!!)
many coders prefer new bar formation, as a analyze frequency. (e.g. each M1 bar).
and some coders prefer intra bar data analyze. (like each tick)
but I think your rate of data-receiving is not necessary. but you know better.
Hello you have to change the you can use Depending on the position where the instrument is in market place.
Thanks for helping !
It works, if I change the position I have another values from different instruments. But how to know which one I am dealing with ? and what is the 1 after position ?
And why it's always the EURUSD chart displayed when I am running the code, how to get the appropriate chart displayed ?
Thanks !
Not true, it reads the data from the chart that your EA is dropped on. (current chart), and from M1 bars.
read about Symbol(), TimeSeries, and Copy...() functions.
to read other symbols, (other instruments), change the first parameter.
like this : iTime("ANOTHER_NAME", PERIOD_M1, ...);
by the way, you probably don't need to retrieve these data with such high frequency refresh rate. (every 16ms ???!!!)
many coders prefer new bar formation, as a analyze frequency. (e.g. each M1 bar).
and some coders prefer intra bar data analyze. (like each tick)
but I think your rate of data-receiving is not necessary. but you know better.
Thanks ! You're probably right, I am just a beginner...
I could retrieve the same data using OnTick method instead of OnTimer, no ?
yes OnTick is (always) better that OnTimer
these are functions that get called when something happens.
Ontick : when new tick is arrived
OnTimer : based on the time interval you set
OnTrade : when something related to trades happens
...
OnTImer introduces may problems usually.
OnTick seems good, it avoids making actions "for nothing" or missing variations as I did with time intervals.
But I can't understand what is exactly behind a tick. I thought it was only when variations occur but there are also ticks when the market is closed, so how it's possible ? Thanks for all.
if a price change happens, a tick is received and OnTick is executed.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everybody,
I am developing my first EA and maybe some of you could help me.
What I want to do is quite simple but I dont know how to write itin mql5.
I just want to get the latest price as quickly as possible (here every 16ms for example). This my current code :
But this code is always collecting data from EURUSD with H1 period, even if this chart is not displayed before running the code.
So how to change it to get data from Google (#GOOG) for example or another share on a minute basis (M1).
Thank you very much for your help !