Specification
//+------------------------------------------------------------------+ //| 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(); } //+------------------------------------------------------------------+
Responded
1
Rating
Projects
3
0%
Arbitration
1
0%
/
100%
Overdue
0
Free
2
Rating
Projects
15
27%
Arbitration
0
Overdue
3
20%
Free
3
Rating
Projects
2
0%
Arbitration
4
25%
/
50%
Overdue
1
50%
Free
4
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
5
Rating
Projects
3
0%
Arbitration
0
Overdue
0
Free
6
Rating
Projects
472
40%
Arbitration
102
40%
/
24%
Overdue
78
17%
Busy
Published: 2 codes
7
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
8
Rating
Projects
0
0%
Arbitration
1
0%
/
100%
Overdue
0
Working
9
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
10
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
11
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
12
Rating
Projects
35
34%
Arbitration
5
0%
/
80%
Overdue
0
Working
Published: 2 codes
Similar orders
Dear Developers, I am seeking a professional developer to build an institutional-grade automated trading system that operates exclusively using pending orders, with advanced and fully customizable trade management logic. This is not a basic Expert Advisor. The goal is to create a structured, intelligent, and long-term trading system with clean architecture and professional execution standards. Project Requirements
Dear Developer, I am currently experiencing several structural and logical limitations in the existing bot system, and I am seeking a complete professional upgrade to a fully automated, intelligent trading solution. The objective is to preserve the core SMC strategy while significantly improving precision, automation, multi-timeframe alignment, and trade quality. Below are the required specifications: 1. Dynamic
Hello there Hpe you are doing good I am in search of a pine script expert developer who can build strategy in apudFlow in pinescript. Kinldy bid on this project if you can do this
Attach up to 32 files maximum 16 Mb per upload (.zip .txt .log .mqh .ex5 .mq5 .mq4 .mqproj .ex4 .mt5 .set .tpl .cl .py .sqlite .csv .ini .ipynb .onnx .gif .png .jpg .jpeg .mp4 .webm)
Convert Pinescript into MQL5 EA trading bot
30 - 200 USD
I need a scalping-specific logic MT5 trading bot with a Donchian-channel–based dynamic stop-loss and take-profit system, applies RSI volatility filtering to avoid low-quality setups, and allows asset-specific adjustable parameters for fine-tuning performance Trading details: - Symbol: Any Forex EUR/USD - Platform: MT5 - Strategy type: Scalping (fast trades) - Timeframes: 5sec/ M1 / M5 - Fixed Stop Loss and Take
Looking for an experienced MQL5 developer to analyze and reverse-engineer the trading logic of an existing scalping Zone Recovery EA using Moving Averages and Bollinger Bands, and then rebuild it
EA Expert MTA 4
30+ USD
I have my own indicator and needs to create EA expert working smoothly with it to hit the targets as defined in indicator: Technical approach: - The EA will read the indicator signals using Copy Buffer on the selected timeframe - The EA should hit indicator variable targets factor -Auto-Entry: Instant execution when the signal appears. -Alerts: Mobile Push Notifications + Pop-up alerts. -Money Management Auto-lot
hello great developer I’m hiring a developer to build a local-only trade copier that sends trades from MT4 and MT5 to NinjaTrader 8 (NT8) in real-time. This copier must be reliable, fast, and fully executable without cloud dependence. I require a short test/demo period before full delivery to ensure quality and performance. here is the full project specs in the file check it please
I need a reliable, clean-coded Expert Advisor built for both MetaTrader 4 and MetaTrader 5 platforms. Main trading behavior: The EA follows buy and sell arrows produced by my custom indicator. Whenever a buy arrow shows up on the chart: if a sell position is currently open → close that sell immediately and enter a buy trade in its place. Whenever a sell arrow appears: if a buy position exists → close the buy and
CONVERTER ROBOT TO MQL5
30 - 40 USD
Hello I'm looking for professional to create a robot to me that will enter us30 or nasdaq around 16H29-minute55-Second New York session opening Monday to Friday and put stop loss 3800 points away from entry hedging strategy
Project information
Budget
30+ USD