Using indicators within ExpertAdvisor

 

Hello,

i like to code an expert advisor based on indicators and want thess indicators also drawn into chart.

Is this possible ? My tests shown that this seems only be possible when running strategy tester using iMA, for instance.

But when attaching ExpertAdvisor to chart, no line is drawn even iMA created. 

So basically i like to declare indicator lines in my ExpertAdvisor.

Is there somthing doing the trick ?

Thank you 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines - Documentation on MQL5
 
chinaski:

Hello,

i like to code an expert advisor based on indicators and want thess indicators also drawn into chart.

Is this possible ? My tests shown that this seems only be possible when running strategy tester using iMA, for instance.

But when attaching ExpertAdvisor to chart, no line is drawn even iMA created. 

So basically i like to declare indicator lines in my ExpertAdvisor.

Is there somthing doing the trick ?

Thank you 

Hi chinaski,

You can't, that's indicator jobs not EA. Attach EA to a chart, attach the indi as well and save your chart as MT5 template. Next time you want to run the EA, attach that template instead the EA.

:D 

 
onewithzachy:

Hi chinaski,

You can't, that's indicator jobs not EA. Attach EA to a chart, attach the indi as well and save your chart as MT5 template. Next time you want to run the EA, attach that template instead the EA.

:D 

Thank you for answer. No good news as it requires doublicate coding of same feature: one in indicator and one in EA. It is also a weakness in terms of visualisation.

Let's say you like to detect patterns also in the past (as to check quality), you can't do it with an indicator as indicators call OnCalculate only with very latest bar. You need to do this in EA, then

do backtest with visualisation. But this visualisation is very limited.

Documentation on MQL5: Language Basics / Functions / Event Handling Functions
  • www.mql5.com
Language Basics / Functions / Event Handling Functions - Documentation on MQL5
 
 
chinaski:

Thank you for answer. No good news as it requires doublicate coding of same feature: one in indicator and one in EA. It is also a weakness in terms of visualisation.

Let's say you like to detect patterns also in the past (as to check quality), you can't do it with an indicator as indicators call OnCalculate only with very latest bar. You need to do this in EA, then

do backtest with visualisation. But this visualisation is very limited.

Hi chinaski,

There's no need for double coding, you can use iCustom instead (https://www.mql5.com/en/docs/indicators/icustom).


Hi alexvd,

Thanks a lot for that, and I guess that's one of the reason we can't change any CI's input parameter inside-EA-on-the-fly-as-we-like-it like we doing it in MQL4, like scanning MA or MACD with different periods.

:D 

Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
Technical Indicators / iCustom - Documentation on MQL5
Reason: