Horizontals 'vs' Trendlines

 

I have a great indicator that automatically puts S&R horizontals on the chart.

The idea would be to replace these horizontals with trendlines - is there a code that I can change in the MQ4 file to change from horizontals to trendlines?

If it is impossible please let me know.

I'm not a coder so simple answers please.

Thanks

TEAMTRADER

 
TEAMTRADER:
I have a great indicator that automatically puts S&R horizontals on the chart.

The idea would be to replace these horizontals with trendlines - is there a code that I can change in the MQ4 file to change from horizontals to trendlines?

If it is impossible please let me know.

I'm not a coder so simple answers please.

Thanks

TEAMTRADER

TEAMTRADER

You have to change the OBJ_HLINE in the ObjectCreate() function to OBJ_TREND and you have to add one more pair of time + price values (horizontal line requires just one set of time + price, trendline must have 2 pairs of time + price points to define it)

 

PS: probably the easiest would be that you post the indicator (if you can of course - if it is not a private or a commercial indicator) since maybe they are using ObjectMove() to place the horizontal lines to their places. In any case, you have to replace the OBJ_HLINE with OBJ_TREND

 

I thought it would be easy but I have had several attempts trying to get this ‘simple’ task completed but none have resulted in the indicator even working, much less getting the upper timeframe trendline on the current TF chart.

Coding is a skill I do not have!

The theory is simple enough, to get an upper timeframe trendline on the current timeframe chart using the open prices as the following fulcrum.

However, if it can’t be done easily then I’m not too concerned as the ultimate aim was to get the trendlines to be trailing profits/stops.

Thanks

TEAMTRADER

Files:
 
TEAMTRADER:
I thought it would be easy but I have had several attempts trying to get this ‘simple’ task completed but none have resulted in the indicator even working, much less getting the upper timeframe trendline on the current TF chart.

Coding is a skill I do not have!

The theory is simple enough, to get an upper timeframe trendline on the current timeframe chart using the open prices as the following fulcrum.

However, if it can’t be done easily then I’m not too concerned as the ultimate aim was to get the trendlines to be trailing profits/stops.

Thanks

TEAMTRADER

TEAMTRADER

That indicator is already using trend lines to draw horizontal lines

 

Thanks.

Can they be made into diagonals easily?

TEAMTRADER

Reason: