how to draw an indicator on a chart

 

Hi - hope there is a simple solution to this query.


I am writing an EA and I use a 'low' SMA (simple moving average) and a 'high' SMA - they could be anything say from 2-10 for the low and 20-100+ for the high.

At the moment I have my default values in my EA - say SMA-LO =5 and SMA-HI =25. Is there anyway that during the init process I could place these lines on the chart.


The way I do things means I have a template set-up with the SMA 5 and SMA 25 and then I have to assume that I have the correct values on the charts - i.e. those which match the EAs defaults.

Equally if I could 'READ' the SMA value from the chart and compare against the default value - and sound an alarm if they differ.


Just want to ensure the chart values match the EA's values

 

Try using Global Variables:

A group of functions intended for working with global variables.

Global variables of the client terminal should not be mixed up with variables declared in the global scope of the MQL4 program.

Global variables are kept in the client terminal within 4 weeks since the last access, then they will be deleted automatically. An access to a global variable is not only setting of a new value, but reading of the global variable value, as well.

Global variables of the client terminal are accessible simultaneously from all MQL4 programs launched in the client terminal.


***Mq should really refer to these as Terminal Variables IMO.

Reason: