Hi tsandrew,
EA can know any bars and it depends on coding.
For example, current open bar is bar #0, previous bar is bar #1 and so on.
I mean - EA understands the bars on this way (0; 1; 2; 3; ...).
So, no need to wait - EA can see any bars.
You only need to be sure that history data was loaded in Metatrader and on the chart too - you can read this small thread about what to do:
Hi tsandrew,
EA can know any bars and it depends on coding.
For example, current open bar is bar #0, previous bar is bar #1 and so on.
I mean - EA understands the bars on this way (0; 1; 2; 3; ...).
So, no need to wait - EA can see any bars.
You only need to be sure that history data was loaded in Metatrader and on the chart too - you can read this small thread about what to do:
https://www.mql5.com/en/forum/181256When I open up MetaTrader, I ALWAYS have bars that show up on EUR/USD - hundreds of them, going back months. And yet - I've heard of traders specifically putting lines in their code to not execute until the chart has a certain number of bars.
How will the chart ever not have enough bars for an EA to trade? I don't understand it. But I want to know so I'll know how to avoid it.
As always, any response is appreciated!
Hi tsandrew,
Yes, you are right - coders are placing min bars to be on the chart/for pair inside the code of the EA sometimes.
So, you will need to wait until the bars will be loaded by itself, or you can doanoad the bars by yourself.
It is related to post #5 of this thread:
https://www.mql5.com/en/forum/181256
Example: you want to attach EA to EURUSD H4 so you can load the data for EURUSD for M1, M5 and so on up to monthly timeframe (according to post #5 of this thread https://www.mql5.com/en/forum/181256 ), after that - right mouse on the chart and select 'Refresh'.
or you can switch "Auto Scroll" and "Chart Shift" for select chart to be off (to be like that):
and press UP on your keyboard, and data will be loaded to the chart.
As some EAs are using many timeframes so it may be good to make it for every timeframe of selected pair.
Example: you are going to attach EA to EURUSD H4 so you should make this preparated for every timeframe/chart of EURUSD started from M1 and up to Monthly.
- 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 all,
I have looked online and as far as I can tell, this topic has not been very thoroughly addressed. Perhaps this post may be of help to others besides myself.
From my current understanding, the EA only knows price data starting from the instant it is attached to the chart. So, if I'm working on a M5 chart and I need to look 6 bars back, I will need to wait at least 30 minutes (from when I attach the EA to the chart) before making my first trade.
BUT I don't understand why the EA has to wait when weeks of price data is already there on the chart in the main MetaTrader application.
I'm wondering -
A) would it be possible to load those 6 bars when I first attach the EA to the chart? That way I could begin trading immediately, instead of having to wait.
B) If it is possible, what is the maximum number of previous bars I can load?
Thank you for your responses.