View Single Post
  #1 (permalink)  
Old 07-28-2006, 03:39 PM
scott TTM scott TTM is offline
Senior Member
 
Join Date: Apr 2006
Posts: 210
scott TTM is on a distinguished road
Convert this into MT3 for me PLEASE

Hi all,

I'm beginning to not trust my broker's MT4 feed. I'd like to compare this indicator in MT3's charting vs. the MT4. It's very, very simple - can anyone convert it for me? It's VERY good for determining when breakouts are about to occur.

Thank you!

SB



Code:
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Aqua
//#property indicator_width1 5
//#property indicator_width2 5

extern int period = 8;

double vftop[];
double vfbot[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(2);
   SetIndexBuffer(0, vfbot);
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 117);
   SetIndexEmptyValue(0, 0);
   SetIndexBuffer(1, vftop);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 117);
   SetIndexEmptyValue(1, 0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int i = Bars - counted_bars;
   if(counted_bars == 0) i = Bars - period*2;
   int j = 0;
   double t1, t2;
   
   while(i >= 0)
   {
      t1 = Low[i];
      t2 = High[i];
      for(j = i+1; j < i + period; j++)
      {
         t1 = MathMax(t1, Low[j]);
         t2 = MathMin(t2, High[j]);
      }
      if(t1 <= t2)
      {
         vftop[i] = t2;
         vfbot[i] = t1;
      }
      i--;
   }
//----
   return(0);
}
//+------------------------------------------------------------------+
Reply With Quote