Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1130

 
The_Sheikh:

Like this


Just my case.

Here's a piece from the example for DRAW_COLOR_HISTOGRAM2 in the handbook:

Here plot_colors = 8, cols[] - array with different colours. But terminal doesn't accept any colours except first.

Do you assign a histogram to the first one? And the colour buffer goes after the second. It should go after the first.

 
Artyom Trishkin:

Do you assign a histogram to the first one? And the colour buffer goes after the second. It should go after the first.

Which is the first? Which second? Which first? What are we talking about?

Give me an example so I don't have to beat around the bush.

 
The_Sheikh:
What is the first one? Which second one? Which first? What are we talking about?

Give an example, so as not to beat around the bush.

Formulate your objective. Describe WHAT you want to get out of the indicator.

 
Vladimir Karputov:

State your objective. Describe WHAT you want to get out of the indicator.

Are you making fun of it?

https://www.mql5.com/ru/forum/6343/page1129#comment_13439765

 
The_Sheikh:

Are you kidding me?

https://www.mql5.com/ru/forum/6343/page1129#comment_13439765

That's no good. You're giving fragments of phrases. In such cases, the universal answer is:Documentation.


When you stop pouting and getting offended, formulate what I ask:

Forum on trading, automated trading systems and testing trading strategies

Questions from Beginners MQL5 MT5 MetaTrader 5

Vladimir Karputov, 2019.10.06 06:49

Define your problem. Describe WHAT you want to get from the indicator.

So now it is not at all clear what you are doing, and most importantly it is not clear WHY. It is not clear what the end goal is - and therefore no one can guess.
 
The_Sheikh:

Like this


Exactly my case.

Here is a piece from the example for DRAW_COLOR_HISTOGRAM2 in the handbook:

Here plot_colors = 8, cols[] is array with different colours. But the terminal does not perceive any colours except for the first one.

This is exactly the opposite. This fills in the array of colours to be assigned in this line of code from the documentation

ColorHistogram_2Colors[i]=day; 
 
Vladimir Karputov:

This is no good. You are giving fragments of phrases. In such cases, the universal answer is:Documentation.

When you stop pouting and being offended, formulate what I am asking you to do:

That is, it is not clear what you are doing and, most importantly, it is not clear WHY you are doing it. It is not clear what the end goal is - and therefore no one can guess.

I asked a question, pointed out the problem, gave an example which can even be compiled. If that doesn't work for you, then you have no idea what you're talking about and therefore don't know the answer. In such cases, the universal answer is to learn to read.

When you stop being clever and learn to read and formulate your own questions, the topic will become clear to you.

The ultimate goal: to draw a histogram with each of the given colours.


Alexey Viktorov:

That's exactly what it's not. It fills in an array of colours to be assigned in this line of code from the documentation

That's right, it's filling in an array of colours. And as I wrote before, the following way (from the example) colours are filled in and specified correctly:

#property indicator_color2 GreenC,RedC

...

Arr23[i]=0.0; //Green

Arr23[i]=1.0; //Red


And with this method:

PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,GreenC;)
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,RedC);
...

Arr23[i]=0.0; //Green

Arr23[i]=1.0; // Instead of red we get black (i.e. no colour is specified)

 
The_Sheikh:
To which first? Which second? Which first? What are we talking about?

Give me an example so I don't have to beat around the bush.

#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots 2

#define  GreenC 0x00FF00
#define  RedC 0x0000FF
#property indicator_type1 DRAW_NONE
#property indicator_type2 DRAW_COLOR_HISTOGRAM2
//#property indicator_color2 GreenC,RedC

double
Arr11[],
Arr21[],
Arr22[],
Arr23[];

void OnInit()
{
SetIndexBuffer(0,Arr11,INDICATOR_CALCULATIONS);
SetIndexBuffer(1,Arr21,INDICATOR_DATA);
SetIndexBuffer(2,Arr22,INDICATOR_DATA);
SetIndexBuffer(3,Arr23,INDICATOR_COLOR_INDEX);
IndicatorSetInteger(INDICATOR_DIGITS,Digits());
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,4);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,GreenC);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,RedC);
//PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0);

One. Second. Three.

You set the first buffer as the colour histogram. What's the second one for? And why does the colour buffer go after the second buffer when it should go after the first. You have a colour buffer of 3. It should be 2.

 
Artyom Trishkin:

One. Second. Third.

You set the first buffer to the colour histogram type. What do you need the second one for? And why does the colour buffer go after the second when it should go after the first. You have a colour buffer of 3, and it should be 2.

Artyom, you haven't noticed that the type is DRAW_COLOR_HISTOGRAM2 and it has two data buffers and a third colour buffer.

 
The_Sheikh:

I asked a question, pointed out the problem, gave an example which can even be compiled. If it does not suit you, then you have no idea what it is about and therefore do not know the answer. In such cases, the universal answer is to learn to read.

When you stop being clever and learn to read and formulate your own questions, the topic will become clear to you.

The ultimate goal: to draw a histogram with each of the given colours.


That's right, it fills in the colour array. And as I wrote before, the following method (from the example) fills the colours and specifies them correctly:

#property indicator_color2 GreenC,RedC

...

Arr23[i]=0.0; //Green

Arr23[i]=1.0; //Red


And with this method:

PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,GreenC);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,RedC);
...

Arr23[i]=0.0; //Green

Arr23[i]=1.0; //We get black instead of red (i.e. colour is not specified)

And why is this line commented out?

//#property indicator_color2 GreenC,RedC
Although other colours must be included in it. Or at least one, but there must be a declaration.