Download MetaTrader 5

Changing y-axis labels for an Indicator

To add comments, please log in or register
collierab
153
collierab  

Hi!

I was wondering if anybody knows how to change the labeling on the y-axis of an indicator?

At present my indicator has a fixed range of values running from -100 to +100. I have added levels at +30, +50 and +70. I am happy with the labels on the level lines. However, I would like to change the label of the zero line from "0.00" to simply "0" and remove the label "-100" at the bottom.

Labels on y-axis

Any ideas?

Best regards, Andrew.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
The code? Please use SRC when posting the code.
collierab
153
collierab  

Sure. Not going to post the whole indicator because it is mostly irrelevant, but here are the salient bits.

First set up the limits for the y-axis:

#property indicator_minimum -100
#property indicator_maximum 100

The layer on the levels:

   IndicatorSetInteger(INDICATOR_LEVELS, 3);
   IndicatorSetDouble(INDICATOR_LEVELVALUE, 0, 30);
   IndicatorSetDouble(INDICATOR_LEVELVALUE, 1, 50);
   IndicatorSetDouble(INDICATOR_LEVELVALUE, 2, 70);

How do I manipulate the labels on the y-axis? Level labels are fine but I want to change the label at "0.00" and remove the label at "-100".

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
#property indicator_minimum 0

Have you tried that?

Be advised that changing minimum and maximum might makes your indicator calculate incorrectly and thus wrong plotting.

collierab
153
collierab  
Yeah, absolutely, that sorts out the labeling of the zero line... but I want to have the full range of -100 to 100 on the y-axis.
Alain Verleyen
Moderator
31186
Alain Verleyen  
collierab:
Yeah, absolutely, that sorts out the labeling of the zero line... but I want to have the full range of -100 to 100 on the y-axis.
I don't think it's possible to change level 0, it's built-in. Nor to hide a label, either you have a level with a label, either you don't have a level.
To add comments, please log in or register