จั่นเจาดอทคอม ถามตอบ คอมพิวเตอร์ อินเตอร์เน็ต Forex MT4 MT5 เทรดทอง

ตลาดหุ้น set ตลาดล่วงหน้า tfex forex Exness FBS XM => Forex Funds Indexes Commodites Gold Silver Oil Crypto (เทรดทอง ค่าเงิน MT4 MT5) => Topic started by: junjao on April 12, 2025, 01:00:33 AM

Title: แจกฟรี EA MT4 EU-M5-EMA50x200-RSI-11APR2025
Post by: junjao on April 12, 2025, 01:00:33 AM
แจกฟรี EA MT4 EU-M5-EMA50x200-RSI-11APR2025

EA ตัวใหม่ MT4 เทรด EU  กรอบเวลา 5 นาที (RAW หรือ Zero)

1,000 USD เปิด 0.1 Lot (100 USD 0.01 Lot)

เปิดบัญชี RAW หรือ Zero ค่า Spread 0 pips ได้ที่ https://exness.com/intl/th/a/73208

ลูกค้าขอทดลอง EA แจ้ง ID ที่สมัครผ่านลิงค์ผม เดี่ยวผมให้ EA ทดลองใช้ฟรี

**** ปรับค่า 2 ตัว หรือลูกค้าลองปรับเองดู *****

Slippage = 1;
extern double RiskRewardRatio = 1.5;
extern int StopLossPips = 20;

Alright! Below is the MQL4 code for a **EUR/USD M5 Trend-Pullback Strategy**, based on:

- 50 EMA and 200 EMA for trend detection
- RSI for pullback confirmation
- Candlestick type for entry signal
- TP/SL based on risk:reward

This EA (Expert Advisor) opens trades when all conditions are met.

---

### ✅ **MQL4 Code – EMA + RSI Trend-Pullback EA (M5)**

```mql4
//+------------------------------------------------------------------+
//|                EURUSD M5 EMA + RSI Strategy EA                  |
//+------------------------------------------------------------------+
#property strict

extern double LotSize = 0.1;
extern int Slippage = 3;
extern double RiskRewardRatio = 1.5;
extern int StopLossPips = 10;

extern int RSI_Period = 14;
extern int RSI_BuyLevel = 40;
extern int RSI_SellLevel = 60;

extern int FastEMA = 50;
extern int SlowEMA = 200;

//+------------------------------------------------------------------+
int OnInit()
{
  Print("EA Initialized");
  return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnTick()
{
  if (TimeFrameCheck()) return; // Avoid multiple trades on same candle

  double emaFast = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, 0);
  double emaSlow = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, 0);
  double rsi = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, 0);

  double ask = NormalizeDouble(Ask, Digits);
  double bid = NormalizeDouble(Bid, Digits);

  // Buy Conditions
  if (emaFast > emaSlow && rsi < RSI_BuyLevel && rsi > 20 && NoOpenTrades(OP_BUY))
  {
      if (IsBullishCandle(1))
      {
        double sl = bid - StopLossPips * Point;
        double tp = bid + (StopLossPips * RiskRewardRatio) * Point;
        OrderSend(Symbol(), OP_BUY, LotSize, ask, Slippage, sl, tp, "Buy Signal", 0, 0, clrBlue);
      }
  }

  // Sell Conditions
  if (emaFast < emaSlow && rsi > RSI_SellLevel && rsi < 80 && NoOpenTrades(OP_SELL))
  {
      if (IsBearishCandle(1))
      {
        double sl = ask + StopLossPips * Point;
        double tp = ask - (StopLossPips * RiskRewardRatio) * Point;
        OrderSend(Symbol(), OP_SELL, LotSize, bid, Slippage, sl, tp, "Sell Signal", 0, 0, clrRed);
      }
  }
}

//+------------------------------------------------------------------+
bool NoOpenTrades(int type)
{
  for (int i = 0; i < OrdersTotal(); i++)
  {
      if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
      {
        if (OrderSymbol() == Symbol() && OrderType() == type)
            return false;
      }
  }
  return true;
}

//+------------------------------------------------------------------+
bool IsBullishCandle(int index)
{
  return (iClose(NULL, 0, index) > iOpen(NULL, 0, index));
}

bool IsBearishCandle(int index)
{
  return (iClose(NULL, 0, index) < iOpen(NULL, 0, index));
}

//+------------------------------------------------------------------+
bool TimeFrameCheck()
{
  static datetime lastTradeTime = 0;
  if (Time
      return true;
  lastTradeTime = Time
  return false;
}
```

---

### 📌 How to Use:
1. Paste into MetaEditor → New → Expert Advisor
2. Compile and attach to **EUR/USD M5 chart**
3. Test in Strategy Tester to optimize parameters (like SL, RSI thresholds, etc.)

---

Want to:
- Add trailing stop?
- Include MACD or volume filter?
- Make it usable on other pairs/timeframes?
------------------------------------------------