Publi
Hola a todos, a ver si alguien me puede ayudar con este codigo, estoy intentando mostrar el valor del precio de una linea horizontal que creo y que si modifico la posicion de la linea me muestre el precio segun su posicion, el codigo es este. Utilizo ObjectGetValueByTime y siempre me aparece el valor 0 ¿hay alguna funcion con la que poder leer el valor?


#property indicator_chart_window

double precio2 = WindowPriceMax();


//+------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping

//---
return(INIT_SUCCEEDED);
}

//+-----------------------------------------------------+
//| Script program start function |
//+-----------------------------------------------------+

int start()
{


ObjectCreate("Precio", OBJ_LABEL, 0,0,0);
ObjectSet("Precio", OBJPROP_XDISTANCE,500);
ObjectSet("Precio", OBJPROP_YDISTANCE, 80);

ObjectCreate(0,"Linea", OBJ_HLINE,0,0,precio2);
ObjectSet("Linea", OBJPROP_COLOR,DarkOrange);
ObjectSet("Linea", OBJPROP_STYLE,STYLE_DOT);


//+------------------------------------------------+
//| Variables |
//+------------------------------------------------+

double Valor = ObjectGetValueByTime(0,"Linea",0) ;

Comment(Valor);


ObjectSetText("Precio", "Precio = "+NormalizeDouble(Valor,2), 12,"Arial", Blue);

return(0);
}

//+-------------------------------------------------------+
//| Custom indicator deinitialization function |
//+-------------------------------------------------------+
int deinit()
{

ObjectDelete("Precio");
ObjectDelete("Linea");


return(0);
}

//+------------------------------------------------------------------+
Foro de Forex Trading United