Discussion of article "Multiple indicators on one chart (Part 04): Advancing to an Expert Advisor"

MetaQuotes
Moderator
249252

New article Multiple indicators on one chart (Part 04): Advancing to an Expert Advisor has been published:

In my previous articles, I have explained how to create an indicator with multiple subwindows, which becomes interesting when using custom indicators. This time we will see how to add multiple windows to an Expert Advisor.

When I decided to create something new using OOP (Object Oriented Programming), I did this because I already knew that there are big advantages to using this approach, including security and inheritance. There is also polymorphism, but we will use it later when creating a cross-order system. In this particular case we will use one of the advantages of OOP - inheritance. C_TemplateChart is already a fully functional class. Seeing this, you wouldn't want to have the trouble of reprogramming everything again or run the risk of adding code to the class while this would prevent the class from being used in other places. The solution is to use inheritance which allows the addition of new code or function without changing the original code at all.

Using inheritance has a number of advantages, including the following: already tested code remains tested; complexity grows without an equal increase in code size; only new features really need to be tested; what does not change is simply inherited, providing stability. In other words, things improve with minimal effort, but with maximum security. To understand this, let's look at the diagram below.

Author: Daniel Jose

CapeCoddah
10
CapeCoddah  

Hi Daniel,

I am having problems with multicolored indicators and your articles, which I am enjoying, indicate that you might know its solution.

I want to produce a function that sets all of the indicator attributes without using the #property options,e.g. #property indicator_color1  clrCrimson,clrWhite,clrLime

What I am finding in the test program below is that with the #property indicator_color1  clrCrimson,clrWhite,clrLime included, the program works properly whereas if I comment it out, then the program doesn't perform correctly.  In this case it seems that it is plotting only some of the data points as if it is using a "higher?" time frame or skipping several data points.  I suspect that the property color directive is setting more attributes that I have not identified when multi colors are specified.

The second problem is that I obviously don't understand the details and requirements of using multicolored plots.   I have searched the documentation and have not found any articles that provide an overview of how to use multi colored indicators.  While the first plot changes color correctly, the second one, plotting the lows, does not change colors according to my function call.   This plot requires all three properties: type2, color2, & width2, to operate properly.  I am also perplexed why the property declarations use 2 instead of 3.  I used Mladen's Laguerre Adaptive Filter indicator to identify that the property indicators use the plot number,2, not the indicator number 3 to display correctly.

Any suggestions, references, or help will be greatly appreciated

Regards, CapeCoddah

Files: