Ayuda a la codificación - página 326

 

Alerta de cambio de dirección

Hola,

En un EA que compra, por ejemplo si MA10>MA20 (y vende en sentido contrario), ¿como puedo escribir una alerta si compra y MA10<MA20 ( y en sentido contrario)?

Gracias.

Jo

 
Jovager:
Hola,

En un EA que compra, por ejemplo, si MA10>MA20 (y vende en sentido contrario), ¿cómo puedo escribir una alerta si compra y MA10<MA20 (y en sentido contrario)?

Gracias.

Jo

Prueba así :

if (MA10previousMA20) para la primera condición

if (MA10previous>MA20previous && MA10<MA20) para la segunda condición

 
mladen:
¿Está probando las alertas en una prueba retrospectiva? Si es así, esa es la causa: las alertas no funcionan en la prueba retrospectiva

Gracias. Solían hacerlo, como en la Build 509.

 
Big Be:
Gracias. Antes sí, como en la Build 509.

:):)

Antes funcionaban muchas cosas que ahora ya no funcionan en este "nuevo metatrader". Prueba con multi time frame en visual back test y tendrás un "divertimento" para el fin de semana

 
mladen:
Me resulta familiar Comprobaré si ya existe

Alguna suerte en esto Sr. Mladen ...

¿Fue capaz de encontrarlo?

Gracias

 
mladen:
:):):) Muchas cosas solían funcionar que ahora ya no funcionan en este "nuevo metatrader". Pruebe el marco de tiempo múltiple en la prueba visual de espalda y usted tendrá una "diversión" para el fin de semana

Hola Mladen

Veo que usted es uno de esos programadores útiles, así que podría preguntar si es posible hacer un EA del indicador añadido. ¡Este no se repinta y da unas señales asombrosamente buenas!

Archivos adjuntos:
 

Hola Chicos, pls ayudar a mirar este código, lo que se puede hacer para que sea de alerta y mostrar las flechas en la vela actual.

Gracias de antemano

// B83A886A5C437CCD9AC15473FD6F1788

void f0_2(cadena As_0) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) SendMail(WindowExpertName(), As_0);

}

// A8CFDE6331BD59EB2AC96F8911C4B666

void f0_1(string A_name_0, string A_text_8, string A_fontname_16, int A_fontsize_24, color A_color_28, int A_y_32, int A_x_36, int A_corner_40, int A_bool_44) {

ObjectCreate(A_nombre_0, OBJ_LABEL, 0, 0, 0);

ObjectSetText(A_name_0, A_text_8, A_fontsize_24, A_fontname_16, A_color_28);

ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_40);

ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_36);

ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_32);

ObjectSet(A_name_0, OBJPROP_BACK, A_bool_44);

}

// 085FEA7ABDC5D904FE69A3081EFD7398

void f0_0(cadena As_0, int GetBar) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) {

if (sound) PlaySound("News.wav");

if (alert) Alert("Nueva señal " + As_0+ " @ Symbol: "+Símbolo()+" & Periodo: M "+Period()+" & Time: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS));

if (email) f0_2("Nueva señal " + As_0+ " @ Symbol: "+Símbolo()+" & Periodo: M "+Period()+" & Time: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS));

}

}

// BE8F80182E0C983916DA7338C2C1C040

int f0_3(cadena A_nombre_0, cadena A_nombre_8) {

if (ObjectFind(A_name_0) == -1) return (0);

if (ObjectFind(A_name_8) == -1) return (0);

if (ObjectGet(A_name_0, OBJPROP_XDISTANCE) > ObjectGet(A_name_8, OBJPROP_XDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_XDISTANCE) < ObjectGet(A_name_8, OBJPROP_XDISTANCE) +

10.0) {

if (ObjectGet(A_name_0, OBJPROP_YDISTANCE) > ObjectGet(A_name_8, OBJPROP_YDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_YDISTANCE) < ObjectGet(A_name_8, OBJPROP_YDISTANCE) +

10.0) return (1);

}

return (0);

}

// E4DB2306E8CC4DEB5830201DE61935CA

double f0_4() {

double Ld_ret_0 = 0;

for (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {

if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES) == TRUE)

if (OrderSymbol() == Symbol()) Ld_ret_0 += OrderProfit();

}

return (Ld_ret_0);

}

// EA2B2676C28C0DB26D39331A336C6B92

int inicio() {

cadena Ls_0;

double iatr_20;

double Ld_28

double Ld_36;

int TimeBar=0;

if (f0_3("x", "r4") == 1) {

alert = FALSE;

ObjectDelete("r2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "t4") == 1) {

sound = FALSE;

ObjectDelete("t2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "u4") == 1) {

email = FALSE;

ObjectDelete("u2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "r3") == 1) {

alert = TRUE;

f0_1("r2", "þ", "Wingdings", 14, Red, 55, 65, 1, FALSE);

f0_1("x", "G", "Wingdings", 25, Rosa, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "t3") == 1) {

sonido = TRUE;

f0_1("t2", "þ", "Wingdings", 14, Red, 80, 65, 1, FALSE);

f0_1("x", "G", "Wingdings", 25, Rosa, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "u3") == 1) {

correo electrónico = TRUE;

f0_1("u2", "þ", "Wingdings", 14, Red, 105, 65, 1, FALSE);

f0_1("x", "G", "Wingdings", 25, Rosa, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

for (int index_8 = 0; index_8 < 100; index_8++) {

si (G_ibuf_108 < 1000.0) {

TimeBar=Time;

Ls_0 = "BUY";

romper;

}

if (G_ibuf_112 < 1000.0) {

TimeBar=Time;

Ls_0 = "VENDER";

break;

}

}

if (Ls_0 == "BUY" && ObjectDescription("Signal1") != "BUY") {

f0_0("COMPRA",TimeBar);

f0_1("Señal1", "COMPRA", "Wingdings 3", 30, Blanco, 80, 32, 1, FALSE);

}

if (Ls_0 == "SELL" && ObjectDescription("Signal1") != "SELL") {

f0_0("VENTA",TimeBar);

f0_1("Señal1", "VENTA", "Wingdings 3", 30, Blanco, 80, 25, 1, FALSE);

}

f0_1("r1", "Profit", "Arial", 10, Lime, 50, 80, 1, FALSE);

f0_1("Pr", DoubleToStr(f0_4(), 0), "Arial", 13, Amarillo, 50, 35, 1, FALSE);

if (Time[0] == G_time_192) return (0);

G_time_192 = Tiempo[0];

int Li_12 = Bares - IndicadorContado();

if (IndicatorCounted() > 0) Li_12++;

for (int bars_16 = Bars; bars_16 > 0; bars_16--) {

if (bars_16 <= HistoriBar) {

iatr_20 = iATR(NULL, 0, 100, 0);

Ld_28 = Close - iATR(NULL, 0, PeriodIndikator, bars_16) * Factor;

Ld_36 = Cierre + iATR(NULL, 0, PeriodIndikator, bars_16) * Factor;

si (Ld_28 > Gd_156 && Gi_180 == 1) Gd_156 = Ld_28;

si (Ld_36 < Gd_148 && Gi_180 == 2) Gd_148 = Ld_36;

si (Gd_156 != 0,0 && Gi_180 == 1) Gd_unused_124 = Gd_156;

if (Gd_148 != 1000.0 && Gi_180 == 2) Gd_unused_132 = Gd_148;

si (Close < Gd_156 && Gi_180 == 1) {

Gi_180 = 2;

si (bars_16 < HistoriBar / 2.0) G_ibuf_112 = High + iatr_20;

Gd_156 = 0;

}

if (Close > Gd_148 && Gi_180 == 2) {

Gi_180 = 1;

if (bars_16 < HistoriBar / 2.0) G_ibuf_108 = Low - iatr_20;

Gd_148 = 1000;

}

}

}

return (0);

}

// 52D46093050F38C27267BCE42543EF60

int deinit() {

 
wolfsch:
Hola Mladen veo que eres uno de esos programadores útiles así que podría preguntar si posiblemente podrías hacer un EA con el indicador añadido. ¡Este no se repinta y da unas señales asombrosamente buenas!

wolfsch

Debo decepcionarte pero ese indicador está usando el indicador T3 clean and snake. Ahora, T3 no repinta. Pero "snake" es tma centrado y recalcula lo que hace que ese indicador sea de tipo recalculante (repintado)

PD: ese es en realidad un indicador renombrado "T3 TMA combination" que luego fue renombrado a indicador "uni cross". Más información sobre él se puede encontrar aquí : https://www.mql5.com/en/forum/general

 
emmany4:
Hola Chicos, pls ayuda a mirar este código, lo que se puede hacer para hacer que la alerta y mostrar las flechas en la vela actual.

Gracias de antemano

// B83A886A5C437CCD9AC15473FD6F1788

void f0_2(cadena As_0) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) SendMail(WindowExpertName(), As_0);

}

// A8CFDE6331BD59EB2AC96F8911C4B666

void f0_1(string A_name_0, string A_text_8, string A_fontname_16, int A_fontsize_24, color A_color_28, int A_y_32, int A_x_36, int A_corner_40, int A_bool_44) {

ObjectCreate(A_nombre_0, OBJ_LABEL, 0, 0, 0);

ObjectSetText(A_name_0, A_text_8, A_fontsize_24, A_fontname_16, A_color_28);

ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_40);

ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_36);

ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_32);

ObjectSet(A_name_0, OBJPROP_BACK, A_bool_44);

}

// 085FEA7ABDC5D904FE69A3081EFD7398

void f0_0(cadena As_0, int GetBar) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) {

if (sound) PlaySound("News.wav");

if (alert) Alert("Nueva señal " + As_0+ " @ Symbol: "+Símbolo()+" & Periodo: M "+Period()+" & Time: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS));

if (email) f0_2("Nueva señal " + As_0+ " @ Symbol: "+Símbolo()+" & Periodo: M "+Period()+" & Time: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS));

}

}

// BE8F80182E0C983916DA7338C2C1C040

int f0_3(cadena A_nombre_0, cadena A_nombre_8) {

if (ObjectFind(A_name_0) == -1) return (0);

if (ObjectFind(A_name_8) == -1) return (0);

if (ObjectGet(A_name_0, OBJPROP_XDISTANCE) > ObjectGet(A_name_8, OBJPROP_XDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_XDISTANCE) < ObjectGet(A_name_8, OBJPROP_XDISTANCE) +

10.0) {

if (ObjectGet(A_name_0, OBJPROP_YDISTANCE) > ObjectGet(A_name_8, OBJPROP_YDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_YDISTANCE) < ObjectGet(A_name_8, OBJPROP_YDISTANCE) +

10.0) return (1);

}

return (0);

}

// E4DB2306E8CC4DEB5830201DE61935CA

double f0_4() {

double Ld_ret_0 = 0;

for (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {

if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES) == TRUE)

if (OrderSymbol() == Symbol()) Ld_ret_0 += OrderProfit();

}

return (Ld_ret_0);

}

// EA2B2676C28C0DB26D39331A336C6B92

int inicio() {

cadena Ls_0;

double iatr_20;

double Ld_28

double Ld_36;

int TimeBar=0;

if (f0_3("x", "r4") == 1) {

alert = FALSE;

ObjectDelete("r2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "t4") == 1) {

sound = FALSE;

ObjectDelete("t2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "u4") == 1) {

email = FALSE;

ObjectDelete("u2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "r3") == 1) {

alert = TRUE;

f0_1("r2", "þ", "Wingdings", 14, Red, 55, 65, 1, FALSE);

f0_1("x", "G", "Wingdings", 25, Rosa, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "t3") == 1) {

sonido = TRUE;

f0_1("t2", "þ", "Wingdings", 14, Red, 80, 65, 1, FALSE);

f0_1("x", "G", "Wingdings", 25, Rosa, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

if (f0_3("x", "u3") == 1) {

correo electrónico = TRUE;

f0_1("u2", "þ", "Wingdings", 14, Red, 105, 65, 1, FALSE);

f0_1("x", "G", "Wingdings", 25, Rosa, 160, 55, 1, FALSE);

Reproducir sonido("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

for (int index_8 = 0; index_8 < 100; index_8++) {

si (G_ibuf_108 < 1000.0) {

TimeBar=Time;

Ls_0 = "BUY";

romper;

}

if (G_ibuf_112 < 1000.0) {

TimeBar=Time;

Ls_0 = "VENDER";

break;

}

}

if (Ls_0 == "BUY" && ObjectDescription("Signal1") != "BUY") {

f0_0("COMPRA",TimeBar);

f0_1("Señal1", "COMPRA", "Wingdings 3", 30, Blanco, 80, 32, 1, FALSE);

}

if (Ls_0 == "SELL" && ObjectDescription("Signal1") != "SELL") {

f0_0("VENTA",TimeBar);

f0_1("Señal1", "VENTA", "Wingdings 3", 30, Blanco, 80, 25, 1, FALSE);

}

f0_1("r1", "Profit", "Arial", 10, Lime, 50, 80, 1, FALSE);

f0_1("Pr", DoubleToStr(f0_4(), 0), "Arial", 13, Amarillo, 50, 35, 1, FALSE);

if (Time[0] == G_time_192) return (0);

G_time_192 = Tiempo[0];

int Li_12 = Bares - IndicadorContado();

if (IndicatorCounted() > 0) Li_12++;

for (int bars_16 = Bars; bars_16 > 0; bars_16--) {

if (bars_16 <= HistoriBar) {

iatr_20 = iATR(NULL, 0, 100, 0);

Ld_28 = Close - iATR(NULL, 0, PeriodIndikator, bars_16) * Factor;

Ld_36 = Cierre + iATR(NULL, 0, PeriodIndikator, bars_16) * Factor;

si (Ld_28 > Gd_156 && Gi_180 == 1) Gd_156 = Ld_28;

si (Ld_36 < Gd_148 && Gi_180 == 2) Gd_148 = Ld_36;

si (Gd_156 != 0,0 && Gi_180 == 1) Gd_unused_124 = Gd_156;

if (Gd_148 != 1000.0 && Gi_180 == 2) Gd_unused_132 = Gd_148;

si (Close < Gd_156 && Gi_180 == 1) {

Gi_180 = 2;

si (bars_16 < HistoriBar / 2.0) G_ibuf_112 = High + iatr_20;

Gd_156 = 0;

}

if (Close > Gd_148 && Gi_180 == 2) {

Gi_180 = 1;

if (bars_16 < HistoriBar / 2.0) G_ibuf_108 = Low - iatr_20;

Gd_148 = 1000;

}

}

}

return (0);

}

// 52D46093050F38C27267BCE42543EF60

int deinit() {

Hola Emmany4, si encuentras el código original de ese EA probablemente podrías añadir o arreglar las flechas y las alertas de compra y venta, pero esa versión está descompilada.

 
mrtools:
Hola Emmany4, si encuentras el código original de ese EA probablemente podrías añadir o arreglar las flechas y las alertas de compra y venta, pero esa versión está descompilada.

Por lo que veo eso es un código descompilado incompleto de alguna variación de supertendencia (la que usa atr, no la versión cci). Nada más. De todas formas, ese código tal y como está, no puede funcionar (faltan grandes partes del mismo)

Razón de la queja: