- awlex redc: I'm trying to convert Indicator to Expert Advisor , but my code isn't working.Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into the EA (using iCustom) and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 programming forum -
int counted_bars = iBars("USDJPY", PERIOD_M5);
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.
-
int counted_bars = iBars("USDJPY", PERIOD_M5); int e = Bars - counted_bars + period + 1; vect[x] = iMA(NULL, 0, period/2, 0, MODE_LWMA, PRICE_CLOSE, x)*2
You are mixing apples and oranges. - Why did you post your MT4 question in the Root / MT5 General
section instead of the MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.
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
Hi, guys .
I'm trying to convert Indicator to Expert Advisor , but my code isn't working.
In the 2nd Loop , ExtMapBuffer Array's Element has value. ( Ex : ExtMapBuffer [x] = 111.1223)
In the 3rd Loop, although ExtMapBuffer ArraySize is still not changed,
but ExtMapBuffer Array's Element hasn't value. Ex : ExtMapBuffer [x] = 0.0)
Here is my code.
Hope you can help me.