I want to create an Object (Trendline and Text), that moves with the Bars, so that Time1 = Time[]. But I want the Object to be always at the same Y-Coordinate in the Window. So that Price1 = 20 or so. Is that possible? I thought ObjectMove would be a solution, but it seems as it changes both Parameters only.
- How to place a red or green square on a chart ?
- How do I lock pixel spacing between two textboxes?
- [Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2.
Detect when you have a new bar and then move your objects using ObjectSet() and
OBJPROP_TIME1 for your Text Object and use ObjectSet twice with
OBJPROP_TIME1 &
OBJPROP_TIME2 for your trendlines.
So I use OBJ_LABEL put in the Coordinates and then Set the X-Coordinate to Time1?
I have an Idea how it coud work,
if I find the highest Bar in the Chartwindow ( I think the Window will be always adjusted between the highest and lowest bar. ) and get the High[] value of it, I could use it instead of the Y-Coordinates.
I hope there is a better solution!
tak88js:
So I use OBJ_LABEL put in the Coordinates and then Set the X-Coordinate to Time1? I have an Idea how it coud work, if I find the highest Bar in the Chartwindow ( I think the Window will be always adjusted between the highest and lowest bar. ) and get the High[] value of it, I could use it instead of the Y-Coordinates. I hope there is a better solution!
So I use OBJ_LABEL put in the Coordinates and then Set the X-Coordinate to Time1? I have an Idea how it coud work, if I find the highest Bar in the Chartwindow ( I think the Window will be always adjusted between the highest and lowest bar. ) and get the High[] value of it, I could use it instead of the Y-Coordinates. I hope there is a better solution!
Please don't mix up your units . . . Text works with Price & Time, Labels work on screen coordinates . . . you cannot put a OBJ_LABEL at a price & time . . . and you cannot put a OBJ_TEXT at X & Y screen coordinates.
You can approximate the position of a OBJ_TEXT to 20% up the screen using WindowsPriceMin() + (0.2 * (WindowsPriceMax() - WindowsPriceMin() ) ) for it's price position.
Ok, so that seems to be the simplest solution. Thanks again for your help!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register