Roshtheking

MQL5 Experten

Spezifikation

//+------------------------------------------------------------------+
//|                   XAUUSD GoldBot EA v3.0                         |
//|          Dedicated Gold (XAU/USD) Trading Expert Advisor         |
//|      MT4 Desktop — Trades visible on MT4 Mobile (iOS/Android)    |
//+------------------------------------------------------------------+
#property copyright   "GoldBot XAUUSD"
#property version     "3.0"
#property strict
#property description "Consecutive XAUUSD trading: EMA + RSI + MACD + ATR"

//+------------------------------------------------------------------+
//  GOLD NOTES:
//  - XAUUSD pip = $0.01  (2-decimal: e.g. 2345.67)
//  - ATR on H1 gold is typically $8–$25
//  - Best sessions: London Open (07:00 GMT), NY Open (13:00 GMT)
//  - Recommended TF: H1 or M15
//+------------------------------------------------------------------+

// ═══════════════════════════════════════════════════════════════════
//  INPUTS
// ═══════════════════════════════════════════════════════════════════
input string  Sec0              = "=== GOLD BOT ===";
input bool    ForceXAUUSD       = true;     // Block run on non-XAUUSD
input int     MagicNum          = 88880001;

input string  Sec1              = "=== TREND ===";
input int     FastEMA           = 8;        // Fast EMA
input int     SlowEMA           = 21;       // Slow EMA
input int     TrendEMA          = 50;       // Trend filter EMA
input bool    UseTrendFilter    = true;     // Only trade with main trend

input string  Sec2              = "=== RSI ===";
input int     RSI_Period        = 14;
input int     RSI_BuyMax        = 65;       // Don't BUY if RSI above this
input int     RSI_SellMin       = 35;       // Don't SELL if RSI below this
input int     RSI_OB            = 75;       // RSI exit overbought
input int     RSI_OS            = 25;       // RSI exit oversold

input string  Sec3              = "=== MACD ===";
input bool    UseMACD           = true;
input int     MACD_Fast         = 12;
input int     MACD_Slow         = 26;
input int     MACD_Sig          = 9;

input string  Sec4              = "=== RISK ===";
input double  RiskPct           = 1.0;      // % balance per trade
input double  SL_ATR            = 1.8;      // SL = ATR x this
input double  TP_ATR            = 3.0;      // TP = ATR x this
input double  MaxLot            = 5.0;
input double  MinLot            = 0.01;
input int     MaxTrades         = 2;        // Gold vol: keep low
input int     Slip              = 10;       // Slippage points

input string  Sec5              = "=== PROTECTION ===";
input bool    UseTrail          = true;
input double  Trail_ATR         = 1.2;
input bool    UseBreakeven      = true;
input double  BE_ATR_Trigger    = 1.0;
input double  BE_Buffer         = 20;       // Points buffer above entry
input bool    UseRSI_Exit       = true;

input string  Sec6              = "=== SESSIONS (GMT) ===";
input bool    Asian             = false;    // 00-07 (low gold vol)
input bool    London            = true;     // 07-12 BEST for gold
input bool    NewYork           = true;     // 13-20 BEST for gold
input bool    AvoidNews         = true;     // Skip last 5min of hour

input string  Sec7              = "=== DISPLAY ===";
input bool    ShowPanel         = true;

// ═══════════════════════════════════════════════════════════════════
//  GLOBALS
// ═══════════════════════════════════════════════════════════════════
int    g_bars      = 0;
bool   g_newBar    = false;
double g_lastSig   = 0;
string g_Name      = "GoldBot v3.0";

//+------------------------------------------------------------------+
int OnInit()
{
   if(ForceXAUUSD)
   {
      string s = Symbol();
      if(s!="XAUUSD" && s!="GOLD" && s!="XAUUSDm" && s!="XAUUSDc" && s!="XAUUSD.")
      {
         Alert("GoldBot: Attach ONLY to XAUUSD chart! Current: " + s);
         return(INIT_PARAMETERS_INCORRECT);
      }
   }
   if(FastEMA >= SlowEMA || SlowEMA >= TrendEMA)
   {
      Alert("GoldBot: EMA order must be Fast < Slow < Trend");
      return(INIT_PARAMETERS_INCORRECT);
   }

   Print("╔══════════════════════════════════╗");
   Print("║   XAUUSD GoldBot v3.0 ACTIVE     ║");
   Print("║  TF: ",PeriodToStr(Period()),"  Risk:",RiskPct,"%");
   Print("║  EMA:",FastEMA,"/",SlowEMA,"/",TrendEMA," RSI:",RSI_Period,"  ║");
   Print("╚══════════════════════════════════╝");

   g_bars = Bars;
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   ObjectsDeleteAll(0,"GB_");
   Comment("");
}

//+------------------------------------------------------------------+
void OnTick()
{
   g_newBar = false;
   if(Bars != g_bars){ g_newBar = true; g_bars = Bars; }

   ManageTrades();
   if(ShowPanel) DrawPanel();
   if(!g_newBar)  return;
   if(!InSession()) return;
   if(CountTrades() >= MaxTrades) return;

   // ── Indicators (bar 1 = last closed, confirmed bar) ──────────
   double fe1 = iMA(NULL,0,FastEMA, 0,MODE_EMA,PRICE_CLOSE,1);
   double fe2 = iMA(NULL,0,FastEMA, 0,MODE_EMA,PRICE_CLOSE,2);
   double se1 = iMA(NULL,0,SlowEMA, 0,MODE_EMA,PRICE_CLOSE,1);
   double se2 = iMA(NULL,0,SlowEMA, 0,MODE_EMA,PRICE_CLOSE,2);
   double te  = iMA(NULL,0,TrendEMA,0,MODE_EMA,PRICE_CLOSE,1);
   double rsi = iRSI(NULL,0,RSI_Period,PRICE_CLOSE,1);
   double atr = iATR(NULL,0,14,1);
   double mm  = iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Sig,PRICE_CLOSE,MODE_MAIN,  1);
   double ms  = iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Sig,PRICE_CLOSE,MODE_SIGNAL,1);

   bool bullX     = (fe2 <= se2) && (fe1 > se1);
   bool bearX     = (fe2 >= se2) && (fe1 < se1);
   bool aboveTrnd = (!UseTrendFilter) || (Close[1] > te);
   bool belowTrnd = (!UseTrendFilter) || (Close[1] < te);
   bool macdUp    = (!UseMACD) || (mm > ms);
   bool macdDn    = (!UseMACD) || (mm < ms);
   bool noDupe    = (g_lastSig != Time[1]);

   // ── BUY ───────────────────────────────────────────────────────
   if(bullX && aboveTrnd && macdUp && rsi > 30 && rsi < RSI_BuyMax && noDupe)
   {
      double sl  = NormalizeDouble(Ask - atr*SL_ATR, Digits);
      double tp  = NormalizeDouble(Ask + atr*TP_ATR, Digits);
      double lot = CalcLot(Ask - sl);
      if(lot > 0 && sl > 0 && tp > sl)
      {
         int tk = OrderSend(Symbol(),OP_BUY,lot,Ask,Slip,sl,tp,g_Name,MagicNum,0,clrGold);
         if(tk > 0){
            g_lastSig = Time[1];
            Print("GOLD BUY  tk:",tk," lot:",lot," entry:",Ask," SL:",sl," TP:",tp," ATR:",DoubleToStr(atr,2));
         } else Print("BUY ERR:",GetLastError());
      }
   }

   // ── SELL ──────────────────────────────────────────────────────
   if(bearX && belowTrnd && macdDn && rsi < 70 && rsi > RSI_SellMin && noDupe)
   {
      double sl  = NormalizeDouble(Bid + atr*SL_ATR, Digits);
      double tp  = NormalizeDouble(Bid - atr*TP_ATR, Digits);
      double lot = CalcLot(sl - Bid);
      if(lot > 0 && sl > 0 && tp < sl)
      {
         int tk = OrderSend(Symbol(),OP_SELL,lot,Bid,Slip,sl,tp,g_Name,MagicNum,0,clrTomato);
         if(tk > 0){
            g_lastSig = Time[1];
            Print("GOLD SELL tk:",tk," lot:",lot," entry:",Bid," SL:",sl," TP:",tp," ATR:",DoubleToStr(atr,2));
         } else Print("SELL ERR:",GetLastError());
      }
   }
}

//+------------------------------------------------------------------+
void ManageTrades()
{
   double atr = iATR(NULL,0,14,1);
   double rsi = iRSI(NULL,0,RSI_Period,PRICE_CLOSE,0);

   for(int i = OrdersTotal()-1; i >= 0; i--)
   {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
      if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNum) continue;

      int    tk   = OrderTicket();
      double opx  = OrderOpenPrice();
      double csl  = OrderStopLoss();
      double ctp  = OrderTakeProfit();

      if(OrderType() == OP_BUY)
      {
         // RSI overbought exit
         if(UseRSI_Exit && rsi >= RSI_OB){
            if(OrderClose(tk, OrderLots(), Bid, Slip, clrOrange))
               Print("RSI OB EXIT BUY tk:",tk);
            continue;
         }
         // Breakeven
         if(UseBreakeven && Bid >= opx + atr*BE_ATR_Trigger && csl < opx){
            double bsl = NormalizeDouble(opx + BE_Buffer*Point, Digits);
            if(bsl > csl) OrderModify(tk,opx,bsl,ctp,0,clrYellow);
         }
         // Trail
         if(UseTrail){
            double tsl = NormalizeDouble(Bid - atr*Trail_ATR, Digits);
            if(tsl > csl && tsl > 0) OrderModify(tk,opx,tsl,ctp,0,clrAqua);
         }
      }

      if(OrderType() == OP_SELL)
      {
         // RSI oversold exit
         if(UseRSI_Exit && rsi <= RSI_OS){
            if(OrderClose(tk, OrderLots(), Ask, Slip, clrOrange))
               Print("RSI OS EXIT SELL tk:",tk);
            continue;
         }
         // Breakeven
         if(UseBreakeven && Ask <= opx - atr*BE_ATR_Trigger && (csl > opx || csl==0)){
            double bsl = NormalizeDouble(opx - BE_Buffer*Point, Digits);
            if(bsl < csl || csl==0) OrderModify(tk,opx,bsl,ctp,0,clrYellow);
         }
         // Trail
         if(UseTrail){
            double tsl = NormalizeDouble(Ask + atr*Trail_ATR, Digits);
            if((tsl < csl || csl==0) && tsl > 0) OrderModify(tk,opx,tsl,ctp,0,clrAqua);
         }
      }
   }
}

//+------------------------------------------------------------------+
double CalcLot(double slDist)
{
   if(slDist <= 0) return MinLot;
   double bal  = AccountBalance();
   double risk = bal * RiskPct / 100.0;
   double tv   = MarketInfo(Symbol(),MODE_TICKVALUE);
   double ts   = MarketInfo(Symbol(),MODE_TICKSIZE);
   double ls   = MarketInfo(Symbol(),MODE_LOTSTEP);
   if(tv==0||ts==0) return MinLot;
   double lot  = risk / ((slDist/ts)*tv);
   lot = MathFloor(lot/ls)*ls;
   return NormalizeDouble(MathMax(MinLot,MathMin(MaxLot,lot)),2);
}

//+------------------------------------------------------------------+
bool InSession()
{
   int h = TimeHour(TimeCurrent());
   int m = TimeMinute(TimeCurrent());
   if(AvoidNews && m >= 55) return false;
   if(Asian   && h>=0  && h<7)  return true;
   if(London  && h>=7  && h<12) return true;
   if(NewYork && h>=13 && h<20) return true;
   return false;
}

//+------------------------------------------------------------------+
int CountTrades()
{
   int n=0;
   for(int i=0;i<OrdersTotal();i++)
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNum) n++;
   return n;
}

//+------------------------------------------------------------------+
double FloatPnL()
{
   double p=0;
   for(int i=0;i<OrdersTotal();i++)
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNum)
            p+=OrderProfit()+OrderSwap()+OrderCommission();
   return p;
}

//+------------------------------------------------------------------+
void DrawPanel()
{
   string q="GB_"; int x=12,y=14,lh=17;

   double fe = iMA(NULL,0,FastEMA, 0,MODE_EMA,PRICE_CLOSE,1);
   double se = iMA(NULL,0,SlowEMA, 0,MODE_EMA,PRICE_CLOSE,1);
   double te = iMA(NULL,0,TrendEMA,0,MODE_EMA,PRICE_CLOSE,1);
   double rsi= iRSI(NULL,0,RSI_Period,PRICE_CLOSE,1);
   double atr= iATR(NULL,0,14,1);
   double mm = iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Sig,PRICE_CLOSE,MODE_MAIN,  1);
   double ms = iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Sig,PRICE_CLOSE,MODE_SIGNAL,1);
   double pnl= FloatPnL();
   int    tr = CountTrades();

   bool up = (fe>se)&&(Close[1]>te);
   bool dn = (fe<se)&&(Close[1]<te);
   string tStr = up?"▲ BULLISH":dn?"▼ BEARISH":"── RANGING";
   color  tClr = up?clrLime:dn?clrTomato:clrGray;

   string rStr; color rClr;
   if(rsi>=RSI_OB){rStr="OVERBOUGHT";rClr=clrTomato;}
   else if(rsi<=RSI_OS){rStr="OVERSOLD";rClr=clrLime;}
   else if(rsi>=60){rStr="BULLISH";rClr=clrLime;}
   else if(rsi<=40){rStr="BEARISH";rClr=clrOrange;}
   else{rStr="NEUTRAL";rClr=clrSilver;}

   bool ses = InSession();

   Lbl(q+"h",  x,y,       "╔══ XAUUSD GOLDBOT v3.0 ══╗",9,clrGold);
   Lbl(q+"s0", x,y+lh,    "  "+Symbol()+" | "+PeriodToStr(Period())+"  | GOLD",8,clrWhite);
   Lbl(q+"d1", x,y+lh*2,  "──────────────────────────",8,C'55,55,75');
   Lbl(q+"b",  x,y+lh*3,  "Balance : $"+DoubleToStr(AccountBalance(),2),8,clrWhite);
   Lbl(q+"e",  x,y+lh*4,  "Equity  : $"+DoubleToStr(AccountEquity(),2),8,clrWhite);
   Lbl(q+"p",  x,y+lh*5,  "Float P&L: $"+DoubleToStr(pnl,2),8,pnl>=0?clrLime:clrTomato);
   Lbl(q+"tr", x,y+lh*6,  "Trades  : "+IntegerToString(tr)+" / "+IntegerToString(MaxTrades),8,clrWhite);
   Lbl(q+"d2", x,y+lh*7,  "──────────────────────────",8,C'55,55,75');
   Lbl(q+"tn", x,y+lh*8,  "Trend   : "+tStr,8,tClr);
   Lbl(q+"rs", x,y+lh*9,  "RSI("+IntegerToString(RSI_Period)+")  : "+DoubleToStr(rsi,1)+"  "+rStr,8,rClr);
   Lbl(q+"mc", x,y+lh*10, "MACD    : "+(mm>ms?"▲ BULL":"▼ BEAR"),8,mm>ms?clrLime:clrTomato);
   Lbl(q+"at", x,y+lh*11, "ATR(14) : $"+DoubleToStr(atr,2),8,clrSilver);
   Lbl(q+"d3", x,y+lh*12, "──────────────────────────",8,C'55,55,75');
   Lbl(q+"ss", x,y+lh*13, "Session : "+(ses?"ACTIVE ✔":"CLOSED ✘"),8,ses?clrLime:clrGray);
   Lbl(q+"cf", x,y+lh*14, "Risk:"+DoubleToStr(RiskPct,1)+"% Trail:"+(UseTrail?"ON":"OFF")+" BE:"+(UseBreakeven?"ON":"OFF"),8,clrGray);
   Lbl(q+"ft", x,y+lh*15, "╚══════════════════════════╝",9,C'55,55,75');
}

//+------------------------------------------------------------------+
void Lbl(string n,int x,int y,string t,int sz,color c)
{
   if(ObjectFind(0,n)<0) ObjectCreate(0,n,OBJ_LABEL,0,0,0);
   ObjectSetInteger(0,n,OBJPROP_CORNER,   CORNER_LEFT_UPPER);
   ObjectSetInteger(0,n,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(0,n,OBJPROP_YDISTANCE,y);
   ObjectSetString(0, n,OBJPROP_TEXT,     t);
   ObjectSetInteger(0,n,OBJPROP_FONTSIZE, sz);
   ObjectSetInteger(0,n,OBJPROP_COLOR,    c);
   ObjectSetString(0, n,OBJPROP_FONT,     "Courier New");
   ObjectSetInteger(0,n,OBJPROP_BACK,     false);
}

//+------------------------------------------------------------------+
string PeriodToStr(int p)
{
   switch(p){
      case PERIOD_M1:  return"M1";  case PERIOD_M5:  return"M5";
      case PERIOD_M15: return"M15"; case PERIOD_M30: return"M30";
      case PERIOD_H1:  return"H1";  case PERIOD_H4:  return"H4";
      case PERIOD_D1:  return"D1";  default: return StringConcatenate(p,"m");
   }
}
//+------------------------------------------------------------------+
//  END — XAUUSD GoldBot EA v3.0
//  Recommended: H1 chart on XAUUSD
//+------------------------------------------------------------------+

Bewerbungen

1
Entwickler 1
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
2
Entwickler 2
Bewertung
(8)
Projekte
8
0%
Schlichtung
2
50% / 0%
Frist nicht eingehalten
1
13%
Arbeitet
3
Entwickler 3
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
4
Entwickler 4
Bewertung
(23)
Projekte
29
31%
Schlichtung
0
Frist nicht eingehalten
2
7%
Frei
5
Entwickler 5
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
Ähnliche Aufträge
preciso de um programa paracido com o CAP channel com botao de refresh e opcaos de alterar o periodo. utilizava um muito bom, mas o vendedor acredito ter sido excluido da comunidade, sumiu. e o que tinha parou de funcionar
Hello I need a Person who write for me a EA on MT5 on renko charts, refreshed time 10s (optionally other timeframes 5s, 15s, 30s, 1min etc). EA will base on The bollinger band modified indicator, the source code is from Tradingwiev. I will share it. Rules: EA will open positions when price close above/under some band from indicator, always on closed brick (EA must wait to close timeframe, SL or Trailing stop will
Krushan 30+ USD
#property copyright "Krishh yadav" #property link "https://krishhautomationfx.in" #property version "1.07" #property strict #include <Trade\Trade.mqh> #include <Trade\AccountInfo.mqh> #include <Trade/PositionInfo.mqh> CTrade trade; CPositionInfo posinfo; CPositionInfo pos; enum LotMode { FixedLot = 0, RiskLot = 1, EquityLot = 2, }; enum ENUM_HOUR { h00=0, h01=1, h02=2, h03=3, h04=4, h05=5, h06=6, h07=7
Project Overview We have a highly optimized, production-ready custom cTrader cBot built for a fast-paced Renko breakout strategy (specifically trading XAUUSD/Gold). The core system architecture, structural mapping, and breakout logic are flawless. We are seeking an expert C# algorithmic developer for a targeted engagement to refine the execution mechanics and add an advanced trade management module. This is not a
I want to convert an MT4 Fractal Breakout EA to MT5. This EA places pending stop order to capture the fractal breakout and trail it. No complex indicator or rules. Enable only Buy or Only Sell or Both Buy Sell option in any indices. MT4 backtest should match Mt5 to some extent
Hello! Is there any person who can teach me Forex. I prefer high time frame strategies Like H4, D1, but I am open for your propositions. Have a nice day
SNIPER X AI 30 - 200 USD
I really need a developer Who can help me to create my SNIPER X AI - Elite AI Trading System Overview SNIPER X AI BOT is an AI-assisted trading system for Forex, Crypto, Stocks, Indices, and Gold. Currency: USD,RAND,KWD, POUND,EURO Core Features AI Scalping, Sniper Entries, Auto Buy/Sell, Smart Risk Management, Telegram Alerts, Mobile Monitoring, VPS Deployment. Supported Platforms MetaTrader 4, MetaTrader 5, Exness
I am looking for a professional developer to create an automated trading bot for Synthetic Derivative Indices. The bot should be designed for efficiency, precision, and stability, with the ability to execute trades automatically based on predefined strategies and market conditions. and synthetic indices trading is essential for this project
Existing EA needed Hi, Im looking to purchase or build an EA that can open many trades or big lot size to churn out IB commission, it doesnt have to be super profitable but will need to have the number of trades on going in order to earn IB commission. If you have any EA or strategy that are gearing towards this, let me know and i would be glad to purchase it
Hello, I am looking for an experienced developer who can build a professional EA suitable for long-term prop firm account passing and account management. I am NOT interested in risky strategies such as martingale, grid, or aggressive recovery systems. My main priorities are: very low and stable drawdown, strong and consistent risk management, strict news filter, long-term sustainability, realistic and stable monthly

Projektdetails

Budget
30+ USD
MwSt (21%): 6.3 USD
Insgesamt: 36 USD
Für die Entwickler
27 USD

Kunde

Veröffentlichte Aufträge1
Anzahl der Schlichtungen0