Spécifications
//+------------------------------------------------------------------+
//| 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
}
}
}
Répondu
1
Évaluation
Projets
1
0%
Arbitrage
0
En retard
1
100%
Travail
2
Évaluation
Projets
8
0%
Arbitrage
2
50%
/
0%
En retard
1
13%
Gratuit
3
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
4
Évaluation
Projets
35
34%
Arbitrage
5
0%
/
80%
En retard
0
Travail
Publié : 2 codes
Commandes similaires
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
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
Need a Profitable with a good trading system or strategy. would test the product first Looking for a professional MT5 Expert Advisor based on smart strategies. The EA should include session filters, risk management, trailing stop, multi-pair support, and low drawdown protection. I need a consistent, high-probability automated trading system optimized for long-term profitability and funded account compliance
Junior EA
30+ USD
1. EA for MT5, hedging allowed. 2. Entry: 50 EMA crosses 200 EMA on H1. Buy on bullish cross, sell on bearish. 3. SL: 100 pips, TP: 200 pips. No trailing stop. 4. Lot size: 0.01 fixed. Max 3 trades at once. 5. Trade only 08:00-18:00 GMT. No trades if spread > 20 points. 6. Inputs: EMA periods, SL, TP, lot size, start/end time
Semi Automated Gold Trading Signal System for MT5
300 - 800 USD
I need an experienced MQL5 developer to build a semi automated trading signal system for Gold (XAUUSD) on MT5. The system is NOT a martingale or grid EA. The goal is to build a clean rule based signal engine that detects high probability setups based on predefined strategy rules and sends trading alerts with optional pending order logic. Main Requirements: 1. Signal Generation - Buy and Sell signals - Buy Limit - Buy
Mambo
30+ USD
I need a bot that can trade weltrade synthetic indices that can be consistently making profits if you have one for deriv its also fine a bot that executes and closes trades automat Will be ideal
I am looking for an experienced MQL4/MQL5 developer to build a custom MT4 indicator from scratch or cracking my ex4 file that i provide to you. I already have an existing indicator (EX4) which produces highly accurate buy/sell signals. I want a similar indicator developed based on its observable behavior and signal structure. my existing indicator is pc id protected so you have to do PC ID security bypass and source
I am looking for an experienced MQL5 developer to build a professional Expert Advisor with the following specs: TECHNICAL REQUIREMENTS: - Platform: MetaTrader 5 (MT5) - Pairs: GBPUSD and EURUSD - Broker suffix support (e.g. GBPUSD@, EURUSD@) - Primary timeframe: M5 -Higher timeframe bias: H1 and H4 (for trend direction only) - One chart setup — manages both pairs from one chart STRATEGY: - Price action based: BOS
OBJETIVO Criar um Expert Advisor MT5 profissional para XAUUSD focado em: Consistência Baixo drawdown Scalping profissional Proteção da conta Crescimento sustentável Compatibilidade com conta micro e prop firms NÃO utilizar: Martingale Grid Hedge agressivo Recovery system Multiplicação de lotes após perda --- ATIVO XAUUSD apenas --- TIMEFRAMES Timeframe principal M5 Confirmação tendência M15 Confirmação macro opcional
Informations sur le projet
Budget
30+ USD
Délais
à 30 jour(s)
Client
Commandes passées1
Nombre d'arbitrages0