MT TRADING BOT

Specifiche

//+------------------------------------------------------------------+ //| HamerrAI_BOT.mq4 | //| EMA crossover + ATR SL/TP, risk % lot sizing, trailing stop | //+------------------------------------------------------------------+ #property strict //--- inputs input int FastEMAPeriod = 9; input int SlowEMAPeriod = 21; input int ATRPeriod = 14; input double ATRMultiplier = 1.5; // SL = ATR * multiplier input double RiskPercent = 1.0; // risk per trade (% of balance) input double MaxSpreadPoints = 50; // in points (for 5-digit brokers 50 points = 5 pips) input int MagicNumber = 202501; input int MaxTrades = 2; input bool UseTrailingStop = true; input int TrailingStopPoints = 30; // in points input bool UseBreakEven = true; input int BreakEvenPoints = 20; // move to BE after this many points in profit input int TradeStartHour = 0; // allowed trading hours (local broker time) input int TradeEndHour = 23; input double MinLot = 0.01; input double MaxLot = 5.0; input int Slippage = 3; //--- globals datetime lastBarTime = 0; //+------------------------------------------------------------------+ //| Custom functions | //+------------------------------------------------------------------+ double GetATR(string symbol, int timeframe, int period, int shift) { // Average True Range using iATR return iATR(symbol, timeframe, period, shift); } double GetEMA(string symbol, int timeframe, int period, int shift) { // iMA with MODE_EMA return iMA(symbol, timeframe, period, 0, MODE_EMA, PRICE_CLOSE, shift); } int CountOpenTradesForMagic(int magic) { int count=0; for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if(OrderMagicNumber()==magic && OrderSymbol()==Symbol()) count++; } } return count; } double CalculateLotSize(double stopLossPips) { // Calculate lot size by RiskPercent of free margin / account balance double riskMoney = AccountBalance() * (RiskPercent/100.0); // value per point for 1 lot: double tickValue = MarketInfo(Symbol(), MODE_TICKVALUE); double tickSize = MarketInfo(Symbol(), MODE_TICKSIZE); double point = MarketInfo(Symbol(), MODE_POINT); // For MT4, SL in pips -> convert to points (pips * 10 for 5-digit) double slPoints = stopLossPips; if(point==0) point = MarketInfo(Symbol(), MODE_POINT); // approximate money per 1 lot per point: double valuePerPointPerLot = tickValue / tickSize * point; // approximate if(valuePerPointPerLot <= 0) valuePerPointPerLot = tickValue; // fallback double lots = 0.01; // Money risked for 1 lot = valuePerPointPerLot * slPoints * (1/point) // Simpler calculation using MODE_LOTSIZE, MODE_TICKVALUE info: double lotStep = MarketInfo(Symbol(), MODE_LOTSTEP); double lotMin = MarketInfo(Symbol(), MODE_MINLOT); double lotMax = MarketInfo(Symbol(), MODE_MAXLOT); if(lotStep<=0) lotStep = 0.01; if(lotMin<=0) lotMin = MinLot; if(lotMax<=0) lotMax = MaxLot; // Money risk for 1 lot (approx): double riskPerLot = (stopLossPips * MarketInfo(Symbol(), MODE_TICKVALUE) / MarketInfo(Symbol(), MODE_TICKSIZE)); if(riskPerLot<=0) riskPerLot = 1.0; lots = NormalizeDouble(riskMoney / riskPerLot, 2); // enforce limits if(lots < lotMin) lots = lotMin; if(lots > lotMax) lots = lotMax; // round to lot step double steps = MathRound(lots / lotStep); lots = steps * lotStep; if(lots < lotMin) lots = lotMin; return NormalizeDouble(lots, 2); } void ManageOpenTrades() { for(int i=OrdersTotal()-1;i>=0;i--) { if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol()) continue; // trailing stop if(UseTrailingStop && OrderType()<=OP_SELL) { double currentPrice = (OrderType()==OP_BUY) ? Bid : Ask; double openPrice = OrderOpenPrice(); double profitPoints = 0; if(OrderType()==OP_BUY) profitPoints = (currentPrice - openPrice)/Point; else profitPoints = (openPrice - currentPrice)/Point; // break even if(UseBreakEven && profitPoints >= BreakEvenPoints) { double newSL; if(OrderType()==OP_BUY) { newSL = OrderOpenPrice() + BreakEvenPoints * Point; if(newSL > OrderStopLoss()) { bool res = OrderModify(OrderTicket(), OrderOpenPrice(), newSL, OrderTakeProfit(), 0, clrYellow); } } else { newSL = OrderOpenPrice() - BreakEvenPoints * Point; if(newSL < OrderStopLoss() || OrderStopLoss()==0) { bool res = OrderModify(OrderTicket(), OrderOpenPrice(), newSL, OrderTakeProfit(), 0, clrYellow); } } } if(profitPoints >= TrailingStopPoints) { double desiredSL; if(OrderType()==OP_BUY) { desiredSL = currentPrice - TrailingStopPoints * Point; if(desiredSL > OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), desiredSL, OrderTakeProfit(), 0, clrGreen); } else { desiredSL = currentPrice + TrailingStopPoints * Point; if(desiredSL < OrderStopLoss() || OrderStopLoss()==0) OrderModify(OrderTicket(), OrderOpenPrice(), desiredSL, OrderTakeProfit(), 0, clrGreen); } } } } } //+------------------------------------------------------------------+ //| Expert tick | //+------------------------------------------------------------------+ void OnTick() { // only run on new bar datetime currentBarTime = iTime(Symbol(), PERIOD_CURRENT, 0); if(currentBarTime == lastBarTime) { // still same bar -> only manage existing trades (trailing) ManageOpenTrades(); return; } lastBarTime = currentBarTime; // Time filter int hour = TimeHour(TimeCurrent()); if(hour < TradeStartHour || hour > TradeEndHour) return; // Spread check double spread = (Ask - Bid) / MarketInfo(Symbol(), MODE_POINT); if(spread > MaxSpreadPoints) return; // count existing our trades int openCount = CountOpenTradesForMagic(MagicNumber); if(openCount >= MaxTrades) { ManageOpenTrades(); return; } // Get EMA values: shift 1 is previous closed bar, shift 0 is current forming bar double emaFastPrev = GetEMA(Symbol(), PERIOD_CURRENT, FastEMAPeriod, 1); double emaSlowPrev = GetEMA(Symbol(), PERIOD_CURRENT, SlowEMAPeriod, 1); double emaFastCurr = GetEMA(Symbol(), PERIOD_CURRENT, FastEMAPeriod, 2); // note: shift orientation double emaSlowCurr = GetEMA(Symbol(), PERIOD_CURRENT, SlowEMAPeriod, 2); // Actually for safety let's use shift 1 and 2 to detect last closed-bar crossover double fast_now = GetEMA(Symbol(), PERIOD_CURRENT, FastEMAPeriod, 1); double slow_now = GetEMA(Symbol(), PERIOD_CURRENT, SlowEMAPeriod, 1); double fast_prev = GetEMA(Symbol(), PERIOD_CURRENT, FastEMAPeriod, 2); double slow_prev = GetEMA(Symbol(), PERIOD_CURRENT, SlowEMAPeriod, 2); // ATR for stop sizing (in points) double atr = GetATR(Symbol(), PERIOD_CURRENT, ATRPeriod, 1); if(atr<=0) atr = MarketInfo(Symbol(), MODE_POINT)*10; double slPips = NormalizeDouble((atr * ATRMultiplier)/MarketInfo(Symbol(), MODE_POINT),0); // Determine signal on the last closed bar bool buySignal = (fast_prev < slow_prev) && (fast_now > slow_now); bool sellSignal = (fast_prev > slow_prev) && (fast_now < slow_now); if(buySignal) { double sl = Ask - slPips * MarketInfo(Symbol(), MODE_POINT); double tp = Ask + slPips * MarketInfo(Symbol(), MODE_POINT) * 2.0; // default 2:1 RR double lots = CalculateLotSize(slPips / MarketInfo(Symbol(), MODE_POINT)); int ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, Slippage, sl, tp, "EMA_ATR BUY", MagicNumber, 0, clrBlue); if(ticket<0) { Print("Buy order failed: ", GetLastError()); } } else if(sellSignal) { double sl = Bid + slPips * MarketInfo(Symbol(), MODE_POINT); double tp = Bid - slPips * MarketInfo(Symbol(), MODE_POINT) * 2.0; double lots = CalculateLotSize(slPips / MarketInfo(Symbol(), MODE_POINT)); int ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, Slippage, sl, tp, "EMA_ATR SELL", MagicNumber, 0, clrRed); if(ticket<0) { Print("Sell order failed: ", GetLastError()); } } // manage trailing stops for existing trades ManageOpenTrades(); } //+------------------------------------------------------------------+

Con risposta

1
Sviluppatore 1
Valutazioni
(3)
Progetti
3
0%
Arbitraggio
1
0% / 100%
In ritardo
0
Gratuito
2
Sviluppatore 2
Valutazioni
(10)
Progetti
15
27%
Arbitraggio
0
In ritardo
3
20%
Gratuito
3
Sviluppatore 3
Valutazioni
Progetti
2
0%
Arbitraggio
4
25% / 50%
In ritardo
1
50%
Gratuito
4
Sviluppatore 4
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
5
Sviluppatore 5
Valutazioni
(2)
Progetti
3
0%
Arbitraggio
0
In ritardo
0
Gratuito
6
Sviluppatore 6
Valutazioni
(296)
Progetti
475
40%
Arbitraggio
105
40% / 24%
In ritardo
80
17%
Occupato
Pubblicati: 2 codici
7
Sviluppatore 7
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
8
Sviluppatore 8
Valutazioni
(1)
Progetti
1
0%
Arbitraggio
3
0% / 100%
In ritardo
1
100%
Gratuito
9
Sviluppatore 9
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
10
Sviluppatore 10
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
11
Sviluppatore 11
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
12
Sviluppatore 12
Valutazioni
(32)
Progetti
35
34%
Arbitraggio
5
0% / 80%
In ritardo
0
In elaborazione
Pubblicati: 2 codici
Ordini simili
I need a boom-and-crash MT5 robot that is very accurate for opening trades just before the spike happens. It should use M1 or M5 timeframe It should have options for changing lot size, number of trades to open, stop loss and take profit in points If the spike happens and it makes some profit, it should automatically close all trades. If the spike happens and the spike is not in profits, the trades can remain open
A perfect indicator 30 - 80 USD
Merge nearby zones yes/no Alert on/off Label on/off Show only current relevant zones near price yes/no Distance filter from current price Zone transparency Colors Preferred Output on Chart: I want the indicator to show only: the strongest nearby support zones under price the strongest nearby resistance zones above price major higher timeframe zones clean chart view I do not want excessive clutter. Entry Assistance
Project Title: Custom XAUUSD Support & Resistance Indicator Platform Required: MT5 preferred. If possible, also provide TradingView Pine Script version later. Main Goal: I want a custom indicator made specifically for XAUUSD (Gold) only. The indicator should automatically detect and draw strong support and resistance zones where price has a high probability of reacting, rejecting, or reversing. It must update
1. IF price forms: - Higher highs + higher lows → TREND = BUY - Lower highs + lower lows → TREND = SELL ELSE → NO TRADE 2. IF: - Trend = BUY - Price retraces to support zone - Bullish engulfing candle forms - TDI green crosses above red (optional) THEN: - Execute BUY 3. IF: - Trend = SELL - Price retraces to resistance - Bearish engulfing forms - TDI confirms THEN: - Execute SELL 4. Risk per trade = 1% of account Lot
Hello, I am looking for a professional trading system including: 1- Trading Bot (Expert Advisor): - Good profit performance - High security and strong risk management - Works efficiently during high market volatility (news and strong movements) - Works on all pairs (Forex + Gold) 2- Signal Indicator: - Provides clear Buy and Sell signals - Includes Take Profit and Stop Loss - No repaint (signals must not change or
Apply with a screen of your work . Symbol Specific Logic . Live Chart Optimization Check the Core logic . [back tests as well] Change points to pips . Create buffer for the zone
Tengo una estrategia basada en divergencia para el oro sobre todo en tf m1 Basado en divergencia con stoch .. confirmando la entrada con ciertos parameteos de entrada Es mejor conversarlo para dar mejor los detalles Cuando entrar, porque o todas las divergencias se debe tomar para entrar en compras o ventas He adjuntado un ejemplo La confrmacion más exacta es el cruce de esos parámetros de stoch edebajo de level de
I already have a fully developed MT5 Expert Advisor with all required prop firm features, including: Risk management Daily loss & max drawdown limits Spread & slippage filters News filter Trade management system The EA structure is complete. 👉 What I need is a professional developer to replace ONLY the entry logic with a high-quality, rule-based trading strategy. 🚨 STRICT REQUIREMENT (READ CAREFULLY): I am NOT
I am looking for a reliable and well-performing Expert Advisor (EA) that is proven to work effectively on a real trading account. The EA should demonstrate consistent profitability, controlled drawdown, and a strong return on investment (ROI). If you already have a ready-made EA that meets these criteria, I would be interested in reviewing its performance. Please provide access to a demo account, backtest results, or

Informazioni sul progetto

Budget
30+ USD