How to add an indicator to a chart?

Back to topics list To post a new topic, please log in or register
avatar
41
dudufx 2015.06.23 09:14
 

Hi,

I looked into documentation and I only function to delete indicator to a chart.

My question is : How can I add from mql4 language an indicator to a specific chart?

Thanks 

avatar
735
honest_knave 2015.06.23 09:28 #
 

In MQL5 you can use ChartIndicatorAdd()

As that doesn't appear to have been implemented in MQL4 you are left with:

1. Create a template containing your indicator; and

2. Using ChartApplyTemplate()

Not an ideal solution, for many reasons... 

avatar
41
dudufx 2015.06.23 09:49 #
 

Thanks for the answer. 

Can you explain what you thing it is not an ideal solution?

 

avatar
735
honest_knave 2015.06.23 10:10 #
 

Often people have lots of other things on the chart too - line studies, indicators, EA.

You apply a new template and it all disappears (unless it happens to be included in the template).

 

avatar
12995
WHRoeder 2015.06.23 16:04 #
 
dudufx: My question is : How can I add from mql4 language an indicator to a specific chart?

Adding indicators is for the Human to see. Therefor you add them to the chart and create a template in case you need to create a new chart.

No need to add them in code.

avatar
313
JD4 2015.06.23 23:55 #
 
WHRoeder:

Adding indicators is for the Human to see. Therefor you add them to the chart and create a template in case you need to create a new chart.

No need to add them in code.

What if your code is trying to read the levels generated by those indicators?  (New to programming in MQL, sorry if this is an obvious answer to someone who does it more.)
avatar
735
honest_knave 2015.06.24 01:57 #
 
JD4:
What if your code is trying to read the levels generated by those indicators?  (New to programming in MQL, sorry if this is an obvious answer to someone who does it more.)

Under those circumstances you would use iCustom 

 

avatar
12995
WHRoeder 2015.06.24 03:08 #
 
JD4: What if your code is trying to read the levels generated by those indicators?
Then you read them. Ima, or iCustom. EA's have no eyes. The indicators don't need to be attached to the chart.
avatar
313
JD4 2015.06.24 05:16 #
 
TY knave and WHRoeder.
Back to topics list  

To add comments, please log in or register