MQL4 - automated forex trading   /  

Forum

Line Drawing Issue

Back to topics list To post a new topic, please log in or register

avatar
6
Qman 2007.12.29 23:41 
I want to draw a line using an indicator, between two points at a given time, and extend the line but only to a third time. This is all in the chart window. Just drawing the line would be simple, but to get it to extend, and only to a third clock time is the trick. I'll gladly code it myself, just looking for some hints cause I'm still fairly new and haven't figured out an easy way to do it.
article

Interview with Matthew Brown (Matmospheric)

There is no added safety to keep the account from a forced closing; you just have to trust that the EA.


avatar
2462
phy 2007.12.30 02:48 

 

You have to use the first and third time/price points to draw the line, with OBJPROP_RAY = 0.

Drawing to a "future" time point is permitted.

 


avatar
6
Qman 2007.12.30 20:22 
phy wrote:

You have to use the first and third time/price points to draw the line, with OBJPROP_RAY = 0.

Drawing to a "future" time point is permitted.

Sorry, I guess I wasn't clear enough.

The slope of the line I want to draw is defined by the price at TimeA (Start) and TimeB (End). But I want the line to extend to TimeC. I cannot use the Trendline object because it only allows 2 price/time inputs. One option, I suspect, looking more closely at the options, is to use the object type Trendbyangle. Is that correct? Since I don't know enough about what I'm doing yet, I think I might need to write a routine to draw a trendline for the first two points. Then find the angle of that line, then, redraw the line as a Trendbyangle line. The question then is, how is the angle calculated? Is it it computed by price over time, or is it computed by pixels? ... Or maybe that wouldn't matter? ... Anyway, the alternative thought is to calculate the trendline, keep it as a ray type, until TimeC. At TimeC I could do a ObjectGet on the price, and then redraw the Trendline with that as the final point, and turn the ray property off.

Just seems like al ot of manipulations to get what is pretty intuitive on the human side... which I know happens alot in the programming world. But, I just have to ask am I overlooking a simpler way? Thanks for your response.


avatar
2462
phy 2007.12.30 23:43 

 

Slope is the key factor. Knowing the origin Time/Price and the slope (pips/bar), you can plot to any time in the future (or past).

TrendlineByAngle is useless. It is not tied to the chart, it is tied to the pixels on your screen. Draw a 45 degree TrendlineByAngle.
Change time frame, change the scale, zoom in, soom out. Useless.


avatar
6
Qman 2007.12.31 07:27 
phy wrote:

Slope is the key factor. Knowing the origin Time/Price and the slope (pips/bar), you can plot to any time in the future (or past).

TrendlineByAngle is useless. It is not tied to the chart, it is tied to the pixels on your screen. Draw a 45 degree TrendlineByAngle.
Change time frame, change the scale, zoom in, soom out. Useless.

phy, thanks. That makes sense to me now. Pretty simpe as you explain it.
Back to topics list  

To add comments, please log in or register