Minor indicator mod, a little help please..

 

Hi all,

I would like the code below to have the price values removed (from the right hand side of the indicator) so I can place a zero-line on the indicator BUT I do not know how to code.

Would someone out there be kind enough to tell or show me how to do this?

If so, I'll buy them a pint or two!

Thanks - if you can help.

DaveFx

#property copyright "Copyright © 2008, Borys Chekmasov"
#property link      "http://uatrader.blogspot.com"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Gold
#property indicator_color2 DodgerBlue
//âõîäíûå ïàðàìåòðû
extern string simbol_name = "EURUSD";
extern int bars_for_autoscale = 200;
extern bool inverse = true;
extern bool MA = true;
extern int MAPeriod = 5;
extern bool MAOnly = true;

double simbolBuffer[];
double MABuffer[];

// èíèöèàëèçàöèÿ
int init()
  {
   SetIndexBuffer(0,simbolBuffer);       
   SetIndexStyle (0,DRAW_LINE);
      SetIndexBuffer(1,MABuffer);       
   SetIndexStyle (1,DRAW_LINE);
   return (0);
  }
     
//îñíîâíîé öèêë                              

int start()
  {
double simbol_scale = 1;
double simbol_offset = 0;
 int i,k;
int cb=IndicatorCounted();
i = Bars-cb-1;
k = bars_for_autoscale;
if (bars_for_autoscale==0) k=Bars;
double max_scale=iClose(simbol_name,0,1);
double min_scale=iClose(simbol_name,0,1);
double max_scale2=Close[1];
double min_scale2=Close[1];
while(k>=0) 
      {
      
      if (max_scale<iClose(simbol_name,0,k)) max_scale=iClose(simbol_name,0,k);
      if (min_scale>iClose(simbol_name,0,k)) min_scale=iClose(simbol_name,0,k);
      if (max_scale2<Close[k])max_scale2=Close[k];
      if (min_scale2>Close[k])min_scale2=Close[k];
    
    
      k--;
      }

simbol_scale = (max_scale2 - min_scale2)/(max_scale-min_scale);
      if(!inverse) {
 simbol_offset = max_scale2 - simbol_scale*max_scale;
 }
 else
 {
 simbol_offset = max_scale2 + simbol_scale*min_scale;
 }

while(i>=0) 
      {
      
        if(!inverse) 
        {
         if (!MAOnly) simbolBuffer[i]=simbol_scale*(iClose(simbol_name,0,i))+simbol_offset;
         if (MA)MABuffer[i]=(iMA(simbol_name,0,MAPeriod,0,0,PRICE_CLOSE,i))*simbol_scale+simbol_offset;
         }
        else 
        {
        if (!MAOnly) simbolBuffer[i]=simbol_offset - simbol_scale*(iClose(simbol_name,0,i));
        if (MA)MABuffer[i]=simbol_offset - simbol_scale*(iMA(simbol_name,0,MAPeriod,0,0,PRICE_CLOSE,i));
        }
          i--;
      }

   
   return(0);
  }
 
Have you tried with MAOnly = true; ?
 
RaptorUK:
Have you tried with MAOnly = true; ?


Yes. What I am looking for is the ability to get rid of the price values on the right hand side of the indicator. So I can have a 0.00 or a zero-line for exit purposes.

DaveFX

 
davefx:


Yes. What I am looking for is the ability to get rid of the price values on the right hand side of the indicator. So I can have a 0.00 or a zero-line for exit purposes.

DaveFX

Can you post a picture of what you have and what you want . . .
 
RaptorUK:
Can you post a picture of what you have and what you want . . .


Sure.

And this is what I would like..

Hope you can help..

 
davefx:


Yes. What I am looking for is the ability to get rid of the price values on the right hand side of the indicator. So I can have a 0.00 or a zero-line for exit purposes.

DaveFX

Not really sure how you can expect to have a zero line if the values drawn are only positive values ?
 
RaptorUK:
Not really sure how you can expect to have a zero line if the values drawn are only positive values ?

I am not a programmer, but surly there must be a way? Mustn't there??
 
RaptorUK:
Not really sure how you can expect to have a zero line if the values drawn are only positive values ?

Yep, I agree with ya..

Whatever it is, Davefx, add this on init()

int init()
  {
   ... // your other ...   
   ... // ... codes

   SetLevelValue (0,0.0);
   SetLevelStyle (STYLE_DOT, 2, Lime ); //<<== Lime color of thick 2 dotted line
   return (0);
  }

You can add more lines if you like, just write SetLevelValue (1, 1,25) which means set horizontal level number 1 (up to number 31) at 1.25 value, SetLevelValue (https://docs.mql4.com/customind/SetLevelValue) and SetLevelStyle (https://docs.mql4.com/customind/SetLevelStyle)

:D

 
onewithzachy:

Yep, I agree with ya..

Whatever it is, Davefx, add this on init()

You can add more lines if you like, just write SetLevelValue (1, 1,25) which means set horizontal level number 1 (up to number 31) at 1.25 value, SetLevelValue (https://docs.mql4.com/customind/SetLevelValue) and SetLevelStyle (https://docs.mql4.com/customind/SetLevelStyle)

:D


Hi onewithzachy,

I did try what you recommended.. But to no avail..

 
davefx:


Hi onewithzachy,

I did try what you recommended.. But to no avail..

Hi davefx

Try this

SetLevelValue (0,1.2240);

I have no problem with that value coz it's close to current EURUSD, and, like RaptorUK said, it's difficult to see value zero, and you may have to restart the MT.

:D

 

Hi onewithzachy,

Thanks it worked.

Is there a way around the small problem of ridding the indicator of the values on the right hand side??

Any help would be most appreciated.

Thanks again.

DaveFx

Reason: