As title, i've already set INDICATOR_LEVELCOLOR = clrNONE but it still show level color on initialize.
I have to set color is None manually after load the indicator, it's very irritating
Any solution? Thanks in advance!
I took the time to create my own test example code, and these are my findings:
- When setting the "Levels" via the terminal's Indicator properties tab, the Colour, Line Style and Line Width are set globally to affect ALL the levels (this differs from the MQL method).
- When setting the "Levels" programmatically via MQL, each level can have it's own local Colour, Line Style and Line Width (this differs from the properties tab).
- When programmatically setting the colour to "clrNONE", this always produces "white" and not "None" as what happens when setting from the properties tab.
This confirms, the OP's findings that setting the level colour to "clrNONE" does NOT work as expected.
This could be considered a bug, but I don't know if MetaQuotes is going to do anything about it.
#property indicator_separate_window #property indicator_maximum 10 #property indicator_minimum -1 input color i_clrLevel = clrNONE; int OnInit() { IndicatorSetInteger( INDICATOR_LEVELS, indicator_maximum ); for(int i = 0; i < indicator_maximum; i++ ) { IndicatorSetDouble( INDICATOR_LEVELVALUE, i, (double) i ); IndicatorSetInteger( INDICATOR_LEVELCOLOR, i, i_clrLevel ); IndicatorSetInteger( INDICATOR_LEVELWIDTH, i, 1 ); IndicatorSetInteger( INDICATOR_LEVELSTYLE, i, STYLE_DOT ); IndicatorSetString( INDICATOR_LEVELTEXT, i, "Level " + (string) i ); }; return INIT_SUCCEEDED; }; int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { return rates_total; };
I took the time to create my own test example code, and these are my findings:
- When setting the "Levels" via the terminal's Indicator properties tab, the Colour, Line Style and Line Width are set globally to affect ALL the levels (this differs from the MQL method).
- When setting the "Levels" programmatically via MQL, each level can have it's own local Colour, Line Style and Line Width (this differs from the properties tab).
- When programmatically setting the colour to "clrNONE", this always produces "white" and not "None" as what happens when setting from the properties tab.
This confirms, the OP's findings that setting the level colour to "clrNONE" does NOT work as expected.
This could be considered a bug, but I don't know if MetaQuotes is going to do anything about it.
I will give my opinion....
According to the documentation "clrNONE" equals -1.
And about "IndicatorSetInteger" it says the following:
Numbering of properties (modifiers) starts from 1 (one) when using the #property directive, while the function uses numbering from 0 (zero). In case the level number is set incorrectly, indicator display can differ from the intended one.
So I deduce that using "IndicatorSetInteger" with "clrNONE" is technically unfeasible because it may return a zero which is equal to the colour white (The numerical values of a colour component are between 0 and 255).
I insist, I haven't tested any of this, I'm just trying to shed some light on the subject.
I will give my opinion....
According to the documentation "clrNONE" equals -1.
And about "IndicatorSetInteger" it says the following:
Numbering of properties (modifiers) starts from 1 (one) when using the #property directive, while the function uses numbering from 0 (zero). In case the level number is set incorrectly, indicator display can differ from the intended one.
So I deduce that using "IndicatorSetInteger" with "clrNONE" is technically unfeasible because it may return a zero which is equal to the colour white (The numerical values of a colour component are between 0 and 255).
I insist, I haven't tested any of this, I'm just trying to shed some light on the subject.
That refers to "0" indexing of the modifier parameter, not the property value parameter.
I understand the point, but... What if the behavior is the same in modifier properties and property values and what we really have in front of us is a problem in the documentation?
Hopefully MQ will take note and fix it soon whatever the reason is.
Good job to all! ;-)
I understand the point, but... What if the behavior is the same in modifier properties and property values and what we really have in front of us is a problem in the documentation?
Hopefully MQ will take note and fix it soon whatever the reason is.
Good job to all! ;-)
Already reported ...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
As title, i've already set INDICATOR_LEVELCOLOR = clrNONE but it still show level color on initialize.
I have to set color is None manually after load the indicator, it's very irritating
Any solution? Thanks in advance!