指定


//+------------------------------------------------------------------+
//| NATHANIEL SMART TRADER EA v1.0 |
//| MetaTrader 5 - MQL5 |
//| EMA + RSI + ATR + Risk Management |
//+------------------------------------------------------------------+
#property copyright "Nathaniel"
#property version "1.00"
#property strict

#include <Trade/Trade.mqh>
CTrade trade;

//--- Trading settings
input double RiskPercent = 1.0;
input double RiskReward = 2.0;
input int FastEMA = 20;
input int SlowEMA = 50;
input int RSIPeriod = 14;
input int ATRPeriod = 14;
input double ATRMultiplier = 2.0;
input int MaxSpreadPoints = 30;
input ulong MagicNumber = 20261128;
input int SlippagePoints = 20;

//--- Indicator handles
int fastHandle, slowHandle, rsiHandle, atrHandle;
datetime lastBarTime = 0;

//+------------------------------------------------------------------+
//| Initialization |
//+------------------------------------------------------------------+
int OnInit()
{
   trade.SetExpertMagicNumber(MagicNumber);
   trade.SetDeviationInPoints(SlippagePoints);

   fastHandle = iMA(_Symbol,_Period,FastEMA,0,MODE_EMA,PRICE_CLOSE);
   slowHandle = iMA(_Symbol,_Period,SlowEMA,0,MODE_EMA,PRICE_CLOSE);
   rsiHandle = iRSI(_Symbol,_Period,RSIPeriod,PRICE_CLOSE);
   atrHandle = iATR(_Symbol,_Period,ATRPeriod);

   if(fastHandle == INVALID_HANDLE ||
      slowHandle == INVALID_HANDLE ||
      rsiHandle == INVALID_HANDLE ||
      atrHandle == INVALID_HANDLE)
   {
      Print("Indicator initialization failed.");
      return INIT_FAILED;
   }

   Print("Nathaniel Smart Trader EA initialized.");
   return INIT_SUCCEEDED;
}

//+------------------------------------------------------------------+
//| Release indicators |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   IndicatorRelease(fastHandle);
   IndicatorRelease(slowHandle);
   IndicatorRelease(rsiHandle);
   IndicatorRelease(atrHandle);
}

//+------------------------------------------------------------------+
//| Calculate position size based on risk |
//+------------------------------------------------------------------+
double CalculateLot(double entry, double stopLoss,
                    ENUM_ORDER_TYPE orderType)
{
   double balance = AccountInfoDouble(ACCOUNT_BALANCE);
   double riskMoney = balance * RiskPercent / 100.0;

   double profit = 0;

   if(!OrderCalcProfit(orderType,_Symbol,1.0,
                       entry,stopLoss,profit))
      return 0;

   double lossPerLot = MathAbs(profit);

   if(lossPerLot <= 0)
      return 0;

   double lot = riskMoney / lossPerLot;

   double minLot = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   double maxLot = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
   double step = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);

   if(step <= 0)
      return 0;

   lot = MathFloor(lot / step) * step;
   lot = MathMin(lot,maxLot);

   if(lot < minLot)
      return 0;

   int digits = 0;
   double temp = step;

   while(temp < 1.0 && digits < 8)
   {
      temp *= 10.0;
      digits++;
   }

   return NormalizeDouble(lot,digits);
}

//+------------------------------------------------------------------+
//| Check if symbol already has an open position |
//+------------------------------------------------------------------+
bool HasOpenPosition()
{
   return PositionSelect(_Symbol);
}

//+------------------------------------------------------------------+
//| Main trading function |
//+------------------------------------------------------------------+
void OnTick()
{
   // Check spread
   double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);

   if(ask <= 0 || bid <= 0)
      return;

   double spread = (ask-bid)/_Point;

   if(spread > MaxSpreadPoints)
      return;

   // Only one open position per symbol
   if(HasOpenPosition())
      return;

   // Trade once per new candle
   datetime currentBar = iTime(_Symbol,_Period,0);

   if(currentBar == 0 || currentBar == lastBarTime)
      return;

   lastBarTime = currentBar;

   // Indicator buffers
   double fast[], slow[], rsi[], atr[];

   ArraySetAsSeries(fast,true);
   ArraySetAsSeries(slow,true);
   ArraySetAsSeries(rsi,true);
   ArraySetAsSeries(atr,true);

   if(CopyBuffer(fastHandle,0,0,3,fast) < 3 ||
      CopyBuffer(slowHandle,0,0,3,slow) < 3 ||
      CopyBuffer(rsiHandle,0,0,3,rsi) < 3 ||
      CopyBuffer(atrHandle,0,0,3,atr) < 3)
      return;

   // Use completed candles
   double fastPrevious = fast[2];
   double fastCurrent = fast[1];

   double slowPrevious = slow[2];
   double slowCurrent = slow[1];

   double currentRSI = rsi[1];
   double currentATR = atr[1];

   if(currentATR <= 0)
      return;

   int digits = (int)SymbolInfoInteger(_Symbol,SYMBOL_DIGITS);

   // BUY condition: bullish EMA crossover + RSI confirmation
   bool buySignal =
      fastPrevious <= slowPrevious &&
      fastCurrent > slowCurrent &&
      currentRSI > 50;

   // SELL condition: bearish EMA crossover + RSI confirmation
   bool sellSignal =
      fastPrevious >= slowPrevious &&
      fastCurrent < slowCurrent &&
      currentRSI < 50;

   // BUY ORDER
   if(buySignal)
   {
      double entry = ask;
      double sl = NormalizeDouble(
         entry - currentATR*ATRMultiplier,digits);

      double tp = NormalizeDouble(
         entry + (entry-sl)*RiskReward,digits);

      double lot = CalculateLot(entry,sl,ORDER_TYPE_BUY);

      if(lot > 0)
      {
         if(!trade.Buy(lot,_Symbol,0,sl,tp,
                       "Nathaniel Smart BUY"))
            Print("BUY failed: ",trade.ResultRetcodeDescription());
      }
   }

   // SELL ORDER
   if(sellSignal)
   {
      double entry = bid;
      double sl = NormalizeDouble(
         entry + currentATR*ATRMultiplier,digits);

      double tp = NormalizeDouble(
         entry - (sl-entry)*RiskReward,digits);

      double lot = CalculateLot(entry,sl,ORDER_TYPE_SELL);

      if(lot > 0)
      {
         if(!trade.Sell(lot,_Symbol,0,sl,tp,
                        "Nathaniel Smart SELL"))
            Print("SELL failed: ",trade.ResultRetcodeDescription());
      }
   }
}
//+------------------------------------------------------------------+

応答済み

1
開発者 1
評価
(1)
プロジェクト
2
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 19 codes
2
開発者 2
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 3 codes
3
開発者 3
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
4
開発者 4
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
5
開発者 5
評価
(1)
プロジェクト
1
100%
仲裁
0
期限切れ
0
暇
6
開発者 6
評価
(11)
プロジェクト
18
17%
仲裁
3
0% / 67%
期限切れ
3
17%
仕事中
7
開発者 7
評価
(43)
プロジェクト
49
29%
仲裁
4
25% / 25%
期限切れ
0
暇
8
開発者 8
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
9
開発者 9
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 2 codes
10
開発者 10
評価
(5)
プロジェクト
7
86%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 4 codes
11
開発者 11
評価
(1)
プロジェクト
1
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 4 codes
12
開発者 12
評価
(1)
プロジェクト
1
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 3 codes
13
開発者 13
評価
(1)
プロジェクト
1
100%
仲裁
0
期限切れ
0
仕事中
パブリッシュした人: 7 codes
14
開発者 14
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 2 codes
15
開発者 15
評価
(268)
プロジェクト
319
74%
仲裁
16
75% / 0%
期限切れ
6
2%
仕事中
16
開発者 16
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
パブリッシュした人: 1 code
類似した注文
Mrwin 30+ USD
//+------------------------------------------------------------------+ //| NATHANIEL SMART TRADER EA v1.0 | //| MetaTrader 5 - MQL5 | //| EMA + RSI + ATR + Risk Management | //+------------------------------------------------------------------+ #property copyright "Nathaniel" #property version "1.00" #property strict #include <Trade/Trade.mqh> CTrade trade; //---
--- I need an MT5 Expert Advisor (EA) for Forex trading. Strategy: - Trade when fast Moving Average (9) crosses above slow Moving Average (21) = BUY - Trade when fast Moving Average (9) crosses below slow Moving Average (21) = SELL - Only 1 trade at a time Settings I want to change: - Lot size - Stop Loss in pips - Take Profit in pips - Trailing Stop - Trading hours (Start and End time) Risk: - Close all trades at
ICC SMART STRUCTURE EA 50 - 100 USD
DEVELOPMENT REQUIREMENTS Project Title: ICC Smart Structure EA – MT5 Automated Trading System 1. Project Objective I want a fully automated Expert Advisor (EA) for MetaTrader 5 (MT5), based on my Indication–Correction–Continuation (ICC) trading strategy. The EA must identify market structure, Break of Structure (BOS), swing highs and lows, supply and demand zones, corrections and continuation entries across multiple
برمجة روبوت تداول MQL5 بهدف 50 نقطة مع إدارة مخاطر.مطلوب برمجة خبير تداول آلي يعمل على منصة MQL5، يركز على تحقيق هدف 50 نقطة مع إدارة صارمة للمخاطر وتحديد وقف الخسارة
I want full experience devloper need , I want devlope 4 Type Bot , Grd strategy 2 , and other bias strategy 2 scaning on market condition choose one order buy or sell and take profit and target fully automatic management, I am explain full details on private chat only experience developer contact me
Hello, I want to clarify that my project is specifically for TradingView only. I am looking for an experienced TradingView Pine Script developer (Pine Script v5/v6) to develop advanced custom technical indicators. I am NOT looking for MT4, MT5, MQL4, MQL5, Expert Advisors (EAs), or automated trade execution. 1. Indicators I want developed A. Smart Money Concepts (SMC) - Buy-side and sell-side liquidity sweeps
Hello, I'm looking for a developer who can build an automated trading bot (Expert Advisor) for MetaTrader 5 (MT5). I want a smart trading robot that can scan the markets, identify high-probability trading opportunities, and automatically execute trades. Strategies and indicators I'd like included: RSI (75 overbought / 25 oversold). MACD crossover with strong momentum. 9/21 EMA crossover. 20/50 SMA crossover. Smart
I am looking for a GOLD (XAUUSD) SCALPING idea that still makes money after realistic costs. I will test it myself on real FTMO tick data before paying for any code. What I need in your application (written, no files): Exact entry and exit rules: timeframe (ticks, M1 or M5), time of day, stop, target, max holding time, spread filter. Why it should work: who is on the other side of the trade. If you have them: results
Delete/Remove . Integrate Support & Resistance . Prop Firm Expert. (Expert is Active With a firm's account) . (Tick Volume) spikes specifically when price interacts with pre-defined Support and Resistance zones. [ required ]
i need a good bot which can scalp and have a tight stop loss an advance bot with a two position only and alot size should be 0.02 AI Trading Bot Development Prompt Build a fast, precision-based scalping trading bot designed to capture small price movements in the market while maintaining strict risk management. 1. Trading Strategy Develop a scalping strategy focused on quick entries and exits. Trade only when

プロジェクト情報

予算
30+ USD
締め切り
最低 1 最高 29 日

依頼者

出された注文2
裁定取引数0