EA EMA 20/50 Crossover USDJPY M5 แจกฟรีให้ลูกค้า MT4/MT5
EA ตัวใหม่ MT4 เทรด UJ กรอบเวลา 5 นาที (RAW หรือ Zero)
1,000 USD เปิด 1 Lot MaxDD 5% (100 USD 0.1 Lot)
30-6-2567 ถึง 11-4-2568
เปิดบัญชี RAW หรือ Zero ค่า Spread 0 pips ได้ที่ https://exness.com/intl/th/a/73208
ลูกค้าขอทดลอง EA แจ้ง ID ที่สมัครผ่านลิงค์ผม เดี่ยวผมให้ EA ทดลองใช้ฟรี
Here's a complete **MQL4 Expert Advisor (EA)** for the EMA 20/50 crossover strategy on the **EUR/USD M5 timeframe**. This EA will:
- Open trades on EMA cross + pullback confirmation
- Set stop loss and take profit automatically
- Use fixed lot size and risk management
---
### ✅ MQL4 EMA 20/50 Crossover Strategy EA
```mql4
//+------------------------------------------------------------------+
//| EMA 20/50 Crossover Strategy EA |
//| EUR/USD - M5 Timeframe |
//+------------------------------------------------------------------+
#property strict
// Input parameters
input int FastEMA = 20;
input int SlowEMA = 50;
input double LotSize = 0.1;
input int Slippage = 3;
input double TakeProfitPips = 20;
input double StopLossPips = 10;
// Global variables
int ticket;
int OnInit()
{
Print("EMA 20/50 Crossover EA initialized.");
return(INIT_SUCCEEDED);
}
void OnTick()
{
// Only run on new candle
static datetime lastTime = 0;
if (Time
lastTime = Time
double emaFastPrev = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, 1);
double emaFastCurr = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, 0);
double emaSlowPrev = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, 1);
double emaSlowCurr = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, 0);
double sl = StopLossPips * Point;
double tp = TakeProfitPips * Point;
// Buy Signal
if (emaFastPrev < emaSlowPrev && emaFastCurr > emaSlowCurr && OrdersTotal() == 0)
{
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage,
Ask - sl, Ask + tp, "EMA Buy", 0, 0, clrGreen);
if (ticket > 0)
Print("Buy order opened at ", Ask);
else
Print("Buy order failed: ", GetLastError());
}
// Sell Signal
if (emaFastPrev > emaSlowPrev && emaFastCurr < emaSlowCurr && OrdersTotal() == 0)
{
ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, Slippage,
Bid + sl, Bid - tp, "EMA Sell", 0, 0, clrRed);
if (ticket > 0)
Print("Sell order opened at ", Bid);
else
Print("Sell order failed: ", GetLastError());
}
}
```
---
### 📌 Notes:
- Works on **EUR/USD, M5** chart. Attach to the chart to run.
- Uses **EMA crossover only**. You can add candle patterns or RSI filters if needed.
- Adjust `TakeProfitPips`, `StopLossPips`, or `LotSize` based on your risk profile.
-------------------------------------
Here's the **MQL5 version** of the **EMA 20/50 crossover strategy EA** for EUR/USD on the **M5 timeframe**. It includes:
- EMA 20 & EMA 50 crossover logic
- Basic risk management (lot size, SL/TP)
- One trade at a time
---
### ✅ MQL5 Expert Advisor: EMA 20/50 Crossover
```mql5 *************** ยังใช้งานไม่ได้ ลูกค้าต้องไปปรับ code เพิ่มเอง ****************
//+------------------------------------------------------------------+
//| EMA 20/50 Crossover EA for EUR/USD M5 |
//+------------------------------------------------------------------+
#property strict
input int FastEMA = 20;
input int SlowEMA = 50;
input double LotSize = 0.1;
input double StopLossPips = 10;
input double TakeProfitPips = 20;
input int Slippage = 3;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
Print("EMA Crossover EA initialized.");
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Only run on a new bar
static datetime lastTime = 0;
if (TimeCurrent() == lastTime)
return;
lastTime = TimeCurrent();
if (PositionsTotal() > 0)
return;
double emaFastPrev = iMA(_Symbol, PERIOD_M5, FastEMA, 0, MODE_EMA, PRICE_CLOSE, 1);
double emaFastCurr = iMA(_Symbol, PERIOD_M5, FastEMA, 0, MODE_EMA, PRICE_CLOSE, 0);
double emaSlowPrev = iMA(_Symbol, PERIOD_M5, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, 1);
double emaSlowCurr = iMA(_Symbol, PERIOD_M5, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, 0);
double stopLoss = StopLossPips * _Point;
double takeProfit = TakeProfitPips * _Point;
MqlTradeRequest request;
MqlTradeResult result;
ZeroMemory(request);
ZeroMemory(result);
// Buy condition
if (emaFastPrev < emaSlowPrev && emaFastCurr > emaSlowCurr)
{
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = LotSize;
request.type = ORDER_TYPE_BUY;
request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
request.sl = request.price - stopLoss;
request.tp = request.price + takeProfit;
request.deviation = Slippage;
request.magic = 123456;
if (!OrderSend(request, result))
Print("Buy order failed: ", result.retcode);
else
Print("Buy order sent at ", request.price);
}
// Sell condition
if (emaFastPrev > emaSlowPrev && emaFastCurr < emaSlowCurr)
{
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = LotSize;
request.type = ORDER_TYPE_SELL;
request.price = SymbolInfoDouble(_Symbol, SYMBOL_BID);
request.sl = request.price + stopLoss;
request.tp = request.price - takeProfit;
request.deviation = Slippage;
request.magic = 123456;
if (!OrderSend(request, result))
Print("Sell order failed: ", result.retcode);
else
Print("Sell order sent at ", request.price);
}
}
```
---
### 🔧 How to Use:
1. Open **MetaTrader 5**
2. Open the **EUR/USD, M5** chart
3. Open MetaEditor → Create new Expert Advisor → Paste the code
4. Compile & attach to chart
---
### 🚀 Want more features?
I can add:
- RSI confirmation
- Candle pattern filters (e.g., engulfing)
- Trailing stop or break-even
- Trading hours filter
----------------------------------------------------