AE MACD MT5

MQL5 Asesores Expertos

Tarea técnica

//+------------------------------------------------------------------+
//| MACD Reverse EA - Daily (MT5)                                    |
//+------------------------------------------------------------------+
#property strict

#include <Trade/Trade.mqh>
CTrade trade;

//---- input
input double LotSize    = 0.10;
input int    StopLoss   = 500;   // points
input int    TakeProfit = 1000;  // points

input int FastMACD   = 9;
input int SlowMACD   = 22;
input int SignalMACD = 2;

//---- global
int macdHandle;
datetime lastBarTime = 0;

//+------------------------------------------------------------------+
int OnInit()
{
   macdHandle = iMACD(_Symbol, PERIOD_D1,
                      FastMACD, SlowMACD, SignalMACD,
                      PRICE_CLOSE);

   if(macdHandle == INVALID_HANDLE)
      return(INIT_FAILED);

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   IndicatorRelease(macdHandle);
}
//+------------------------------------------------------------------+
void OnTick()
{
   datetime barTime = iTime(_Symbol, PERIOD_D1, 0);
   if(barTime == lastBarTime) return;

   lastBarTime = barTime;

   double macdMain[3], macdSignal[3];
   CopyBuffer(macdHandle, 0, 0, 3, macdMain);
   CopyBuffer(macdHandle, 1, 0, 3, macdSignal);

   double main_now  = macdMain[1];
   double main_prev = macdMain[2];
   double sig_now   = macdSignal[1];
   double sig_prev  = macdSignal[2];

   bool crossUp   = (main_prev < sig_prev && main_now > sig_now);
   bool crossDown = (main_prev > sig_prev && main_now < sig_now);

   // ถ้ามีออเดอร์อยู่
   if(PositionSelect(_Symbol))
   {
      long type = PositionGetInteger(POSITION_TYPE);

      // Buy → MACD ตัดลง
      if(type == POSITION_TYPE_BUY && crossDown)
      {
         trade.PositionClose(_Symbol);
         SellOrder();
      }

      // Sell → MACD ตัดขึ้น
      if(type == POSITION_TYPE_SELL && crossUp)
      {
         trade.PositionClose(_Symbol);
         BuyOrder();
      }
   }
   else
   {
      // ไม่มีออเดอร์ → เปิดตามสัญญาณ
      if(crossUp)   BuyOrder();
      if(crossDown) SellOrder();
   }
}
//+------------------------------------------------------------------+
void BuyOrder()
{
   double price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   double sl = price - StopLoss * _Point;
   double tp = price + TakeProfit * _Point;

   trade.Buy(LotSize, _Symbol, price, sl, tp, "MACD Buy");
}
//+------------------------------------------------------------------+
void SellOrder()
{
   double price = SymbolInfoDouble(_Symbol, SYMBOL_BID);
   double sl = price + StopLoss * _Point;
   double tp = price - TakeProfit * _Point;

   trade.Sell(LotSize, _Symbol, price, sl, tp, "MACD Sell");
}
//+------------------------------------------------------------------+

Han respondido

1
Desarrollador 1
Evaluación
(18)
Proyectos
22
9%
Arbitraje
5
40% / 40%
Caducado
1
5%
Trabajando
2
Desarrollador 2
Evaluación
(22)
Proyectos
21
10%
Arbitraje
4
25% / 75%
Caducado
0
Libre
3
Desarrollador 3
Evaluación
(168)
Proyectos
199
48%
Arbitraje
3
33% / 33%
Caducado
2
1%
Libre
4
Desarrollador 4
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
5
Desarrollador 5
Evaluación
(4)
Proyectos
4
0%
Arbitraje
1
0% / 100%
Caducado
0
Libre
6
Desarrollador 6
Evaluación
(1)
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
7
Desarrollador 7
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
Solicitudes similares
I will send the source code privately Note that the tradingview indicator is profitable so should be the conversion to mql5 ea... ONE WORD EA SHOULD BE PROFITABLE when fully converted.. I created the source code of the indicator and fully analyzed the data.... I NEED A WELL COOKING CODER TO FULLY WORK WITH URGENT let's work towards the future
I need a reliable, clean-coded Expert Advisor built for both MetaTrader 4 and MetaTrader 5 platforms. Main trading behavior: The EA follows buy and sell arrows produced by my custom indicator. Whenever a buy arrow shows up on the chart: if a sell position is currently open → close that sell immediately and enter a buy trade in its place. Whenever a sell arrow appears: if a buy position exists → close the buy and
Hello I'm looking for professional to create a robot to me that will enter us30 or nasdaq around 16H29-minute55-Second New York session opening Monday to Friday and put stop loss 3800 points away from entry hedging strategy
hello every one i have a sample strategy i need a expert for automatical trade on vps pls let me know if every one can summer of expert : mixed 2 EMA and hicenashi + money managment i will need test befor pay
Looking for an experienced developer to build an AI-driven trading system for MetaTrader 5. The bot should be able to: Analyze market structure (accumulation, manipulation, distribution) and 45-min pullback zones (25%, 50%, 70%) for trade decisions Integrate with Bookmap via API for real-time order flow, liquidity, and footprint data
*I am looking for an experienced MQL5 developer to build a custom Expert Advisor (EA) for MetaTrader 5 based on my proprietary trading strategy. The full strategy details will be shared privately with the selected developer after agreement. The EA must be designed for automated trade execution with a strong focus on accuracy, speed, and stability. It should support flexible input settings and allow for future
Hello, I am seeking assistance in setting up a trade copier or bridge to facilitate the copying of trades from MetaTrader 5 to the Tradovate platform. I am looking for someone who can help automate my trading process, allowing trades generated by my Expert Advisor in MT5 to be copied to different accounts on Tradovate using their API.Something like in the attached image
📋 Project Description I am looking for an experienced MT5 (MQL5) developer to code a fully automated Expert Advisor for NASDAQ (US100) based on a fixed, rule-based opening range breakout strategy. The strategy is mechanical, uses no discretionary logic, and must be coded exactly as specified below. 🕒 Time & Session Rules Market: NASDAQ (US100) Trading days: Monday–Friday Session open: 9:30 EST EA must convert
I am looking for a professional developer to build a custom trading analysis software for me. This tool is NOT an automated trading bot (EA); it is an analysis dashboard to help me identify high-probability setups based on my strategy. Key Requirements: Multi-Timeframe Analysis: The software should scan 4 different timeframes (M15, M30, H1, H4, D1, WK1, MTH1) and alert me when my conditions are met. Indicator
Looking for an experienced developer to build an AI-driven trading system for MetaTrader 5. Have to finalize the trading logic (market structure, pullback zones, sessions, order-flow confirmation), then build the AI framework to learn from live trade results

Información sobre el proyecto

Presupuesto
30+ USD

Cliente

Encargos realizados1
Número de arbitrajes0