指定

//+------------------------------------------------------------------+
//|                                        HighPerformanceEA.mq5     |
//|                                  Copyright 2026, AI Developer    |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

// Include standard trade library for high-speed, optimized execution
#include <Trade\Trade.mqh>
CTrade trade;

//--- Input Parameters (Adjustable by user)
input group "--- Risk Management ---"
input double   InpLotSize        = 0.01;       // Fixed Lot Size
input int      InpStopLoss       = 200;       // Stop Loss in points (e.g., 200 points = 20 pips)
input int      InpTakeProfit     = 400;       // Take Profit in points
input ulong    InpMagicNumber    = 123456;    // Unique ID for this EA

input group "--- Strategy Settings ---"
input int      InpFastMA         = 10;        // Fast Moving Average Period
input int      InpSlowMA         = 20;        // Slow Moving Average Period

//--- Global Variables for Optimization
int      fastMA_Handle;
int      slowMA_Handle;
datetime lastBarTime;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   // Set Magic Number for trade tracking
   trade.SetExpertMagicNumber(InpMagicNumber);
   
   // High Performance: Initialize indicators once. Do NOT create handles inside OnTick.
   fastMA_Handle = iMA(_Symbol, _Period, InpFastMA, 0, MODE_SMA, PRICE_CLOSE);
   slowMA_Handle = iMA(_Symbol, _Period, InpSlowMA, 0, MODE_SMA, PRICE_CLOSE);
   
   // Validate handles
   if(fastMA_Handle == INVALID_HANDLE || slowMA_Handle == INVALID_HANDLE)
   {
      Print("Failed to initialize indicator handles.");
      return(INIT_FAILED);
   }

   lastBarTime = 0;
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   // Clean up handles from memory
   IndicatorRelease(fastMA_Handle);
   IndicatorRelease(slowMA_Handle);
}

//+------------------------------------------------------------------+
//| Expert tick function (Core Logic)                                |
//+------------------------------------------------------------------+
void OnTick()
{
   // Performance Lock: Ensure strategy only executes once per NEW bar, not on every single price fluctuation
   datetime currentBarTime = iTime(_Symbol, _Period, 0);
   if(currentBarTime == lastBarTime) return; 
   
   // Dynamic arrays to hold indicator values
   double fastMA[], slowMA[];
   
   // Sort arrays from current bar backwards (Index 0 is the current setup)
   ArraySetAsSeries(fastMA, true);
   ArraySetAsSeries(slowMA, true);
   
   // Copy indicator data into memory (Fast data retrieval)
   if(CopyBuffer(fastMA_Handle, 0, 0, 3, fastMA) < 0 || 
      CopyBuffer(slowMA_Handle, 0, 0, 3, slowMA) < 0)
   {
      Print("Error copying indicator buffers.");
      return;
   }
   
   // Check if we already have an open position for this specific asset/magic number
   bool hasPosition = false;
   if(PositionSelect(_Symbol))
   {
      if(PositionGetInteger(POSITION_MAGIC) == InpMagicNumber)
      {
         hasPosition = true;
      }
   }
   
   //--- CRITICAL TRADING SIGNALS (Index 1 is the most recently closed candlestick)
   // Buy Signal: Fast MA crosses ABOVE Slow MA
   bool buySignal  = (fastMA[1] > slowMA[1]) && (fastMA[2] <= slowMA[2]);
   
   // Sell Signal: Fast MA crosses BELOW Slow MA
   bool sellSignal = (fastMA[1] < slowMA[1]) && (fastMA[2] >= slowMA[2]);
   
   //--- EXECUTION LOGIC
   if(!hasPosition)
   {
      if(buySignal)
      {
         double askPrice = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
         double slPrice  = askPrice - (InpStopLoss * _Point);
         double tpPrice  = askPrice + (InpTakeProfit * _Point);
         
         // Open Buy Order
         trade.Buy(InpLotSize, _Symbol, askPrice, slPrice, tpPrice, "High-Perf Buy");
         lastBarTime = currentBarTime; // Lock bar on successful evaluation
      }
      else if(sellSignal)
      {
         double bidPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID);
         double slPrice  = bidPrice + (InpStopLoss * _Point);
         double tpPrice  = bidPrice - (InpTakeProfit * _Point);
         
         // Open Sell Order
         trade.Sell(InpLotSize, _Symbol, bidPrice, slPrice, tpPrice, "High-Perf Sell");
         lastBarTime = currentBarTime; // Lock bar on successful evaluation
      }
   }
}

反馈

1
开发者 1
等级
(1)
项目
2
0%
仲裁
0
逾期
1
50%
工作中
2
开发者 2
等级
(8)
项目
8
0%
仲裁
2
50% / 0%
逾期
1
13%
空闲
3
开发者 3
等级
项目
0
0%
仲裁
0
逾期
0
空闲
4
开发者 4
等级
(33)
项目
36
33%
仲裁
5
0% / 80%
逾期
0
工作中
发布者: 2 代码
5
开发者 5
等级
(258)
项目
264
30%
仲裁
0
逾期
3
1%
空闲
发布者: 2 代码
6
开发者 6
等级
项目
0
0%
仲裁
0
逾期
0
空闲
7
开发者 7
等级
项目
0
0%
仲裁
0
逾期
0
空闲
8
开发者 8
等级
(14)
项目
15
20%
仲裁
1
100% / 0%
逾期
0
空闲
9
开发者 9
等级
(174)
项目
233
61%
仲裁
3
33% / 33%
逾期
6
3%
空闲
发布者: 1 代码
10
开发者 10
等级
项目
0
0%
仲裁
0
逾期
0
空闲
11
开发者 11
等级
(242)
项目
285
77%
仲裁
12
75% / 0%
逾期
4
1%
工作中
12
开发者 12
等级
(1)
项目
1
0%
仲裁
0
逾期
1
100%
空闲
相似订单
I am looking for an experienced MQL4 developer to recreate an Expert Advisor from an existing .EX4 file and provide a fully editable .MQ4 source code version. Requirements: Strong knowledge of MQL4 and Expert Advisor development Ability to analyze and reproduce EA functionality accurately Deliver clean, organized, and well-documented source code Please apply with your relevant experience, pricing, and estimated
I am looking for a skilled developer who can fix an exciting telegram copyingtrades bot for me for 30$ I have the ea source code and python source code everything
SNIPER X AI 30 - 200 USD
I really need a developer Who can help me to create my SNIPER X AI - Elite AI Trading System Overview SNIPER X AI BOT is an AI-assisted trading system for Forex, Crypto, Stocks, Indices, and Gold. Currency: USD,RAND,KWD, POUND,EURO Core Features AI Scalping, Sniper Entries, Auto Buy/Sell, Smart Risk Management, Telegram Alerts, Mobile Monitoring, VPS Deployment. Supported Platforms MetaTrader 4, MetaTrader 5, Exness
I need an experienced MQL5 developer to build a professional XAUUSD scalping Expert Advisor. The trading logic is already fully defined and will be shared privately with selected developers. Requirements Fast execution suitable for scalping Dynamic lot sizing Strict risk management Clean and optimized MQL5 code Compatible with MetaTrader 5 Additional Rules No repainting logic No delayed execution Avoid duplicate
ZigZag based on oscillators is needed The idea of ​​the indicator Create a ZigZag indicator, which is constructed based on extreme values determined using oscillators. It can use any classical normalized oscillator, which has overbought and oversold zones. The algorithm should first be executed with the WPR indicator, then similarly add the possibility to draw a zigzag using the following indicators: CCI Chaikin RSI
Prepare expert for xauusd live chart [ expert is not executing xauusd trades , just printing the logic on the chart ] . Deletion and cleaning code ( subject to if required ) . Integration of candles with present logic, Since expert is coming out from an arbitration subject : Before project start , review the code if it is clean and ready for the developer to continue with previous developer's technical debt -thereby
Hello, I am looking for an experienced developer who can build a professional EA suitable for long-term prop firm account passing and account management. I am NOT interested in risky strategies such as martingale, grid, or aggressive recovery systems. My main priorities are: very low and stable drawdown, strong and consistent risk management, strict news filter, long-term sustainability, realistic and stable monthly
Dear developers. We seek experienced developer in PHP, MySQL, JavaScript. we want to publish custom chart and CSV to our website Homepage. Our MQL5 Script contains custom layout we seek to publish on the website. we are looking for experienced developer in the field of website engineer. we want to broadcast our custom pairs in our website, as outlined in our MQL5 Script. we need React developers
TrendPulse EMA Wick EA 50 - 200 USD
EA specification for MT5 developer (coder‑ready spec) You can copy‑paste this directly into an MQL5 Freelance job. --- 1. General * Platform: MetaTrader 5 (MT5) * Type: Expert Advisor (EA) * Markets: Major FX pairs (configurable list via inputs) * Execution: Market orders only * Timeframes: EA must work on any timeframe, but I will mainly use it on M15–H1 --- 2. Indicators & definitions * EMA 20: Exponential Moving
the task is a little hard but i need someone's assistance that requires physical work on the phone or computer. It'll take at least 1-10 days so please bare with me. Answer my questions before we start

项目信息

预算
30+ USD
截止日期
 30 天

客户

所下订单1
仲裁计数0