Hi,
Is it possible for EA to access arrays of candles with different size than current Chart size?
I want my EA to perform some calculations on 1-minute candles but other on 1-hour candles. Can it be done?
You mean other timeframes ? yes it can be done ,but you must be ever-vigilant to request the correct candles and never assume data exists already (downloaded) ,as William will point out .
For example I want to calculate difference between Close[2] and Close [5], but also Close[4] and Close[1500].
I did call ArraySize() on Close and it returned around 67000 so it is weird that I am receiving "array out of range" when accessing Close[1500].
Anyway if I could switch somehow to 30min candles and access Close[50] it would be same as 1500 on 1 minute Chart and should fix my problem.
The reason can be Tick Data Suite software I am testing recently. It allows to test historical data later than regular Strategy Tester and it may be the reason of errors. I don't know really.
-
On MT4: Unless the current chart is that
specific symbol(s)/TF(s) referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero on the first call.
On MT5: Unless the chart is that specific pair/TF, you must Synchronize the terminal Data from the Server.
Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum
Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum
SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum 2019.09.03 - Don't mix apples and oranges.
- 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,
Is it possible for EA to access arrays of candles with different size than current Chart size?
I want my EA to perform some calculations on 1-minute candles but other on 1-hour candles. Can it be done?