Página 1 de 1

Añadir alerta a indicador Trading View

Publicado: 10 Sep 2022 01:15
por Tryez
Buenas a todos, os pediría la gente que sabe programar en Pine. si me podéis ayudar a ponerle la opción a este indicador de que cuando pinte un bloque de velas de una alerta para no tener que estar pendiente a la pantalla todo el día y así llegaría al móvil también. Adjunto el código. Gracias de antemano :D

//@version=2
study("C Bunny G",overlay=true)

isHigherHigh() => high>high[1] and high[1]>high[2] and close>close[1] and close[1]>close[2] and close>open and close[1]>open[1] and close[2]>open[2] and low>open[1] and low[1]>open[2] and (open+low)<(open+close)

barcolor(isHigherHigh()? blue :na)
barcolor(isHigherHigh()? blue :na, -1)
barcolor((isHigherHigh() and close>open)? blue :na, -2)


isLowerLow() => low<low[1] and low[1]<low[2] and close<close[1] and close[1]<close[2] and close<open and close[1]<open[1] and close[2]<open[2] and high<open[1] and high[1]<open[2]

barcolor(isLowerLow()? red :na)
barcolor(isLowerLow()? red :na, -1)
barcolor((isLowerLow() and close<open)? red :na, -2)

Re: Añadir alerta a indicador Trading View

Publicado: 10 Sep 2022 13:41
por Tryez
He intentado hacerlo yo, me gustaria saber si esta bien echo así:


study("C Bunny G",overlay=true)

isHigherHigh() => high>high[1] and high[1]>high[2] and close>close[1] and close[1]>close[2] and close>open and close[1]>open[1] and close[2]>open[2] and low>open[1] and low[1]>open[2] and (open+low)<(open+close)

barcolor(isHigherHigh()? blue :na)
barcolor(isHigherHigh()? blue :na, -1)
barcolor((isHigherHigh() and close>open)? blue :na, -2)


isLowerLow() => low<low[1] and low[1]<low[2] and close<close[1] and close[1]<close[2] and close<open and close[1]<open[1] and close[2]<open[2] and high<open[1] and high[1]<open[2]

barcolor(isLowerLow()? red :na)
barcolor(isLowerLow()? red :na, -1)
barcolor((isLowerLow() and close<open)? red :na, -2)

//Alerta insertada

alertcondition(high>high[1] and high[1]>high[2] and close>close[1] and close[1]>close[2] and close>open and close[1]>open[1] and close[2]>open[2] and low>open[1] and low[1]>open[2] and (open+low)<(open+close),'Alert Buy','Opción de Compra')
alertcondition(low<low[1] and low[1]<low[2] and close<close[1] and close[1]<close[2] and close<open and close[1]<open[1] and close[2]<open[2] and high<open[1] and high[1]<open[2],'Alert Sell','Opción de Venta')

Re: Añadir alerta a indicador Trading View

Publicado: 12 Sep 2022 00:33
por gu5tavo71
Hola

El código es viejo (v2), y debe actualizarse a la última versión v5
Hay dos funciones: f_isHigherHigh() y f_isLowerLow()
Las alertas deben apuntar a estas funciones

Código: Seleccionar todo

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gu5tavo71 (Gustavo Cardelle)

//@version=5
indicator('C Bunny G', overlay = true)

// Project name: 'C Bunny G'
// Original Indicator: Unknow
// Actual Study Version: @gu5tavo71 for Tryez (@Tryez for X-Trade)
// v1.1.6, 2022.09.11
// Project #738
// This script reuses open source code from another authors:
// @PineCoders, Built-in Library, and Community Scripts
// Disclaimer: I am not a financial advisor.
//             For purpose educate only. Use at your own risk.


// ——————————— <function_declarations> {
f_isHigherHigh() =>
  high     > high[1]  and high[1]    > high[2]  and
  close    > close[1] and close[1]   > close[2] and
  close    > open     and close[1]   > open[1]  and
  close[2] > open[2]  and low        > open[1]  and
  low[1]   > open[2]  and
  open + low < open + close
f_isLowerLow() =>
  low      < low[1]   and low[1]     < low[2]   and
  close    < close[1] and close[1]   < close[2] and
  close    < open     and close[1]   < open[1]  and
  close[2] < open[2]  and
  high < open[1] and high[1] < open[2]

//}
// ——————————— <plots> {
barcolor(f_isHigherHigh()                  ? color.new(color.blue,  0) : na)
barcolor(f_isHigherHigh()                  ? color.new(color.blue,  0) : na, -1)
barcolor(f_isHigherHigh() and close > open ? color.new(color.blue,  0) : na, -2)
barcolor(f_isLowerLow()                    ? color.new(color.white, 0) : na)
barcolor(f_isLowerLow()                    ? color.new(color.white, 0) : na, -1)
barcolor(f_isLowerLow()   and close < open ? color.new(color.white, 0) : na, -2)
//}
// ——————————— <alerts> {
alertcondition(
  f_isHigherHigh() or f_isLowerLow(),
  title      = "Any Alert",
  message    = "Any Alert")
alertcondition(
  f_isHigherHigh(),
  title      = "Long Alert",
  message    = "Long Alert")
alertcondition(
  f_isLowerLow(),
  title      = "Short Alert",
  message    = "Short Alert")
//}//}

Re: Añadir alerta a indicador Trading View

Publicado: 12 Sep 2022 10:55
por Tryez
gu5tavo71 escribió: 12 Sep 2022 00:33 Hola

El código es viejo (v2), y debe actualizarse a la última versión v5
Hay dos funciones: f_isHigherHigh() y f_isLowerLow()
Las alertas deben apuntar a estas funciones

Código: Seleccionar todo

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gu5tavo71 (Gustavo Cardelle)

//@version=5
indicator('C Bunny G', overlay = true)

// Project name: 'C Bunny G'
// Original Indicator: Unknow
// Actual Study Version: @gu5tavo71 for Tryez (@Tryez for X-Trade)
// v1.1.6, 2022.09.11
// Project #738
// This script reuses open source code from another authors:
// @PineCoders, Built-in Library, and Community Scripts
// Disclaimer: I am not a financial advisor.
//             For purpose educate only. Use at your own risk.


// ——————————— <function_declarations> {
f_isHigherHigh() =>
  high     > high[1]  and high[1]    > high[2]  and
  close    > close[1] and close[1]   > close[2] and
  close    > open     and close[1]   > open[1]  and
  close[2] > open[2]  and low        > open[1]  and
  low[1]   > open[2]  and
  open + low < open + close
f_isLowerLow() =>
  low      < low[1]   and low[1]     < low[2]   and
  close    < close[1] and close[1]   < close[2] and
  close    < open     and close[1]   < open[1]  and
  close[2] < open[2]  and
  high < open[1] and high[1] < open[2]

//}
// ——————————— <plots> {
barcolor(f_isHigherHigh()                  ? color.new(color.blue,  0) : na)
barcolor(f_isHigherHigh()                  ? color.new(color.blue,  0) : na, -1)
barcolor(f_isHigherHigh() and close > open ? color.new(color.blue,  0) : na, -2)
barcolor(f_isLowerLow()                    ? color.new(color.white, 0) : na)
barcolor(f_isLowerLow()                    ? color.new(color.white, 0) : na, -1)
barcolor(f_isLowerLow()   and close < open ? color.new(color.white, 0) : na, -2)
//}
// ——————————— <alerts> {
alertcondition(
  f_isHigherHigh() or f_isLowerLow(),
  title      = "Any Alert",
  message    = "Any Alert")
alertcondition(
  f_isHigherHigh(),
  title      = "Long Alert",
  message    = "Long Alert")
alertcondition(
  f_isLowerLow(),
  title      = "Short Alert",
  message    = "Short Alert")
//}//}

Muchisimas Gracias, y sabrías si hay algun sitio donde traducirlo para crear el indicador tambien en MT4?

Re: Añadir alerta a indicador Trading View

Publicado: 12 Sep 2022 17:30
por gu5tavo71
No hay una manera de convertir Pinescript en MQL5. Al menos no de forma automática.
Debes contratar a un programador freelancer.
Soy nuevo en el foro y no conozco a nadie de por acá, pero veo que hay varios programadores.
Quizás alguien pueda ayudarte.

Re: Añadir alerta a indicador Trading View

Publicado: 12 Sep 2022 19:22
por Foréxitos
Hola Tryez, me ofrezco a programarte en mt4 el indicador sin fines de lucro. saludos.

Re: Añadir alerta a indicador Trading View

Publicado: 12 Sep 2022 23:00
por Tryez
Foréxitos escribió: 12 Sep 2022 19:22 Hola Tryez, me ofrezco a programarte en mt4 el indicador sin fines de lucro. saludos.
Buenas Foréxitos, me ayudaría bastante a poder seguir haciendo backtesting, te lo agradecería mucho de corazón!

Re: Añadir alerta a indicador Trading View

Publicado: 13 Sep 2022 16:59
por Foréxitos
sin problemas... cuando quieras hacemos un zoom y lo empezamos. nos mantenemos en contacto. según tengo entendido para escribirnos por acá por MP necesitas completar tus primeros 5 mensajes. saludos.

Re: Añadir alerta a indicador Trading View

Publicado: 13 Sep 2022 18:13
por X-Trader
Foréxitos escribió: 13 Sep 2022 16:59 sin problemas... cuando quieras hacemos un zoom y lo empezamos. nos mantenemos en contacto. según tengo entendido para escribirnos por acá por MP necesitas completar tus primeros 5 mensajes. saludos.
Le habilito el tema para que podáis hablaros por MP ;).


Saludos,
X-Trader

Re: Añadir alerta a indicador Trading View

Publicado: 13 Sep 2022 18:32
por Foréxitos
estas en todas Alberto! .... Saludos

Re: Añadir alerta a indicador Trading View

Publicado: 13 Sep 2022 21:27
por Foréxitos
Hecho...descarga el Tryez_v0.00, copialo, vas a File => Open Data Folder => MQL4 => Indicators y lo pegas ahí y cerras el MT4. Después tenes que bajarte mt4 para Móvil desde play store, una vez instalada la plataforma en tu teléfono vas a las tres rallitas => ajustes y en la parte de mensajes => MetaQuotes ID copias el código alfanumérico.
luego vas a tu CPU abrís el MT4, entras a Herramientas => Opciones => pestaña Notificaciones => click en notificaciones Push y abajo pegas el código alfanumérico, le das a aceptar y desde el Navigator (ctrl+N) arrastras el indicador hasta el chart con el activo que quieras operar. Listo! cada vez que se cumpla la condición del indicador te va a llegar una notificación a tu teléfono. Saludos.

Re: Añadir alerta a indicador Trading View

Publicado: 14 Sep 2022 19:43
por X-Trader
¡Eres grande Foréxitos! ¡¡¡Gracias por aportar tanto a esta comunidad!!!


Saludos,
X-Trader

Re: Añadir alerta a indicador Trading View

Publicado: 14 Sep 2022 23:50
por Foréxitos
No por favor!.... es un placer, de verdad. Quisiera que haya mas como Tryez... no tengo ningún problema en aportar mi granito de arena. saludos.

Re: Añadir alerta a indicador Trading View

Publicado: 15 Sep 2022 21:39
por Foréxitos
Hola Tryez, ahí va la segunda versión que te pinta las velas. Le agregue parámetros: si queres sacar el comentario por si molesta; también le podes cambiar el tamaño de las velas pintadas si te gusta ver mas grandes los gráficos o mas chicos y por supuesto el color de las velas alcistas y las bajistas; también si queres activar o desactivar las notificaciones Push; y por ultimo y los mas importante es que el indicador repinta (mucho cuidado con esto a la hora de hacer backtest), así que te agregue una opción si queres que te repinte como lo viste siempre o que no repinte. saludos y espero que te guste.