Download MetaTrader 5
To add comments, please log in or register
No time for trading? Subscribe to signals!
mk77ch
96
mk77ch 2010.04.28 13: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
Brian Dee - Random Trader
1764
Brian Dee - Random Trader 2010.04.28 14: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-

mk77ch
96
mk77ch 2010.04.29 15: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
cameo
464
cameo 2010.05.04 08: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.

Files:
timlead
23
timlead 2016.06.03 14:27  

Hello,

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

Fernando Carreiro
1439
Fernando Carreiro 2016.06.03 15: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)!

/
To add comments, please log in or register