Need help in a simple formula +1;-1;0

 

Hi,

I'm new on metatrader stuff, and I'm trying to change some indicators, make some signals with some of them, but It's a little bit confusing.

I would like to my indicator show 1 when the High is above accelaration upperband, and plot -1 when it's below accelaration downband. For the rest, plot zero.

Thanks, and I hope someone help me how to solve this problem.

Files:
 

i'm so sorry but what indicator is this

 
qjol:

i'm so sorry but what indicator is this


Accelaration Bands
 
rodrigosm:

Hi,

I'm new on metatrader stuff, and I'm trying to change some indicators, make some signals with some of them, but It's a little bit confusing.

I would like to my indicator show 1 when the High is above accelaration upperband, and plot -1 when it's below accelaration downband. For the rest, plot zero.

Thanks, and I hope someone help me how to solve this problem.


show where?
 
qjol:

show where?

when I put this indicator, it did not show any value.... and I don`t know why! I want it return 1 if High is greater than upper band, -1 if it's less than down band.
 

the indicator u upload is corrupted here u have a good one

 
qjol:

the indicator u upload is corrupted here u have a good one


Yes, I was trying to change this code to do what I what. I was using this one, but it's return the bands value, and what I want to see is when price is above or below the bands. So, I'm trying too get only a signal.

I really appreciate your help, thanks a lot for your time and patience.

 
for(int i=limit-1;i>=0;i--){
      ExtMapBuffer3[i]=High[i]*(1+Factor*(High[i]-Low[i])/((High[i]+Low[i])/2));
      ...
}
while(i>=0){ 
    if(High[i]>ExtMapBuffer5[i]) {
            a[i]=1;
  1. a[i] isn't a display buffer. What you wanted to do not show the existing ones and add the a[]
  2. After the for loop i=-1 so the while never runs.
 
WHRoeder:
  1. a[i] isn't a display buffer. What you wanted to do not show the existing ones and add the a[]
  2. After the for loop i=-1 so the while never runs.

WHRoeder,


Thanks for your help, but I very beginner, so I couldn't make it works. What I understood is : a[i] is wrong, and to plot a line Ineed to change a[] for a buffer. So, I did it:

The problem is: it still not working. Can you show me an example? how to correct this formula. Thanks for your time.

 while(i>=0)
    { 
    if(High[i]>ExtMapBuffer5[i])
         {
            ExtMapBuffer1[i]=1;
         }
    if(Low[i]<ExtMapBuffer6[i])
         {
            ExtMapBuffer5[i]=-1;
         }
    else ExtMapBuffer5[i] = 0;
    
    }
   return(0);
   }
 

I got a step upward today. This formula is showing when price is below the low band, but the problem is that I don't know why it did'nt work when price is above the upperband. Please, all suggestions are welcome.

Files:
code.txt  4 kb
Reason: