How to EA draw an indicator on the chart automatic?
-
Hi Admin and Bro
How to EA draw indicators on the chart automatic?Thanks
-
@khacdiepvnc if you use MT5 to add an indicator on the chart in automatic mode, in on init tab open a custom mql block and copy paste this code :
long handle=ChartID();
if(!ChartIndicatorAdd(handle,1,v::atrcurrent))
PrintFormat("Failed to add ATR indicator on %d chart window. Error code %d",
handle,GetLastError());
if(!ChartIndicatorAdd(handle,0,v::imacurrent))
PrintFormat("Failed to add EMA indicator on %d chart window. Error code %d",
handle,GetLastError());First "if" is for a subwindow indicator like ATR in this case, second "if" is for an indicator in main chart like EMA.
v::atrcurrent and v::imacurrent you have to replace them with the handles of the indicators you want to use. -
thanks Bro.
But i need find how to do with MT4 -
@khacdiepvnc from what i know you can't in mql4, one more reason to switch to mt5

-
thanks Bro
-
@khacdiepvnc up!
-
I could be wrong but, any indicators & chart settings I want to use with EA I save as template so I can add in a couple of clicks, there is a block called apply template which would probably do this for you, also this post link text may help.
-
@jstap thanks
-
