MT TRADING BOT

指定

//+------------------------------------------------------------------+ //| 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(); } //+------------------------------------------------------------------+

反馈

1
开发者 1
等级
(3)
项目
3
0%
仲裁
1
0% / 100%
逾期
0
空闲
2
开发者 2
等级
(10)
项目
15
27%
仲裁
0
逾期
3
20%
空闲
3
开发者 3
等级
项目
2
0%
仲裁
4
25% / 50%
逾期
1
50%
空闲
4
开发者 4
等级
项目
0
0%
仲裁
0
逾期
0
空闲
5
开发者 5
等级
(2)
项目
3
0%
仲裁
0
逾期
0
空闲
6
开发者 6
等级
(295)
项目
472
40%
仲裁
102
40% / 24%
逾期
78
17%
繁忙
发布者: 2 代码
7
开发者 7
等级
项目
0
0%
仲裁
0
逾期
0
空闲
8
开发者 8
等级
项目
0
0%
仲裁
1
0% / 100%
逾期
0
工作中
9
开发者 9
等级
项目
0
0%
仲裁
0
逾期
0
空闲
10
开发者 10
等级
项目
0
0%
仲裁
0
逾期
0
空闲
11
开发者 11
等级
项目
0
0%
仲裁
0
逾期
0
空闲
12
开发者 12
等级
(32)
项目
35
34%
仲裁
5
0% / 80%
逾期
0
工作中
发布者: 2 代码
相似订单
Yash Agrawal 30+ USD
// Simple EMA Bot input int FastEMA = 9; input int SlowEMA = 21; void OnTick() { double fast = iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,0); double slow = iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,0); if(fast > slow) { if(PositionsTotal()==0) OrderSend(Symbol(),OP_BUY,0.01,Ask,10,0,0); } if(fast < slow) { if(PositionsTotal()==0) OrderSend(Symbol(),OP_SELL,0.01,Bid,10,0,0); } }
Gold robot Ga1 30 - 200 USD
mport pandas as pd import numpy as np def detecter_tendance(data): # Code pour détecter la tendance pass def identifier_niveaux(data): # Code pour identifier les niveaux de support et de résistance pass def calculer_stop_loss(tendance, support, resistance): # Code pour calculer les stop loss pass def calculer_profils(tendance, support, resistance): # Code pour calculer les profils mport pandas as pd
Martingale Strategy 50 - 70 USD
I need a gambling bot that implements the Martingale Strategy for betting on roulette. It will be used on platforms like Betcity and Unibet to manage bets effectively. Scope of work - Develop a bot that implements the Martingale Strategy for roulette. - Ensure compatibility with Betcity and Unibet platforms. - Include functionalities for adjusting bet size and managing losses. - Integrate platform-specific features
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
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

项目信息

预算
30+ USD