Errores, fallos, preguntas - página 2737

 

En MT4, mientras se depuran indicadores, el depurador se cuelga permanentemente si se cambia a un gráfico.

Se reproduce, por ejemplo, durante el inicio de la depuración del indicador CCI estándar.

1. Establezca un punto de interrupción;

2. Pulse F5;

3. Cambia al gráfico.

Resultado: el gráfico del depurador se cuelga.

También puedes simplemente pulsar F5 varias veces durante la depuración - el gráfico se cuelga.

Construye 1260.

Configuración del depurador:


 
Los comentarios no relacionados con este tema han sido trasladados a "Preguntas de los principiantes de MQL4 MT4 MetaTrader 4".
 

El resultado de la búsqueda borra parte del texto.


Aquí está el original.

Foro sobre trading, sistemas de trading automatizados y comprobador de estrategias

Probador de Estrategias de MetaTrader 5: errores, fallos, sugerencias de mejora

fxsaber, 2020.05.11 20:31

Probablemente no tiene sentido que Tester cree archivos opt que tengan Header.passes_passed== 0.
 
En muy pocas ocasiones de trabajo con objetos gráficos, surgió la necesidad de colorear el fondo para OBJ_LABLE (set OBJPROP_BGCOLOR).
Resulta que establecer el color de fondo no es posible para un objeto de tipo OBJ_LABLE, es necesario utilizar OBJ_EDIT.
Al utilizar OBJ_EDIT, ha surgido un nuevo problema: la necesidad de establecer el tamaño de OBJPROP_XSIZE y OBJPROP_YSIZE para que todo el texto se ajuste a las dimensiones correspondientes del objeto.

Pregunta: ¿cómo determinar los tamaños OBJPROP_XSIZE y OBJPROP_YSIZE para que quepa todo el texto?
Consideré dos opciones:
1. Creación del objeto OBJ_LABLE, lectura de sus dimensiones, borrado del objeto OBJ_LABLE.
No es adecuado porque la acotación sólo es posible después de que el objeto haya sido creado y no es posible cuando el objeto está en la cola de ChartRedraw.

2. utilizando TextSetFont seguido de TextGetSize.
No es adecuado, porque el resultado es radicalmente diferente de los resultados del método nº 1, la diferencia de 2,5 - 2,9 veces, dependiendo del tamaño de la fuente.
Probablemente la razón sea el monitor 4K y el 175% de DPI.

#define  PRINT(x) ; Print(#x, ":", string(x))
          
void SetLabel(long achart, string name, int wnd, string text, color clr, int x, int y, int corn=0, int fontsize=8, string font="Tahoma")
{
   ObjectCreate(achart, name, OBJ_LABEL, wnd, 0, 0); 
   ObjectSetInteger(achart, name, OBJPROP_CORNER, corn); 
   ObjectSetString(achart, name, OBJPROP_TEXT, text); ObjectSetInteger(achart, name, OBJPROP_COLOR, clr); 
   ObjectSetInteger(achart, name, OBJPROP_FONTSIZE, fontsize); ObjectSetString(achart, name, OBJPROP_FONT, font);
   ObjectSetInteger(achart, name, OBJPROP_SELECTABLE, false); 
   ObjectSetInteger(achart, name, OBJPROP_BORDER_TYPE, 0);
   ObjectSetInteger(achart, name, OBJPROP_XDISTANCE, x); ObjectSetInteger(achart, name, OBJPROP_YDISTANCE, y);
}

void OnStart(){     
   string obj_name = "test_obj";   
   string text = "AAAA::BBBB";
   int font_size = 7;
   string font_name = "Tahoma";
   
   SetLabel(0, obj_name, 0, text, clrWhite, 100, 100, 0, font_size, font_name);
   ChartRedraw(0);
   Sleep(1000);
   
   uint dx_fixed_0 = int(ObjectGetInteger(0, obj_name, OBJPROP_XSIZE));
   uint dy_fixed_0 = int(ObjectGetInteger(0, obj_name, OBJPROP_YSIZE));
   ObjectDelete(0, obj_name);
   
   PRINT(dx_fixed_0);
   PRINT(dy_fixed_0);
   
   
   uint dx_fixed_1;
   uint dy_fixed_1;
   TextSetFont(font_name, -10 *  font_size);
   TextGetSize(text, dx_fixed_1, dy_fixed_1);
   
   PRINT(1.0 * dx_fixed_0 / dx_fixed_1);  	// Result: 1.0
   PRINT(1.0 * dy_fixed_0 / dy_fixed_1);  	// Result: 1.0
}  


Gracias aGeess por lasolución.
Es necesario multiplicar por -10 el tamaño del barajado al pasarlo a TextSetFont.

 
Sergey Dzyublik:
Rara vez trabajo con objetos gráficos, necesito pintar el color de fondo para OBJ_LABLE (establecer OBJPROP_BGCOLOR).
Resulta que establecer el color de fondo no es posible para un objeto de tipo OBJ_LABLE, es necesario utilizar OBJ_EDIT.
Al utilizar OBJ_EDIT, ha surgido un nuevo problema: la necesidad de establecer el tamaño de OBJPROP_XSIZE y OBJPROP_YSIZE para que todo el texto se ajuste a las dimensiones correspondientes del objeto.

Pregunta: ¿cómo determinar los tamaños OBJPROP_XSIZE y OBJPROP_YSIZE para que quepa todo el texto?
He considerado dos opciones:
1. Crear el objeto OBJ_LABLE, leer las cotas, borrar el objeto OBJ_LABLE.
No es adecuado porque la acotación sólo es posible después de que el objeto haya sido creado y no es posible cuando el objeto está en la cola de ChartRedraw.

2. utilizando TextSetFont seguido de TextGetSize.
No es adecuado, porque el resultado es radicalmente diferente de los resultados del método nº 1, la diferencia de 2,5 - 2,9 veces, dependiendo del tamaño de la fuente.
Probablemente la razón sea el monitor 4K y el 175% de DPI.

En primer lugar, el tamaño del texto y el tamaño del objeto no son lo mismo. Como mínimo tiene que haber una frontera. Y por lo tanto estos valores no pueden coincidir.
En segundo lugar, es mejor utilizar OBJ_BITMAP_LABEL que no tiene limitaciones.
Y si lo usas, es mejor usar la clase CCanvas.

#include <Canvas\Canvas.mqh>
          
void SetLabel(CCanvas &c, long achart, string name, int wnd, string text, color clr_text, color clr_bckgrnd, int x, int y, int corn=0, int fontsize=8, int border=2, string font="Tahoma", uchar transparency=0xFF)
{
   uint w,h;
   c.FontSet(font, fontsize);
   c.TextSize(text, w, h);
   if(!c.CreateBitmapLabel(achart,wnd,name,x,y,w+border*2,h+border*2,COLOR_FORMAT_ARGB_NORMALIZE))
      Print("Error creating canvas object: ", GetLastError());
   c.Erase(ColorToARGB(clr_bckgrnd,transparency));
   c.TextOut(border,border,text,ColorToARGB(clr_text,transparency));
   c.Update();
}

void OnStart(){     
   string obj_name = "test_obj";   
   string text = "AAAA::BBBB";
   int font_size = 17;
   string font_name = "Tahoma";
   CCanvas Can;
   SetLabel(Can,0, obj_name, 0, text, clrYellow, clrBlue, 100, 100, 0, font_size,3, font_name, 0x80);
   Sleep(10000);
   Can.Destroy();
}  

El resultado es el mismo objeto, sólo que con más posibilidades. Por ejemplo, añadiendo transparencia a la etiqueta de texto.


 
Geess:

En primer lugar, el tamaño del texto y el tamaño del objeto no son lo mismo. Como mínimo, debe haber una frontera. Por lo tanto, estos valores no pueden coincidir.

Muchas gracias por su ayuda.
Estás adaptando una solución ya hecha a tus propias necesidades, así que no veo la necesidad de implementar bibliotecas.
La solución que usted propuso originalmente puede representarse como:

void SetBitmapLabel(long achart, string name, int wnd, string text, color clr, color bgclr, int x, int y, int corn=0, int fontsize=8, string font="Tahoma", int border=2)
{
   uint w,h;
   TextSetFont(font,-10* fontsize,0,0);
   TextGetSize(text,w,h);
   w = w+border*2;
   h = h+border*2;
   
   uint pixels[];
   ArrayResize(pixels,w*h);
   ArrayInitialize(pixels,0);
   ENUM_COLOR_FORMAT color_format = COLOR_FORMAT_XRGB_NOALPHA;
   string resource_name="::"+name+(string)ChartID()+(string)(GetTickCount()+MathRand());
   
   ResourceCreate(resource_name,pixels,w,h,0,0,0,color_format);
   ObjectCreate(achart,name,OBJ_BITMAP_LABEL,wnd,0,0);
   ObjectSetInteger(achart,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(achart,name,OBJPROP_YDISTANCE,y);
   ObjectSetString(achart,name,OBJPROP_BMPFILE,resource_name);
   ArrayInitialize(pixels,ColorToARGB(bgclr));
   TextOut(text,border,border,0,pixels,w,h,ColorToARGB(clr),color_format);
   ResourceCreate(resource_name,pixels,w,h,0,0,0,color_format);
}

void SetLabel(long achart, string name, int wnd, string text, color clr, int x, int y, int corn=0, int fontsize=8, string font="Tahoma")
{
        ObjectCreate(achart, name, OBJ_LABEL, wnd, 0, 0); 
        ObjectSetInteger(achart, name, OBJPROP_CORNER, corn); 
        ObjectSetString(achart, name, OBJPROP_TEXT, text); ObjectSetInteger(achart, name, OBJPROP_COLOR, clr); 
        ObjectSetInteger(achart, name, OBJPROP_FONTSIZE, fontsize); ObjectSetString(achart, name, OBJPROP_FONT, font);
        ObjectSetInteger(achart, name, OBJPROP_SELECTABLE, false); 
        ObjectSetInteger(achart, name, OBJPROP_BORDER_TYPE, 0);
        ObjectSetInteger(achart, name, OBJPROP_XDISTANCE, x); ObjectSetInteger(achart, name, OBJPROP_YDISTANCE, y);
}

void OnStart(){     
   string obj_name = "test_obj";   
   string text = "AAAA::BBBB";
   int font_size = 50;
   string font_name = "Tahoma";
   
   SetBitmapLabel(0, "BL" + obj_name, 0, text, clrRed, clrWhite, 100, 100, 0, font_size, font_name);
   SetLabel      (0, "L"  + obj_name, 0, text, clrRed,           100, 200, 0, font_size, font_name);
   ChartRedraw(0);
   Sleep(10000);
}  


Desafortunadamente, debido a un defecto en MT5 - la solución propuesta no puede ser utilizada normalmente.
El tamaño del texto resulta ser 3 veces más pequeño de lo necesario en un monitor 4K con 175% de DPI de Windows.
Tengo que multiplicar el tamaño de la fuente por DPI / 100% * [1,6 ... 1,8]

GraciasGeesspor lasolución.
Tienes que multiplicar el tamaño de la fuente por -10 al pasarlo aTextSetFont.




 
Sergey Dzyublik:

Muchas gracias por su ayuda.
Estás adaptando una solución ya hecha a tus propias necesidades, así que no veo la necesidad de implementar bibliotecas.
La solución que usted propuso originalmente puede representarse como:


Desafortunadamente, debido a un defecto en MT5 - la solución propuesta no puede ser utilizada normalmente.
El tamaño del texto resulta ser 3 veces más pequeño de lo necesario en un monitor 4K con 175% de DPI de Windows.
Tengo que multiplicar el tamaño de la fuente por DPI / 100% * [1,6 ... 1,8].

https://www.mql5.com/ru/docs/objects/textsetfont


tienes que hacerlo así:

void SetBitmapLabel(long achart, string name, int wnd, string text, color clr, color bgclr, int x, int y, int corn=0, int fontsize=8, string font="Tahoma", int border=2, uchar transparency=0xFF)
{
   uint w,h;
   TextSetFont(font,-10*fontsize,0,0);
   TextGetSize(text,w,h);
   w = w+border*2;
   h = h+border*2;
   
   uint pixels[];
   ArrayResize(pixels,w*h);
   ArrayInitialize(pixels,0);
   ENUM_COLOR_FORMAT color_format = COLOR_FORMAT_ARGB_NORMALIZE;
   string resource_name="::"+name+(string)ChartID()+(string)(GetTickCount()+MathRand());
   
   ResourceCreate(resource_name,pixels,w,h,0,0,0,color_format);
   ObjectCreate(achart,name,OBJ_BITMAP_LABEL,wnd,0,0);
   ObjectSetInteger(achart,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(achart,name,OBJPROP_YDISTANCE,y);
   ObjectSetString(achart,name,OBJPROP_BMPFILE,resource_name);
   ObjectSetInteger(achart,name,OBJPROP_BACK,false);
   ArrayInitialize(pixels,ColorToARGB(bgclr, transparency));
   TextOut(text,border,border,0,pixels,w,h,ColorToARGB(clr, transparency),color_format);
   ResourceCreate(resource_name,pixels,w,h,0,0,0,color_format);
}

void SetLabel(long achart, string name, int wnd, string text, color clr, int x, int y, int corn=0, int fontsize=8, string font="Tahoma")
{
        ObjectCreate(achart, name, OBJ_LABEL, wnd, 0, 0); 
        ObjectSetInteger(achart, name, OBJPROP_CORNER, corn); 
        ObjectSetString(achart, name, OBJPROP_TEXT, text); ObjectSetInteger(achart, name, OBJPROP_COLOR, clr); 
        ObjectSetInteger(achart, name, OBJPROP_FONTSIZE, fontsize); ObjectSetString(achart, name, OBJPROP_FONT, font);
        ObjectSetInteger(achart, name, OBJPROP_SELECTABLE, false); 
        ObjectSetInteger(achart, name, OBJPROP_BORDER_TYPE, 0);
        ObjectSetInteger(achart, name, OBJPROP_XDISTANCE, x); ObjectSetInteger(achart, name, OBJPROP_YDISTANCE, y);
}

void OnStart(){     
   string obj_name = "test_obj";   
   string text = "AAAA::BBBB";
   int font_size = 50;
   string font_name = "Tahoma";
   
   SetBitmapLabel(0, "BL" + obj_name, 0, text, clrRed, clrBlue, 100, 100, 0, font_size, font_name,2,0xA0);
   SetLabel      (0, "L"  + obj_name, 0, text, clrBlue,         100, 200, 0, font_size, font_name);
   ChartRedraw(0);
   Sleep(10000);
}



No entiendo por qué necesitas tanto OBJ_LABEL? Ha implementado una variante sin bibliotecas con OBJ_BITMAP_LABEL. ¿Cuál es su ventaja? Sólo veo una limitación.

 
Objetivo
Geess:

https://www.mql5.com/ru/docs/objects/textsetfont
No entiendo por qué necesitas tanto OBJ_LABEL? Ha implementado una variante sin bibliotecas con OBJ_BITMAP_LABEL. ¿Cuál es su ventaja? Sólo veo una limitación.

Muchas gracias de nuevo.
No sabía, no vio, no leyó, sobre la multiplicación por -10. Problema resuelto.
OBJ_LABEL se utilizó para ilustrar el problema y poder reproducirlo.

 
¡Hola!

Por favor, dígame cuál es el problema.

Diferentes indicadores, que funcionan correctamente y se actualizan, comienzan a mostrar algo diferente, no basado en el gráfico de precios mostrado en la ventana principal. Ocurre de vez en cuando, no todos los días.

Al principio le eché la culpa a los indicadores, pero después de probar diferentes, incluidos los nativos de MT5, sospecho del terminal. Observo el problema desde hace mucho tiempo, desde el año pasado, en diferentes versiones del terminal. Primero fue en la versión personalizada de Alpari, ahora es lo mismo en la versión original. Tanto en cuenta demo como en ecn real .

El corredor Alpari. MT5 build 2363 del 13.03.2020. No recuerdo en otros periodos, pero definitivamente ocurre en la M1.

Capturas de pantalla:

Variante "deslizada". Excepto el zigzag, todos los indicadores están incorporados. El zigzag con el trabajo correcto con la historia. Las lecturas de los indicadores son convergentes entre sí. No se corresponden con los precios.

Después de la actualización.

Versión MT5

Archivos adjuntos:
 

Por la tarde.

Me he encontrado con una cosa incomprensible y no entiendo qué es.

Hay dos funciones que se utilizan en diferentes estrategias. Lógicamente, el código en comprobaciones como

if(m_position.PositionType()==POSITION_TYPE_SELL  && m_position.Magic()==magic)

No debe ejecutarse si una de las condiciones es incorrecta. Pero por alguna razón se ejecuta si el número mágico y el número mágico pasado a la función NO SON IGUALES.

Parece que se trata de una comparación de tipo entero. No puedo entender por qué. Puedes verlo en la siguiente captura de pantalla.


void OpenNextBuyPositionBySignal(CTrade &m_trade,long magic,double ExtDP,double iuv,double imv,int itp,int isl,double etp,double esl,double ev,double &rev,string numstr,ulong &last_pt)
{
   for(int i=PositionsTotal()-1;i>=0;i--)
     if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
       if(m_position.Symbol()==m_symbol.Name())
       {
          if(m_position.PositionType()==POSITION_TYPE_SELL  && m_position.Magic()==magic)
          {
             if((m_position.Profit()+m_position.Swap()+m_position.Commission())<0)
             {
                if(IsSetBuy(magic,ExtDP)==true)
                {
                    double cdist=MathFloor(MathAbs((m_position.PriceOpen()-m_position.PriceCurrent())/ExtDP));
                    Print("#1122 cdist ",numstr,": ",cdist);
                    Print("#2211! m_position.PriceOpen(): ",m_position.PriceOpen());
                    Print("#2212! m_position.PriceCurrent(): ",m_position.PriceCurrent());
                    Print("#2213! ExtDP: ",ExtDP);
                    Print("#2214! magic: ",magic);
                    Print("#2215! ev: ",ev);
                    Print("#2216! iuv: ",iuv);
                    Print("#2217! m_position.Volume(): ",m_position.Volume());
                    Print("#2218! m_position.Magic(): ",m_position.Magic());
                    
                   
                    if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)<=imv)
                       ev=NormalizeDouble(m_position.Volume()+iuv*cdist,2);
                     if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)>imv)
                        ev=NormalizeDouble(imv,2);
                     rev=ev;
                     double sl=0.0;
                     double tp=0.0;
                     if(itp>0) tp=m_symbol.Ask()+etp;
                     if(isl>0) sl=m_symbol.Bid()-esl;
                     //m_trade.SetExpertMagicNumber(magic);
                     if(OpenBuy(m_trade,ev,sl,tp,numstr))
                     {
                        last_pt=POSITION_TYPE_BUY;
                        FileWrite(filehandle,numstr+", ",TimeCurrent(),", ",GetLastPositionsType(magic),", ",GetPositionTicket(magic,POSITION_TYPE_BUY)); 
                        Print("#516! Position BUY after down SELL "+numstr);                                 
                        //Sleep(3000);
                        continue;
                     }
                  }
               }
            }
            if(m_position.PositionType()==POSITION_TYPE_BUY  && m_position.Magic()==magic)
            {
               if((m_position.Profit()+m_position.Swap()+m_position.Commission())<0)
               {
                  if(IsSetBuy(magic,ExtDP)==true)
                  {
                     double cdist=MathFloor(MathAbs((m_position.PriceOpen()-m_position.PriceCurrent())/ExtDP));
                     Print("#1123 cdist ", numstr," : ",cdist);
                     Print("#3211! m_position.PriceOpen(): ",m_position.PriceOpen());
                     Print("#3212! m_position.PriceCurrent(): ",m_position.PriceCurrent());
                     Print("#3213! ExtDP: ",ExtDP);
                     Print("#3214! magic: ",magic);
                     Print("#3215! ev: ",ev);
                     Print("#3216! iuv: ",iuv);
                     Print("#3217! m_position.Volume(): ",m_position.Volume());
                     Print("#3218! m_position.Magic(): ",m_position.Magic());
                    
                     if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)<=imv)
                        ev=NormalizeDouble(m_position.Volume()+iuv*cdist,2);
                     if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)>imv)
                        ev=NormalizeDouble(imv,2); 
                     rev=ev;                          
                     double sl=0.0;
                     double tp=0.0;
                     if(itp>0) tp=m_symbol.Ask()+etp;
                     if(isl>0) sl=m_symbol.Bid()-esl;
                     //m_trade.SetExpertMagicNumber(magic);
                     if(OpenBuy(m_trade,ev,sl,tp,numstr))
                     {
                        last_pt=POSITION_TYPE_BUY;
                        FileWrite(filehandle,numstr+", ",TimeCurrent(),", ",GetLastPositionsType(magic),", ",GetPositionTicket(magic,POSITION_TYPE_BUY)); 
                        Print("#517! Position BUY After down BUY "+numstr);                                 
                        //Sleep(3000);
                        continue;
                     }
                  }
               } 
            }
         }
}


void OpenNextSellPositionBySignal(CTrade &m_trade,long magic,double ExtDP,double iuv,double imv,int itp,int isl,double etp,double esl,double ev,double &rev,string numstr,ulong &last_pt)
{
   for(int i=PositionsTotal()-1;i>=0;i--)
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if(m_position.Symbol()==m_symbol.Name())
         {
            if(m_position.PositionType()==POSITION_TYPE_BUY  && m_position.Magic()==magic)
            {
               if((m_position.Profit()+m_position.Swap()+m_position.Commission())<0)
               {
                  if(IsSetSell(magic,ExtDP)==true)
                  {
                     double cdist=MathFloor(MathAbs((m_position.PriceCurrent()-m_position.PriceOpen())/ExtDP));
                     Print("#1124 cdist ", numstr," : ",cdist);
                     Print("#4211! m_position.PriceOpen(): ",m_position.PriceOpen());
                     Print("#4212! m_position.PriceCurrent(): ",m_position.PriceCurrent());
                     Print("#4213! ExtDP: ",ExtDP);
                     Print("#4214! magic: ",magic);
                     Print("#4215! ev: ",ev);
                     Print("#4216! iuv: ",iuv);
                     Print("#4217! m_position.Volume(): ",m_position.Volume());
                     Print("#4218! m_position.Magic(): ",m_position.Magic());
                   
                     if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)<=imv)
                        ev=NormalizeDouble(m_position.Volume()+iuv*cdist,2);
                     if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)>imv)
                        ev=NormalizeDouble(imv,2);
                     rev=ev;
                     double sl=0.0;
                     double tp=0.0;
                     if(itp>0) tp=m_symbol.Bid()-etp;
                     if(isl>0) sl=m_symbol.Ask()+esl;
                     //m_trade.SetExpertMagicNumber(magic);
                     if(OpenSell(m_trade,ev,sl,tp,numstr))
                     {
                        last_pt=POSITION_TYPE_SELL;
                        FileWrite(filehandle,numstr+", ",TimeCurrent(),", ",GetLastPositionsType(magic),", ",GetPositionTicket(magic,POSITION_TYPE_SELL)); 
                        Print("#518! Position SELL After down BUY "+numstr);                             
                        //Sleep(3000);
                        continue;
                      }
                   }
                }
             }
             if(m_position.PositionType()==POSITION_TYPE_SELL  && m_position.Magic()==magic)
             {
                if((m_position.Profit()+m_position.Swap()+m_position.Commission())<0)
                {
                   if(IsSetSell(magic,ExtDP)==true)
                   {
                      double cdist=MathFloor(MathAbs((m_position.PriceCurrent()-m_position.PriceOpen())/ExtDP));
                      Print("#1125 cdist ", numstr," : ",cdist);
                      Print("#5211! m_position.PriceOpen(): ",m_position.PriceOpen());
                      Print("#5212! m_position.PriceCurrent(): ",m_position.PriceCurrent());
                      Print("#5213! ExtDP: ",ExtDP);
                      Print("#5214! magic: ",magic);
                      Print("#5215! ev: ",ev);
                      Print("#5216! iuv: ",iuv);
                      Print("#5217! m_position.Volume(): ",m_position.Volume());
                      Print("#5218! m_position.Magic(): ",m_position.Magic());
                    
                      if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)<=imv)
                         ev=NormalizeDouble(m_position.Volume()+iuv*cdist,2);
                      if(NormalizeDouble(m_position.Volume()+iuv*cdist,2)>imv)
                         ev=NormalizeDouble(imv,2); 
                      rev=ev;                             
                      double sl=0.0;
                      double tp=0.0;
                      if(itp>0) tp=m_symbol.Bid()-etp;
                      if(isl>0) sl=m_symbol.Ask()+esl;
                      //m_trade.SetExpertMagicNumber(magic);
                      if(OpenSell(m_trade,ev,sl,tp,numstr))
                      {
                        last_pt=POSITION_TYPE_SELL;
                        FileWrite(filehandle,numstr+", ",TimeCurrent(),", ",GetLastPositionsType(magic),", ",GetPositionTicket(magic,POSITION_TYPE_SELL)); 
                        Print("#519! Position SELL After down SELL "+numstr);                                 
                        //Sleep(3000);
                        continue;
                      }
                   }
                }
             }
          }
}


revista
Заранее спасибо за ответ.