AGREGAR NOTIFICACION PUSH EN INDICADOR

Responder
Dibene
Mensajes: 15
Registrado: 02 Abr 2020 03:55

AGREGAR NOTIFICACION PUSH EN INDICADOR

Mensaje por Dibene »

Buenas noches acudo a ustedes esperando me puedan ayudar con el siguiente indicador , debo aclarar que no tengo conocimientos de programación, antes este solo pintaba la flecha blanca que se ve en la imagen, le moví un poco y ya me manda la alerta sonora y la pantalla con el mensaje de alerta, pero me gustaría que metatrader me mandara la notificación a la App de android, como hace con otros indicadores que tengo; Saludos y espero me puedan echar una mano, Gracias
Adjuntos
RSI 3TF ALERT INDICADOR.mq4
(12.08 KiB) Descargado 122 veces
Avatar de Usuario
X-Trader
Administrador
Mensajes: 12781
Registrado: 06 Sep 2004 10:18
Contactar:

Re: AGREGAR NOTIFICACION PUSH EN INDICADOR

Mensaje por X-Trader »

Hola Dibene, bienvenido al Foro. En este artículo explico la manera de hacerlo:

https://www.x-trader.net/articulos/soft ... n-mt4.html

Saludos,
X-Trader
"Los sistemas de trading pueden funcionar en ciertas condiciones de mercado todo el tiempo, en todas las condiciones de mercado en algún momento del tiempo, pero nunca en todas las condiciones de mercado todo el tiempo."
Dibene
Mensajes: 15
Registrado: 02 Abr 2020 03:55

Re: AGREGAR NOTIFICACION PUSH EN INDICADOR

Mensaje por Dibene »

Muchas gracias por tu pronta respuesta X-trader, he estado intentando la opción que me diste , pero no logre tener los mejores resultado, el código del indicador se me hace complejo y ante mi falta de experiencia creo no supe ordenarlo bien, me llegaba la alerta y el mensaje al celular pero con una especie de rebote un mensaje tras otro , ademas al escribir SendNotification("RSI-3TF_ALERT ", Symbol(), " M", Period()); me daba este error 'SendNotification' - wrong parameters count
Por lo cual opte por solo escribir solo texto en los parentesis SendNotification("RSI-3TF_ALERT ", "Largo") o SendNotification("RSI-3TF_ALERT ", "Corto")

Me he tomado la libertad de compartirte el código, he quitado lo que yo había escrito para no enredarte con mis errores, espero te puedas tomar el tiempo de echarle un ojo y ver si me pueden ayudar con una solución ; desde ya muchas gracias por sus comentarios, Saludos


#property copyright ""
#property link ""

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 100.0
#property indicator_levelcolor DarkGray
#property indicator_levelwidth 0
#property indicator_buffers 8
#property indicator_color1 Fuchsia
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 White
#property indicator_color6 White
#property indicator_color7 GreenYellow
#property indicator_color8 Yellow
#property indicator_level1 93.0
#property indicator_level2 7.0
#property indicator_level3 50.0

extern string RSI_INPUT_1 = "=== RSI A ===";
extern int RSI_Period_1 = 2;
extern int RSI_Period_2 = 2;
extern int RSI_Period_3 = 2;
extern string RSI_INPUT_2 = "=== RSI B ===";
extern int RSI_Period_B1 = 2;
extern int RSI_Period_B2 = 2;
extern int RSI_Period_B3 = 2;
extern int TF1 = 0;
extern int TF2 = 0;
extern int TF3 = 0;
bool Gi_unused_128 = TRUE;
bool Gi_unused_132 = TRUE;
bool Gi_unused_136 = TRUE;
extern int LineSize1 = 1;
extern int LineSize2 = 1;
extern int LineSize3 = 2;
extern int LineSize4 = 1;
extern int DotSizeRSI = 1;
extern int DotSizeARROW = 1;
extern int DotSizeZERO = 1;
extern int DotSizeRSI5 = 4;
extern int NumberOfBars = 500;
extern bool AlertOn = TRUE;
extern bool AlertHighProbabilityOnly = FALSE;
extern bool alertsMessage = true; // Alerts should display alert message?
extern bool alertsSound = true; // Alerts should play alert sound?
extern bool alertNotification = true; // Alerts should send alert notification?
extern bool alertsEmail = false; // Alerts should send alert email?
extern string soundFile = "alert2.wav"; //"stops.wav" //"alert2.wav" //"expert.wav";

double Gd_176;
double Gd_184;
double Gd_192;
double Gd_200;
double Gd_208;
double Gd_216;
double Gd_224;
double Gd_232;
double Gd_240;
double Gd_248;
double Gd_256;
double Gd_264;
double Gd_272;
double Gd_280;
double Gd_288;
double Gd_296;
double G_ibuf_304[];
double G_ibuf_308[];
double G_ibuf_312[];
double G_ibuf_316[];
double G_ibuf_320[];
double G_ibuf_324[];
double G_ibuf_328[];
double G_ibuf_332[];
int Gi_336 = 0;
datetime G_dtPrevSignal;

void init() {
string Ls_unused_0;
string Ls_unused_12;
string Ls_unused_24;
string Ls_unused_36;
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, LineSize1);
SetIndexBuffer(0, G_ibuf_304);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, LineSize2);
SetIndexBuffer(1, G_ibuf_308);
SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, LineSize3);
SetIndexBuffer(2, G_ibuf_312);
SetIndexStyle(3, DRAW_ARROW, STYLE_SOLID, DotSizeRSI);
SetIndexArrow(3, 159);
SetIndexBuffer(3, G_ibuf_316);
SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, DotSizeARROW);
SetIndexArrow(4, 233);
SetIndexBuffer(4, G_ibuf_320);
SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, DotSizeARROW);
SetIndexArrow(5, 234);
SetIndexBuffer(5, G_ibuf_324);
SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, DotSizeZERO);
SetIndexArrow(6, 159);
SetIndexBuffer(6, G_ibuf_328);
SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, DotSizeRSI5);
SetIndexArrow(7, 159);
SetIndexBuffer(7, G_ibuf_332);
Gd_224 = 0;
Gd_232 = 0;
Gd_288 = 0;
Gd_296 = 0;
switch (TF1) {
case 1:
Ls_unused_12 = "Period_M1";
break;
case 5:
Ls_unused_12 = "Period_M5";
break;
case 15:
Ls_unused_12 = "Period_M15";
break;
case 30:
Ls_unused_12 = "Period_M30";
break;
case 60:
Ls_unused_12 = "Period_H1";
break;
case 240:
Ls_unused_12 = "Period_H4";
break;
case 1440:
Ls_unused_12 = "Period_D1";
break;
case 10080:
Ls_unused_12 = "Period_W1";
break;
case 43200:
Ls_unused_12 = "Period_MN1";
break;
default:
Ls_unused_12 = "Current Timeframe";
SetStepTF1_Up();
}
switch (TF2) {
case 1:
Ls_unused_24 = "Period_M1";
break;
case 5:
Ls_unused_24 = "Period_M5";
break;
case 15:
Ls_unused_24 = "Period_M15";
break;
case 30:
Ls_unused_24 = "Period_M30";
break;
case 60:
Ls_unused_24 = "Period_H1";
break;
case 240:
Ls_unused_24 = "Period_H4";
break;
case 1440:
Ls_unused_24 = "Period_D1";
break;
case 10080:
Ls_unused_24 = "Period_W1";
break;
case 43200:
Ls_unused_24 = "Period_MN1";
break;
default:
Ls_unused_24 = "Current Timeframe";
SetStepTF2_Up();
}
switch (TF3) {
case 1:
Ls_unused_36 = "Period_M1";
break;
case 5:
Ls_unused_36 = "Period_M5";
break;
case 15:
Ls_unused_36 = "Period_M15";
break;
case 30:
Ls_unused_36 = "Period_M30";
break;
case 60:
Ls_unused_36 = "Period_H1";
break;
case 240:
Ls_unused_36 = "Period_H4";
break;
case 1440:
Ls_unused_36 = "Period_D1";
break;
case 10080:
Ls_unused_36 = "Period_W1";
break;
case 43200:
Ls_unused_36 = "Period_MN1";
break;
default:
Ls_unused_36 = "Current Timeframe";
SetStepTF3_Up();
}
string Ls_44 = "RSI-3TF_ALERT";
string Ls_52 = Ls_44;
Ls_52 = Ls_52 + " (" + TF1;
Ls_52 = Ls_52 + ", " + TF2;
Ls_52 = Ls_52 + ", " + TF3;
Ls_52 = Ls_52 + ")";
Ls_52 = Ls_52 + "(";
Ls_52 = Ls_52 + " " + DoubleToStr(RSI_Period_1, 0);
Ls_52 = Ls_52 + ", " + DoubleToStr(RSI_Period_2, 0);
Ls_52 = Ls_52 + ", " + DoubleToStr(RSI_Period_3, 0);
Ls_52 = Ls_52 + ") ";
IndicatorShortName(Ls_52);
}

void start() {
int Li_4;
int L_shift_12;
int L_shift_16;
int L_shift_20;
double L_irsi_24;
double L_irsi_32;
double L_irsi_40;
int Li_0 = Bars - NumberOfBars;
string sHiLo;

if (NumberOfBars == 0) Li_4 = Bars - 1;
else Li_4 = NumberOfBars - 1;
for (int Li_8 = Li_4; Li_8 >= 0; Li_8--) {
L_shift_20 = iBarShift(NULL, TF1, Time[Li_8], FALSE);
L_shift_12 = iBarShift(NULL, TF2, Time[Li_8], FALSE);
L_shift_16 = iBarShift(NULL, TF3, Time[Li_8], FALSE);
G_ibuf_304[Li_8] = iRSI(NULL, TF1, RSI_Period_1, PRICE_CLOSE, L_shift_20);
G_ibuf_308[Li_8] = iRSI(NULL, TF2, RSI_Period_2, PRICE_CLOSE, L_shift_12);
G_ibuf_312[Li_8] = iRSI(NULL, TF3, RSI_Period_3, PRICE_CLOSE, L_shift_16);
G_ibuf_316[Li_8] = iRSI(NULL, TF3, RSI_Period_3, PRICE_CLOSE, L_shift_16);
if (G_ibuf_304[Li_8] > 50.0) Gd_176 = 1;
else Gd_176 = 0;
if (G_ibuf_308[Li_8] > 50.0) Gd_184 = 1;
else Gd_184 = 0;
if (G_ibuf_312[Li_8] > 50.0) Gd_192 = 1;
else Gd_192 = 0;
if (Gd_224 == 0.0 && Gi_336 != Time[Li_8] && Gd_176 + Gd_184 + Gd_192 == 3.0) {
G_ibuf_320[Li_8] = 30;
Gd_224 = 1;
Gd_232 = 0;
if (AlertOn && Li_8 == 0 && G_dtPrevSignal != Time[Li_8])
{
if (G_ibuf_316[Li_8] > 50)
sHiLo = "ALTA PROB";
else
sHiLo = "BAJA PROB";

G_dtPrevSignal = Time[Li_8];
if (!AlertHighProbabilityOnly || G_ibuf_316[Li_8] > 50)
{
Alert("RSI-3TF_ALERT ", Symbol(), " M", Period()," Signal LARGO ", sHiLo);
}
}
}
if (G_ibuf_304[Li_8] < 50.0) Gd_200 = 1;
else Gd_200 = 0;
if (G_ibuf_308[Li_8] < 50.0) Gd_208 = 1;
else Gd_208 = 0;
if (G_ibuf_312[Li_8] < 50.0) Gd_216 = 1;
else Gd_216 = 0;
if (Gd_232 == 0.0 && Gi_336 != Time[Li_8] && Gd_200 + Gd_208 + Gd_216 == 3.0) {
G_ibuf_324[Li_8] = 70;
Gd_224 = 0;
Gd_232 = 1;
if (AlertOn && Li_8 == 0 && G_dtPrevSignal != Time[Li_8])
{
if (G_ibuf_316[Li_8] < 50)
sHiLo = "ALTA PROB";
else
sHiLo = "BAJA PROB";

G_dtPrevSignal = Time[Li_8];
if (!AlertHighProbabilityOnly || G_ibuf_316[Li_8] < 50)
{
Alert("RSI-3TF_ALERT ", Symbol(), " M", Period()," Signal CORTO ", sHiLo);
}
}
}

if (Gd_224 == 1.0 && Gd_176 + Gd_184 + Gd_192 != 3.0) {
Gd_224 = 0;
Gd_232 = 0;
}
if (Gd_232 == 1.0 && Gd_200 + Gd_208 + Gd_216 != 3.0) {
Gd_224 = 0;
Gd_232 = 0;
}
if (G_ibuf_304[Li_8] > 50.0 && G_ibuf_304[Li_8 + 1] < 50.0) G_ibuf_328[Li_8] = 50;
if (G_ibuf_308[Li_8] > 50.0 && G_ibuf_308[Li_8 + 1] < 50.0) G_ibuf_328[Li_8] = 50;
if (G_ibuf_312[Li_8] > 50.0 && G_ibuf_312[Li_8 + 1] < 50.0) G_ibuf_328[Li_8] = 50;
if (G_ibuf_304[Li_8] < 50.0 && G_ibuf_304[Li_8 + 1] > 50.0) G_ibuf_328[Li_8] = 50;
if (G_ibuf_308[Li_8] < 50.0 && G_ibuf_308[Li_8 + 1] > 50.0) G_ibuf_328[Li_8] = 50;
if (G_ibuf_312[Li_8] < 50.0 && G_ibuf_312[Li_8 + 1] > 50.0) G_ibuf_328[Li_8] = 50;
L_irsi_24 = iRSI(NULL, TF1, RSI_Period_B1, PRICE_CLOSE, L_shift_20);
L_irsi_32 = iRSI(NULL, TF2, RSI_Period_B2, PRICE_CLOSE, L_shift_12);
L_irsi_40 = iRSI(NULL, TF3, RSI_Period_B3, PRICE_CLOSE, L_shift_16);
if (L_irsi_24 > 50.0) Gd_240 = 1;
else Gd_240 = 0;
if (L_irsi_32 > 50.0) Gd_248 = 1;
else Gd_248 = 0;
if (L_irsi_40 > 50.0) Gd_256 = 1;
else Gd_256 = 0;
if (Gd_288 == 0.0 && Gd_240 + Gd_248 + Gd_256 == 3.0) {
G_ibuf_332[Li_8] = 95;
Gd_288 = 1;
Gd_296 = 0;
}
if (G_ibuf_304[Li_8] < 50.0) Gd_264 = 1;
else Gd_264 = 0;
if (G_ibuf_308[Li_8] < 50.0) Gd_272 = 1;
else Gd_272 = 0;
if (G_ibuf_312[Li_8] < 50.0) Gd_280 = 1;
else Gd_280 = 0;
if (Gd_296 == 0.0 && Gd_264 + Gd_272 + Gd_280 == 3.0) {
G_ibuf_332[Li_8] = 95;
Gd_288 = 0;
Gd_296 = 1;
}
if (Gd_288 == 1.0 && Gd_240 + Gd_248 + Gd_256 != 3.0) {
Gd_288 = 0;
Gd_296 = 0;
}
if (Gd_296 == 1.0 && Gd_264 + Gd_272 + Gd_280 != 3.0) {
Gd_288 = 0;
Gd_296 = 0;
}
}
}

void SetValues(int Ai_0) {
TF1 = Ai_0;
}

void SetStepTF1_Up() {
switch (Period()) {
case PERIOD_M1:
SetValues(30);
return;
case PERIOD_M5:
SetValues(60);
return;
case PERIOD_M15:
SetValues(240);
return;
case PERIOD_M30:
SetValues(1440);
return;
case PERIOD_H1:
SetValues(10080);
return;
case PERIOD_H4:
SetValues(43200);
return;
case PERIOD_D1:
SetValues(43200);
return;
case PERIOD_W1:
SetValues(43200);
return;
case PERIOD_MN1:
SetValues(43200);
return;
return;
}
}

void SetValues2(int Ai_0) {
TF2 = Ai_0;
}

void SetStepTF2_Up() {
switch (Period()) {
case PERIOD_M1:
SetValues2(15);
return;
case PERIOD_M5:
SetValues2(30);
return;
case PERIOD_M15:
SetValues2(60);
return;
case PERIOD_M30:
SetValues2(240);
return;
case PERIOD_H1:
SetValues2(1440);
return;
case PERIOD_H4:
SetValues2(10080);
return;
case PERIOD_D1:
SetValues2(43200);
return;
case PERIOD_W1:
SetValues2(43200);
return;
case PERIOD_MN1:
SetValues2(43200);
return;
return;
}
}

void SetValues3(int Ai_0) {
TF3 = Ai_0;
}

void SetStepTF3_Up() {
switch (Period()) {
case PERIOD_M1:
SetValues3(5);
return;
case PERIOD_M5:
SetValues3(15);
return;
case PERIOD_M15:
SetValues3(30);
return;
case PERIOD_M30:
SetValues3(60);
return;
case PERIOD_H1:
SetValues3(240);
return;
case PERIOD_H4:
SetValues3(1440);
return;
case PERIOD_D1:
SetValues3(10080);
return;
case PERIOD_W1:
SetValues3(43200);
return;
case PERIOD_MN1:
SetValues3(43200);
return;
}
Avatar de Usuario
MF1Forex
Mensajes: 70
Registrado: 24 May 2018 06:18

Re: AGREGAR NOTIFICACION PUSH EN INDICADOR

Mensaje por MF1Forex »

A ver... pruebalo así, a ver si te funciona bien.
Saludos.
Adjuntos
RSI 3TF PUSH INDICADOR.mq4
(12.16 KiB) Descargado 108 veces
Imagen
Imagen
Dibene
Mensajes: 15
Registrado: 02 Abr 2020 03:55

Re: AGREGAR NOTIFICACION PUSH EN INDICADOR

Mensaje por Dibene »

Muchas gracias, hace mucho no me conectaba y apenas vi tu mensaje, si asi funciona muy bien mejor que lo que yo había intentado, que fue sustituir el "if (AlertOn " - por- "if (Alertnotification ; con eso apenas logre lo mas básico que era que me llegara el msj al móvil, de nuevo muchas gracias
Si te ha gustado este hilo del Foro, ¡compártelo en redes!


Responder

Volver a “Indicadores”