Ayuda a la codificación - página 489

 

No importa, ahora veo que tengo que quitar la línea else AlarmTotal = AlarmTotal+1;

 

Necesito ayuda para añadir texto a mi indicador

Escribí un indicador personalizado que encuentra los máximos y mínimos del swing.

Actualmente pone un objeto flecha que apunta al nivel de precio y a la barra de tiempo. Verde para los altos y rojo para los bajos.

Me gustaría cambiarlo por un texto que muestre una variable de recuento.

Aquí está una parte del código que he creado pero no muestra el texto.

Alguien puede mostrarme qué es lo que está mal. Gracias.

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);
 
ThemBonez:
Escribí un indicador personalizado que encuentra los máximos y mínimos del swing.

Actualmente pone un objeto flecha que señala el nivel de precio y la barra de tiempo. Verde para el Alto y Rojo para el Bajo.

Me gustaría cambiarlo por un texto que muestre una variable de conteo.

Aquí está una parte del código que he creado pero no muestra el texto.

Alguien puede mostrarme lo que está mal. Gracias.

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

Intente cambiar

ObjectSet("Texto",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

a

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

 

Gracias, pero no ha servido de nada. No hay etiquetas de texto.

Aquí está el código completo, tal vez eso ayudaría.

//+------------------------------------------------------------------+

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

//+------------------------------------------------------------------+

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

//+------------------------------------------------------------------+

//| Find Hi and Lo Bars |

//+------------------------------------------------------------------+

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingHi+20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

//+------------------------------------------------------------------+

 
ThemBonez:
Gracias, pero no ayudó. No hay etiquetas de texto.

Aquí está el código completo, tal vez eso ayude.

//+------------------------------------------------------------------+

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

//+------------------------------------------------------------------+

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

//+------------------------------------------------------------------+

//| Find Hi and Lo Bars |

//+------------------------------------------------------------------+

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingHi+20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

//+------------------------------------------------------------------+

Estaba allí, pero sólo uno (en el pasado)

Utilice este :

//+------------------------------------------------------------------+

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

//+------------------------------------------------------------------+

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

//+------------------------------------------------------------------+

//| Find Hi and Lo Bars |

//+------------------------------------------------------------------+

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text"+Time,OBJ_TEXT,0,0,0);

ObjectSet("Text"+Time,OBJPROP_TIME1,Time);

ObjectSet("Text"+Time,OBJPROP_PRICE1,SwingHi+20*_Point);

ObjectSetString(0,"Text"+Time,OBJPROP_TEXT,SwingCount);

ObjectSet("Text"+Time,OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text"+Time,OBJ_TEXT,0,0,0);

ObjectSet("Text"+Time,OBJPROP_TIME1,Time);

ObjectSet("Text"+Time,OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text"+Time,OBJPROP_TEXT,SwingCount);

ObjectSet("Text"+Time,OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

//+------------------------------------------------------------------+
 

Estimado mladen, mrtools esperando ansiosamente su respuesta para mis consultas sobre el cambio de la configuración del indicador en el post anterior.

espero que me responda cuando el tiempo se lo permita.

Gracias.

 
brijeshsinh:
Hola,

puede mladen, mrtools ayudarme a añadir los siguientes ajustes para el indicador--- Rsi bar chart v2.02 mtf & alerts

--pueden las barras ser coloreadas de forma diferente cuando cruzan por encima o por debajo de la línea media (nivel 50 para la perspectiva rsi); --por ejemplo, por encima de la línea 50 un color y por debajo del nivel 50 un color diferente.

--puede añadirse la media móvil en el indicador en una ventana separada, como podemos añadir la media móvil para el gráfico principal (como se ve en la imagen de abajo).

Adjuntando aquí el indicador y la imagen.

rsi_bar_chart_v2.02_mtf_amp_alerts.mq4

gracias de antemano, su ayuda será muy apreciada.

Ese indicador tiene 4 valores (se combina de 4 valores rsi diferentes). Eso excluye el cruce - ya que no hay un valor que puede ser utilizado como un criterio para cruzar algún valor

En cuanto a la media - lo mismo que para los cruces : ya que hay 4 valores rsi la media no tiene un valor único para ser aplicado

 

gracias mladen por responder y encontrar tiempo para mí. te agradezco tu ayuda.

 

Hola,

mladen, mr tools puede por favor ayudar a cambiar los siguientes ajustes en el indicador FXUltraTrend publicado abajo a

--- mostrar en una ventana separada como línea, (o histograma) con flechas para mostrar el cambio de color si es posible (por defecto en la configuración actual pinta barras en el gráfico principal)

---- y si es posible añadir una columna para diferentes configuraciones, de manera que se pueda cambiar según nuestro deseo. (en el modo actual por defecto no tiene ninguna columna para añadir ajustes)

adjuntando el siguiente indicador y su imagen para usted

fxultratrend.mq4

Espero que no me moleste por tomar un poco de tiempo de usted, pero ustedes están haciendo un gran trabajo para alguien como nosotros que son nuevos en esta plataforma y sin saber de programación.

realmente merecen el aprecio de mi parte y de todos los miembros de este foro por sus valiosos esfuerzos.

gracias por la rapida respuesta al mensaje anterior.

Archivos adjuntos:
444.png  56 kb
 

Implementar; Indicador NonLag_Schaff_TrendCycle:

Hola Pro-Coders,

Me pregunto si alguien podría ayudarme a implementar el indicador NonLag_Schaff_TrendCycle.

Externas del indicador:

extern int FastLength = 23;

extern int SlowLength = 50;

extern int StcPeriod = 10;

extern int MacdPrice = PRICE_CLOSE;

extern bool Interpolate = true

extern bool MultiColor = true;

Buffer de Indicadores:

IndicatorBuffers(8);

SetIndexBuffer(0,stcBuffer);

SetIndexBuffer(1,stcBufferUA);

SetIndexBuffer(2,stcBufferUB);

SetIndexBuffer(3,macdBuffer);

SetIndexBuffer(4,fastKBuffer);

SetIndexBuffer(5,fastDBuffer);

SetIndexBuffer(6,fastKKBuffer);

SetIndexBuffer(7,trend);

Intento hacer algo como

double STC1_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar);

double STC2_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar+1);

if((STC1_c>15 && STC2_c85 && STC2_c BUY

if((STC1_c15)||(STC1_c85) -> VENDER

Pero me sale un mensaje de error

Error: NonLag_Schaff_TrendCycle ha sido eliminado.

Supongo que puedo leer mal los buffers. ¿Alguien tiene alguna sugerencia?

Gracias de antemano.

Razón de la queja: