Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 882

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Examine the code
Thanks for the quick reply. I don't mean to be rude, but it's close but not quite right. My case uses DRAW_COLOR_HISTOGRAM2
it has three buffers, two for values of start and end of candle and third for storing colour of this candle.
The example shown above uses DRAW_COLOR_HISTOGRAM , it has two buffers (candlestick size and colour) and builds bars only from "0". Such a histogram cannot plot from the level (e.g. 50).
We should subtract 50 from the range of the indicator array values to shift the value from -50 to 50, instead of 0 to 100 as in the original source. Instead of level 50 it will be level 0. And
to arrange the histograms above and below 0, I will have to use two of them, one "negative", below 0, the other "positive", above 0. I guess :-))
This, of course, is also an option and it's probably easier to implement for me now, but I want to understand it and find ERROR.
What I'm doing wrong? The values are calculated correctly (I checked them in the tester, step by step), the colour index changes correctly, but the indicator itself has no effect, the colour does not change, there is no connection between the colour index
and the display. Thanks anyway.
Made changes, added Prints to see the changes on each tick
it can be seen that the index is equal to the green value "32768", it must be, because
ExtMainBuffer[i]>50
i.e. stochastic is above 50. But the bars of the histogram are still red.
I've added the file with the printout.
I used the example from the MQL5 Reference as an example for myself
MQL5 Reference Guide / Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_HISTOGRAM2
double-checked everything, everything as they do, and it does not work!!!!
Who knows, please advise where the error, what's wrong?
I just figuratively called the program a compiler, but in general, in what case would it be better?
to use many small functions rather than one "big chunk" of code - as@Ilyas advised
I used the example from the MQL5 Reference as an example for myself
MQL5 Reference Guide / Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_HISTOGRAM2
double-checked everything, everything as they do, and it does not work!!!!
Who knows, please advise where the error, what's wrong?
I gave you a link to learn about working with a colour buffer, not a histogram. Abstract away from the histogram, and focus on how to work with colour.
Good evening. Tried for a long time and in vain. The histogram draws correctly, but the coloring in different colours (above and below level 50) has not won. Please tell me where I screwed up. The text below, the file is linked
The first thing that caught my eye was the sequence of buffers.
The buffers should ALWAYS be consecutive. I.e. if data buffers are number 2 and 3, then the colour buffer MUST be number 4
If this is not the only error, then we will look further.
I can't think straight.
I've been poking around for half an hour and can't figure it out.
Please tell me how to know the value in rubles of 1 point of price, if the size of the tick and its price are different in the tool specification.
For example, if I have a variable with value 10
it is clear that for Uber it is 10 rubles
rts 130 rubles
oil 60 rubles
How does it look like in the code? I'm confused, the simple points are ok, but the rts oil is different
I can't think straight.
I've been poking around for half an hour and can't figure it out.
Please tell me how to know the value in rubles of 1 point of price, if the size of the tick and its price are different in the tool specification.
For example, if I have a variable with value 10
it is clear that for Uber it is 10 rubles
rts 130 rubles
oil 60 rubles
How does it look like in the code? I'm confused, the simple points are ok, but the rts oil is different
SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE) * volume
MQL4
SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE) * volume
MQL4
MQL5 is needed
futures are not traded in mt4
this is what you need
MQL5 is needed
futures are not traded in mt4
this is what you need
So it's the same in mql5. It's even extended a little bit. Isn't that what we need?
SYMBOL_TRADE_TICK_VALUE
SYMBOL_TRADE_TICK_VALUE_PROFITvalue
double
SYMBOL_TRADE_TICK_VALUE_PROFIT
Calculated tick value for profitable position
double
SYMBOL_TRADE_TICK_VALUE_LOSS
Calculated value of a tick for a losing position
double
SYMBOL_TRADE_TICK_SIZE
Minimum price change
double