Level Description

Back to topics list To post a new topic, please log in or register
avatar
77
mk77ch 2010.04.28 15:42
 
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
 
avatar
1936
BarrowBoy 2010.04.28 16:28 #
 

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-

 
avatar
77
mk77ch 2010.04.29 17:40 #
 
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
 
avatar
416
cameofx 2010.05.04 10:02 #
 
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.

Attached files:
  _autolevel_stoch.mq4  (2.31 KB)
 
avatar
2
timlead 2016.06.03 16:27 #
 

Hello,

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

 

avatar
1200
FMIC 2016.06.03 17:10 #
 
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)!

Back to topics list  

To add comments, please log in or register