Respuesta

Visualización de texto en un gráfico

4 respuestas

Paul

Suscriptor, bbp_participant, comunidad, 7 respuestas.

Visitar el perfil

hace 10 años #111323

Aquí hay algo de código para mostrar hasta 6 líneas de texto en un gráfico que es muy útil para la visualización de las variables cuando las pruebas en vivo EAs.

Copie y pegue las líneas ObjectCreate y las líneas ObjectSetText correspondientes en el campo Command de Custom Action.
Por ejemplo, si sólo necesita 2 líneas de texto, copie y pegue ObjectCreate("Line1" y 2, y ObjectSetText("Line1 y 2, resultando en 4 comandos de Acción Personalizada.

 

Personalice los siguientes datos en las líneas ObjectSetText:
Mi etiqueta" es una etiqueta de texto para los datos que desea mostrar.
mi variable' es la variable cuyos datos desea visualizar.
Asegúrate de dejar la sintaxis del resto de las líneas exactamente como se muestra.

 

La captura de pantalla adjunta debería aclarar las cosas.

 

Salud,

Paul

 

ObjectCreate("Line1", OBJ_LABEL, 0, 0 , 0); ObjectSet("Line1", OBJPROP_CORNER, 0); ObjectSet("Line1", OBJPROP_XDISTANCE, 10); ObjectSet("Line1", OBJPROP_YDISTANCE, 130);

 

ObjectCreate("Line2", OBJ_LABEL, 0, 0 , 0); ObjectSet("Line2", OBJPROP_CORNER, 0); ObjectSet("Line2", OBJPROP_XDISTANCE, 10); ObjectSet("Line2", OBJPROP_YDISTANCE, 150);

 

ObjectCreate("Line3", OBJ_LABEL, 0, 0 , 0); ObjectSet("Line3", OBJPROP_CORNER, 0); ObjectSet("Line3", OBJPROP_XDISTANCE, 10); ObjectSet("Line3", OBJPROP_YDISTANCE, 170);

 

ObjectCreate("Line4", OBJ_LABEL, 0, 0 , 0); ObjectSet("Line4", OBJPROP_CORNER, 0); ObjectSet("Line4", OBJPROP_XDISTANCE, 10); ObjectSet("Line4", OBJPROP_YDISTANCE, 190);

 

ObjectCreate("Line5", OBJ_LABEL, 0, 0 , 0); ObjectSet("Line5", OBJPROP_CORNER, 0); ObjectSet("Line5", OBJPROP_XDISTANCE, 10); ObjectSet("Line5", OBJPROP_YDISTANCE, 210);

 

ObjectCreate("Line6", OBJ_LABEL, 0, 0 , 0); ObjectSet("Line6", OBJPROP_CORNER, 0); ObjectSet("Line6", OBJPROP_XDISTANCE, 10); ObjectSet("Line6", OBJPROP_YDISTANCE, 230);

 

ObjectSetText("Line1", "My Lable 1: " + my variable 1, 10, "Arial", White);

 

ObjectSetText("Line2", "My Lable 2: " + my variable 2, 10, "Arial", White);

 

ObjectSetText("Line3", "Mi Lable 3: " + mi variable 3, 10, "Arial", Blanco);

 

ObjectSetText("Line4", "My Lable 4: " + my variable 4, 10, "Arial", White);

 

ObjectSetText("Line5", "My Lable 5: " + my variable 5, 10, "Arial", White);

 

ObjectSetText("Line6", "My Lable 6: " + my variable 6, 10, "Arial", White);

Archivo: ejemplo.JPGejemplo.JPG

0

JS17

Cliente, bbp_participant, comunidad, 73 respuestas.

Visitar el perfil

hace 10 años #122023

Gran post muchas gracias 🙂 .

 

Sólo una pregunta rápida si se me permite, su mensaje dice hasta 6 líneas, es de 6 líneas un límite dentro de la programación langauge?

0

Mark Fric

Administrador, sq-ultimate, 2 respuestas.

Visitar el perfil

hace 10 años #122090

no, no hay límite en el número de objetos de texto que puedes mostrar.

 

Sólo tienes que crear más objetos de texto utilizando ObjectCreate() y luego puedes establecer su valor utilizando ObjectSetText()

 

Mark
Arquitecto de StrategyQuant

0

Brian Caudill

Cliente, bbp_participant, comunidad, 0 respuestas.

Visitar el perfil

hace 5 años #234676

Aquí tienes una forma fácil de añadir tantos objetos como quieras al gráfico

int n=8;//cambia este número por el número de objetos que quieras crear
int distancia_horizontal=10;//la posición horizontal
int distancia_entre_verticula=40;//la distancia entre cada objeto
int top_offset = 100; /a qué distancia de la parte superior quieres empezar a imprimir los objetos (si no los quieres justo contra la parte superior del gráfico.
int text_color= clrAntiqueWhite; //el color que quieras que tenga el texto de las cajas
for(int i=0;i<n;i++){
ObjectCreate("Línea "+i, OBJ_LABEL, 0, 0 , 0);
ObjectSet("Línea "+i, OBJPROP_CORNER, 0);
ObjectSet("Línea "+i, OBJPROP_XDISTANCE, distancia_horizontal);
ObjectSet("Línea "+i, OBJPROP_YDISTANCE, (distancia_entre_partícula * i)+ desplazamiento_superior);
ObjectSetText("Line "+i, "My Lable "+i, 10, "Arial", White);
}

0

stickytrader

Abonado, bbp_participant, 38 respuestas.

Visitar el perfil

hace 4 años #249063

Gracias por compartir esta función personalizada . ¿hay alguna solución para mostrar texto en el gráfico para la prueba de espalda ? por ejemplo, en lugar de dibujar la flecha en los gráficos de impresión "Comprar señal" en la prueba de espalda .

0

Viendo 4 respuestas - de la 1 a la 4 (de un total de 4)