Examples for subclassed trendline?

To add comments, please log in or register
Wolfgang Gresch
209
Wolfgang Gresch  

Hello all,

aiming to create an indicator that basically consists of a trendline displaying text at its ends. RayRight and RayLeft should be prohibited (easy). The handling should be just as if it was a regular trendline (difficult).

My questions at the moment are as follows:

1) Which time/price values can I use when applying the indicator to the chart? I.e. how shall I get an initial value so the line is created within a visible area of the chart?

2) How would I plot the text to the ends? 

 

Any examples are very appreciated - couldn't find something at mql5 at all (though the article  "Designing and implementing new GUI widgets based on CChartObject class" uses trendlines as the general example, but unfortunately doesn't show how to do something with trendlines)!

 

Thanks very much and so long, 

z3tr4d3r 

onewithzachy
1864
onewithzachy  
z3tr4d3r:

Hello all,

aiming to create an indicator that basically consists of a trendline displaying text at its ends. RayRight and RayLeft should be prohibited (easy). The handling should be just as if it was a regular trendline (difficult).

My questions at the moment are as follows:

1) Which time/price values can I use when applying the indicator to the chart? I.e. how shall I get an initial value so the line is created within a visible area of the chart?

2) How would I plot the text to the ends? 

Any examples are very appreciated - couldn't find something at mql5 at all (though the article  "Designing and implementing new GUI widgets based on CChartObject class" uses trendlines as the general example, but unfortunately doesn't show how to do something with trendlines)!

Thanks very much and so long, 

z3tr4d3r 

Hi z3tr4d3r ,

1. The price value can come from the CI itself. It depend on the CI then, what CI you going to use or what are the base/the data source of your CI ?. and the time value is always bar time value.  You can use FirstVisibleBar() (and perhaps also VisibleBars() ) then recalculate so that the trendline (or part of the trendline) will be drawn on visible area of the chart.

2. Create separate Object Text at the end of the trendline, or ... good luck :).

:D 

To add comments, please log in or register