How to refresh Line and Text objects upon opening/closing orders?

 

My EA is set to EachTick, but my objects does not update values/location when orders gets opend or closed.

my code structure as following:

int init()
{
WindowRedraw();
ObjectDelete ("MyLine");
}

int deinit()
{
WindowRedraw();
ObjectDelete ("MyLine");
}

int start()
{
WindowRedraw();
ObjectCreate ( "MyLine", OBJ_HLINE, 0, 0, MyLine_Value );
ObjectSet ( "MyLine", OBJPROP_STYLE, STYLE_SOLID );
ObjectSet ( "MyLine", OBJPROP_COLOR, Blue );
ObjectSet ( "MyLine", OBJPROP_WIDTH, 2 );
string MyLine_Text = DoubleToStr ( MyLine_Value,Digits );
ObjectSetText ( "MyLine", MyLine_Text+" << MyLine_Value", 8, NULL, Black );
}

Please Help and advice.

Hints:

1) MyLine_Value and its label MyLine_Text shall be updated upon closing existing order or opening new order.

2) MyLine_Value is a local variable calculated within the start() function, so that, I can not move the ObjectCreate(....) command into the init() function.

 
OmegaFX:

My EA is set to EachTick, but my objects does not update values/location when orders gets opend or closed.

my code structure as following:

Please Help and advice.

Hint: MyLine_Value and its label MyLine_Text shall be updated upon closing existing order or opening new order.

If you create and Object and then try and create it again it fails because the Object already exists . . . if it exists (ObjectFind() > -1) move it to the new position using ObjectSet() or ObjectMove()