指定

//+------------------------------------------------------------------+
//|                                           MomentumScalper.mq5   |
//|                                  Copyright 2026, HackerAI       |
//|                                             https://hackerai.co |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, HackerAI"
#property link      "https://hackerai.co"
#property version   "1.00"

#include <Trade\Trade.mqh>

input int FastEMA = 9;
input int SlowEMA = 21;
input int RSI_Period = 14;
input double LotSize = 0.01;
input int SL_Pips = 100;
input int TP_Pips = 200;
input int MaxSpread = 5;
input int RSI_Overbought = 70;
input int RSI_Oversold = 30;
input bool UseTrailing = true;
input int TrailingStart = 100;
input int TrailingStep = 50;
input int Magic = 12345;

CTrade trade;
int ema_fast, ema_slow, rsi_handle;
double ema_f[3], ema_s[3], rsi[2];

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   ema_fast = iMA(_Symbol, PERIOD_CURRENT, FastEMA, 0, MODE_EMA, PRICE_CLOSE);
   ema_slow = iMA(_Symbol, PERIOD_CURRENT, SlowEMA, 0, MODE_EMA, PRICE_CLOSE);
   rsi_handle = iRSI(_Symbol, PERIOD_CURRENT, RSI_Period, PRICE_CLOSE);
   
   if(ema_fast == INVALID_HANDLE || ema_slow == INVALID_HANDLE || rsi_handle == INVALID_HANDLE)
   {
      Print("Indicator init failed");
      return INIT_FAILED;
   }
   
   trade.SetExpertMagicNumber(Magic);
   trade.SetDeviationInPoints(10);
   
   return INIT_SUCCEEDED;
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   IndicatorRelease(ema_fast);
   IndicatorRelease(ema_slow);
   IndicatorRelease(rsi_handle);
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   if(!IsNewBar()) return;
   
   double spread = (SymbolInfoDouble(_Symbol, SYMBOL_ASK) - SymbolInfoDouble(_Symbol, SYMBOL_BID)) / _Point;
   if(spread > MaxSpread) return;
   
   if(CopyBuffer(ema_fast, 0, 0, 3, ema_f) < 3 || CopyBuffer(ema_slow, 0, 0, 3, ema_s) < 3 ||
      CopyBuffer(rsi_handle, 0, 0, 2, rsi) < 2) return;
   
   bool buy_signal = (ema_f[1] > ema_s[1] && ema_f[2] <= ema_s[2]) && rsi[1] > 50;
   bool sell_signal = (ema_f[1] < ema_s[1] && ema_f[2] >= ema_s[2]) && rsi[1] < 50;
   
   if(buy_signal && PositionsTotal() == 0)
   {
      double sl = SymbolInfoDouble(_Symbol, SYMBOL_BID) - SL_Pips * _Point;
      double tp = SymbolInfoDouble(_Symbol, SYMBOL_ASK) + TP_Pips * _Point;
      trade.Buy(LotSize, _Symbol, 0, sl, tp);
   }
   if(sell_signal && PositionsTotal() == 0)
   {
      double sl = SymbolInfoDouble(_Symbol, SYMBOL_ASK) + SL_Pips * _Point;
      double tp = SymbolInfoDouble(_Symbol, SYMBOL_BID) - TP_Pips * _Point;
      trade.Sell(LotSize, _Symbol, 0, sl, tp);
   }
   
   if(UseTrailing) TrailingStop();
}

//+------------------------------------------------------------------+
//| Check for new bar                                                |
//+------------------------------------------------------------------+
bool IsNewBar()
{
   static datetime last_time = 0;
   datetime current_time = iTime(_Symbol, PERIOD_CURRENT, 0);
   if(current_time != last_time)
   {
      last_time = current_time;
      return true;
   }
   return false;
}

//+------------------------------------------------------------------+
//| Trailing stop                                                    |
//+------------------------------------------------------------------+
void TrailingStop()
{
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      if(PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_MAGIC) == Magic)
      {
         double pos_open = PositionGetDouble(POSITION_PRICE_OPEN);
         double pos_sl = PositionGetDouble(POSITION_SL);
         ENUM_POSITION_TYPE type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
         
         if(type == POSITION_TYPE_BUY)
         {
            double new_sl = SymbolInfoDouble(_Symbol, SYMBOL_BID) - TrailingStart * _Point;
            if(new_sl > pos_sl + TrailingStep * _Point)
               trade.PositionModify(_Symbol, new_sl, PositionGetDouble(POSITION_TP));
         }
         else
         {
            double new_sl = SymbolInfoDouble(_Symbol, SYMBOL_ASK) + TrailingStart * _Point;
            if(new_sl < pos_sl - TrailingStep * _Point || pos_sl == 0)
               trade.PositionModify(_Symbol, new_sl, PositionGetDouble(POSITION_TP));
         }
      }
   }
}

応答済み

1
開発者 1
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
2
開発者 2
評価
(18)
プロジェクト
22
9%
仲裁
6
33% / 50%
期限切れ
1
5%
仕事中
3
開発者 3
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
4
開発者 4
評価
(2)
プロジェクト
4
0%
仲裁
2
0% / 50%
期限切れ
1
25%
仕事中
類似した注文
I have developed a ready-made quantitative trading system for MetaTrader 5. The system uses an ensemble of machine learning models (XGBoost, LightGBM, Random Forest) combined with a market regime filter based on a Hidden Markov Model. Core features: - Automated trading for XAUUSD - Risk management and dynamic position sizing - Market regime detection (trend / range) - Volatility filter - Telegram monitoring interface
Yemen sanaa 30+ USD
Sergey Golubev: Nick Rypock Trailing Reverse ( NRTR ) The forum Key thread Basic explanation/the theory - the post Second version of AscTrend system - asctrend indicator together with NRTR indicator NRTR_color_line indicator for MT5 - the post First version of AsctrendND EA - This EA use Asctrend indicator as main signal and Nrtr indicator as filter: - How to install . - optimization results for M15 timeframe for
Hello, I am looking for an experienced MT5 (MetaTrader 5) developer to create a simple and reliable Forex trading EA. Broker: Skyriss Platform: MT5 Requirements: • EA should work only on Forex pairs (EURUSD, GBPUSD, USDJPY, USDCHF) • Around 1–2 trades per day is enough • Proper risk management with Stop Loss (SL) and Take Profit (TP) • Prefer low-risk trading with 0.01–0.03 lot depending on balance • No martingale or
hello, please take a moment to review my project. It is for Quanttower. it is very detailed in the instructions. Thank you, Just let me know if you can do it and the whats the cost and timeframe
Key Requirements: Source Account: Connect to a Master account using Investor (Read-only) Password. Destination Account: Execute trades on a Live Slave account with full trading access. Currency Focus: The system must handle Currency Pairs accurately, including symbol mapping (e.g., EURUSD to EURUSD.m) between different brokers. Stealth Features: Remove/Disable all trade comments. Assign custom Magic Numbers to the
I need a developer to start robot from scratch based on existing EA that is running live. I do not have the source file as my previous coder did not give it to me. What I do have is the investor password which is running the EA from the coder side but not from my end. I like someone to monitor the account and re create the same system for me
Project Overview: I am looking for a highly experienced MetaTrader 4 (MQL4) developer to build a sophisticated automated trading system. This is not a standard grid bot; it requires complex trade management, dynamic exposure rebalancing, and a custom "Salami" liquidation module for partial loss mitigation . Key Features to Implement: Virtual Grid & Dynamic Trend: Price-action-based grid triggers without pending
We are looking for a professional developer or trader who already has a proven profitable EA or strategy based mainly on price action logic. Important requirements: No Martingale No Grid No Micro-scalping Avoid heavy indicator-based strategies Strategy should be based mainly on price behavior / market structure We are not looking for aggressive systems that promise unrealistic returns. Our focus is on stable
I run an ea it makes good profits bit that one bad grid blows up the account. I want an EA which runs parallel to it which can intelligently close bad trades or grids. It shouldn't close recoverable trades but close very bad entries and grids. It can even close with hedging. The goal recover max and also not blow up the account
I am looking for an expert MQL5 developer to build a high-precision Hedging System between two different MT5 brokers running on the same local PC. Core Objective: Execute opposite (inverse) trades between a Master and Slave account (e.g., Master BUY = Slave SELL, Master SELL = Slave BUY). The Challenge: Standard "Trade Copiers" are insufficient as they cannot prevent single-legged exposure when using manual trading

プロジェクト情報

予算
30+ USD

依頼者

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