Demo_IndicatorSetInteger - MetaTrader 5 Script - MT4/MT5 Resources

An example of the IndicatorSetInteger() function. A simple indicator that shows how to create labels such as "overbought levels" for each horizontal level.
Using the #property compiler directive for indicators drawn in separate windows you can specify the color, style and width of the horizontal level, for example:
//--- Set display of three horizontal levels in separate indicator windows#attribute indicator_level1 20 #Property Indicator Level 2 50 #Property Indicator Level 3 80 //--- Set the width of the horizontal line # Property indicator level width 5 //--- Set the color of the horizontal line #propertyindicator_levelcolor clr alice- blue //--- Set the style of the horizontal line
Additionally, IndicatorSetInteger() Functions can dynamically set styles for each level
//--- Set the level color indicator set integer ( INDICATOR_LEVLCOLOR , level, level color); Indicator set integer ( INDICATOR_LEVLSTYLE , level, level_style);
The style of horizontal lines can be enumerated via ENUM_LINE_STYLE :
STYLE_DASHDOTDOT
dash – two dots
When using the #property directive, properties (modifiers) are numbered starting from 1 (one), and functions are numbered from 0 (zero). If the level numbers are set incorrectly, the resulting metrics may be different than expected.
For example, to set the width of the first horizontal line, use index zero:
//--- Index 0 is used to set the width indicator set integer of the first layer ( INDICATOR_LEVELWIDTH , 0 , 5 );

Attachment download
📎 demo_indicatorsetinteger.mq5 (5.58 KB)
Source: MQL5 #1761
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •