View Single Post
  #1 (permalink)  
Old 06-30-2006, 06:03 AM
Aaragorn's Avatar
Aaragorn Aaragorn is offline
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
Coding help..How do I get indicator to filter instead of alert?

This produces an alert when the price reaches an upper or lower line.

I want to allow trades to execute until they come close to these lines. When the price gets too close not allow trades to open.

how do I get that logic to happen on current bar closing(s) when all that are here are arrays?

PHP Code:
for(int x=0x<limitx++) {
      
Xdown[x] = 0Xup[x] = 0;
      
middle1[x] = iMA(NULL0period0MODE_EMAPRICE_TYPICALx);// drawn line
      
middle2iMA(NULL0period0MODE_SMAPRICE_TYPICALx);// only used to calculate outer bands

      
avg  findAvg(periodx);
      
upper[x] = middle2 + (3.5*avg);
      
lower[x] = middle2 - (3.5*avg);

      
      if (
MathAbs(upper[x] - High[x]) < 2*Point)
      {
         
Xdown[x] = upper[x];
         if (
NewBar() && == 0)
            
Alert(Symbol()," ",Period()," reach upper edge");
      }   
      if (
MathAbs(lower[x] - Low[x]) < 2*Point)
      {
         
Xup[x] = lower[x];
         if (
NewBar() && == 0)
            
Alert(Symbol()," ",Period()," reach lower edge");
      }
   }
   return(
0);
  } 
Reply With Quote