- The iMA does not return a double in MT5. Invalid smoothing method in either language. Wrong number of
arguments.
Your code Documentation double HIWeekly = iMA( Symbol(), PERIOD_W1, 1, 0, MODE_HIGH, <<< Not a smoothing method PRICE_HIGH, 0 <<< invalid argument );
int iMA( string symbol, // symbol name ENUM_TIMEFRAMES period, // period int ma_period, // averaging period int ma_shift, // horizontal shift ENUM_MA_METHOD ma_method, // smoothing type ENUM_APPLIED_PRICE applied_price // type of price or handle );
- Did you previous create those two objects?
- Why are you getting a moving average of length one? Just get the price you're interested in.
thank you i am still using mt4 perhaps this is my issue.
Please post in the correct section in future.
I will move this to the MQL4 and Metatrader 4 section.
- Kyle Travis Mowery: i am still using mt4 perhaps this is my issue.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. -
double LOWWeekly = iMA(Symbol(),PERIOD_W1,1,0,MODE_LOW,PRICE_LOW,0)
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 № 4
}
I get an error while running these codes. Where am I wrong?
I get an error while running these codes. Where am I wrong?
https://www.mql5.com/en/docs/indicators/ima
int iMA(
string symbol, // symbol name
ENUM_TIMEFRAMES period, // period
int ma_period, // averaging period
int ma_shift, // horizontal shift
ENUM_MA_METHOD ma_method, // smoothing type
ENUM_APPLIED_PRICE applied_price // type of price or handle
);
Answer has been given above by William.
Check your parameters.
![Documentation on MQL5: Technical Indicators / iMA Documentation on MQL5: Technical Indicators / iMA](https://c.mql5.com/36/35/documentation-on-mql5-technical__3.png)
- www.mql5.com
- Not using SRC. Please edit your (original) post
and use the CODE button (Alt-S)! (For large amounts of
code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
- Not specifying what error.
-
Check your return codes for errors, and report them including GLE/LE, your variable values, and the market. That way we would know that at least you are calling your code.
What are Function return values ? How do I use them ? - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles -
if (BigMovingAverage1 > SmallMovingAverage1) if(BigMovingAverage2 < SmallMovingAverage2){ signal="sell"; } if (BigMovingAverage1 < SmallMovingAverage1) if (BigMovingAverage2 > SmallMovingAverage2){ signal="sell"; }
Obvious. -
Magic number only allows an EA to identify its
trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly
and/or no Magic number filtering on your OrderSelect / Position select loop means your code is incompatible with every
EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
PositionClose is not working - MQL5 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
Hi all I am having a similar problem with the following, I am trying to call the spread
double spread = SymbolInfoDouble(_Symbol, SYMBOL_SPREAD);
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am working on compiling codes and have come to a bit of a loss when it comes to these 4 lines. am I just writing it an older way? do i need to define with an enum?
double LOWWeekly = iMA(Symbol(),PERIOD_W1,1,0,MODE_LOW,PRICE_LOW,0); // line for lower code
double HIWeekly = iMA(Symbol(),PERIOD_W1,1,0,MODE_HIGH,PRICE_HIGH,0); //line for lower code
ObjectSetText("Whigh",DoubleToStr(HIWeekly,Digits), 12, "Arial Bold", Orange);