Simple MA Crossover with very powerful money management for both MQL4 and MQL5

Specification

//+------------------------------------------------------------------+
//| $10 Smart Scalping Bot for MT5 |
//| EURGBP + AUDUSD + XAGUSD Optimized |
//+------------------------------------------------------------------+
#property strict

#include <Trade/Trade.mqh>
CTrade trade;

//========================= INPUTS ==================================
input double LotSize = 0.01;

input int FastEMA = 20;
input int SlowEMA = 50;
input int RSIPeriod = 14;

input double BuyRSI = 55.0;
input double SellRSI = 45.0;

input int StopLoss = 150;
input int TakeProfit = 350;

input int MaxSpread = 35;

input int MaxOpenTrades = 1;
input int MaxDailyLosses = 3;

input bool UseTrailingStop = true;
input int TrailingStop = 80;

//========================= VARIABLES ===============================
int fastEMAHandle;
int slowEMAHandle;
int rsiHandle;

double fastEMA[];
double slowEMA[];
double rsi[];

int dailyLosses = 0;

//+------------------------------------------------------------------+
//| Expert Initialization |
//+------------------------------------------------------------------+
int OnInit()
{
   // Allow only these symbols
   if(_Symbol != "EURGBP" &&
      _Symbol != "AUDUSD" &&
      _Symbol != "XAGUSD")
   {
      Print("Use only EURGBP, AUDUSD or XAGUSD");
      return(INIT_FAILED);
   }

   // Create indicators
   fastEMAHandle = iMA(_Symbol, PERIOD_M5, FastEMA, 0, MODE_EMA, PRICE_CLOSE);
   slowEMAHandle = iMA(_Symbol, PERIOD_M5, SlowEMA, 0, MODE_EMA, PRICE_CLOSE);
   rsiHandle = iRSI(_Symbol, PERIOD_M5, RSIPeriod, PRICE_CLOSE);

   if(fastEMAHandle == INVALID_HANDLE ||
      slowEMAHandle == INVALID_HANDLE ||
      rsiHandle == INVALID_HANDLE)
   {
      Print("Indicator creation failed");
      return(INIT_FAILED);
   }

   Print("Smart $10 Scalper Loaded");

   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Main Trading Logic |
//+------------------------------------------------------------------+
void OnTick()
{
   // Daily protection
   if(dailyLosses >= MaxDailyLosses)
   {
      Print("Daily loss limit reached.");
      return;
   }

   // Max open trades protection
   if(PositionsTotal() >= MaxOpenTrades)
   {
      ManageTrailingStop();
      return;
   }

   // Spread filter
   double spread =
      (SymbolInfoDouble(_Symbol, SYMBOL_ASK) -
       SymbolInfoDouble(_Symbol, SYMBOL_BID)) / _Point;

   if(spread > MaxSpread)
      return;

   // Get indicator values
   CopyBuffer(fastEMAHandle, 0, 0, 3, fastEMA);
   CopyBuffer(slowEMAHandle, 0, 0, 3, slowEMA);
   CopyBuffer(rsiHandle, 0, 0, 3, rsi);

   double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);

   //================ BUY CONDITIONS =================
   bool buySignal =
      fastEMA[1] < slowEMA[1] &&
      fastEMA[0] > slowEMA[0] &&
      rsi[0] > BuyRSI;

   if(buySignal)
   {
      double sl = ask - StopLoss * _Point;
      double tp = ask + TakeProfit * _Point;

      trade.Buy(LotSize, _Symbol, ask, sl, tp, "BUY");
   }

   //================ SELL CONDITIONS ================
   bool sellSignal =
      fastEMA[1] > slowEMA[1] &&
      fastEMA[0] < slowEMA[0] &&
      rsi[0] < SellRSI;

   if(sellSignal)
   {
      double sl = bid + StopLoss * _Point;
      double tp = bid - TakeProfit * _Point;

      trade.Sell(LotSize, _Symbol, bid, sl, tp, "SELL");
   }

   // Trailing stop
   ManageTrailingStop();
}

//+------------------------------------------------------------------+
//| Trailing Stop Function |
//+------------------------------------------------------------------+
void ManageTrailingStop()
{
   if(!UseTrailingStop)
      return;

   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      ulong ticket = PositionGetTicket(i);

      if(PositionSelectByTicket(ticket))
      {
         double currentSL = PositionGetDouble(POSITION_SL);
         double tp = PositionGetDouble(POSITION_TP);

         ENUM_POSITION_TYPE type =
            (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);

         double priceCurrent;

         // BUY POSITION
         if(type == POSITION_TYPE_BUY)
         {
            priceCurrent = SymbolInfoDouble(_Symbol, SYMBOL_BID);

            double newSL = priceCurrent - TrailingStop * _Point;

            if(newSL > currentSL)
            {
               trade.PositionModify(ticket, newSL, tp);
            }
         }

         // SELL POSITION
         if(type == POSITION_TYPE_SELL)
         {
            priceCurrent = SymbolInfoDouble(_Symbol, SYMBOL_ASK);

            double newSL = priceCurrent + TrailingStop * _Point;

            if(currentSL == 0 || newSL < currentSL)
            {
               trade.PositionModify(ticket, newSL, tp);
            }
         }
      }
   }
}

//+------------------------------------------------------------------+
//| Track Losing Trades |
//+------------------------------------------------------------------+
void OnTradeTransaction(
   const MqlTradeTransaction &trans,
   const MqlTradeRequest &request,
   const MqlTradeResult &result)
{
   if(trans.type == TRADE_TRANSACTION_DEAL_ADD)
   {
      double profit = HistoryDealGetDouble(trans.deal, DEAL_PROFIT);

      if(profit < 0)
      {
         dailyLosses++;
      }
   }
}
//+------------------------------------------------------------------+

Responded

1
Developer 1
Rating
(258)
Projects
322
30%
Arbitration
34
26% / 65%
Overdue
10
3%
Working
2
Developer 2
Rating
(382)
Projects
493
23%
Arbitration
59
56% / 25%
Overdue
57
12%
Loaded
3
Developer 3
Rating
(2)
Projects
2
0%
Arbitration
0
Overdue
0
Free
4
Developer 4
Rating
(104)
Projects
127
24%
Arbitration
23
30% / 52%
Overdue
8
6%
Free
5
Developer 5
Rating
(279)
Projects
376
72%
Arbitration
19
32% / 47%
Overdue
14
4%
Free
Published: 14 codes
6
Developer 6
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
7
Developer 7
Rating
(2)
Projects
3
0%
Arbitration
0
Overdue
0
Free
8
Developer 8
Rating
(258)
Projects
265
29%
Arbitration
0
Overdue
3
1%
Free
Published: 2 codes
9
Developer 9
Rating
(454)
Projects
717
34%
Arbitration
34
71% / 9%
Overdue
22
3%
Free
10
Developer 10
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
11
Developer 11
Rating
(198)
Projects
255
21%
Arbitration
22
50% / 18%
Overdue
0
Working
12
Developer 12
Rating
(578)
Projects
669
32%
Arbitration
42
45% / 45%
Overdue
12
2%
Busy
13
Developer 13
Rating
(33)
Projects
36
33%
Arbitration
5
0% / 80%
Overdue
0
Working
Published: 2 codes
14
Developer 14
Rating
(46)
Projects
59
53%
Arbitration
7
86% / 0%
Overdue
2
3%
Working
15
Developer 15
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
16
Developer 16
Rating
(314)
Projects
560
35%
Arbitration
80
31% / 44%
Overdue
203
36%
Loaded
17
Developer 17
Rating
(2)
Projects
2
0%
Arbitration
0
Overdue
0
Free
18
Developer 18
Rating
(268)
Projects
600
35%
Arbitration
64
20% / 58%
Overdue
147
25%
Working
Published: 1 article, 22 codes
19
Developer 19
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
20
Developer 20
Rating
(640)
Projects
864
48%
Arbitration
29
38% / 17%
Overdue
63
7%
Working
21
Developer 21
Rating
(512)
Projects
551
53%
Arbitration
13
69% / 15%
Overdue
3
1%
Free
22
Developer 22
Rating
(11)
Projects
18
28%
Arbitration
4
50% / 50%
Overdue
1
6%
Free
23
Developer 23
Rating
(62)
Projects
90
29%
Arbitration
24
13% / 58%
Overdue
7
8%
Working
24
Developer 24
Rating
(4)
Projects
5
0%
Arbitration
1
100% / 0%
Overdue
1
20%
Loaded
25
Developer 25
Rating
(363)
Projects
436
54%
Arbitration
21
52% / 14%
Overdue
30
7%
Loaded
26
Developer 26
Rating
(250)
Projects
460
26%
Arbitration
139
20% / 60%
Overdue
100
22%
Free
27
Developer 27
Rating
(6)
Projects
7
43%
Arbitration
1
0% / 100%
Overdue
0
Free
28
Developer 28
Rating
(8)
Projects
8
0%
Arbitration
2
50% / 0%
Overdue
1
13%
Working
29
Developer 29
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
30
Developer 30
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
31
Developer 31
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
Prepare expert for xauusd live chart [ expert is not executing trades on xauusd ] . Deletion and cleaning code . Trailing Stop Rule to follow the given method . Live Chart Only
SNIPER X AI 30 - 120 USD
I need help in building a Robot SNIPER X AI — FINAL BUILD Trading System Type AI Scalping + Sniper Entry Expert Advisor Platforms MetaTrader 4 MetaTrader 5 Supported Brokers � exness.com � justmarkets.com � deriv.com Universal MT4/MT5 broker support FINAL CORE FEATURES ✅ AI Scalping Engine ✅ Sniper Entries ✅ Auto Buy/Sell ✅ EMA Trend Detection ✅ RSI Momentum Filter ✅ Smart Stop Loss ✅ Dynamic Take Profit ✅ Trailing
Am looking for Professional programmer who can build below analysis bot as specified below. The indicators will be provided. 🔷 1. CORE ARCHITECTURE OF YOUR EA Your EA has 3 modes: ✅ Mode 1: Indicator 1 Strategy (9-Signal Engine) ✅ Mode 2: Indicator 2 Strategy (Multi-indicator confluence) ✅ Mode 3: Hybrid Mode (Indicator 1 filters Indicator 2) 🔷 2. PAIR SELECTION LOGIC EA will NOT auto-scan market (based on your
Matriks programında güzel bir stratejim var, meta da kayıtlı olmayan iki indikatörümü de metaya yükledim, stratejim belli, ama robot oluşturmak konusunda bilgim eksik. Yardım istiyorum. Acil dönüş bekliyorum. 12-276 üssel ortalamayı hangi yöne keserse, alphatrend indikaörüde bunu desteklesin, kendi gömdüpüm diğer bir indikatörde seviyelere göre alsın satsın
Hi. Could you slightly rewrite my cBot for me to use a 5-minute chart without a fixed target? The stop should be a trailing stop at the level of the initial range
MT5 EA Developer for Structured ICT/SMC Market Logic Requirements Specification: I need an MT5 Expert Advisor only in MQL5. No indicator, no script, no DLL, and no external API. The EA must be built on a rule-based ICT/SMC-style framework with objective, backtestable logic. I am not looking for social-media-style ICT/SMC interpretation. I need a developer who can convert trading concepts into clear coding rules. The
Hi all, I am looking for a top-rated, experienced MQL5 developer to code Phase 1 (Retail Version) of an advanced Expert Advisor for MetaTrader 5. Key Requirements: 1. Pure Price Action Strategy: Uses H4 Trend Filter (Swing High/Low) and H1 Execution (Wick Scanning >= 66% & Engulfing Candlesticks). Places orders via Buy/Sell Limit at Fibonacci 50% level of the candle body (with Giant Candle threshold rules). 2
I want a mobile bot to trade automatically on my behalf must have experience and be willing to verify your work. It must be profitable and user friendly be easy to use and connect. You'll be given a share of profits
Szukam doświadczonego programisty do stworzenia dedykowanego doradcy eksperckiego (EA) do tradingu. Programista powinien posiadać solidną wiedzę z zakresu MT5, logiki strategii, wskaźników, zarządzania ryzykiem i backtestingu. Doświadczenie w tworzeniu niezawodnych i profesjonalnych robotów handlowych będzie dodatkowym atutem. Proszę o kontakt, jeśli zrealizowałeś już podobne projekty. wszystkie szczeguły podam w
Looking for an experienced programmer to create a fully automated trading system. The EA must be able to detect SPECIFIC H&Shoulder patterns, identify entry point and open a position. Parameters: Candle Count : EX: 50 - meaning the max amount of candle history to look for a pattern. (user adjustable) RISK: EG "2" Meaning the position that must be opened must be 2% of the Balance of the account (user adjustable). The

Project information

Budget
30 - 300 USD
VAT (21%): 6.3 - 63 USD
Total: 36 - 363 USD
For the developer
27 - 270 USD
Deadline
from 5 to 20 day(s)

Customer

Placed orders1
Arbitrage count0