EA Expert basado en EMA lenta barras y EMA rapida

MQL5 エキスパート

仕事が完了した

実行時間2 日
開発者からのフィードバック
Gracias por la oportunidad.
依頼者からのフィードバック
This encoder performs extremely well in the mql language. He interpreted the strategy extremely well and patiently knew how to add conditions to the code to achieve the objective.

指定

Necesito que se desarrole un EA Expert para MT5 basado en EMA de 200 periodos el cual será el detector de la tendencia principal.

Para indice de futuros S&P500 y otros en marco temporal D1 y H1:

El EA debe detectar que la tendencia es alcista, de lo contrario no hacer nada.

Condiciones: se deben cumplir 3 barras bajistas completadas en contra de la tendencia principal, despues de la tercera vela el EA debe abrir una operacion de compra en favor de la tendencia principal.

El EA cerrará la orden solo cuando el precio esté por encima de la EMA de 5 periodos.

En imputs debe haber gestión de capital lote fijo o dinámico así como ajuste de Stop Loss

Es una estrategia FIFO.

Aquí un borrador en código de la estrategia:

//+------------------------------------------------------------------+

//|                                            EMAS&bars.mq5   |

//|                          Copyright 2024, xxxx xxxxxx xxxxx. |

//|                                   https://www.opentrading.top |

//+------------------------------------------------------------------+

input int emaSlowPeriods = 200;

input int emaFastPeriods = 5;

input double lotSize = 0.1;

input int stopLoss = 135; // en puntos


// Variables globales

bool trendIsUp = false;

int consecutiveBearishCandles = 0;

int ticket = 0;


//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

   return (INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

   //--- 

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

   // Verificar tendencia

   double emaSlow = iMA(NULL, 0, emaSlowPeriods, 0, MODE_EMA, PRICE_CLOSE, 0);

   double emaFast = iMA(NULL, 0, emaFastPeriods, 0, MODE_EMA, PRICE_CLOSE, 0);


   if (emaSlow > emaSlow[1])

       trendIsUp = true;

   else

       trendIsUp = false;


   // Detectar velas bajistas consecutivas

   if (Close[0] < Open[0])

       consecutiveBearishCandles++;

   else

       consecutiveBearishCandles = 0;


   // Condición de entrada

   if (trendIsUp && consecutiveBearishCandles >= 3 && ticket == 0)

   {

       // Realizar acciones de entrada

       double stopLossPrice = NormalizeDouble(Bid - stopLoss * Point, Digits);

       ticket = OrderSend(Symbol(), OP_BUY, lotSize, Ask, 3, stopLossPrice, 0, "Compra basada en estrategia", 0, 0, Green);

       if (ticket > 0)

       {

           Print("Orden de compra abierta: Ticket #", ticket);

       }

       else

       {

           Print("Error al abrir la orden de compra: ", GetLastError());

       }

   }


   // Condición de salida

   if (ticket > 0)

   {

       if (OrderSelect(ticket, SELECT_BY_TICKET) == true)

       {

           if (OrderType() == OP_BUY && Close[0] > emaFast)

           {

               if (OrderClose(ticket, OrderLots(), Bid, 3, Red))

               {

                   Print("Orden de compra cerrada: Ticket #", ticket);

                   ticket = 0; // Restablecer la variable ticket

               }

               else

               {

                   Print("Error al cerrar la orden de compra: ", GetLastError());

               }

           }

       }

   }

  }

//+------------------------------------------------------------------+



応答済み

1
開発者 1
評価
(154)
プロジェクト
258
24%
仲裁
12
25% / 8%
期限切れ
15
6%
仕事中
類似した注文
Hola, soy Pedro, gestor del Darwin KBS. Buscamos un programador de MQL5 con experiencia para realizar varios proyectos y tener una relación de aproximadamente 12 meses realizando Experts Advisors según nuestros requerimientos. Imprescindible experiencia amplia en MQL5 y que hable Español. Un saludo
Busco un desarrollador en MQL5 para la creación de un EA. El diseño y las especificaciones técnicas se facilitarán al contratar el servicio. El EA es enteramente programable ya que yo he desarrollado la versión en MQL4
I want to learn how to use a robot to pass funding tests and to operate and maintain 8% profits, whether with copy trade or another option, the company is befunding

プロジェクト情報

予算
30+ USD
VAT(付加価値税) (19%): 5.7 USD
合計: 35.7 USD
開発者用
27 USD