Bibliotecas: MT4Orders - página 37

 

Estoy trabajando en las peculiaridades de la conversión de indicadores para la autoeducación. Aquí hay tres indicadores más.

#define  MT4_TICKET_TYPE // Obligar a OrderSend y OrderTicket a devolver un valor del mismo tipo que en MT4 - int.
#include <KimIVToMT5.mqh> // https://c.mql5.com/3/263/KimIVToMT5.mqh

#define  MT4_OLD_EVENT_HANDLERS
#include "ind4to5.mqh" // https://c.mql5.com/3/277/ind4to5.mqh

bool ObjectSetText( const string name, const string text,
                    const int font_size = 0, const string font_name = NULL, const color Color = clrNONE )
{
  return(ObjectSetString(0, name, OBJPROP_TEXT, text) &&
         ((font_name == NULL) || ObjectSetInteger(0, name, OBJPROP_FONTSIZE, font_size)) &&
         ((font_name == NULL) || ObjectSetString(0, name, OBJPROP_FONT, font_name)) &&
         ((Color == clrNONE) || ObjectSetInteger(0, name, OBJPROP_COLOR, Color)));
}

int WindowFind( const string ) { return(ChartWindowFind()); }
int Digits( void ) { return(_Digits); }
string StringTrimRight2( string Str ) { StringTrimRight(Str); return(Str); }
string StringTrimLeft2( string Str )  { StringTrimLeft(Str); return(Str); }
string ObjectDescription( const string name ) { return(ObjectGetString(0, name, OBJPROP_TEXT)); }

#define CORNER_LEFT_LOWER  2
#define CORNER_LEFT_UPPER  0
#define CORNER_RIGHT_LOWER 3
#define CORNER_RIGHT_UPPER 1
#define  CORNER(A) ((A) ? ((A) + 1) % 3 + 1 : 0)

bool ObjectSet2( const string name, const ENUM_OBJECT_PROPERTY_INTEGER property, const long value )
{
  return((property != OBJPROP_CORNER) ? ObjectSetInteger(0, name, property, value)
                                      : ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER(value)) && 
                                        ObjectSetInteger(0, name, OBJPROP_ANCHOR, CORNER(value) << 1));
}

bool ObjectSet2( const string name, const ENUM_OBJECT_PROPERTY_DOUBLE property, const double value )
{  
  return(ObjectSetDouble(0, name, property, value));
}

#undef  CORNER

template <typename T>
bool ObjectCreate2(const string name, const T type, const int subwindow, const datetime time1, const double price1,
                                                                        const datetime time2 = NULL, const double price2 = NULL)
{
  return(ObjectCreate(0, name, (ENUM_OBJECT)type, subwindow, time1, price1, time2, price2));
};

template <typename T>
bool ObjectCreate2(const long chart_id, const string name, const T type, const int subwindow,
                   const datetime time1, const double price1, const datetime time2 = NULL, const double price2 = NULL)
{
  return(ObjectCreate(chart_id, name, (ENUM_OBJECT)type, subwindow, time1, price1, time2, price2));
};

#define  TRUE  true
#define  FALSE false

#define StringTrimRight   StringTrimRight2
#define StringTrimLeft    StringTrimLeft2
#define  ObjectSet ObjectSet2
#define ObjectCreate ObjectCreate2
#define StringConcatenate StringConcatenate2

string StringConcatenate2( const string Str1, const int Str2 ) { return(Str1 + (string)Str2); }
string StringConcatenate2( const double Str1, const string Str2, const string Str3 ) { return((string)Str1 + Str2 + Str3); }
string StringConcatenate2( const string Str1, const string Str2, const string Str3 = "", 
                           const string Str4 = "", const string Str5 = "", const string Str6 = "", const string Str7 = "" )
{
  return(Str1 + Str2 + Str3 + Str4 + Str5 + Str6 + Str7);
}

string StringConcatenate2( const string Str1, const int Str2, const string Str3, 
                           const string Str4, const string Str5, const double Str6,
                           const string Str7,  const string Str8, const string Str9, const double Str10 )
{
  return(Str1 + (string)Str2 + Str3 + Str4 + Str5 + (string)Str6 + Str7 + Str8 + Str9 + (string)Str10);  
}

string StringConcatenate2( const string Str1, const int Str2, const string Str3, 
                           const string Str4, const string Str5, const double Str6,
                           const string Str7,  const string Str8, const string Str9,
                           const double Str10,  const string Str11, const double Str12 )
{
  return(Str1 + (string)Str2 + Str3 + Str4 + Str5 + (string)Str6 + Str7 + Str8 + Str9 + (string)Str10 + Str11 + (string)Str12);  
}

string StringConcatenate2( const string Str1, const int Str2, const string Str3, 
                           const double Str4, const string Str5, const double Str6 )
{
  return(Str1 + (string)Str2 + Str3 + (string)Str4 + Str5 + (string)Str6);
}

string StringConcatenate2( const string Str1, const double Str2, const string Str3, const string Str4 )
{
  return(Str1 + (string)Str2 + Str3 + Str4);  
}
   
string StringConcatenate2( const string Str1, const string Str2, const int Str3 )  { return(Str1 + Str2 + (string)Str3); }
   

#property indicator_buffers 0
#property indicator_plots 0

#define  Symb  SymbTmp
#define NULL  ""

#property indicator_separate_window
#include "TradeInfo.mq4" // https://github.com/icefx/tradeinfo/blob/master/TradeInfo.mq4

// #propiedad indicator_chart_window
// #include "ProfitInfo.mq4" // https://github.com/icefx/profitinfo/blob/master/ProfitInfo.mq4

// #propiedad indicator_chart_window
// #include "IceFX.DrawProfit.mq4" // https://github.com/icefx/drawprofit/blob/master/IceFX.DrawProfit.mq4

Como de costumbre, el código original de MT4 no fue tocado.

Usted puede ver claramente en el código fuente lo que los autores utilizan StringConcatenate en sus códigos. ¡Es simplemente estúpido!

 

TO: fxsaber

Gracias amable hombre. Mucho trabajo por hacer. Me quito el sombrero ante usted.

Los dos últimos indicadores (ProfitInfo, IceFX.DrawProfit) realmente lanzó 44 errores. Algo falta. Pero no importa.

Lo importante es que ahora usted puede traducir rápidamente sus desarrollos, si es necesario, en MKL5.

Suerte

PD: ¿Quizá sea el momento de trasladar tu trabajo a GitHub?
Archivos adjuntos:
Err.zip  229 kb
 
Vladimir Perervenko:

Los dos últimos indicadores (ProfitInfo, IceFX.DrawProfit) realmente arrojaron 44 errores. Algo falta.

Lo más probable es que accidentalmente dejaron un carácter extra en alguna parte.

PS: ¿Tal vez es hora de mover sus obras a GitHub?

No sé cómo hacerlo. ¿Y por qué mover algo de un recurso perfilado?

 
Vladimir Perervenko:
PD: ¿Quizá ha llegado el momento de trasladar tu trabajo a GitHub?

Llevo mucho tiempo sugiriéndolo. Incluso inicié un repositorio y empecé a actualizarlo periódicamente, pero luego lo dejé.


fxsaber:

¿Y por qué deberías mover algo de un recurso perfilado?

1. Es conveniente hacer un seguimiento de las actualizaciones (todas las ediciones en una lista, resaltado en fuentes, ...). Especialmente importante, dados los problemas con el archivo de todos los ficheros en kodobase (¿bicho aún no solucionado?).

2. Cambiar a cualquier versión con un solo clic (en el terminal de trabajo).

3. Sincronización en un nuevo PC en un par de clics.

4. ...

5. Libertad frente a la gestión autocrática local. Es habitual borrar un comentario, un código, un artículo o una cuenta. Y prohibir la entrada a los disidentes es un procedimiento habitual (no se lo voy a decir yo).


Por ejemplo, los desarrollos getch-a y hrenfx son ahora difíciles de encontrar, y algunos de ellos son imposibles de encontrar en absoluto. ¿Qué pasará mañana con fxsaber? ;)

 
fxsaber:


Desde la fuente se puede ver claramente que autores utilizan StringConcatenate en sus códigos. ¡Es una estupidez!

¿Cuál es la forma correcta?

Si se sustituye por "+" - se convierte. Si hay dos parámetros en StringConcatenate() - se convierte, si más - fuera.

 
Vladimir Perervenko:

¿Cuál es el camino correcto?

Str = Str1 + Str2 + Str3 + ....;
 
Andrey Khatimlianskii:

Lo he estado sugiriendo durante un tiempo. Incluso comenzó un repo y comenzó a actualizar periódicamente, pero luego lo corrió.


1. Es conveniente para realizar un seguimiento de las actualizaciones (todas las ediciones en una lista, destacando en las fuentes, ...). 2. Especialmente importante, dados los problemas con el archivo de todos los ficheros en kodobase (¿fallo aún no solucionado?).

2. Cambiar a cualquier versión con un solo clic (en el terminal de trabajo).

3. Sincronización en un nuevo PC en un par de clics.

4. ...

5. Libertad frente a la arrogancia local de la dirección. Borrar un comentario, un código, un artículo o una cuenta es habitual. Y prohibir la entrada a los disidentes es un procedimiento habitual (no se lo voy a decir yo).

Gracias por la lista de argumentos. Intentaré investigar el tema.

 
fxsaber:

Gracias por la lista de argumentos. Intentaré investigar el tema.

Hubo una discusión aquí en el foro.
BitBucket + codificación utf8 + SourceTree para sincronización = repositorio listo
 
Andrey Khatimlianskii:
Hubo una discusión aquí en el foro.
BitBucket + codificación utf8 + SourceTree para la sincronización = repositorio listo.

Y más o menos hasta 5 personas pueden tener derechos de edición al mismo tiempo.

 
Stanislav Korotky:

Y es como si hasta 5 personas pudieran tener derechos de edición al mismo tiempo.

Eso es redundante. Envíen una propuesta (¿si las hay?) al autor y si las acepta, que lo haga el comité. Es el proyecto del autor.