Spécifications
//+------------------------------------------------------------------+
//| TrendPullbackEA.mq5 |
//| Copyright 2024, EA DENIS MUSYOKA Trading Robot |
//+------------------------------------------------------------------+
#property strict
#property copyright "Copyright 2024"
#property version "1.00"
// 1. Include the Trade Library (Fixes OrderSend errors)
#include <Trade\Trade.mqh>
// 2. Global Objects
CTrade trade; // Trading class to handle Buy/Sell
int maHandle; // Handle for the Moving Average indicator
//--- Input parameters
input int StopLoss = 200; // Stop Loss in Points
input int TakeProfit = 400; // Take Profit in Points
input double LotSize = 0.1; // Trading Lot Size
input int MovingAveragePeriod = 20; // MA Period
input ENUM_MA_METHOD MA_Method = MODE_SMA; // MA Method
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Initialize the Moving Average Handle
maHandle = iMA(_Symbol, _Period, MovingAveragePeriod, 0, MA_Method, PRICE_CLOSE);
if(maHandle == INVALID_HANDLE)
{
Print("Failed to create handle for MA indicator");
return(INIT_FAILED);
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Release the indicator handle to save memory
IndicatorRelease(maHandle);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// 3. Get Current Prices (Fixes 'Ask' and 'Bid' undefined errors)
double Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double Bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
// 4. Get Indicator Data
double maArray[];
ArraySetAsSeries(maArray, true);
// Copy the last 2 values of the MA into our array
if(CopyBuffer(maHandle, 0, 0, 2, maArray) < 0) return;
double currentMA = maArray[0];
double prevMA = maArray[1];
// 5. Get Candle Data (Fixes 'Close' array errors)
double currentClose = iClose(_Symbol, _Period, 0);
double prevClose = iClose(_Symbol, _Period, 1);
// 6. Check if we already have an open position (Simple logic: 1 trade at a time)
if(PositionsTotal() > 0) return;
// 7. Trading Logic
// BUY Condition: Price crosses above MA
if(prevClose < prevMA && currentClose > currentMA)
{
double sl = Ask - (StopLoss * _Point);
double tp = Ask + (TakeProfit * _Point);
// Normalize prices for the broker
double price = NormalizeDouble(Ask, _Digits);
sl = NormalizeDouble(sl, _Digits);
tp = NormalizeDouble(tp, _Digits);
// Execute Buy
if(!trade.Buy(LotSize, _Symbol, price, sl, tp, "Trend Pullback Buy"))
{
Print("Buy Order Error: ", trade.ResultRetcodeDescription());
}
}
// SELL Condition: Price crosses below MA
if(prevClose > prevMA && currentClose < currentMA)
{
double sl = Bid + (StopLoss * _Point);
double tp = Bid - (TakeProfit * _Point);
// Normalize prices for the broker
double price = NormalizeDouble(Bid, _Digits);
sl = NormalizeDouble(sl, _Digits);
tp = NormalizeDouble(tp, _Digits);
// Execute Sell
if(!trade.Sell(LotSize, _Symbol, price, sl, tp, "Trend Pullback Sell"))
{
Print("Sell Order Error: ", trade.ResultRetcodeDescription());
}
}
}
Répondu
1
Évaluation
Projets
14
21%
Arbitrage
1
0%
/
0%
En retard
2
14%
Travail
2
Évaluation
Projets
1
0%
Arbitrage
1
0%
/
100%
En retard
1
100%
Travail
3
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
4
Évaluation
Projets
69
35%
Arbitrage
4
25%
/
75%
En retard
0
Gratuit
5
Évaluation
Projets
4
0%
Arbitrage
3
0%
/
0%
En retard
1
25%
Chargé
6
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
7
Évaluation
Projets
64
20%
Arbitrage
11
27%
/
55%
En retard
5
8%
Gratuit
8
Évaluation
Projets
2
50%
Arbitrage
0
En retard
0
Gratuit
9
Évaluation
Projets
83
28%
Arbitrage
9
33%
/
56%
En retard
9
11%
Gratuit
Publié : 1 code
10
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
11
Évaluation
Projets
35
34%
Arbitrage
5
0%
/
80%
En retard
0
Travail
Publié : 2 codes
12
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
13
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Travail
Commandes similaires
I need a custom MT5 trade copier that can copy trades from one master account to 10 slave accounts in real time. Some slave accounts may share the same broker, while others will be on different brokers. Requirements: Copy all trades from the master account to slave accounts: Entries Stop Loss (SL) Take Profit (TP) Trade modifications Trade closing Handle multiple currency pairs simultaneously. Risk management: Option
Profitable XAUUSD Scalping EA
30+ USD
I am searching for a fully developed and already profitable Expert Advisor focused on XAUUSD scalping. I am not looking for a custom build or experimental system. The EA must already be trading successfully on a real live account. What I am looking for: • At least 6 months of verified live results • Daily drawdown controlled within 10% • Around 13% or more average monthly return • Clean risk management approach with
Modification of EA and Addition of New Trade Logic and Features Currently, the EA is opening trades correctly but in addition, there are times when it is opening the trades wrongly. The EA is based on an indicator (only the .ex5 file is available). A new trigger logic also needs to be added, along with new closing conditions. This project must NOT use any DLL and must be submitted in 1 day (max 2 days) The EA will be
Wayne Butts
100 - 800 USD
I need a great trading robot that can analyze the market for me and make precise and accurate trades and close them at capital gains. I need the robot to not lose below a certain amount and shit down when the goal for the day month quarter or year has been met
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, with at least 6 months of history performance I’m open to reviewing it immediately. Please apply only if you meet all the requirements below
I am in need of a buy stop sell stop EA that is developed already and profitable in live market for SCALPING XAUUSD. Note: Profitable in LIVE MARKET. It should have god risk management and low drawdown. If you have one developed, pls reply. The developer will need to send a demo so I can test myself
Automated trading system
150 - 250 USD
Anyone I need my own bot with my own licenses keys I will pay up please the bot must make good profit and I will pay up good money just hope it helps me
Developing a trading robot
30 - 150 USD
Hello Muzaffar, I am inquiring about trading robot for my Gold trading scalping, Day trading and swing trading, could you develop this kind of trading robot, if its yes how long it will take you to deliver and how much will it cost? I would appreciate your response, Kind Regards, Ahmed
Develop a fully automated MT5 Expert Advisor based on a multi-timeframe institutional trend-pullback strategy with: Regime filtering (H4) Execution logic (H1) ATR-based stop model Multi-stage trailing system Risk-based position sizing Portfolio-level risk protection Detailed performance logging This EA will be used for client capital (PAMM/MAM environment). Stability and risk control are higher priority than high
Fix bugs and modify existing EA
30+ USD
Hello, I have an existing MT5 Expert Advisor that works perfectly on a demo account. The strategy is profitable and executes trades correctly in demo testing. However, when I run the same EA on a live account, it takes trades but the results are not profitable. The performance is significantly different compared to demo. I am looking for an experienced MQL5 developer who can: Analyze the EA logic Identify why live
Informations sur le projet
Budget
35+ USD
Client
Commandes passées1
Nombre d'arbitrages0