Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/forex/public_html/wp-settings.php on line 18
A :forex decode

A Archives

Awesome.mq4

//+------------------------------------------------------------------+
//|                                                      Awesome.mq4 |
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Black
#property  indicator_color2  Green
#property  indicator_color3  Red

//---- indicator buffers
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
   SetIndexDrawBegin(2,34);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("AO");
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd
   for(int i=0; i<limit; i++)
      ExtBuffer0[i]=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ExtBuffer2[i]=current;
         ExtBuffer1[i]=0.0;
        }
      else
        {
         ExtBuffer1[i]=current;
         ExtBuffer2[i]=0.0;
        }
     }
//---- done
   return(0);
  }

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

Avg Daily Range.mq4

//+------------------------------------------------------------------+
//|                                              Avg Daily Range.mq4 |
//|                 Copyright ? 2005, tageiger aka fxid10t@yahoo.com |
//|                                        http://www.metatrader.org |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, tageiger aka fxid10t@yahoo.com"
#property link      "http://www.metatrader.org"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 SpringGreen
#property indicator_color3 Tomato
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

double rng,sum.rng,avg.rng;

int init()  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);}

int deinit()   {return(0);}

int start() {
   int    counted_bars=IndicatorCounted();
   rng=0;sum.rng=0;avg.rng=0;

   for(int i=0;i<Bars;i++) {
      rng=(iHigh(Symbol(),PERIOD_D1,i)-iLow(Symbol(),PERIOD_D1,i));
      sum.rng+=rng;
   }

   int db=iBars(Symbol(),1440);
   avg.rng=sum.rng/db;

//   for(int t=0;t<db;t++)   {
      for(int s=0;s<Bars;s++) {

      ExtMapBuffer2[s]=(iOpen(Symbol(),PERIOD_D1,s)+(avg.rng/2));
      ExtMapBuffer3[s]=(iOpen(Symbol(),PERIOD_D1,s)-(avg.rng/2));
   }//  }
   Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n",
           "Sum of Daily Ranges:",sum.rng,"\n",
           "Average Range:",avg.rng,"\n",
           "i:",i+1);

return(0);}
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

Average Size Bar.mq4

//+------------------------------------------------------------------+
//|                                             Average Size Bar.mq4 |
//|                                          ?? ??? ?. aka KimIV. |
//|                                             http://www.kimiv.ru/ |
//+------------------------------------------------------------------+
#property copyright "?? ??? ?. aka KimIV."
#property link      "http://www.kimiv.ru/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int MA_Period=10;
extern int MA_Shift=0;
extern int MA_Method=0;
//---- indicator buffers
double ExtMapBuffer[];
//----
int ExtCountedBars=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
  int    draw_begin;
  string short_name;
  //---- drawing settings
  SetIndexStyle(0, DRAW_LINE);
  SetIndexShift(0, MA_Shift);
  IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
  if(MA_Period<2) MA_Period=10;
  draw_begin = MA_Period - 1;
  //---- indicator short name
  switch(MA_Method) {
    case 1  : short_name = "EMA("; draw_begin = 0; break;
    case 2  : short_name = "SMMA("; break;
    case 3  : short_name = "LWMA("; break;
    default : short_name = "SMA("; MA_Method = 0;
  }
  IndicatorShortName(short_name + MA_Period + ")");
  SetIndexDrawBegin(0, draw_begin);
  //---- indicator buffers mapping
  SetIndexBuffer(0, ExtMapBuffer);
  //---- initialization done
  return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start() {
  if(Bars<=MA_Period) return(0);
  ExtCountedBars=IndicatorCounted();
  //---- check for possible errors
  if (ExtCountedBars<0) return(-1);
  //---- last counted bar will be recounted
  if (ExtCountedBars>0) ExtCountedBars--;
  //----
  switch(MA_Method) {
    case 0 : sma();  break;
    case 1 : ema();  break;
    case 2 : smma(); break;
    case 3 : lwma();
  }
  //---- done
  return(0);
}

//+------------------------------------------------------------------+
//| Simple Average Size Bar                                          |
//+------------------------------------------------------------------+
void sma() {
  double sum = 0;
  int    i, pos = Bars - ExtCountedBars - 1;
  //---- initial accumulation
   if(pos<MA_Period) pos=MA_Period;
   for(i=1;i<MA_Period;i++,pos--) sum+=High[pos]-Low[pos];
  //---- main calculation loop
  while(pos>=0) {
    sum+=High[pos]-Low[pos];
    ExtMapBuffer[pos]=sum/MA_Period;
	  sum-=High[pos+MA_Period-1]-Low[pos+MA_Period-1];
 	  pos--;
  }
  //---- zero initial bars
  if(ExtCountedBars<1) for(i=1;i<MA_Period;i++) ExtMapBuffer[Bars-i]=0;
}

//+------------------------------------------------------------------+
//| Exponential Average Size                                         |
//+------------------------------------------------------------------+
void ema() {
  double pr=2.0/(MA_Period+1);
  int    pos=Bars-2;
  if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
  //---- main calculation loop
  while(pos>=0) {
    if(pos==Bars-2) ExtMapBuffer[pos+1]=High[pos+1]-Low[pos+1];
    ExtMapBuffer[pos]=(High[pos]-Low[pos])*pr+ExtMapBuffer[pos+1]*(1-pr);
 	  pos--;
  }
}

//+------------------------------------------------------------------+
//| Smoothed Average Size Bar                                        |
//+------------------------------------------------------------------+
void smma() {
  double sum=0;
  int    i,k,pos=Bars-ExtCountedBars+1;
  //---- main calculation loop
  pos=Bars-MA_Period;
  if(pos>Bars-ExtCountedBars) pos=Bars-ExtCountedBars;
  while(pos>=0) {
    if(pos==Bars-MA_Period) {
      //---- initial accumulation
      for(i=0,k=pos;i<MA_Period;i++,k++) {
        sum+=High[k]-Low[k];
        //---- zero initial bars
        ExtMapBuffer[k]=0;
      }
    }
    else sum=ExtMapBuffer[pos+1]*(MA_Period-1)+High[pos]-Low[pos];
    ExtMapBuffer[pos]=sum/MA_Period;
    pos--;
  }
}

//+------------------------------------------------------------------+
//| Linear Weighted Average Size Bar                                 |
//+------------------------------------------------------------------+
void lwma() {
  double sum=0.0,lsum=0.0;
  double price;
  int    i,weight=0,pos=Bars-ExtCountedBars-1;
  //---- initial accumulation
  if(pos<MA_Period) pos=MA_Period;
  for(i=1;i<=MA_Period;i++,pos--) {
    price=High[pos]-Low[pos];
    sum+=price*i;
    lsum+=price;
    weight+=i;
  }
  //---- main calculation loop
  pos++;
  i=pos+MA_Period;
  while(pos>=0) {
    ExtMapBuffer[pos]=sum/weight;
    if(pos==0) break;
    pos--;
    i--;
    price=High[pos]-Low[pos];
    sum=sum-lsum+price*MA_Period;
    lsum-=High[i]-Low[i];
    lsum+=price;
  }
  //---- zero initial bars
  if(ExtCountedBars<1) for(i=1;i<MA_Period;i++) ExtMapBuffer[Bars-i]=0;
}
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

Average Range.mq4

//+------------------------------------------------------------------+
//|                                              Avg Daily Range.mq4 |
//|                 Copyright ? 2005, tageiger aka fxid10t@yahoo.com |
//|                                        http://www.metatrader.org |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, tageiger aka fxid10t@yahoo.com"
#property link      "http://www.metatrader.org"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 SpringGreen
#property indicator_color3 Tomato
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

double rng,sum.rng,avg.rng;

int init()  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);}

int deinit()   {return(0);}

int start() {
   int    counted_bars=IndicatorCounted();
   rng=0;sum.rng=0;avg.rng=0;

   for(int i=0;i<Bars;i++) {
      rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i));
      sum.rng+=rng;
   }

   int db=iBars(Symbol(),Period());
   avg.rng=sum.rng/db;

//   for(int t=0;t<db;t++)   {
      for(int s=0;s<Bars;s++) {

      ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2));
      ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2));
   }//  }
   Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n",
           "Sum of Period Ranges:",sum.rng,"\n",
           "Average Range:",avg.rng,"\n",
           "Total Bars:",i+1);

return(0);}
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

AutoDayFibsWhiteKnightv2.mq4

//+------------------------------------------------------------------+
//|                                                AutoDayFibs V1.0  |
//|                                                                  |
//|              Copyright ? 2005, Jason Robinson                    |
//|               (jasonrobinsonuk,  jnrtrading)                     |
//|                http://www.jnrtrading.co.uk                       |
//|                                                                  |
//|                    Created by jnrtrading                         |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Jason Robinson (jnrtrading)"
#property link      "http://www.jnrtrading.co.uk"

#property indicator_chart_window
extern int daysBackForHigh = 1;
extern int daysBackForLow = 1;
extern color LabelColor = White;
extern color LineColor = Orange;
//---- buffers

double Rates[][6];

double fib000,
       fib236,
       fib382,
       fib50,
       fib618,
       fib100,
       fib1618,
       fib2618,
       fib4236,
       range,
       prevRange,
       high,
       low;

bool objectsExist, highFirst;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   //prevRange = 0;
   //objectsExist = false;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("fib000");
   ObjectDelete("fib000_label");
   ObjectDelete("fib236");
   ObjectDelete("fib236_label");
   ObjectDelete("fib382");
   ObjectDelete("fib382_label");
   ObjectDelete("fib50");
   ObjectDelete("fib50_label");
   ObjectDelete("fib618");
   ObjectDelete("fib618_label");
   ObjectDelete("fib100");
   ObjectDelete("fib100_label");
   ObjectDelete("fib1618");
   ObjectDelete("fib1618_label");
   ObjectDelete("fib2618");
   ObjectDelete("fib2618_label");
   ObjectDelete("fib4236");
   ObjectDelete("fib4236_label");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i = 0;
//----
   //Print(prevRange);
   ArrayCopyRates(Rates, Symbol(), PERIOD_D1);

   high = Rates[daysBackForHigh][3];
   low = Rates[daysBackForLow][2];
   range = high - low;

   while(true) {
      if(High[i] == high) {
         highFirst = true;
         break;
      }
      else if(Low[i] == low) {
         highFirst = false;
         break;
      }
      i++;
   }
   //Print(highFirst);

   // Delete Objects if necessary
   if (prevRange != range) {
      ObjectDelete("fib000");
      ObjectDelete("fib000_label");
      ObjectDelete("fib236");
      ObjectDelete("fib236_label");
      ObjectDelete("fib382");
      ObjectDelete("fib382_label");
      ObjectDelete("fib50");
      ObjectDelete("fib50_label");
      ObjectDelete("fib618");
      ObjectDelete("fib618_label");
      ObjectDelete("fib100");
      ObjectDelete("fib100_label");
      ObjectDelete("fib1618");
      ObjectDelete("fib1618_label");
      ObjectDelete("fib2618");
      ObjectDelete("fib2618_label");
      ObjectDelete("fib4236");
      ObjectDelete("fib4236_label");
      objectsExist = false;
      prevRange = range;
      //Print("Objects do not exist");
   }

   if (highFirst == true) {
      fib000 = low;
      fib236 = (range * 0.236) + low;
      fib382 = (range * 0.382) + low;
      fib50 = (high + low) / 2;
      fib618 = (range * 0.618) + low;
      fib100 = high;
      fib1618 = (range * 0.618) + high;
      fib2618 = (range * 0.618) + (high + range);
      fib4236 = (range * 0.236) + high + (range * 3);
   }
   else if (highFirst == false) {
      fib000 = high;
      fib236 = high - (range * 0.236);
      fib382 = high - (range * 0.382);
      fib50  = (high + low) / 2;
      fib618 = high - (range * 0.618);
      fib100 = low;
      fib1618 = low - (range * 0.618);
      fib2618 = (low - range) - (range * 0.618);// + (high + range);
      fib4236 = low - (range * 3) - (range * 0.236);// + high + (range * 3);
   }

   if (objectsExist == false) {
      ObjectCreate("fib000", OBJ_HLINE, 0, Time[40], fib000);
      ObjectSet("fib000", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib000", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib000_label", OBJ_TEXT, 0, Time[0], fib000);
      ObjectSetText("fib000_label","                             0.0", 8, "Times", LabelColor);

      ObjectCreate("fib236", OBJ_HLINE, 0, Time[40], fib236);
      ObjectSet("fib236", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib236", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib236_label", OBJ_TEXT, 0, Time[0], fib236);
      ObjectSetText("fib236_label","                             23.6", 8, "Times", LabelColor);

      ObjectCreate("fib382", OBJ_HLINE, 0, Time[40], fib382);
      ObjectSet("fib382", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib382", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib382_label", OBJ_TEXT, 0, Time[0], fib382);
      ObjectSetText("fib382_label","                             38.2", 8, "Times", LabelColor);

      ObjectCreate("fib50", OBJ_HLINE, 0, Time[40], fib50);
      ObjectSet("fib50", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib50", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib50_label", OBJ_TEXT, 0, Time[0], fib50);
      ObjectSetText("fib50_label","                             50.0", 8, "Times", LabelColor);

      ObjectCreate("fib618", OBJ_HLINE, 0, Time[40], fib618);
      ObjectSet("fib618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib618", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib618_label", OBJ_TEXT, 0, Time[0], fib618);
      ObjectSetText("fib618_label","                             61.8", 8, "Times", LabelColor);

      ObjectCreate("fib100", OBJ_HLINE, 0, Time[40], fib100);
      ObjectSet("fib100", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib100", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib100_label", OBJ_TEXT, 0, Time[0], fib100);
      ObjectSetText("fib100_label","                             100.0", 8, "Times", LabelColor);

      ObjectCreate("fib1618", OBJ_HLINE, 0, Time[40], fib1618);
      ObjectSet("fib1618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib1618", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib1618_label", OBJ_TEXT, 0, Time[0], fib1618);
      ObjectSetText("fib1618_label","                             161.8", 8, "Times", LabelColor);

      ObjectCreate("fib2618", OBJ_HLINE, 0, Time[40], fib2618);
      ObjectSet("fib2618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib2618", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib2618_label", OBJ_TEXT, 0, Time[0], fib2618);
      ObjectSetText("fib2618_label","                             261.8", 8, "Times", LabelColor);

      ObjectCreate("fib4236", OBJ_HLINE, 0, Time[40], fib4236);
      ObjectSet("fib4236", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib4236", OBJPROP_COLOR, LineColor);
      ObjectCreate("fib4236_label", OBJ_TEXT, 0, Time[0], fib4236);
      ObjectSetText("fib4236_label","                             423.6", 8, "Times", LabelColor);
      //Print("Objects Exist");
   }

//----
   return(0);
  }
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

AutoDayFibsWhiteKnight.mq4

//+------------------------------------------------------------------+
//|                                                AutoDayFibs V1.0  |
//|                                                                  |
//|              Copyright ? 2005, Jason Robinson                    |
//|               (jasonrobinsonuk,  jnrtrading)                     |
//|                http://www.jnrtrading.co.uk                       |
//|                                                                  |
//|                    Created by jnrtrading                         |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Jason Robinson (jnrtrading)"
#property link      "http://www.jnrtrading.co.uk"

#property indicator_chart_window
extern int daysBackForHigh = 1;
extern int daysBackForLow = 1;

//---- buffers

double Rates[][6];

double fib000,
       fib236,
       fib382,
       fib50,
       fib618,
       fib100,
       fib1618,
       fib2618,
       fib4236,
       range,
       prevRange,
       high,
       low;

bool objectsExist, highFirst;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   //prevRange = 0;
   //objectsExist = false;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("fib000");
   ObjectDelete("fib000_label");
   ObjectDelete("fib236");
   ObjectDelete("fib236_label");
   ObjectDelete("fib382");
   ObjectDelete("fib382_label");
   ObjectDelete("fib50");
   ObjectDelete("fib50_label");
   ObjectDelete("fib618");
   ObjectDelete("fib618_label");
   ObjectDelete("fib100");
   ObjectDelete("fib100_label");
   ObjectDelete("fib1618");
   ObjectDelete("fib1618_label");
   ObjectDelete("fib2618");
   ObjectDelete("fib2618_label");
   ObjectDelete("fib4236");
   ObjectDelete("fib4236_label");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i = 0;
//----
   //Print(prevRange);
   ArrayCopyRates(Rates, Symbol(), PERIOD_D1);

   high = Rates[daysBackForHigh][3];
   low = Rates[daysBackForLow][2];
   range = high - low;

   while(true) {
      if(High[i] == high) {
         highFirst = true;
         break;
      }
      else if(Low[i] == low) {
         highFirst = false;
         break;
      }
      i++;
   }
   //Print(highFirst);

   // Delete Objects if necessary
   if (prevRange != range) {
      ObjectDelete("fib000");
      ObjectDelete("fib000_label");
      ObjectDelete("fib236");
      ObjectDelete("fib236_label");
      ObjectDelete("fib382");
      ObjectDelete("fib382_label");
      ObjectDelete("fib50");
      ObjectDelete("fib50_label");
      ObjectDelete("fib618");
      ObjectDelete("fib618_label");
      ObjectDelete("fib100");
      ObjectDelete("fib100_label");
      ObjectDelete("fib1618");
      ObjectDelete("fib1618_label");
      ObjectDelete("fib2618");
      ObjectDelete("fib2618_label");
      ObjectDelete("fib4236");
      ObjectDelete("fib4236_label");
      objectsExist = false;
      prevRange = range;
      //Print("Objects do not exist");
   }

   if (highFirst == true) {
      fib000 = low;
      fib236 = (range * 0.236) + low;
      fib382 = (range * 0.382) + low;
      fib50 = (high + low) / 2;
      fib618 = (range * 0.618) + low;
      fib100 = high;
      fib1618 = (range * 0.618) + high;
      fib2618 = (range * 0.618) + (high + range);
      fib4236 = (range * 0.236) + high + (range * 3);
   }
   else if (highFirst == false) {
      fib000 = high;
      fib236 = high - (range * 0.236);
      fib382 = high - (range * 0.382);
      fib50  = (high + low) / 2;
      fib618 = high - (range * 0.618);
      fib100 = low;
      fib1618 = low - (range * 0.618);
      fib2618 = (low - range) - (range * 0.618);// + (high + range);
      fib4236 = low - (range * 3) - (range * 0.236);// + high + (range * 3);
   }

   if (objectsExist == false) {
      ObjectCreate("fib000", OBJ_HLINE, 0, Time[40], fib000);
      ObjectSet("fib000", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib000", OBJPROP_COLOR, Orange);
      ObjectCreate("fib000_label", OBJ_TEXT, 0, Time[0], fib000);
      ObjectSetText("fib000_label","                             0.0", 8, "Times", White);

      ObjectCreate("fib236", OBJ_HLINE, 0, Time[40], fib236);
      ObjectSet("fib236", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib236", OBJPROP_COLOR, Orange);
      ObjectCreate("fib236_label", OBJ_TEXT, 0, Time[0], fib236);
      ObjectSetText("fib236_label","                             23.6", 8, "Times", White);

      ObjectCreate("fib382", OBJ_HLINE, 0, Time[40], fib382);
      ObjectSet("fib382", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib382", OBJPROP_COLOR, Orange);
      ObjectCreate("fib382_label", OBJ_TEXT, 0, Time[0], fib382);
      ObjectSetText("fib382_label","                             38.2", 8, "Times", White);

      ObjectCreate("fib50", OBJ_HLINE, 0, Time[40], fib50);
      ObjectSet("fib50", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib50", OBJPROP_COLOR, Orange);
      ObjectCreate("fib50_label", OBJ_TEXT, 0, Time[0], fib50);
      ObjectSetText("fib50_label","                             50.0", 8, "Times", White);

      ObjectCreate("fib618", OBJ_HLINE, 0, Time[40], fib618);
      ObjectSet("fib618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib618", OBJPROP_COLOR, Orange);
      ObjectCreate("fib618_label", OBJ_TEXT, 0, Time[0], fib618);
      ObjectSetText("fib618_label","                             61.8", 8, "Times", White);

      ObjectCreate("fib100", OBJ_HLINE, 0, Time[40], fib100);
      ObjectSet("fib100", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib100", OBJPROP_COLOR, Orange);
      ObjectCreate("fib100_label", OBJ_TEXT, 0, Time[0], fib100);
      ObjectSetText("fib100_label","                             100.0", 8, "Times", White);

      ObjectCreate("fib1618", OBJ_HLINE, 0, Time[40], fib1618);
      ObjectSet("fib1618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib1618", OBJPROP_COLOR, Orange);
      ObjectCreate("fib1618_label", OBJ_TEXT, 0, Time[0], fib1618);
      ObjectSetText("fib1618_label","                             161.8", 8, "Times", White);

      ObjectCreate("fib2618", OBJ_HLINE, 0, Time[40], fib2618);
      ObjectSet("fib2618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib2618", OBJPROP_COLOR, Orange);
      ObjectCreate("fib2618_label", OBJ_TEXT, 0, Time[0], fib2618);
      ObjectSetText("fib2618_label","                             261.8", 8, "Times", White);

      ObjectCreate("fib4236", OBJ_HLINE, 0, Time[40], fib4236);
      ObjectSet("fib4236", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib4236", OBJPROP_COLOR, Orange);
      ObjectCreate("fib4236_label", OBJ_TEXT, 0, Time[0], fib4236);
      ObjectSetText("fib4236_label","                             423.6", 8, "Times", White);
      //Print("Objects Exist");
   }

//----
   return(0);
  }
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

AutoDayFibs.mq4

//+------------------------------------------------------------------+
//|                                                AutoDayFibs V1.0  |
//|                                                                  |
//|              Copyright ? 2005, Jason Robinson                    |
//|               (jasonrobinsonuk,  jnrtrading)                     |
//|                http://www.jnrtrading.co.uk                       |
//|                                                                  |
//|                    Created by jnrtrading                         |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Jason Robinson (jnrtrading)"
#property link      "http://www.jnrtrading.co.uk"

#property indicator_chart_window
extern int daysBackForHigh = 1;
extern int daysBackForLow = 1;

//---- buffers

double Rates[][6];

double fib000,
       fib236,
       fib382,
       fib50,
       fib618,
       fib100,
       fib1618,
       fib2618,
       fib4236,
       range,
       prevRange,
       high,
       low;

bool objectsExist, highFirst;
prevRange = 0;
objectsExist = false;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   //prevRange = 0;
   //objectsExist = false;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("fib000");
   ObjectDelete("fib000_label");
   ObjectDelete("fib236");
   ObjectDelete("fib236_label");
   ObjectDelete("fib382");
   ObjectDelete("fib382_label");
   ObjectDelete("fib50");
   ObjectDelete("fib50_label");
   ObjectDelete("fib618");
   ObjectDelete("fib618_label");
   ObjectDelete("fib100");
   ObjectDelete("fib100_label");
   ObjectDelete("fib1618");
   ObjectDelete("fib1618_label");
   ObjectDelete("fib2618");
   ObjectDelete("fib2618_label");
   ObjectDelete("fib4236");
   ObjectDelete("fib4236_label");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i = 0;
//----
   //Print(prevRange);
   ArrayCopyRates(Rates, Symbol(), PERIOD_D1);

   high = Rates[daysBackForHigh][3];
   low = Rates[daysBackForLow][2];
   range = high - low;

   while(true) {
      if(High[i] == high) {
         highFirst = true;
         break;
      }
      else if(Low[i] == low) {
         highFirst = false;
         break;
      }
      i++;
   }
   //Print(highFirst);

   // Delete Objects if necessary
   if (prevRange != range) {
      ObjectDelete("fib000");
      ObjectDelete("fib000_label");
      ObjectDelete("fib236");
      ObjectDelete("fib236_label");
      ObjectDelete("fib382");
      ObjectDelete("fib382_label");
      ObjectDelete("fib50");
      ObjectDelete("fib50_label");
      ObjectDelete("fib618");
      ObjectDelete("fib618_label");
      ObjectDelete("fib100");
      ObjectDelete("fib100_label");
      ObjectDelete("fib1618");
      ObjectDelete("fib1618_label");
      ObjectDelete("fib2618");
      ObjectDelete("fib2618_label");
      ObjectDelete("fib4236");
      ObjectDelete("fib4236_label");
      objectsExist = false;
      prevRange = range;
      //Print("Objects do not exist");
   }

   if (highFirst == true) {
      fib000 = low;
      fib236 = (range * 0.236) + low;
      fib382 = (range * 0.382) + low;
      fib50 = (high + low) / 2;
      fib618 = (range * 0.618) + low;
      fib100 = high;
      fib1618 = (range * 0.618) + high;
      fib2618 = (range * 0.618) + (high + range);
      fib4236 = (range * 0.236) + high + (range * 3);
   }
   else if (highFirst == false) {
      fib000 = high;
      fib236 = high - (range * 0.236);
      fib382 = high - (range * 0.382);
      fib50  = (high + low) / 2;
      fib618 = high - (range * 0.618);
      fib100 = low;
      fib1618 = low - (range * 0.618);
      fib2618 = (low - range) - (range * 0.618);// + (high + range);
      fib4236 = low - (range * 3) - (range * 0.236);// + high + (range * 3);
   }

   if (objectsExist == false) {
      ObjectCreate("fib000", OBJ_HLINE, 0, Time[40], fib000);
      ObjectSet("fib000", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib000", OBJPROP_COLOR, Orange);
      ObjectCreate("fib000_label", OBJ_TEXT, 0, Time[0], fib000);
      ObjectSetText("fib000_label","                             0.0", 8, "Times", Black);

      ObjectCreate("fib236", OBJ_HLINE, 0, Time[40], fib236);
      ObjectSet("fib236", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib236", OBJPROP_COLOR, Orange);
      ObjectCreate("fib236_label", OBJ_TEXT, 0, Time[0], fib236);
      ObjectSetText("fib236_label","                             23.6", 8, "Times", Black);

      ObjectCreate("fib382", OBJ_HLINE, 0, Time[40], fib382);
      ObjectSet("fib382", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib382", OBJPROP_COLOR, Orange);
      ObjectCreate("fib382_label", OBJ_TEXT, 0, Time[0], fib382);
      ObjectSetText("fib382_label","                             38.2", 8, "Times", Black);

      ObjectCreate("fib50", OBJ_HLINE, 0, Time[40], fib50);
      ObjectSet("fib50", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib50", OBJPROP_COLOR, Orange);
      ObjectCreate("fib50_label", OBJ_TEXT, 0, Time[0], fib50);
      ObjectSetText("fib50_label","                             50.0", 8, "Times", Black);

      ObjectCreate("fib618", OBJ_HLINE, 0, Time[40], fib618);
      ObjectSet("fib618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib618", OBJPROP_COLOR, Orange);
      ObjectCreate("fib618_label", OBJ_TEXT, 0, Time[0], fib618);
      ObjectSetText("fib618_label","                             61.8", 8, "Times", Black);

      ObjectCreate("fib100", OBJ_HLINE, 0, Time[40], fib100);
      ObjectSet("fib100", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib100", OBJPROP_COLOR, Orange);
      ObjectCreate("fib100_label", OBJ_TEXT, 0, Time[0], fib100);
      ObjectSetText("fib100_label","                             100.0", 8, "Times", Black);

      ObjectCreate("fib1618", OBJ_HLINE, 0, Time[40], fib1618);
      ObjectSet("fib1618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib1618", OBJPROP_COLOR, Orange);
      ObjectCreate("fib1618_label", OBJ_TEXT, 0, Time[0], fib1618);
      ObjectSetText("fib1618_label","                             161.8", 8, "Times", Black);

      ObjectCreate("fib2618", OBJ_HLINE, 0, Time[40], fib2618);
      ObjectSet("fib2618", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib2618", OBJPROP_COLOR, Orange);
      ObjectCreate("fib2618_label", OBJ_TEXT, 0, Time[0], fib2618);
      ObjectSetText("fib2618_label","                             261.8", 8, "Times", Black);

      ObjectCreate("fib4236", OBJ_HLINE, 0, Time[40], fib4236);
      ObjectSet("fib4236", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      ObjectSet("fib4236", OBJPROP_COLOR, Orange);
      ObjectCreate("fib4236_label", OBJ_TEXT, 0, Time[0], fib4236);
      ObjectSetText("fib4236_label","                             423.6", 8, "Times", Black);
      //Print("Objects Exist");
   }

//----
   return(0);
  }
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

ATR ratio.mq4

//+------------------------------------------------------------------+
//|                                                    ATR ratio.mq4 |
//|                         Copyright ? 2005, Luis Guilherme Damiani |
//|                                      http://www.damianifx.com.br |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Luis Guilherme Damiani"
#property link      "http://www.damianifx.com.br"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Violet
//---- input parameters
extern int       short_atr=7;
extern int       long_atr=49;
extern double    triglevel=1.00;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   //Comment("ATR ratio= "+short_atr+" / "+long_atr);
   for(int i=0;i<Bars-counted_bars;i++)
   {
      ExtMapBuffer1[i]=triglevel;
      double sa=iATR(NULL,0,short_atr,i);
      ExtMapBuffer2[i]= sa/iATR(NULL,0,long_atr,i);
   }
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

ATR Levels.mq4

//+------------------------------------------------------------------+
//|                                                   ATR Levels.mq4 |
//|                                                    Mike Ischenko |
//|                                            mishanya_fx@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Mike Ischenko"
#property link      "mishanya_fx@yahoo.com"

#property indicator_chart_window

extern int ATRPeriod = 10;

double rates_d1[][6];
double H1, H2, H3, H4, H4t, H5, L5, L4, L4t, L3, L2, L1, halfatr, fullatr;
int timeshift=0, timeshifts=0, beginner=0;
int periods;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

   ObjectDelete("H4atr line");
   ObjectDelete("L4atr line");
   ObjectDelete("L4atr label");
   ObjectDelete("H4atr label");
   ObjectDelete("H4tatr line");
   ObjectDelete("L4tatr line");
   ObjectDelete("L4tatr label");
   ObjectDelete("H4tatr label");

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   //if (counted_bars<1) return(0);

   switch (Period())
   {
      case PERIOD_M1:  {timeshifts=60; beginner=Hour()*60;} break;
      case PERIOD_M5:  {timeshifts=300; beginner=Hour()*12;} break;
      case PERIOD_M15: {timeshifts=900; beginner=Hour()*4;} break;
      case PERIOD_M30: {timeshifts=1800; beginner=Hour()*2;} break;
      case PERIOD_H1:  {timeshifts=3600; beginner=Hour()*1;} break;
      case PERIOD_H4:  {timeshifts=14400; beginner=Hour()*0.25;} break;
      case PERIOD_D1:  {timeshifts=86400; beginner=Hour()*0;} break;
    }

   timeshift=timeshifts*24;

   if(Period() > 86400)
      {
         Print("Error - Chart period is greater than 1 day.");
         return(-1); // then exit
      }

   ArrayCopyRates(rates_d1, Symbol(), PERIOD_D1);

   //beginner=Hour();

            fullatr = iATR(Symbol(), PERIOD_D1, ATRPeriod, 1);

            L4 = rates_d1[1][3] - fullatr;
            H4 = rates_d1[1][2] + fullatr;
            L4t = rates_d1[0][3] - fullatr;
            H4t = rates_d1[0][2] + fullatr;
            halfatr = fullatr * 0.5;

            H1 = H4+1.5*fullatr;
            H2 = H4+fullatr;
            H3 = H4+halfatr;
            L3 = L4-halfatr;
            L2 = L4-fullatr;
            L1 = L4-1.5*fullatr;

   if (ObjectFind("H4atr Line") != 0)
     {
      ObjectCreate("H4atr line",OBJ_HLINE,0,Time[0],H4);
      ObjectSet("H4atr line",OBJPROP_COLOR,Yellow);
      ObjectSet("H4atr line",OBJPROP_WIDTH,1);
     }
     else
     {
     ObjectMove("H4atr line", 0,Time[0],H4);
     }

   if (ObjectFind("L4atr Line") != 0)
     {
      ObjectCreate("L4atr line",OBJ_HLINE,0,Time[0],L4);
      ObjectSet("L4atr line",OBJPROP_COLOR,Yellow);
      ObjectSet("L4atr line",OBJPROP_WIDTH,1);
     }
     else
     {
     ObjectMove("L4atr line", 0,Time[0],L4);
     }

   if (ObjectFind("H4tatr Line") != 0)
     {
      ObjectCreate("H4tatr line",OBJ_HLINE,0,Time[0],H4t);
      ObjectSet("H4tatr line",OBJPROP_COLOR,Yellow);
      ObjectSet("H4tatr line",OBJPROP_WIDTH,1);
     }
     else
     {
     ObjectMove("H4tatr line", 0,Time[0],H4t);
     }

   if (ObjectFind("L4tatr Line") != 0)
     {
      ObjectCreate("L4tatr line",OBJ_HLINE,0,Time[0],L4t);
      ObjectSet("L4tatr line",OBJPROP_COLOR,Yellow);
      ObjectSet("L4tatr line",OBJPROP_WIDTH,1);
     }
     else
     {
     ObjectMove("L4tatr line", 0,Time[0],L4t);
     }

if(ObjectFind("H4atr label") != 0)
      {
      ObjectCreate("H4atr label", OBJ_TEXT, 0, Time[0]+timeshift, H4);
      ObjectSetText("H4atr label", "ATR(y) res: " + DoubleToStr(H4,4), 8, "Verdana", Yellow);
      }
      else
      {
      ObjectMove("H4atr label", 0, Time[0]+timeshift, H4);
      }

if(ObjectFind("L4atr label") != 0)
      {
      ObjectCreate("L4atr label", OBJ_TEXT, 0, Time[0]+timeshift, L4);
      ObjectSetText("L4atr label", "ATR(y) sup: " + DoubleToStr(L4,4), 8, "Verdana", Yellow);
      }
      else
      {
      ObjectMove("L4atr label", 0, Time[0]+timeshift, L4);
      }

if(ObjectFind("H4tatr label") != 0)
      {
      ObjectCreate("H4tatr label", OBJ_TEXT, 0, Time[0]+timeshift, H4t);
      ObjectSetText("H4tatr label", "ATR(t) res: " + DoubleToStr(H4t,4), 8, "Verdana", Yellow);
      }
      else
      {
      ObjectMove("H4tatr label", 0, Time[0]+timeshift, H4t);
      }

if(ObjectFind("L4tatr label") != 0)
      {
      ObjectCreate("L4tatr label", OBJ_TEXT, 0, Time[0]+timeshift, L4t);
      ObjectSetText("L4tatr label", "ATR(t) sup: " + DoubleToStr(L4t,4), 8, "Verdana", Yellow);
      }
      else
      {
      ObjectMove("L4tatr label", 0, Time[0]+timeshift, L4t);
      }

   return(0);
  }
//+------------------------------------------------------------------+

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

ATR Channels.mq4

//+------------------------------------------------------------------+
//|                                                 ATR Channels.mq4 |
//|                         Copyright ? 2005, Luis Guilherme Damiani |
//|                                      http://www.damianifx.com.br |
//+------------------------------------------------------------------+

#property copyright "Copyright ? 2005, Luis Guilherme Damiani"
#property link      "http://www.damianifx.com.br"
#property indicator_chart_window
#property  indicator_buffers 7
#property  indicator_color1  Aqua //Moving Average
#property  indicator_color2  DeepSkyBlue // Lower band 1
#property  indicator_color3  DeepSkyBlue // Upper band 1
#property  indicator_color4  RoyalBlue // Lower band 2
#property  indicator_color5  RoyalBlue // Upper band 2
#property  indicator_color6  BlueViolet // Lower band 3
#property  indicator_color7  BlueViolet // Upper band 3
//---- indicator buffers
double     MA_Buffer0[];
double     Ch1up_Buffer1[];
double     Ch1dn_Buffer2[];
double     Ch2up_Buffer3[];
double     Ch2dn_Buffer4[];
double     Ch3up_Buffer5[];
double     Ch3dn_Buffer6[];

//---- input parameters
extern int       PeriodsATR=18;
extern int       MA_Periods=49;
extern int       MA_type=MODE_LWMA;
extern double       Mult_Factor1= 1.6;
extern double       Mult_Factor2= 3.2;
extern double       Mult_Factor3= 4.8;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  string mat;

//---7- indicators
// MA
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MA_Buffer0);
   SetIndexDrawBegin(0,0);
   /*if (MA_type==MODE_LWMA)SetIndexLabel(0,"WMA"+MA_Periods) else
   {
      if (MA_type==MODE_SMA) SetIndexLabel(0,"SMA"+MA_Periods) else
      {
         if (MA_type==MODE_EMA) SetIndexLabel(0,"EMA"+MA_Periods) else
         SetIndexLabel(0,"SMMA"+MA_Periods);
      };
   };*/
  // ATR 1 up
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,Ch1up_Buffer1);
   SetIndexDrawBegin(1,0);
   SetIndexLabel(1,"ATRu "+PeriodsATR+", "+Mult_Factor1);
  // ATR 1 down
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,Ch1dn_Buffer2);
   SetIndexDrawBegin(2,0);
   SetIndexLabel(2,"ATRd "+PeriodsATR+", "+Mult_Factor1);
// ATR 2 up
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,Ch2up_Buffer3);
   SetIndexDrawBegin(3,0);
   SetIndexLabel(3,"ATRu "+PeriodsATR+", "+Mult_Factor2);
  // ATR 2 down
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,Ch2dn_Buffer4);
   SetIndexDrawBegin(4,0);
   SetIndexLabel(4,"ATRd "+PeriodsATR+", "+Mult_Factor2);
   // ATR 3 up
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,Ch3up_Buffer5);
   SetIndexDrawBegin(5,0);
   SetIndexLabel(5,"ATRu "+PeriodsATR+", "+Mult_Factor3);
  // ATR 3 down
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,Ch3dn_Buffer6);
   SetIndexDrawBegin(6,0);
   SetIndexLabel(6,"ATRd "+PeriodsATR+", "+Mult_Factor3);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int fixed_bars=IndicatorCounted();
   for(int i=0;i< Bars - fixed_bars;i++)
     {
         double atr=iATR(NULL,0,PeriodsATR,i);
         double ma=iMA(NULL,0,MA_Periods,0,MA_type,PRICE_TYPICAL,i);
         MA_Buffer0[i]=ma;
         Ch1up_Buffer1[i]=ma+atr*Mult_Factor1;
         Ch1dn_Buffer2[i]=ma-atr*Mult_Factor1;

         Ch2up_Buffer3[i]=ma+atr*Mult_Factor2;
         Ch2dn_Buffer4[i]=ma-atr*Mult_Factor2;

         Ch3up_Buffer5[i]=ma+atr*Mult_Factor3;
         Ch3dn_Buffer6[i]=ma-atr*Mult_Factor3;
      }

//----

//----
   return(0);
  }

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

 Page 1 of 6  1  2  3  4  5 » ...  Last » 

Tweet This Post links powered by Tweet This v1.3.9, a WordPress plugin for Twitter.