expert advisor - miscellaneous questions - page 26

 
Max Enrik:
I already tried like below code.
if(id==CHARTEVENT_OBJECT_DRAG && sparam=="#"+IntegerToString(OrderTicket())+"-TP")
  {
// here was my functions
  }

That was not response to me.

Just reading this again... are you trying to trigger code when you drag a terminal-generated TP line? If so, I'll have to see if that works when the markets open.
 
honest_knave:
Just reading this again... are you trying to trigger code when you drag a terminal-generated TP line?

No he's not.

He is trying to move a custom made stealth line.

It should work 24/7 and if markets closed produce modification error, if the code is set to do that because i had removed that part upon his request last time.

 

@honest_knave

No, I do not want to use terminal - generated TP line. ( Terminal TP Line should follows custom HLine object - I already made it with your and Mr. Marco's helps - thanks a lot once again )

---

First of all thanks for both of yours comments.
Maybe I lost my brain, really I am sorry. I can't use your latest comments.

I just think I should write code that help you to understand my issue more clearly.

void OnTick()
  {
   ObjectCreate(0,"Label",OBJ_LABEL,0,0,0);
   ObjectSetInteger(0,"Label",OBJPROP_COLOR,clrWhite);
   ObjectSetInteger(0,"Label",OBJPROP_XDISTANCE,20);
   ObjectSetInteger(0,"Label",OBJPROP_YDISTANCE,Bid); // of course this is not correct value for it - but I try Label object moves with bid line together

   /*
   I do not need Object Text why? Because it will disappear when I scrolls chart.
   I just need fixed OBJPROP_XDISTANCE = 20 | also my chart design starts from left margin x = 20

   I have a faith this Chart Operation can help me,
   but there is not example for how can I use this operation ( in MQL4 documentation - also I can't find it )
   ChartTimePriceToXY();
   */

  }

One more time really sorry for this confusion.

Thanks in advance. 

 

No now you try to recreate the object at every tick ! this will generate error 4200 at every tick object already exists.

Create the object once in OnInit or in a separate fucntion and use ObjectMove() function to move the object.

 
Marco vd Heijden:

No now you try to recreate the object at every tick ! this will generate error 4200 at every tick object already exists.

Create the object once in OnInit or in a separate fucntion and use ObjectMove() function to move the object.

I do not see in Obj_Label documentation about ObjectMove().
Is it possible to use ObjectMove() for Obj_Label, please? 

 
Max Enrik:

I do not see in Obj_Label documentation about ObjectMove().
Is it possible to use ObjectMove() for Obj_Label, please? 

No. ObjectMove() is for objects fixed by time/price not x/y, I believe (unless documentation needs updating!).

Use two ObjectSetInteger() calls with OBJPROP_XDISTANCE and OBJPROP_YDISTANCE

 

Thanks for your comment.

I already asked in other forum sites, that can Obj_Label moves with Bid Price Line together, please?
Can I convert bid price value to Y coordinate, please? 

I am really tired to research about this issue.

Thanks! 

 

If you are not sure you can always try it, it is the only way to find out if something works or not.

If it does not work there's always an alternative OBJ_BUTTON  OBJ_RECTANGLE

 
Max Enrik:

Thanks for your comment.

I already asked in other forum sites, that can Obj_Label moves with Bid Price Line together, please?
Can I convert bid price value to Y coordinate, please? 

I am really tired to research about this issue.

Thanks! 

The easiest solution is to use OBJPROP_TEXT on a line. The text will always be on the left of the screen, but move up and down with price.

Otherwise you will need more code. Have a look at ChartTimePriceToXY() and ChartXYToTimePrice()

 
honest_knave:

The easiest solution is to use OBJPROP_TEXT on a line. The text will always be on the left of the screen, but move up and down with price.
Otherwise you will need more code. Have a look at ChartTimePriceToXY() and ChartXYToTimePrice()

Mr. Marco already post example for ChartXYToTimePrice(), and then I tried for Label Object, I can't get good result, but that was awesome example which I am saving it for me - thanks a lot @Marco vd Heijden.

So I would like to ask  are both of ChartTimePriceToXY() and ChartXYToTimePrice() can help me for this solution, please?
If yes, where can I learn with example about ChartTimePriceToXY() functions, please?

If I made mistakes in my comment, please do not blame me, I am tired to looking for solution for this issue.

Thanks in advance. 

Reason: