Aiuto per la codifica - pagina 629

 
traderduke:

mladen & mrtools

Ho un EA che si fa esplodere con i trade. Ho bisogno di aiuto per costruire un Void o una funzione che può essere aggiunta a un EA esistente. Questa funzione ha bisogno di affrontare:

input bool doBasketExit = true; // Controlla le condizioni di Basket Exit
input double BasketTP = 250.0; // Basket Take Profit (valuta del conto) Il grafico Pair
input double BasketSL = -100.0; // Basket Stop Loss (valuta del conto) La coppia del grafico

Sto eseguendo 9 coppie/carte con un EA aggressivo su H1 e voglio che il trading del cesto sia specifico per la coppia su ognuno dei 9 grafici.
Ecco cosa mi è successo. 9 grafici in esecuzione, 3 grafici sono in commercio con, naturalmente, 3 coppie separate, ciascuno con 15 scambi, sì 45 scambi aperti, 2 sono in profitto e uno sta perdendo male. Ho cercato un modo per sommare ogni gruppo/coppia dei 15 separatamente e strofinare ogni gruppo contro un canestro SL & TP. Ho trovato un cesto impostato, ma ovviamente ha bisogno di essere perfezionato. Il trucco è quello di far sommare la stessa coppia dalla colonna Order Profit Trade. Stando su un grafico con una coppia specifica ho pensato di trovare un vuoto ma è un po' complicato. La funzione deve in qualche modo leggere l'OrderProfit per coppia?

Vedere il mio codice come un povero esempio;

void closeTrades( CURRENCY* &currencies[] ) {
// Controlla l'uscita dal paniere
if ( doBasketExit ) {
double basketProfit = getBasketProfit();
if ( ( ( BasketTP > 0.0 ) && ( basketProfit > BasketTP ) ) ||
( BasketSL < 0.0 ) && ( basketProfit < BasketSL ) ) ) {
closeAll();
}
}
doppio 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 closeAll() {
double closePrice;
stringa symbolName;
int risultato;
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 );
risultato = OrderCloseReliable(OrderTicket(), OrderLots(), closePrice, 50 );
}
}



Apprezzo molto che tu dia un'occhiata a questo

Grazie
Ray

Ray


Hai bisogno di una sorta di "EA madre" - che conosca tutti i numeri magici gestiti da altri EA e poi faccia le operazioni "sul gruppo" di cui hai bisogno

 
Mr MLADEN, per favore controlli la sua casella di posta elettronica signore
 
mladen:

Prova a fare quanto segue:

Invece di

Grazie Mladen, ho fatto qualche aggiustamento del codice e ora funziona.
 
mladen:

Ray


Hai bisogno di una sorta di "EA madre" - che conoscerebbe tutti i numeri magici gestiti da altri EA e poi fare le operazioni "sul gruppo" che hai bisogno di essere fatto

mladen

grazie per i vostri pensieri su questo argomento. Quindi NO.

grazie ancora


Ray

 

ho provato a far apparire la freccia dopo la chiusura della candela del segnale per evitare la riverniciatura, ma tutto senza risultato. TOOLS e MLADEN, di seguito il codice.

//+------------------------------------------------------------------+
//|                                              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);
}
 
ciao

Ciao mladen

Ho bisogno dell'indicatore ITM X-Gen Daily Scalper.mq4

Heelp me

Grazie

 
alozard:

Ciao mladen

Ho bisogno dell'indicatore ITM X-Gen Daily Scalper.mq4

Aiutami

Grazie

alozard

Quell'indicatore è un rinominato il mio indicatore delle bande TMA centrate. Puoi trovarlo qui: https: //www.mql5.com/en/forum/181241

 
Mr. mladen , per favore aiutatemi con la versione dei codici di cui sopra.
 

Sig. Mladen, per favore guardi i codici qui sotto, la freccia non viene fuori dal vivo fino a quando non ho cambiato il time frame.


//+------------------------------------------------------------------+
//|                                              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:

Mr. Mladen, per favore guardi i codici qui sotto, la freccia non viene fuori in diretta fino a quando non ho cambiato il time frame.


kapoo

Come ti ho già detto più volte: quell'indicatore è un cattivo riquadro ed è per questo che fa quello che fa. Il mio miglior consiglio è di lasciar perdere