Questions from Beginners MQL5 MT5 MetaTrader 5 - page 808

 
DCodec:

In the Expert Advisor, when receiving an indicator handle in OnInit() ...

....terminal draws both lines, but I need only the top line.

How to disable drawing of this line? I.e. change its colour to CLR_NONE, or change the line style to DRAW_DONE?


When this advisor (in which an indicator handle is created) works on a NORMAL chart in the TERMINAL - the called indicator is not shown at all on the chart.

When such an EA (in which an indicator handle is created) works in the STRATEGY TESTER in visual mode - the called indicator MUST be displayed on the chart.


Based on the above, why do you need to hide ONE line of the called indicator, if the Expert Advisor is running in the STRATEGY Tester in visual mode?

 
DCodec:

In the Expert Advisor, when receiving an indicator handle in OnInit() ...

....terminal draws both lines, but I need only the top line.

How to disable drawing of this line? I.e. change its colour to CLR_NONE, or change the line style to DRAW_DONE?

I gave you a suggestion.
 
Artyom Trishkin:

Well because it is a single indicator which has two lines. Use Moving Average with the same parameters as Envelopes to draw only one MA line. Only add Deviation*Point() for the upper line to the MA value and subtract Deviation*Point() for the lower line

Vladimir Karputov:

When such an EA (in which an indicator handle is created) works on a NORMAL chart in the TERMINAL - then the called indicator is not shown at all on the chart.

When such an Expert Advisor (in which an indicator handle is created) works in the STRATEGY TESTER in visual mode - the called indicator MUST be displayed on the chart.

Now it is clear that the indicator is displayed in the TESTER, I have not thrown the EA on the OVERWHELD chart.

The variant with Deviation*Point() is very good, but only for Envelopes.

 
Vladimir Karputov:
Based on the above, why do you need to hide ONE line of the called indicator, if the Expert Advisor is running in the STRATEGY TEST in visual mode?

When testing, I would like to see the upper line of Envelopes with period (e.g.) 14 and the lower line of Envelopes with period (e.g.) 8.

The strategy is a breakout strategy with different periods on Buy and Sell. Periods are defined by optimization. But then the result should be looked at visually.

 
DCodec:

When testing, I would like to see an upper Envelopes line with a period of (say) 14 and a lower Envelopes line with a period of (say) 8.

The strategy is breakout with different periods for Buy and Sell. Periods are defined by optimization. But then the result should be viewed visually.


Options:

  1. A custom indicator based on iEnvelopes with line colour settings - thus by calling it via iCustom and passing the required parameter, the required line can be "turned off". Then, use two calls of the modified iEnvelopes in the Expert Advisor: one with period 14 and one with period 8
  2. In the Expert Advisor, use two calls of iEnvelopes: one with period 14 and one with period 8, and accept that four lines will be visible (two from the indicator with period 14 and two from the indicator with period 8)
  3. In the Expert Advisor, use two calls of iEnvelopes: one with period 14, the second with period 8. Create a chart template with the name of the Expert Advisor, in this template, change the colour of indicator lines. The template with the name of the Expert Advisor will be caught by the tester in visual mode automatically. A little nuance: manually adjust (set) the periods for the indicators in the chart template with the periods in the EA.
 
DCodec:

When testing, I would like to see the upper Envelopes line with period (e.g.) 14 and the lower Envelopes line with period (e.g.) 8.

The strategy is a breakout strategy with different periods on Buy and Sell. The periods are defined by optimization. But then the result should be looked at visually.

There are two MA with the required periods.
 
Vladimir Karputov:

Options:

  1. Custom indicator based on iEnvelopes with line colour settings - this way calling it via iCustom and passing the required parameter, the required line can be "turned off". Then, use two calls of the modified iEnvelopes in the Expert Advisor: one with period 14 and one with period 8
  2. In the Expert Advisor, use two calls of iEnvelopes: one with period 14 and one with period 8, and accept that four lines will be visible (two from the indicator with period 14 and two from the indicator with period 8)
  3. In the Expert Advisor, use two calls of iEnvelopes: one with period 14, the second with period 8. Create a chart template with the name of the Expert Advisor, in this template, change the colour of indicator lines. The template with the name of the Expert Advisor will be caught by the tester in visual mode automatically. A subtlety: it is necessary to manually coordinate (set) periods for indicators in the chart template with the periods in the Expert Advisor.

Interesting, but I do not understand how to "turn off" the required line. I tried it myself, but it did not work.

Thanks for the ideas.

 
Artyom Trishkin:
Two MAs with the right periods.

This option is brilliantly simple, but I'm not looking for the easy way out.

Thank you for your feedback.

 
DCodec:

This option is brilliantly simple, but I'm not looking for the easy way out.

Thank you for your response.

Then a custom indicator with one line. Vladimir already told you about it.
However, if you wanted to do it, you would have done it by now. It feels like you're looking for a problem to solve.
 
Artyom Trishkin:
Then a custom indicator with one line. Vladimir already told you about it.
However, if you wanted to do it, you would have done it by now. It feels like you're looking for a problem to solve.

No, not a problem. Just playing it in my head, no way to install MT5 on my tablet.

I'll get to the PC this weekend and get it done.

Thank you all for the help.

Reason: