Hi can someone please assist me. I have no knowledge of MQL but i have created my first EA. I am not sure if it will work and would appreciate some pointers from the experts.
Files:
Dual_X_Over.mq4
4 kb
- EA help
- Please can you help me with this EA. Should be easy for experienced MQL4 programmer.Thanks!!
- 3 Moving Average and MACD
Martin: I have no knowledge of MQL
- <edited by moderator>
extern double lots = AccountBalance() / 3000; RefreshRates(); extern double SMAFast = iMA(NULL,0,MAFastPeriod,0,MODE_EMA,PRICE_CLOSE,1); extern double SMAMedium = iMA(NULL,0,MAMediumPeriod,0,MODE_EMA,PRICE_CLOSE,1); extern double SMASlow = iMA(NULL,0,MASlowPeriod,0,MODE_EMA,PRICE_CLOSE,1);
Externs or global variables or static variable must be initialized with constants. Those variables never change. They are not input/external variables. Assign them in OnInit.- Code can no be on global scope, only in functions.
int start(){
Start using the new Event Handling Functions.
Event Handling Functions - Functions - Language Basics - MQL4 ReferenceIF trade_active = false && ((SMAFastPrev < SMAFast ... ELSE IF trade_active = true && ... IF @SMAFastPrev < @SMAFast && @SMAFast >= @SMASlow && @SMAFastPrev < @SMASlow
Don't post code that won't even compile.extern int trade_type;
Can't be an extern. What does trade_type 1, 9, and zero mean? Perhaps you mean an enumeration not an int.ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,slippage,stopLoss,takeProfit,"buy",magicNumber,0,Green;
Check your return codes for errors and report them.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 ArticlesOrderClose(OrderTicket(),lots,Ask,slippage,Red);
Check your return codes for errors and report them.- You can not use any
Trade Functions until you select an order.
-
You buy at the Ask and sell at the Bid.
- Your buy order's TP/SL are triggered when the Bid reaches it. Not the Ask.
-
Your sell order's TP/SL will be triggered when the Ask reaches it. To trigger at
a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools -> Options {control-O} -> charts -> Show ask line.)
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