Rectangle object on fixed place

 

Hi there,


How can I draw a rectangle object (indicator) on a fixed place int the chart window (for example: on the left upper corner of the chart window)?

Is it possible?


Thank you!

 
ggekko wrote >>

Hi there,

How can I draw a rectangle object (indicator) on a fixed place int the chart window (for example: on the left upper corner of the chart window)?

Is it possible?

Thank you!

Hey, of course it's possible. If it were me, I'd delete and redraw the object every time a new bar was formed. That would keep it in the same place. Would that work for you?

 
LaBombaGrande:

Hey, of course it's possible. If it were me, I'd delete and redraw the object every time a new bar was formed. That would keep it in the same place. Would that work for you?

Redraw is OK, but how can I get the fixed position (for coordinates change - new time, new price)?

 
ggekko wrote >>

Redraw is OK, but how can I get the fixed position (for coordinates change - new time, new price)?

Hey ggekko,

I see the problem... Sadly, I think the only objects that can be locked in place are labels. Unfortunately, ObjectGetValueByShift() doesn't work with them so there's no way I see to use a label to find a time/price coordinate to lock your rectangle in place.

I don't know if this would work, but you could create another chart, make it a line chart, make the color the same as background, turn off auto scroll and chart shift and display your indicator like that. You may have to transfer the data to global variables if you don't want two EAs/Scripts/Indicators running at once.

Hope that helps. I look forward to seeing if anyone else has any ideas.

 
LaBombaGrande:

Hey ggekko,

I see the problem... Sadly, I think the only objects that can be locked in place are labels. Unfortunately, ObjectGetValueByShift() doesn't work with them so there's no way I see to use a label to find a time/price coordinate to lock your rectangle in place.

I don't know if this would work, but you could create another chart, make it a line chart, make the color the same as background, turn off auto scroll and chart shift and display your indicator like that. You may have to transfer the data to global variables if you don't want two EAs/Scripts/Indicators running at once.

Hope that helps. I look forward to seeing if anyone else has any ideas.

Thank you, LaBombaGrande.

Reason: