Ayuda a la codificación - página 629

 
traderduke:

mladen y mrtools

Tengo un EA que se autoexplota con operaciones. Necesito ayuda para construir un vacío o función que se puede añadir a un EA existente. Esta función tiene que abordar:

input bool doBasketExit = true; // Comprobar las condiciones de salida de la cesta
input double BasketTP = 250.0; // Basket Take Profit (Moneda de la cuenta) El par del gráfico
input double BasketSL = -100.0; // Basket Stop Loss (Moneda de la cuenta) El par del gráfico

Estoy ejecutando 9 pares/gráficos con un EA agresivo en el H1 y quiero operar con cestas específicas para cada uno de los 9 gráficos.
Esto es lo que me pasó. 9 gráficos que se ejecutan, 3 gráficos están en el comercio con, por supuesto, 3 pares separados, cada uno con 15 operaciones, sí 45 operaciones abiertas, 2 están en beneficio y uno está perdiendo mal. Estoy buscando una manera de sumar cada grupo/par de los 15 por separado y frotar cada grupo contra los límites de SL y TP de la cesta. He encontrado una cesta de configuración, pero por supuesto que necesita refinamiento. El truco es conseguir que el mismo par se sume desde la columna Order Profit Trade. Al estar en un Gráfico con un par específico pensé que se me ocurrió un vacío pero es algo complicado. La función debe leer de alguna manera el OrderProfit por par???

Ver mi código como un pobre ejemplo;

void closeTrades( CURRENCY* &currencies[] ) {
// Comprobar la salida de la cesta
if ( doBasketExit ) {
double basketProfit = getBasketProfit();
if ( ( BasketTP > 0.0 ) && ( basketProfit > BasketTP ) ||
( ( BasketSL < 0.0 ) && ( basketProfit < BasketSL ) ) ) {
closeAll();
}
}
double getBasketProfit() {
double basketProfit = 0.0;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--) {
if (OrderSelect(iOrder,SELECT_BY_POS,M ODE_TRADES)) {
if ( OrderMagicNumber() == MagicNumber ) {
if ( (OrderType() == OP_BUY) || (OrderType() == OP_SELL) ) {
basketProfit += OrderProfit() + OrderSwap() + OrderCommission();
}
}
}
}
return(basketProfit);
}

void cerrarTodo() {
double closePrice;
string symbolName;
int resultado;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--) {
if (OrderSelect(iOrder,SELECT_BY_POS,M ODE_TRADES)) {
if ( OrderMagicNumber() == MagicNumber ) {
if ( (OrderType() == OP_BUY) || (OrderType() == OP_SELL) ) {
symbolName = OrderSymbol();
closePrice = ( OrderType() == OP_BUY ) ? MarketInfo( symbolName, MODE_BID ) : MarketInfo( symbolName, MODE_ASK );
result = OrderCloseReliable(OrderTicket(), OrderLots(), closePrice, 50 );
}
}



Realmente agradezco que se investigue esto

Gracias
Ray

Rayo


Necesitas algún tipo de "EA madre" - que conozca todos los números mágicos manejados por otros EAs y luego haga las operaciones "en grupo" que necesitas que se hagan

 
Sr. MLADEN, por favor, compruebe su bandeja de entrada, señor.
 
mladen:

Intente hacer lo siguiente:

En lugar de

Gracias Mladen , he hecho algunos ajustes en el código y ahora funciona .
 
mladen:

Ray


Necesitas algún tipo de "EA madre" - que conozca todos los números mágicos manejados por otros EAs y luego haga las operaciones "en grupo" que necesitas que se hagan

mladen

gracias por sus reflexiones sobre este asunto. Así que NO.

gracias de nuevo


Ray

 

he tratado de hacer que la flecha aparezca después del cierre de la vela de la señal en otros para evitar repintar pero todo en vano.por favor ayúdame MR. TOOLS y MLADEN, abajo está el código.

//+------------------------------------------------------------------+
//|                                              signalindicator.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property  indicator_color1 Blue
#property  indicator_color2 Yellow
#property  indicator_color3 Aqua
#property  indicator_color4 Red

extern int FastEMA = 5;
extern int SlowEMA = 6;
extern int RSIPeriod = 7;
extern bool Alerts = TRUE;
double buffer_1[];
double buffer_2[];
double arrow_1[];
double arrow_2[];
int a = 0;
int b = 0;
double x = 0.0;
double y = 0.0;

int init() {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, buffer_1);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, buffer_2);
   SetIndexStyle(2, DRAW_ARROW, 0,4);
   SetIndexArrow(2, 217);
   SetIndexBuffer(2, arrow_1);
   SetIndexEmptyValue(2, 0.0);
   SetIndexStyle(3, DRAW_ARROW, 0,4);
   SetIndexArrow(3, 218);
   SetIndexBuffer(3, arrow_2);
   SetIndexEmptyValue(3, 0.0);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int counted_bars = IndicatorCounted();
   double irsi_1 = 0;
   bool c = FALSE;
   double price_10 = 0;
   if (counted_bars < 0) return (-1);
   if (counted_bars > 0) counted_bars--;
   int li_0 = Bars - counted_bars;
   for (int i = 0; i < li_0; i++) {
      buffer_1[i] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i);
      buffer_2[i] = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, i);
      irsi_1 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i);
      x = buffer_1[i] - buffer_2[i];
      if (x > 0.0 && irsi_1 > 50.0) a = 1;
      else
         if (x < 0.0 && irsi_1 < 50.0) a = 2;
      if (a == 1 && b == 2) {
         arrow_2[i - 1] = High[i - 1] - 5.0 * Point;
         c= TRUE;
         price_10 = Ask;
      } else {
         if (a == 2 && b == 1) {
            arrow_1[i - 1] = Low[i - 1] - 5.0 * Point;
            c = TRUE;
            price_10 = Bid;
         }
      }
      b = a;
      y = x;
   }
   if (Alerts && c) {
      PlaySound("alert.wav");
      if (b == 2) Alert(Symbol(),"  M",Period(),"Buy at " + price_10 + "!!", "Entry Point", 0);
      else
         if (b == 1) Alert(Symbol(),"  M",Period(),"Sell at " + price_10 + "!!", "Entry Point", 0);
      c= FALSE;
   }
   return (0);
}
 
hola

Hola mladen

Necesito ITM X-Gen Daily Scalper Indicator.mq4

Ayúdame

Gracias

Archivos adjuntos:
 
alozard:

Hola mladen

Necesito ITM X-Gen Daily Scalper Indicator.mq4

Ayúdame

Gracias

alozard

Ese indicador es un renombrado mi indicador de bandas TMA centradas. Puedes encontrarlo aquí : https://www.mql5.com/en/forum/181241

 
Sr. mladen , por favor ayúdeme con la versión de los códigos anteriores.
 

Sr. Mladen, por favor mire los siguientes códigos, la flecha no aparece en vivo hasta que cambie el marco de tiempo.


//+------------------------------------------------------------------+
//|                                              signalindicator.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property  indicator_color1 Blue
#property  indicator_color2 Yellow
#property  indicator_color3 Aqua
#property  indicator_color4 Red

#property  indicator_color4 Red

extern int FastEMA = 5;
extern int SlowEMA = 6;
extern int RSIPeriod = 7;
extern bool Alerts = TRUE;
double buffer_1[];
double buffer_2[];
double arrow_1[];
double arrow_2[];
int a = 0;
int b = 0;
double x = 0.0;
double y = 0.0;
 double alertshow;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0, DRAW_NONE);
   SetIndexBuffer(0, buffer_1);
   SetIndexStyle(1, DRAW_NONE);
   SetIndexBuffer(1, buffer_2);
   SetIndexStyle(2, DRAW_ARROW, 0,4);
   SetIndexArrow(2, 241);
   SetIndexBuffer(2, arrow_1);
   SetIndexEmptyValue(2, 0.0);
   SetIndexStyle(3, DRAW_ARROW, 0,4);
   SetIndexArrow(3, 242);
   SetIndexBuffer(3, arrow_2);
   SetIndexEmptyValue(3, 0.0);

   return (0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return (0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int counted_bars = IndicatorCounted();
   double irsi_1 = 0;
   int li_0;
   bool c = FALSE;
   double price_10 = 0;
   if (counted_bars < 0) return (-1);
   if (counted_bars > 0) counted_bars--;
   if(counted_bars==0)
      li_0=MathMin(Bars-10-1,Bars-MathMax(FastEMA,SlowEMA)-1);
   else
      li_0=Bars-counted_bars;
   for (int i = 0; i < li_0; i++) {
      buffer_1[i] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i);
      buffer_2[i] = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, i);
      irsi_1 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i);
      x = buffer_1[i] - buffer_2[i];
      if (x > 0.0 && irsi_1 > 50.0) a = 1;
      else
         if (x < 0.0 && irsi_1 < 50.0) a = 2;
      if (a == 1 && b == 2) {
         arrow_2[i - 1] = High[i - 1] - 5.0 * Point;
         c= TRUE;
         price_10 = Ask;
      } else {
         if (a == 2 && b == 1) {
            arrow_1[i - 1] = Low[i - 1] - 5.0 * Point;
            c = TRUE;
            price_10 = Bid;
         }
      }
      b = a;
      y = x;
   }
   if (Alerts && c) {
      PlaySound("alert.wav");
      if (b == 2)  
      
         if(alertshow<Time[1] && counted_bars!=0)
           {
            PlaySound("news.wav");// buy wav
            Alert(Symbol()," buy signal");
            alertshow=Time[1];
           }
      else
         if (b == 1) if(alertshow<Time[1] && counted_bars!=0)
           {
            PlaySound("news.wav");// buy wav
            Alert(Symbol(),"  sell signal");
            alertshow=Time[1];
           }
   }
//----
   return(prev_calculated);
  }
//+------------------------------------------------------------------+
 
kapoo:

Sr. Mladen, por favor mire los siguientes códigos, la flecha no aparece en vivo hasta que cambie el marco de tiempo.


kapoo

Como ya te he dicho varias veces : ese indicador es un mal reparador y por eso hace lo que hace. Mi mejor consejo es que te olvides de él