Ekvationen:
Hi there, I am currently trying to get my first EA to be compiled, but i got som errors, any idea how to fix them?
https://pastebin.com/N4EahfUJ
Thanks in advance, Ekvationen.
Hi there, I am currently trying to get my first EA to be compiled, but i got som errors, any idea how to fix them?
https://pastebin.com/N4EahfUJ
Thanks in advance, Ekvationen.
void OnTick() { if (OrdersTotal() > 0) return; double lots = 0.01; int stopLoss = 500; int takeProfit = 500; double ema = iMA(NULL, 0, 300, 0, MODE_EMA, PRICE_CLOSE, 0); if (Ask + 500 * Point < ema) if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "My forex wall-e order", 12345, 0, clrRed)) Print("Buy order succeeded!"); }
Mladen Rakic:
Thanks, im still getting errors though..
'iMA' - wrong parameters count EA-test.mq5 38 17
'Ask' - undeclared identifier EA-test.mq5 40 8
'Point' - undeclared identifier EA-test.mq5 40 20
'OP_BUY' - undeclared identifier EA-test.mq5 41 28
'OrderSend' - wrong parameters count EA-test.mq5 41 8
5 error(s), 0 warning(s) 6 1
-
Why did you post your MT4 code question in the
Root /
MT5 EA 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. - Don't link to code, Use the SRC button! Please edit your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum - Compiling with MT5 not MT4
double ema = iMA( NULL, 0, 300, 0, MODE_EMA, PRICE_CLOSE, 0);
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 );
Technical Indicators / iMA - Reference on algorithmic/automated trading language for MetaTrader 5 - Compiling with MT5 not MT4. There is no Ask.
Predefined Variables - Reference on algorithmic/automated trading language for MetaTrader 5 - You can't download MT4 via the site, only from brokers.
if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "My forex wall-e order", 12345, 0, clrRed)) Print("Buy order succeeded!");
OrderSend does not return a bool, your if statement will always be true (never ticket № 0.)
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
https://pastebin.com/N4EahfUJ
Thanks in advance, Ekvationen.