PDA

Ver la versión completa : Foro Forex 2 programador que me ayude



Rilexley
11:50,
Coincido, debes crear una variable booleana a la que asignes el valor 0 antes de dar la alerta y y asignarle valor 1 después de que la envíe para evitar que te mande continuamente la señal al mail.

De todos modos he probado el indicador y me da un error de Array out of range en la línea 65, ¿has mirado en la pestaña de Experts a ver si te da el mismo error? Quizás no esté funcionando bien.

Saludos,

alexleyv
12:03,
hola, tu problema es que el indicador esta controlando en cada tick, y si la señal sigue siendo sell volvera a enviarte un mail. lo que debes hacer es colocar una bandera (una variable del tipo bool) que le cambies el valor al mismo tiempo que envies el mail. y luego le cambies el valor cuando las condiciones dejen de ser sell.

PD: no lo lei mucho al codigo porque los nombres de las variables son un travalenguas y no lo copie al editor de mt4 para que quede mas ordenado, pero me da la impresion que la hubicacion donde pusiste el envio de mail no es correcta.

Qalkyr
12:17,
Solo agregé esto: SendMail("[Signal Alert]", " [ " + Symbol() + " ] " + DoubleToStr(Bid, Digits) + " Open Sell");

Pero me envía un correo cada segundo y yo quisiera que solo mandara uno cada vez que aparezca una flecha

Código:


#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 MediumBlue
#property indicator_color3 Red
#property indicator_color4 MediumBlue
#property indicator_color5 Blue
#property indicator_color6 Red

extern int MaMetod = 3;
extern int MaPeriod = 20;
double g84[];
double g88[];
double g92[];
double g96[];
double g100[];
double g104[];
int g108 = 0;

int init() {
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 1, Red);
SetIndexBuffer(0, g84);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 1, MediumBlue);
SetIndexBuffer(1, g88);
SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2, Red);
SetIndexBuffer(2, g92);
SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 2, MediumBlue);
SetIndexBuffer(3, g96);
SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, 3);
SetIndexBuffer(4, g100);
SetIndexArrow(4, 233);
SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 3);
SetIndexBuffer(5, g104);
SetIndexArrow(5, 234);
SetIndexDrawBegin(0, 5);
SetIndexBuffer(0, g84);
SetIndexBuffer(1, g88);
SetIndexBuffer(2, g92);
SetIndexBuffer(3, g96);
return (0);
}

int deinit() {
return (0);
}

int start() {
double l_ima_0;
double l_ima_8;
double l_ima_16;
double l_ima_24;
double ld_32;
double ld_40;
double ld_48;
double ld_56;
if (Bars <= 10) return (0);
g108 = IndicatorCounted();
if (g108 < 0) return (-1);
if (g108 > 0) g108--;
for (int li_80 = Bars - g108 - 1; li_80 >= 0; li_80--) {
l_ima_0 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_CLOSE, li_80);
l_ima_8 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_LOW, li_80);
l_ima_16 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_OPEN, li_80);
l_ima_24 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_HIGH, li_80);
ld_32 = (g92[li_80 + 1] + (g96[li_80 + 1])) / 2.0;
ld_56 = (l_ima_0 + l_ima_24 + l_ima_16 + l_ima_8) / 4.0;
ld_40 = MathMax(l_ima_24, MathMax(ld_32, ld_56));
ld_48 = MathMin(l_ima_16, MathMin(ld_32, ld_56));
if (ld_32 < ld_56) {
g84[li_80] = ld_48;
if (g84[li_80] < g88[li_80] && g84[li_80 + 1] < g88[li_80 + 1] && g84[li_80 + 2] > g88[li_80 + 2] && g84[li_80 + 3] > g88[li_80 +
3]) g100[li_80] = ld_48 - 10.0 * Point;
g88[li_80] = ld_40;
} else {
g84[li_80] = ld_40;
g88[li_80] = ld_48;
if (g84[li_80] > g88[li_80] && g84[li_80 + 1] > g88[li_80 + 1] && g84[li_80 + 2] < g88[li_80 + 2] && g84[li_80 + 3] < g88[li_80 +
3]) g104[li_80] = ld_48 + 10.0 * Point;
}
g92[li_80] = ld_32;
g96[li_80] = ld_56;


SendMail("[Signal Alert]", " [ " + Symbol() + " ] " + DoubleToStr(Bid, Digits) + " Open Sell");

}
return (0);
}

LLopanuy
12:30,
Hola, ¿puedes subir el código que has modificado para ver dónde puede estar el error con el SendMail? Gracias.

Saludos,

Qalkyr
12:43,
Hola de nuevo, soy yo otra vez. mira, sigo necesitando un programador que me ayude. Quiero que cada vez que se dibuje una flecha, me envíe un correo.
Ya he intentado con la función SendMail pero me envía correos cada tick. Por favor ayúdame.

código:

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Red

#property indicator_color2 MediumBlue

#property indicator_color3 Red

#property indicator_color4 MediumBlue

#property indicator_color5 Blue

#property indicator_color6 Red




extern int MaMetod = 3;

extern int MaPeriod = 20;

double g_ibuf_84[];

double g_ibuf_88[];

double g_ibuf_92[];

double g_ibuf_96[];

double g_ibuf_100[];

double g_ibuf_104[];

int gi_108 = 0;




int init() {

SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 1, Red);

SetIndexBuffer(0, g_ibuf_84);

SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 1, MediumBlue);

SetIndexBuffer(1, g_ibuf_88);

SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2, Red);

SetIndexBuffer(2, g_ibuf_92);

SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 2, MediumBlue);

SetIndexBuffer(3, g_ibuf_96);

SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, 3);

SetIndexBuffer(4, g_ibuf_100);

SetIndexArrow(4, 233);

SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 3);

SetIndexBuffer(5, g_ibuf_104);

SetIndexArrow(5, 234);

SetIndexDrawBegin(0, 5);

SetIndexBuffer(0, g_ibuf_84);

SetIndexBuffer(1, g_ibuf_88);

SetIndexBuffer(2, g_ibuf_92);

SetIndexBuffer(3, g_ibuf_96);

return (0);

}




int deinit() {

return (0);

}




int start() {

double l_ima_0;

double l_ima_8;

double l_ima_16;

double l_ima_24;

double ld_32;

double ld_40;

double ld_48;

double ld_56;

if (Bars <= 10) return (0);

gi_108 = IndicatorCounted();

if (gi_108 < 0) return (-1);

if (gi_108 > 0) gi_108--;

for (int li_80 = Bars - gi_108 - 1; li_80 >= 0; li_80--) {

l_ima_0 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_CLOSE, li_80);

l_ima_8 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_LOW, li_80);

l_ima_16 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_OPEN, li_80);

l_ima_24 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_HIGH, li_80);

ld_32 = (g_ibuf_92[li_80 + 1] + (g_ibuf_96[li_80 + 1])) / 2.0;

ld_56 = (l_ima_0 + l_ima_24 + l_ima_16 + l_ima_8) / 4.0;

ld_40 = MathMax(l_ima_24, MathMax(ld_32, ld_56));

ld_48 = MathMin(l_ima_16, MathMin(ld_32, ld_56));

if (ld_32 < ld_56) {

g_ibuf_84[li_80] = ld_48;

if (g_ibuf_84[li_80] < g_ibuf_88[li_80] && g_ibuf_84[li_80 + 1] < g_ibuf_88[li_80 + 1] && g_ibuf_84[li_80 + 2] > g_ibuf_88[li_80 + 2] && g_ibuf_84[li_80 + 3] > g_ibuf_88[li_80 +

3]) g_ibuf_100[li_80] = ld_48 - 10.0 * Point;

g_ibuf_88[li_80] = ld_40;

} else {

g_ibuf_84[li_80] = ld_40;

g_ibuf_88[li_80] = ld_48;

if (g_ibuf_84[li_80] > g_ibuf_88[li_80] && g_ibuf_84[li_80 + 1] > g_ibuf_88[li_80 + 1] && g_ibuf_84[li_80 + 2] < g_ibuf_88[li_80 + 2] && g_ibuf_84[li_80 + 3] < g_ibuf_88[li_80 +

3]) g_ibuf_104[li_80] = ld_48 + 10.0 * Point;

}

g_ibuf_92[li_80] = ld_32;

g_ibuf_96[li_80] = ld_56;

}

return (0);

}