Spécifications

-----------+ //| EMA_BB_Fib_RSI_EA.mq5 | //| 1m scalping EMA/BB/RSI + Fib | //+------------------------------------------------------------------+ #property copyright "ChatGPT" #property version "1.00" #property strict #include <Trade/Trade.mqh> CTrade trade; //-------------------- Inputs -------------------- input ulong InpMagic = 240611; input double InpRiskPercent = 0.50; // risk per trade (% of balance) input bool InpOneTradeAtATime = true; input int InpEMAFast = 3; input int InpEMAMid = 9; input int InpEMASlow = 21; input int InpRSIPeriod = 14; input double InpRSILevel = 50.0; input int InpBBPeriod = 20; input double InpBBDeviation = 2.0; input int InpFibLookbackBars = 60; // how far to search swing high/low for fib input double InpFibSupportLow = 0.382; // fib zone lower bound for longs input double InpFibSupportHigh = 0.618; // fib zone upper bound for longs input double InpFibResistanceLow = 0.382; // fib zone lower bound for shorts input double InpFibResistanceHigh = 0.618; // fib zone upper bound for shorts input int InpSL_Method = 0; // 0=structure (recent swing), 1=BB-based, 2=fixed points buffer input double InpFixedSL_Points = 80; // used if SL_Method=2 input double InpFixedTP_RR = 1.2; // TP = SL * RR input bool InpUseTrailing = true; input double InpTrailStartR = 0.6; // start trailing after profit >= R input double InpTrailStepPoints = 20; //-------------------- Globals/Handles -------------------- int hEMAfast = INVALID_HANDLE; int hEMAmid = INVALID_HANDLE; int hEMAslow = INVALID_HANDLE; int hRSI = INVALID_HANDLE; int hBB = INVALID_HANDLE; // latest market data datetime lastBarTime = 0; //-------------------- Helper: Normalize -------------------- double NormalizeLots(double lots) { double minLot=SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); double maxLot=SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); double step =SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP); lots = MathMax(minLot, MathMin(maxLot, lots)); // adjust to step lots = MathFloor(lots/step)*step; return lots; } //-------------------- Helper: Get tick size/value -------------------- double GetTickValue() { // value per 1 tick for 1 lot double tickVal = 0.0; SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE, tickVal); return tickVal; } double GetTickSize() { double tickSize=0.0; SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE, tickSize); return tickSize; } //-------------------- Helper: Risk-based lot sizing -------------------- double CalcLots(double sl_points) { double balance = AccountInfoDouble(ACCOUNT_BALANCE); double riskMoney = balance * (InpRiskPercent/100.0); double tickSize = GetTickSize(); double tickValue = GetTickValue(); if(tickSize <= 0 || tickValue <= 0) return 0.01; // sl_points is in points (not price) // points -> price distance: sl_points * point double priceDist = sl_points * _Point; // number of ticks double ticks = priceDist / tickSize; if(ticks <= 0) return 0.01; double lossPerLot = ticks * tickValue; if(lossPerLot <= 0) return 0.01; double lots = riskMoney / lossPerLot; return NormalizeLots(lots); } //-------------------- Helper: Check open positions -------------------- bool HasOpenPosition() { if(!InpOneTradeAtATime) return false; for(int i=PositionsTotal()-1; i>=0; i--) { if(PositionSelectByIndex(i)) { string sym = PositionGetString(POSITION_SYMBOL); long mg = PositionGetInteger(POSITION_MAGIC); if(sym == _Symbol && (ulong)mg == InpMagic) return true; } } return false; } //-------------------- Helper: find recent swing high/low -------------------- // Simple swing approximation: highest high and lowest low over lookback. bool GetSwingHighLow(double &swingHigh, double &swingLow, int &highIndex, int &lowIndex) { swingHigh = -DBL_MAX; swingLow = DBL_MAX; highIndex = -1; lowIndex = -1; int bars = MathMin(InpFibLookbackBars, (int)Bars(_Symbol, PERIOD_M1)-2); if(bars < 10) return false; for(int i=1; i<=bars; i++) { double h = iHigh(_Symbol, PERIOD_M1, i); double l = iLow(_Symbol, PERIOD_M1, i); if(h > swingHigh) { swingHigh = h; highIndex = i; } if(l < swingLow) { swingLow = l; lowIndex = i; } } return (highIndex!=-1 && lowIndex!=-1); } //-------------------- Helper: compute Fib levels -------------------- void ComputeFibLevels(double swingHigh, double swingLow, double &lvl382, double &lvl618, bool uptrendForFib) { // If we assume move is from low->high (uptrend), fib retracement levels measured from high to low: // Standard: retracement = high - (high-low)*ratio // For long: support levels often use retracement during pullback. // We'll compute both ways based on which swing occurred later using uptrendForFib. // uptrendForFib=true means we consider low->high as the impulse. // Then retracement support = high - (high-low)*ratio // If downtrendForFib=false means high->low impulse: retracement resistance = low + (high-low)*ratio double range = MathAbs(swingHigh - swingLow); if(range <= 0) { lvl382=0; lvl618=0; return; } if(uptrendForFib) { lvl382 = swingHigh - (swingHigh - swingLow) * InpFibSupportLow; // 0.382 by default lvl618 = swingHigh - (swingHigh - swingLow) * InpFibSupportHigh; // 0.618 by default } else { // measuring resistance levels during bounce in a down impulse lvl382 = swingLow + (swingHigh - swingLow) * InpFibResistanceLow; lvl618 = swingLow + (swingHigh - swingLow) * InpFibResistanceHigh; } } //-------------------- Helper: trailing -------------------- void ManageTrailing() { if(!InpUseTrailing) return; for(int i=PositionsTotal()-1; i>=0; i--) { if(!PositionSelectByIndex(i)) continue; string sym = PositionGetString(POSITION_SYMBOL); long mg = PositionGetInteger(POSITION_MAGIC); if(sym != _Symbol || (ulong)mg != InpMagic) continue; long type = PositionGetInteger(POSITION_TYPE); double openPrice = PositionGetDouble(POSITION_PRICE_OPEN); double sl = PositionGetDouble(POSITION_SL); double tp = PositionGetDouble(POSITION_TP); double volume = PositionGetDouble(POSITION_VOLUME); double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID); double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); // current profit in price distance double pointDist = 0; if(type == POSITION_TYPE_BUY) { double profit = bid - openPrice; pointDist = profit / _Point; if(profit <= 0) continue; } else { double profit = openPrice - ask; pointDist = profit / _Point; if(profit <= 0) continue; } // Compute R using SL distance double slDist = 0; if(sl > 0) { if(type == POSITION_TYPE_BUY) slDist = (openPrice - sl)/_Point; else slDist = (sl - openPrice)/_Point; } else slDist = InpFixedSL_Points; if(slDist <= 0) continue; double R = pointDist / slDist; if(R < InpTrailStartR) continue; // trail: for buy -> move SL up near EMA9; for sell -> move SL down near EMA9 double ema9 = 0.0; double buf[1]; // EMA9 buffer request is heavy; but fine for trailing if(CopyBuffer(hEMAmid, 0, 0, 1, buf) > 0) ema9 = buf[0]; if(ema9 <= 0) continue; double newSL = sl; if(type == POSITION_TYPE_BUY) { // SL should be below EMA9 newSL = ema9 - 5*_Point; // only raise SL if(newSL > sl) { // step check if((newSL - sl)/_Point >= InpTrailStepPoints) { trade.PositionModify(_Symbol, newSL, tp); } } } else { newSL = ema9 + 5*_Point; // only lower SL if(sl <= 0 || newSL < sl) { if(sl<=0 || (sl - newSL)/_Point >= InpTrailStepPoints) { trade.PositionModify(_Symbol, newSL, tp); } } } } } //-------------------- Helper: get indicator values at shift -------------------- bool GetIndi(double &emaFast, double &emaMid, double &emaSlow, double &rsi, double &bbUpper, double &bbBasis, double &bbLower) { double buf1[3], buf2[3], buf3[3], buf4[3]; ArraySetAsSeries(buf1,true); ArraySetAsSeries(buf2,true); ArraySetAsSeries(buf3,true); ArraySetAsSeries(buf4,true); // EMA buffers (shift 1 candle close used) int shift = 1; if(CopyBuffer(hEMAfast, 0, shift, 1, buf1) <= 0) return false; emaFast = buf1[0]; if(CopyBuffer(hEMAmid, 0, shift, 1, buf2) <= 0) return false; emaMid = buf2[0]; if(CopyBuffer(hEMAslow, 0, shift, 1, buf3) <= 0) return false; emaSlow = buf3[0]; // RSI if(CopyBuffer(hRSI, 0, shift, 1, buf4) <= 0) return false; rsi = buf4[0]; // BB: buffers: 0=upper,1=middle,2=lower (depends on MT5 implementation) // For iBands in MQL5: buffer 0=upper,1=middle,2=lower double buft[1]; if(CopyBuffer(hBB, 0, shift, 1, buft) <= 0) return false; bbUpper = buft[0]; if(CopyBuffer(hBB, 1, shift, 1, buft) <= 0) return false; bbBasis = buft[0]; if(CopyBuffer(hBB, 2, shift, 1, buft) <= 0) return false; bbLower = buft[0]; return true; } //-------------------- OnInit -------------------- int OnInit() { hEMAfast = iMA(_Symbol, PERIOD_M1, InpEMAFast, 0, MODE_EMA, PRICE_CLOSE); hEMAmid = iMA(_Symbol, PERIOD_M1, InpEMAMid, 0, MODE_EMA, PRICE_CLOSE); hEMAslow = iMA(_Symbol, PERIOD_M1, InpEMASlow, 0, MODE_EMA, PRICE_CLOSE); if(hEMAfast==INVALID_HANDLE || hEMAmid==INVALID_HANDLE || hEMAslow==INVALID_HANDLE) return INIT_FAILED; hRSI = iRSI(_Symbol, PERIOD_M1, InpRSIPeriod, PRICE_CLOSE); if(hRSI==INVALID_HANDLE) return INIT_FAILED; hBB = iBands(_Symbol, PERIOD_M1, InpBBPeriod, 0, InpBBDeviation, PRICE_CLOSE); if(hBB==INVALID_HANDLE) return INIT_FAILED; trade.SetExpertMagicNumber((int)InpMagic); return INIT_SUCCEEDED; } //-------------------- OnTick -------------------- void OnTick() { if(_Period != PERIOD_M1) return; // new bar check datetime t0 = iTime(_Symbol, PERIOD_M1, 0); if(t0 == lastBarTime) { // still manage trailing intrabar ManageTrailing(); return; } lastBarTime = t0; if(HasOpenPosition()) { ManageTrailing(); return; } // Get indicators on closed candle (shift=1) double emaFast, emaMid, emaSlow, rsi; double bbUpper, bbBasis, bbLower; if(!GetIndi(emaFast, emaMid, emaSlow, rsi, bbUpper, bbBasis, bbLower)) return; // Fibonacci swing double swingHigh, swingLow; int highIndex, lowIndex; if(!GetSwingHighLow(swingHigh, swingLow, highIndex, lowIndex)) return; // Determine impulse direction by which swing occurred later: // If lowIndex > highIndex (means low happened more recently, higher index is older? In our loop i=1..bars older increases) // In iHigh/iLow with shift i: i=1 is last closed candle, larger i is older. // So "more recent" has smaller i. bool lowMoreRecent = (lowIndex < highIndex); // low happened more recently bool upImpulse = lowMoreRecent; // low -> high impulse (up) double fib382, fib618; ComputeFibLevels(swingHigh, swingLow, fib382, fib618, upImpulse); // Prices (use last closed candle) double close1 = iClose(_Symbol, PERIOD_M1, 1); double open1 = iOpen(_Symbol, PERIOD_M1, 1); double high1 = iHigh(_Symbol, PERIOD_M1, 1); double low1 = iLow(_Symbol, PERIOD_M1, 1); // Fib zone checks bool inLongFibZone = (close1 >= MathMin(fib382, fib618) && close1 <= MathMax(fib382, fib618)); bool inShortFibZone = (close1 >= MathMin(fib382, fib618) && close1 <= MathMax(fib382, fib618)); // BB touch/close logic (reversion style) bool longBB = (low1 <= bbLower && close1 > bbLower) || (close1 > bbBasis); bool shortBB = (high1 >= bbUpper && close1 < bbUpper) || (close1 < bbBasis); // EMA alignment bool longEMA = (emaFast > emaMid && emaMid > emaSlow); bool shortEMA = (emaFast < emaMid && emaMid < emaSlow); // RSI 50 filter + direction hint (optional using two-candle change) double rsiPrev2 = 0.0; double tmp[1]; int shift2 = 2; if(CopyBuffer(hRSI, 0, shift2, 1, tmp) > 0) rsiPrev2 = tmp[0]; bool rsiLong = (rsi > InpRSILevel); bool rsiShort = (rsi < InpRSILevel); bool rsiRising = (rsiPrev2 > 0 ? (rsi > rsiPrev2) : true); bool rsiFalling = (rsiPrev2 > 0 ? (rsi < rsiPrev2) : true); // Structure SL estimate double sl=0,tp=0; double ask=SymbolInfoDouble(_Symbol, SYMBOL_ASK); double bid=SymbolInfoDouble(_Symbol, SYMBOL_BID); // ---- LONG ---- if(longEMA && rsiLong && rsiRising && longBB && inLongFibZone) { // SL method if(InpSL_Method == 2) { sl = close1 - InpFixedSL_Points * _Point; double sl_points = InpFixedSL_Points; double lots = CalcLots(sl_points); double tp_dist_points = sl_points * InpFixedTP_RR; tp = close1 + tp_dist_points * _Point; trade.Buy(lots, _Symbol, ask, sl, tp, "EMA_BB_FIB_LONG"); } else { // structure SL: below recent lowest low over lookback double recentLow = DBL_MAX; int bars = MathMin(InpFibLookbackBars, (int)Bars(_Symbol, PERIOD_M1)-2); for(int i=1;i<=bars;i++) recentLow = MathMin(recentLow, iLow(_Symbol, PERIOD_M1, i)); sl = recentLow - 5*_Point; double sl_points = (close1 - sl)/_Point; if(sl_points <= 0) return; double lots = CalcLots(sl_points); double tp = close1 + sl_points * InpFixedTP_RR * _Point; trade.Buy(lots, _Symbol, ask, sl, tp, "EMA_BB_FIB_LONG"); } } // ---- SHORT ---- if(shortEMA && rsiShort && rsiFalling && shortBB && inShortFibZone) { if(InpSL_Method == 2) { sl = close1 + InpFixedSL_Points * _Point; double sl_points = InpFixedSL_Points; double lots = CalcLots(sl_points); double tp_dist_points = sl_points * InpFixedTP_RR; tp = close1 - tp_dist_points * _Point; trade.Sell(lots, _Symbol, bid, sl, tp, "EMA_BB_FIB_SHORT"); } else { // structure SL: above recent highest high over lookback double recentHigh = -DBL_MAX; int bars = MathMin(InpFibLookbackBars, (int)Bars(_Symbol, PERIOD_M1)-2); for(int i=1;i<=bars;i++) recentHigh = MathMax(recentHigh, iHigh(_Symbol, PERIOD_M1, i)); sl = recentHigh + 5*_Point; double sl_points = (sl - close1)/_Point; if(sl_points <= 0) return; double lots = CalcLots(sl_points); double tp = close1 - sl_points * InpFixedTP_RR * _Point; trade.Sell(lots, _Symbol, bid, sl, tp, "EMA_BB_FIB_SHORT"); } } ManageTrailing(); } //-------------------- OnDeinit -------------------- void OnDeinit(const int reason) { // nothing }

Répondu

1
Développeur 1
Évaluation
(111)
Projets
184
25%
Arbitrage
25
16% / 76%
En retard
16
9%
Gratuit
2
Développeur 2
Évaluation
(1)
Projets
2
0%
Arbitrage
0
En retard
1
50%
Travail
3
Développeur 3
Évaluation
(64)
Projets
145
46%
Arbitrage
21
38% / 24%
En retard
32
22%
Gratuit
4
Développeur 4
Évaluation
(33)
Projets
38
21%
Arbitrage
5
0% / 60%
En retard
0
Gratuit
5
Développeur 5
Évaluation
(7)
Projets
9
67%
Arbitrage
0
En retard
0
Gratuit
Publié : 1 article, 2 codes
6
Développeur 6
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
7
Développeur 7
Évaluation
(631)
Projets
709
42%
Arbitrage
2
100% / 0%
En retard
1
0%
Gratuit
Publié : 9 codes
8
Développeur 8
Évaluation
Projets
1
0%
Arbitrage
0
En retard
0
Gratuit
Publié : 4 codes
Commandes similaires
Hello, I need an Expert Advisor for MetaTrader 5 in MQL5. 1. GENERAL: Scalping on M1, Monday to Friday, 3 symbols: XAUUSD, EURUSD, GBPUSD. Scan every tick. Fully automatic. NO MARTINGALE, NO GRID, NO HEDGING. 2. TIMEFRAME: M1 ONLY. Use PERIOD_M1 for all indicators. Magic 101010. Comment "Adaptive V11". Deviation 10. Spread filter: >30 points EURUSD/GBPUSD or >50 points XAUUSD = NO TRADE. 3. INDICATORS: EMA 20, EMA
CyberShadow AI 30 - 300 USD
I want a bot that’s trades using smc strategy having stop loss and take profit.I want it to be able to trade with small account I want a disciplined robot but a strong one to I also what it to trade using trend line and locate point of interest
Elektra Trading Robot 100 - 200 USD
Elektra Trading Robot is an automated Forex trading system designed to analyze market conditions execute trades according to predefined trading strategies. It aims to identify potential trading opportunities, manage trading positions, and apply risk management rules to help protect trading capital. The robot is designed for real-account trading and focuses on consistency, disciplined execution, and efficient trade
SMC Bot Creation 350 - 550 USD
Hello, I am interested in developing a professional MT5 Expert Advisor similar in functionality and technical sophistication to your reference product, Institutional SMC Robot: https://www.mql5.com/en/market/product/187011 I want to develop my own independent EA based on advanced Smart Money Concepts (SMC), with a strong focus on institutional price action, liquidity and market structure. The key functionalities I
(I can't pay 30 for this of course if you can just help.me solve this problem I would appreciate you )It was doing everything perfectly until yesterday this happened this is a python file that copies from telegram Iand send to ea signal if you have any idea what to do or why this happened please tell me
PROJECT: BYBIT PUMP & DUMP EARLY DETECTION ENGINE Fixed Budget: USD $1,000 – Complete Project I am looking for an experienced quantitative trading developer to design, develop, validate and deliver a professional standalone Python 3.12 module for detecting early pump and dump movements on Bybit USDT perpetual futures. IMPORTANT: This is NOT an MT4/MT5 indicator, Expert Advisor or a request to build a complete trading
​I am looking for an experienced MQL5 developer to build a fully automated MetaTrader 5 Expert Advisor (EA) optimized primarily for XAUUSD (Gold), featuring a clean Tkinter-style telemetry dashboard control concept or customizable input parameters. ​1. Core Strategy Rules (Full-Body Engulfing) ​Signal Identification: The EA must scan completed candles across multiple selectable timeframes (e.g., 1M, 5M, 15M, 30M, 1H)
Exir AI 30 - 200 USD
I need an experienced MQL5 developer to build a custom AI-assisted Expert Advisor (EA) for MetaTrader 5. The EA will run on a live MT5 account with Tickmill and must support Forex and Crypto CFDs. Required instruments: - EURUSD - GBPUSD - USDJPY - XAUUSD - BTCUSD - ETHUSD Required timeframes: - M5, M15, and M30 Trading logic: - M30 determines the overall trend. - M15 identifies entry zones, support/resistance, and
Best trader robot 499 - 550 USD
Objective: Develop a robust and highly profitable Expert Advisor (EA) for MetaTrader based on a precise custom trading strategy to achieve a high win rate. ​ Instrument & Timeframe: XAUUSD (Gold), optimized for M5 / M15 timeframes. ​ Entry Strategy: Open Buy/Sell orders based on strict confirmation signals (e.g., Moving Average crossover combined with Price Action or RSI threshold). ​ Lot Size & Risk Management
Titolo: Cerco sviluppatore per EA su XAUUSD M1 per conto reale Cerco uno sviluppatore MQL5 per creare un Expert Advisor per MetaTrader 5 su XAUUSD M1, da utilizzare su conto reale con deposito iniziale di 100–200 €. La strategia prevede un Buy Stop a 1,00 sopra l’Ask e un Sell Stop a 1,00 sotto il Bid, entrambi con stop loss iniziale di 1,00 e senza take profit fisso. I pendenti devono restare fermi: quando uno viene

Informations sur le projet

Budget
39+ USD

Client

Commandes passées1
Nombre d'arbitrages0