Level Description

 
hi,

is it possible to set a level description in an indicator?
if i edit a level in the indicator properties i can set level-value and description but i didnt found it in mql.

thank you.
mike
 

M
You can do this in the init() of an indi, dont know if you can change it after?

if (Period()==PERIOD_H4)
{
  SetLevelValue(0, 0.00); // Same for all periods
  
  SetLevelValue(1, 2.50);
  SetLevelValue(2, -2.50);
  SetLevelValue(3, 5.00);
  SetLevelValue(4, -5.00);
  SetLevelValue(5, 10.00);
  SetLevelValue(6, -10.00);
}

if (Period()==PERIOD_D1)
{
  SetLevelValue(0, 0.00); // Same for all periods
  
  SetLevelValue(1, 10.00);
  SetLevelValue(2, -10.00);
  SetLevelValue(3, 25.00);
  SetLevelValue(4, -25.00);
  SetLevelValue(5, 50.00);
  SetLevelValue(6, -50.00);
}


Good Luck
-BB-

 
thank you but the question is how to set the text description for the level. the level value itself is not a problem :)

best regards,
mike
 
mk77ch:
thank you but the question is how to set the text description for the level. the level value itself is not a problem :)

best regards,
mike

I take it you meant the level in subwindow for oscillator indy ranging from 0 to 100. We can put up to 32 level. Although you can just easily read the level value on the right of subwindow, I assume
you want to display it next to the Indicator Name like in some other platform... I often went to great length for convenience, here's my try... enjoy.
EDIT : A maximum of only 7 level input can be displayed. Restriction of IndicatorshortName size I suppose... but the line shows up alright.

Files:
 

Hello,

Have you found how to set a description for a level corresponding to indicator_levelN ? 

 
mk77ch:
... the question is how to set the text description for the level. the level value itself is not a problem :)

Use the "IndicatorSetString()" function with the "INDICATOR_LEVELTEXT"  property ID. At the first link provided, the example code is for that exact functionality, namely setting the level description.

PS! I've never used this function before, and found it by simply doing a "Search" in the MQL4 Reference documentation (hint, hint)!