Ramen ka algo

MQL5 Asesores Expertos C++

Tarea técnica

//+------------------------------------------------------------------+
//| Advanced_EA_MT5.mq5 |
//| Educational Purpose |
//+------------------------------------------------------------------+
#property copyright "Educational"
#property version "1.00"
#property strict

// ইনপুট প্যারামিটার - ট্রেডিং সেটিংস
input double RiskPercent = 1.0; // প্রতি ট্রেডে ঝুঁকি (%)
input double FixedLot = 0.01; // ফিক্সড লট (RiskPercent=0 হলে ব্যবহার হবে)
input int MagicNumber = 20240401; // ম্যাজিক নম্বর

// ইনপুট - ইনডিকেটর প্যারামিটার
input int FastMAPeriod = 5; // ফাস্ট MA পিরিয়ড
input int SlowMAPeriod = 20; // স্লো MA পিরিয়ড
input int RSIPeriod = 14; // RSI পিরিয়ড
input int ATRPeriod = 14; // ATR পিরিয়ড
input double RSIOversold = 30.0; // RSI ওভারসল্ড লেভেল
input double RSIOverbought = 70.0; // RSI ওভারবট লেভেল

// ইনপুট - মাল্টি-টাইমফ্রেম ফিল্টার
input ENUM_TIMEFRAMES FilterTF = PERIOD_H1; // ফিল্টার টাইমফ্রেম (এখানে ট্রেন্ড নির্ধারণ)

// ইনপুট - নিউজ ফিল্টার
input bool UseNewsFilter = true; // নিউজ ফিল্টার ব্যবহার করবেন?
input int NewsMinutesBefore= 30; // নিউজের কত মিনিট আগে থেকে ট্রেড বন্ধ
input int NewsMinutesAfter = 30; // নিউজের কত মিনিট পরে পর্যন্ত ট্রেড বন্ধ

// ইনপুট - টাইম ফিল্টার
input bool UseTimeFilter = false; // টাইম ফিল্টার ব্যবহার?
input int StartHour = 8; // ট্রেড শুরুর ঘণ্টা (ব্রোকার টাইম)
input int StartMinute = 0;
input int EndHour = 17;
input int EndMinute = 0;

// ইনপুট - ট্রেলিং স্টপ
input bool UseTrailing = true; // ট্রেলিং স্টপ ব্যবহার?
input int TrailingStart = 20; // কত পয়েন্ট লাভ হলে ট্রেলিং শুরু হবে
input int TrailingStep = 10; // ট্রেলিং স্টপ কত পয়েন্ট দূরে রাখবে

// গ্লোবাল ভেরিয়েবল
string SymbolName;
double point, atrValue;
int handleFastMA, handleSlowMA, handleRSI, handleATR, handleFilterMA;
MqlTick currentTick;
CTrade Trade;

//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
   SymbolName = _Symbol;
   point = SymbolInfoDouble(SymbolName, SYMBOL_POINT);
   if(point == 0) point = 0.0001;
   
   // ইনডিকেটর হ্যান্ডেল তৈরি
   handleFastMA = iMA(SymbolName, _Period, FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
   handleSlowMA = iMA(SymbolName, _Period, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
   handleRSI = iRSI(SymbolName, _Period, RSIPeriod, PRICE_CLOSE);
   handleATR = iATR(SymbolName, _Period, ATRPeriod);
   handleFilterMA = iMA(SymbolName, FilterTF, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
   
   if(handleFastMA==INVALID_HANDLE || handleSlowMA==INVALID_HANDLE ||
      handleRSI==INVALID_HANDLE || handleATR==INVALID_HANDLE ||
      handleFilterMA==INVALID_HANDLE)
   {
      Print("Error creating indicators");
      return(INIT_FAILED);
   }
   
   Trade.SetExpertMagicNumber(MagicNumber);
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   if(handleFastMA != INVALID_HANDLE) IndicatorRelease(handleFastMA);
   if(handleSlowMA != INVALID_HANDLE) IndicatorRelease(handleSlowMA);
   if(handleRSI != INVALID_HANDLE) IndicatorRelease(handleRSI);
   if(handleATR != INVALID_HANDLE) IndicatorRelease(handleATR);
   if(handleFilterMA != INVALID_HANDLE) IndicatorRelease(handleFilterMA);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
   // ফিল্টার চেক
   if(!IsTradeAllowed()) return;
   if(!IsTimeAllowed()) return;
   if(!IsNewsTimeAllowed()) return;
   
   // বর্তমান টিক পেতে
   SymbolInfoTick(SymbolName, currentTick);
   
   // ATR ভ্যালু আপডেট (স্টপ লস ক্যালকুলেশনের জন্য)
   double atrArray[1];
   CopyBuffer(handleATR, 0, 0, 1, atrArray);
   atrValue = atrArray[0];
   
   // বর্তমান ওপেন পজিশন ম্যানেজ (ট্রেলিং স্টপ)
   ManagePositions();
   
   // নতুন সিগন্যাল চেক - শুধু যদি কোনো পজিশন না থাকে
   if(PositionCount() == 0)
   {
      if(CheckBuySignal())
         OpenTrade(ORDER_TYPE_BUY);
      else if(CheckSellSignal())
         OpenTrade(ORDER_TYPE_SELL);
   }
}
//+------------------------------------------------------------------+
//| বাই সিগন্যাল চেক |
//+------------------------------------------------------------------+
bool CheckBuySignal()
{
   // বর্তমান টাইমফ্রেমের ডাটা
   double fastMA[], slowMA[], rsi[];
   ArraySetAsSeries(fastMA, true);
   ArraySetAsSeries(slowMA, true);
   ArraySetAsSeries(rsi, true);
   CopyBuffer(handleFastMA, 0, 0, 2, fastMA);
   CopyBuffer(handleSlowMA, 0, 0, 2, slowMA);
   CopyBuffer(handleRSI, 0, 0, 1, rsi);
   
   if(fastMA[0] == 0 || slowMA[0] == 0 || rsi[0] == 0) return false;
   
   // ফিল্টার টাইমফ্রেম থেকে ট্রেন্ড (মূল ট্রেন্ড ফিল্টার)
   double filterMA[];
   ArraySetAsSeries(filterMA, true);
   CopyBuffer(handleFilterMA, 0, 0, 1, filterMA);
   double filterClose = iClose(SymbolName, FilterTF, 0);
   if(filterMA[0] == 0 || filterClose == 0) return false;
   
   // শর্ত: ফাস্ট MA স্লো MA কে নিচ থেকে উপরে কাটবে (ক্রসওভার)
   bool crossUp = (fastMA[1] <= slowMA[1] && fastMA[0] > slowMA[0]);
   // RSI ওভারসল্ড থেকে উঠছে
   bool rsiOk = (rsi[0] > RSIOversold);
   // ফিল্টার টাইমফ্রেমে ক্লোজ ফিল্টার MA-র উপরে (আপট্রেন্ড)
   bool trendOk = (filterClose > filterMA[0]);
   
   return (crossUp && rsiOk && trendOk);
}
//+------------------------------------------------------------------+
//| সেল সিগন্যাল চেক |
//+------------------------------------------------------------------+
bool CheckSellSignal()
{
   double fastMA[], slowMA[], rsi[];
   ArraySetAsSeries(fastMA, true);
   ArraySetAsSeries(slowMA, true);
   ArraySetAsSeries(rsi, true);
   CopyBuffer(handleFastMA, 0, 0, 2, fastMA);
   CopyBuffer(handleSlowMA, 0, 0, 2, slowMA);
   CopyBuffer(handleRSI, 0, 0, 1, rsi);
   
   if(fastMA[0] == 0 || slowMA[0] == 0 || rsi[0] == 0) return false;
   
   double filterMA[];
   ArraySetAsSeries(filterMA, true);
   CopyBuffer(handleFilterMA, 0, 0, 1, filterMA);
   double filterClose = iClose(SymbolName, FilterTF, 0);
   if(filterMA[0] == 0 || filterClose == 0) return false;
   
   bool crossDown = (fastMA[1] >= slowMA[1] && fastMA[0] < slowMA[0]);
   bool rsiOk = (rsi[0] < RSIOverbought);
   bool trendOk = (filterClose < filterMA[0]);
   
   return (crossDown && rsiOk && trendOk);
}
//+------------------------------------------------------------------+
//| ট্রেড ওপেন করার ফাংশন |
//+------------------------------------------------------------------+
void OpenTrade(ENUM_ORDER_TYPE type)
{
   double price = (type == ORDER_TYPE_BUY) ? currentTick.ask : currentTick.bid;
   double sl = 0, tp = 0;
   
   // ATR ভিত্তিক স্টপ লস (ATR * 1.5)
   double atrStop = atrValue * 1.5;
   if(type == ORDER_TYPE_BUY)
   {
      sl = price - atrStop;
      tp = price + (atrStop * 2.0); // রিস্ক:রিওয়ার্ড = 1:2
   }
   else
   {
      sl = price + atrStop;
      tp = price - (atrStop * 2.0);
   }
   
   // লট সাইজ ক্যালকুলেশন (রিস্ক শতাংশ অনুযায়ী)
   double lot = CalculateLotSize(price, sl, type);
   if(lot <= 0) lot = FixedLot;
   
   // ট্রেড ওপেন
   Trade.PositionOpen(SymbolName, type, lot, price, sl, tp, "Advanced EA");
}
//+------------------------------------------------------------------+
//| রিস্ক ভিত্তিক লট সাইজ ক্যালকুলেটর |
//+------------------------------------------------------------------+
double CalculateLotSize(double entry, double sl, ENUM_ORDER_TYPE type)
{
   if(RiskPercent <= 0) return FixedLot;
   double riskMoney = AccountInfoDouble(ACCOUNT_BALANCE) * RiskPercent / 100.0;
   double slDistance = MathAbs(entry - sl);
   if(slDistance <= 0) return FixedLot;
   
   double tickValue = SymbolInfoDouble(SymbolName, SYMBOL_TRADE_TICK_VALUE);
   double pointValue = tickValue / SymbolInfoDouble(SymbolName, SYMBOL_POINT);
   double lot = riskMoney / (slDistance * pointValue);
   
   // লট সাইজ নিয়ন্ত্রণ
   double minLot = SymbolInfoDouble(SymbolName, SYMBOL_VOLUME_MIN);
   double maxLot = SymbolInfoDouble(SymbolName, SYMBOL_VOLUME_MAX);
   double stepLot = SymbolInfoDouble(SymbolName, SYMBOL_VOLUME_STEP);
   lot = MathFloor(lot / stepLot) * stepLot;
   lot = MathMax(minLot, MathMin(maxLot, lot));
   return lot;
}
//+------------------------------------------------------------------+
//| ওপেন পজিশন ম্যানেজ (ট্রেলিং স্টপ) |
//+------------------------------------------------------------------+
void ManagePositions()
{
   for(int i = PositionsTotal()-1; i >= 0; i--)
   {
      ulong ticket = PositionGetTicket(i);
      if(PositionSelectByTicket(ticket))
      {
         if(PositionGetInteger(POSITION_MAGIC) != MagicNumber) continue;
         if(PositionGetString(POSITION_SYMBOL) != SymbolName) continue;
         
         double openPrice = PositionGetDouble(POSITION_PRICE_OPEN);
         double currentSL = PositionGetDouble(POSITION_SL);
         double currentProfit = PositionGetDouble(POSITION_PROFIT);
         ENUM_POSITION_TYPE type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
         
         if(!UseTrailing) continue;
         
         double currentPrice = (type == POSITION_TYPE_BUY) ? currentTick.bid : currentTick.ask;
         double newSL = 0;
         bool modify = false;
         
         if(type == POSITION_TYPE_BUY)
         {
            double profitPoints = (currentPrice - openPrice) / point;
            if(profitPoints >= TrailingStart)
            {
               double trailSL = currentPrice - TrailingStep * point;
               if(trailSL > currentSL)
               {
                  newSL = trailSL;
                  modify = true;
               }
            }
         }
         else if(type == POSITION_TYPE_SELL)
         {
            double profitPoints = (openPrice - currentPrice) / point;
            if(profitPoints >= TrailingStart)
            {
               double trailSL = currentPrice + TrailingStep * point;
               if(trailSL < currentSL || currentSL == 0)
               {
                  newSL = trailSL;
                  modify = true;
               }
            }
         }
         
         if(modify)
         {
            Trade.PositionModify(ticket, newSL, PositionGetDouble(POSITION_TP));
         }
      }
   }
}
//+------------------------------------------------------------------+
//| বর্তমান সিম্বলে ওপেন পজিশন কাউন্ট (শুধু এই ম্যাজিক) |
//+------------------------------------------------------------------+
int PositionCount()
{
   int count = 0;
   for(int i = PositionsTotal()-1; i >= 0; i--)
   {
      ulong ticket = PositionGetTicket(i);
      if(PositionSelectByTicket(ticket))
      {
         if(PositionGetInteger(POSITION_MAGIC) == MagicNumber &&
            PositionGetString(POSITION_SYMBOL) == SymbolName)
            count++;
      }
   }
   return count;
}
//+------------------------------------------------------------------+
//| টাইম ফিল্টার (ঘণ্টা) |
//+------------------------------------------------------------------+
bool IsTimeAllowed()
{
   if(!UseTimeFilter) return true;
   datetime now = TimeCurrent();
   MqlDateTime tm;
   TimeToStruct(now, tm);
   int currentMinutes = tm.hour * 60 + tm.min;
   int startMinutes = StartHour * 60 + StartMinute;
   int endMinutes = EndHour * 60 + EndMinute;
   if(startMinutes <= endMinutes)
      return (currentMinutes >= startMinutes && currentMinutes <= endMinutes);
   else
      return (currentMinutes >= startMinutes || currentMinutes <= endMinutes);
}
//+------------------------------------------------------------------+
//| নিউজ ফিল্টার |
//+------------------------------------------------------------------+
bool IsNewsTimeAllowed()
{
   if(!UseNewsFilter) return true;
   // এখানে আপনাকে আপনার নিজের নিউজ ক্যালেন্ডার API বা CSV ফাইল থেকে ডাটা আনতে হবে।
   // উদাহরণস্বরূপ, আমরা ধরে নিচ্ছি কোন নিউজ নেই। বাস্তবে আপনাকে নিউজ ইভেন্ট চেক করতে হবে।
   // এই ফাংশনটি ডেমো হিসেবে সবসময় true রিটার্ন করে।
   return true;
}
//+------------------------------------------------------------------+

Archivos adjuntos:

Solicitudes similares
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
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
Hi, I am looking for an Quant/MQL5 developer to build a pure mathematical, Delta-Neutral Statistical Arbitrage (spot vs future ) Expert Advisor. ​ No retail indicator logic (No RSI, MACD, etc.). This is a high-speed, spread-based execution model trading the pricing inefficiency between two correlated assets (e.g., Gold Spot XAUUSD vs Gold Futures). ​ Core Requirements at a Glance: ​Real-time Spread & Z-Score
Looking for a Proven Non-Repainting Gold Indicator (XAUUSD) – High Accuracy & Ready-Made Solutions Only 📌 Project Description: I am looking for a high-quality, non-repainting indicator specifically for XAUUSD (Gold) that is already developed and tested. ⚠️ Important: I am NOT looking for a new indicator to be built from scratch. I want an existing, proven system that you have already created and are confident in. 🎯
Fair Value Gap Expert , Optimize the core logic for live chart . [Filters are working] Lets ace the trailing stop . Change points to pip . Project will start from next week
Hi, Before ordering, I want to verify the quality of your ICT/SMC logic. Do you have an existing indicator or strategy (your own work) that I can test on TradingView? If yes, please provide: 1. A demo (invite-only script or video) 2. Proof it is NON-repainting (explained clearly) 3. Live or replay demonstration (not static screenshots) Specifically I want to see: * Clean swing structure (no consecutive highs/lows) *
Project Overview ​I am looking for a high-level Algorithmic Trader / Developer to build a sophisticated, fully automated scalping system for the Nasdaq-100 Future (NQ) . The system must integrate institutional order flow logic with market structure analysis. ​The core logic must be written in Python , acting as a central hub that bridges ATAS (as the primary data source for Order Flow) and MetaTrader 5 (as the
Hi Im working with a Crypto trading company and we want to branch out with our indicator, i'm researching the bot automation and need some hands on board. i i want to hear your opinion about the indicator that i would like you to build. in the PDF i explain the whole indicator and how it need to look like. happy to hear form you
Existing EA 30 USD
I’m looking to acquire an existing, profitable Expert Advisor (EA) with full source code to add to our client investment portfolio. To be clear, this is not a request to develop or design a new strategy. If you already have an EA that is proven, consistent, and production-ready, I’m open to reviewing it immediately. Please apply only if you meet all the requirements below. Submissions without a proper introduction or
have the Beatrix Inventor Expert Advisor (EA) that was profitable in the past but has been losing money recently. I need an experienced EA developer/optimizer to study the trade history (especially Stop Loss hits, drawdown periods, SL/TP behavior, win/loss ratio, etc.) and recommend + implement specific tweaks so it becomes consistently profitable again. Your job: 1. Deep analysis of why the EA is no longer

Información sobre el proyecto

Presupuesto
30+ USD
Plazo límite de ejecución
de 1 a 100 día(s)

Cliente

Encargos realizados1
Número de arbitrajes0