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
2008 August :forex decode

Archive for August, 2008

KiS_Avg.mq4

//+------------------------------------------------------------------+
//| KiS_max_min_Avg.mq4 |
//+------------------------------------------------------------------+
/*[[
Name := KiS_max_min_Avg
Author := KCBT
Link := http://www.kcbt.ru/forum/index.php?
]]*/

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 MediumOrchid
#property indicator_color2 Aqua
#property indicator_color3 MediumOrchid
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(2, DRAW_LINE);
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int shift, i, CurDay, BarCount;
double DayMax, DayMin;
double DayOpen, DayClose, Avg;

for (shift=Bars-1; shift>=0; shift--) {
if (CurDay != TimeDay(Time[shift])) {
for (i=BarCount; i>=0; i--) {
ExtMapBuffer1[shift+i] = DayMax;
ExtMapBuffer2[shift+i] = (DayMax+DayMin)/2;
ExtMapBuffer3[shift+i] = DayMin;
}
CurDay = TimeDay(Time[shift]);
BarCount = 0;
DayMax = 0;
DayMin = 1000; //???? ???, ?? ?????? ? ????
DayOpen = Open[shift];
}
if (DayMax < High[shift]) {DayMax = High[shift];}
if (DayMin > Low[shift]) {DayMin = Low[shift];}
BarCount = BarCount + 1;
}

// ?? ????? ?????, ??????? ??, ??
for (i=BarCount; i>=0; i--) {
ExtMapBuffer1[shift+i] = DayMax;
ExtMapBuffer2[shift+i] = (DayMax+DayMin)/2;
ExtMapBuffer3[shift+i] = DayMin;
}
DayClose = Close[0];
Avg = (DayMax+DayMin)/2; //????? ? ???? ??

Comment("Max:", DayMax," Min:", DayMin, "\n", "Avg:", Avg, " Width:", (DayMax-DayMin)/Point,"\n","From Avg to Open:",MathRound(MathAbs(Avg-DayOpen)/Point),"\n","From Avg to Close:",MathRound(MathAbs(Avg-DayClose)/Point));
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 

KijunTenkan+.mq4

//+------------------------------------------------------------------+
//|                                                     Ichimoku.mq4 |
//|                      Copyright ? 2004, MetaQuotes Software Corp. |
//|                      Copyright ? 2004, AlexSilver ? ??? +      |
//|                                       http://www.metaquotes.net/ |
//|                                       http://www.viac.ru/        |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2004, AlexSilver ? ??? +"
#property link      "http://www.viac.ru/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int Tenkan=9;
extern int Kijun=26;
extern int TenkanShift=3;
extern int KijunShift=9;
//---- buffers
double Tenkan_Buffer[];
double Kijun_Buffer[];
//----
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- ??? Tenkan-sen
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Tenkan_Buffer);
   SetIndexDrawBegin(0,Tenkan+TenkanShift-1);
   SetIndexShift(0,TenkanShift);
   SetIndexLabel(0,"Tenkan Sen");
//---- ??? Kijun-sen
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,Kijun_Buffer);
   SetIndexDrawBegin(1,Kijun+KijunShift-1);
   SetIndexShift(1,KijunShift);
   SetIndexLabel(1,"Kijun Sen");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k;
   int    counted_bars=IndicatorCounted();
   double high,low,price;
//----
   if(Bars<=Tenkan || Bars<=Kijun) return(0);
//---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=Tenkan;i++)    Tenkan_Buffer[Bars-i]=0;
      for(i=1;i<=Kijun;i++)     Kijun_Buffer[Bars-i]=0;
     }
//---- Tenkan Sen
   i=Bars-Tenkan;
   if(counted_bars>Tenkan) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Tenkan;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Tenkan_Buffer[i+TenkanShift]=(high+low)/2;
      i--;
     } i=TenkanShift-1;
   while(i>=0)
     {
      high=High[0]; low=Low[0]; k=Tenkan-TenkanShift+i;
      while(k>=0)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price) low=price;
         k--;
        }
      Tenkan_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Kijun Sen
   i=Bars-Kijun;
   if(counted_bars>Kijun) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price) low=price;
         k--;
        }
      Kijun_Buffer[i+KijunShift]=(high+low)/2;
      i--;
     } i=KijunShift-1;
   while(i>=0)
     {
      high=High[0]; low=Low[0]; k=Kijun-KijunShift+i;
      while(k>=0)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price) low=price;
         k--;
        }
      Kijun_Buffer[i]=(high+low)/2;
      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 

Kijun-sen+.mq4

//+------------------------------------------------------------------+
//|                                                    Kijun-sen.mq4 |
//|                                     Copyright ? 2004, AlexSilver |
//|                                                  http://viac.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2004, AlexSilver"
#property link      "http://viac.ru/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DeepSkyBlue
//---- input parameters
extern int Kijun=26;
extern int ShiftKijun=3;
//---- buffers
double Kijun_Buffer[];
//----
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//----
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Kijun_Buffer);
   SetIndexDrawBegin(0,Kijun+ShiftKijun-1);
   SetIndexShift(0,ShiftKijun);
   SetIndexLabel(0,"Kijun Sen+");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo Kijun-sen Only                                |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k;
   int    counted_bars=IndicatorCounted();
   double high,low,price;
//----
   if(Bars<=Kijun) return(0);
//---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=Kijun;i++)     Kijun_Buffer[Bars-i]=0;
     }
//---- Kijun Sen
   i=Bars-Kijun;
   if(counted_bars>Kijun) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price) low=price;
         k--;
        }
      Kijun_Buffer[i+ShiftKijun]=(high+low)/2;
      i--;
     } i=ShiftKijun-1;
   while(i>=0)
     {
      high=High[0]; low=Low[0]; k=Kijun-ShiftKijun+i;
      while(k>=0)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price) low=price;
         k--;
        }
      Kijun_Buffer[i]=(high+low)/2;
      i--;
     }
   }
//+------------------------------------------------------------------+

[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 

KI_signals_v2.mq4

//+------------------------------------------------------------------+
//|                                                KI_signals_v1.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 SteelBlue
#property indicator_color2 Orange
#property indicator_color3 DodgerBlue
#property indicator_color4 Magenta
#property indicator_color5 Blue
#property indicator_color6 Red

#property indicator_level1 0

extern int Length1 = 3;
extern int Length2 = 10;
extern int Length3 = 16;
 bool showHL = false;
 bool showCrosses = false;

double Histo[];
double MaHisto[];

double up[];
double dn[];

double high[];
double valley[];

double cUp[];
double cDn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- additional buffers are used for counting
   IndicatorBuffers(8);

   SetIndexStyle(0,DRAW_ARROW,EMPTY,0);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,0);

   SetIndexStyle(2,DRAW_ARROW,EMPTY,1);
   SetIndexStyle(3,DRAW_ARROW,EMPTY,1);

   SetIndexStyle(4,DRAW_ARROW,EMPTY,0);
   SetIndexStyle(5,DRAW_ARROW,EMPTY,0);

   SetIndexArrow(0,217);
   SetIndexArrow(1,218);

   SetIndexArrow(2,233);
   SetIndexArrow(3,234);

   SetIndexArrow(4,108);
   SetIndexArrow(5,108);

   IndicatorDigits(6);

   SetIndexBuffer(0,high);
   SetIndexBuffer(1,valley);

   SetIndexBuffer(2,up);
   SetIndexBuffer(3,dn);

   SetIndexBuffer(4,cUp);
   SetIndexBuffer(5,cDn);

   SetIndexBuffer(6,Histo);
   SetIndexBuffer(7,MaHisto);

   IndicatorShortName("KI signals v1");

   SetIndexLabel(2,"UP SIGNAL");
   SetIndexLabel(3,"DN SIGNAL");

   return(0);
  }
//+------------------------------------------------------------------+
//| SignalIndicator                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//----

   for(int i = 0 ;i <= limit ;i++)Histo[i] = iMA(Symbol(),0,Length1,0,MODE_EMA,PRICE_CLOSE,i) - iMA(Symbol(),0,Length2,0,MODE_EMA,PRICE_CLOSE,i);

   for(int j = 0 ;j <= limit ;j++)MaHisto[j] = iMAOnArray(Histo,0,Length3,0,MODE_EMA,j);

   for(int m = 0 ;m <= limit ;m++)
   {
      if(MaHisto[m+1] <= 0 && MaHisto[m]>0)
      {
         up[m] = Open[m]-(5*Point);
      }

      if(MaHisto[m+1] >= 0 && MaHisto[m]<0)
      {
         dn[m] = Open[m]+(5*Point);
      }

      if(showHL)
      {
         if(Histo[m]<= 0 && Histo[m+2]<= Histo[m+1] && Histo[m+1]>Histo[m])
         {
            high[m+1] = High[m+1]+(2*Point);
         }

         if(Histo[m]>= 0 && Histo[m+2]>= Histo[m+1] && Histo[m+1]<Histo[m])
         {
            valley[m+1] = Low[m+1]+(2*Point);
         }
      }

      if(showCrosses)
      {
         if(Histo[m+1] <= MaHisto[m+1] && Histo[m] > MaHisto[m])
         {
            cUp[m] = Open[m];
         }

         if(Histo[m+1] >= MaHisto[m+1] && Histo[m] < MaHisto[m])
         {
            cDn[m] = Open[m];
         }
      }

   }
//----
 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 

KI_signals1_H1+low_3-10-18_optimized.mq4

//+------------------------------------------------------------------+
//|                                                KI_signals_v1.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 AliceBlue
#property indicator_color2 AliceBlue
#property indicator_color3 DarkViolet
#property indicator_color4 DarkViolet

#property indicator_level1 0

extern int Length1 = 3;
extern int Length2 = 10;
extern int Length3 = 18;

// 60[min] = PERIOD_H1
int period = 60;

double Histo[];
double MaHisto[];

double Histoh1[];
double MaHistoh1[];

double up[];
double dn[];

double uph1[];
double dnh1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- additional buffers are used for counting
   IndicatorBuffers(8);

   SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,1);

   SetIndexStyle(2,DRAW_ARROW,EMPTY,1);
   SetIndexStyle(3,DRAW_ARROW,EMPTY,1);

   SetIndexArrow(0,241);
   SetIndexArrow(1,242);

   SetIndexArrow(2,241);
   SetIndexArrow(3,242);

//   IndicatorDigits(6);

   SetIndexBuffer(0,up);
   SetIndexBuffer(1,dn);

   SetIndexBuffer(2,uph1);
   SetIndexBuffer(3,dnh1);

   SetIndexBuffer(4,Histoh1);
   SetIndexBuffer(5,MaHistoh1);
   SetIndexBuffer(6,Histo);
   SetIndexBuffer(7,MaHisto);

//   IndicatorShortName("KI signals v1");

   return(0);
}

int start()
  {
   int limit;
   int counted_bars;// = IndicatorCounted();

   int tmp, i, j, m;

   // this is fro M30 (we are on it), but we want for H1
   counted_bars = IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;

  // ----------- H1

   // this is for H1, but counted_bars is for M30
   // so...
   limit = (Bars-counted_bars)/(period/Period()) + 1;
//   limit=iBars(Symbol(),period)-1;//counted_bars;

   for (i = 0 ;i <= limit ;i++)Histoh1[i] = iMA(Symbol(),period,Length1,0,MODE_EMA,PRICE_CLOSE,i) - iMA(Symbol(),period,Length2,0,MODE_EMA,PRICE_CLOSE,i);
   for (j = 0 ;j <= limit ;j++)MaHistoh1[j] = iMAOnArray(Histoh1,0,Length3,0,MODE_EMA,j);
   for (m = 0 ;m <= limit ;m++)
   {
      if(MaHistoh1[m+1] <= 0 && MaHistoh1[m]>0)
      {
         tmp = iTime (Symbol(),period,m);
         for (j = 0; j < Bars; j++)
         {
           if (iTime(Symbol(),0,j) == tmp)
            uph1[j-period/Period()+1] = iOpen(Symbol(),period,m)-(20*Point);
         }
      }

      if(MaHistoh1[m+1] >= 0 && MaHistoh1[m]<0)
      {
         tmp = iTime (Symbol(),period,m);
         for (j = 0; j < Bars; j++)
         {
           if (iTime(Symbol(),0,j) == tmp)
            dnh1[j-period/Period()+1] = iOpen(Symbol(),period,m)+(20*Point);
         }
      }
   }

  // ----------- M30

  counted_bars = IndicatorCounted();

  if(counted_bars<0) counted_bars=0;
  if(counted_bars>0) counted_bars--;

  limit=Bars-counted_bars;

   for (i = 0 ;i <= limit ;i++)Histo[i] = iMA(Symbol(),0,Length1,0,MODE_EMA,PRICE_CLOSE,i) - iMA(Symbol(),0,Length2,0,MODE_EMA,PRICE_CLOSE,i);
   for (j = 0 ;j <= limit ;j++)MaHisto[j] = iMAOnArray(Histo,0,Length3,0,MODE_EMA,j);
   for (m = 0 ;m <= limit ;m++)
   {
      if(MaHisto[m+1] <= 0 && MaHisto[m]>0)
      {
        for (i = m+1; i < limit; i++)
        {
          if (uph1[i] != dnh1[i])
          {
            if (uph1[i] < dnh1[i])
              up[m] = iOpen(Symbol(),0,m)-(20*Point);
            else
              break;
          }
        }
      }
      if(MaHisto[m+1] >= 0 && MaHisto[m]<0)
      {
        for (i = m+1; i < limit; i++)
        {
          if (uph1[i] != dnh1[i])
          {
            if (uph1[i] > dnh1[i])
              dn[m] = iOpen(Symbol(),0,m)+(20*Point);
            else
              break;
          }
        }
      }
   }

  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 

KhaosAssault2.mq4

//+------------------------------------------------------------------+
//|                                                 KhaosAssault.mq4 |
//|                                                         SGalaise |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Sgalaise"

#property indicator_separate_window
#property indicator_buffers 3
#property  indicator_color1  Black
#property  indicator_color2  LawnGreen
#property  indicator_color3  Red

//---- input parameters
extern int       FastMovingMAType=3;
extern int       FastMovingMAPeriod=5;
extern int       SlowMovingMAType=1;
extern int       SlowMovingMAPeriod=120;

//---- buffers
double CAOBuffer0[];
double CAOBuffer1[];
double CAOBuffer2[];

string SlowMA = "";
string FastMA = "";

double prev,current;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //IndicatorBuffers(3);

   switch(FastMovingMAType)
   {
      case 0: FastMA = "SMA"; break;
      case 1: FastMA = "EMA"; break;
      case 2: FastMA = "SMMA"; break;
      case 3: FastMA = "LWMA"; break;
   }

   switch(SlowMovingMAType)
   {
      case 0: SlowMA = "SMA"; break;
      case 1: SlowMA = "EMA"; break;
      case 2: SlowMA = "SMMA"; break;
      case 3: SlowMA = "LWMA"; break;
   }
//   IndicatorBuffers(3);

//---- indicators
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM,0,3,LawnGreen);
   SetIndexStyle(2,DRAW_HISTOGRAM,0,3,Red);
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,SlowMovingMAPeriod);
   SetIndexDrawBegin(1,SlowMovingMAPeriod);
   SetIndexDrawBegin(2,SlowMovingMAPeriod);

   SetIndexBuffer(0,CAOBuffer0);
   SetIndexBuffer(1,CAOBuffer1);
   SetIndexBuffer(2,CAOBuffer2);

//----
   IndicatorShortName("KhaosAssault ("+FastMA+":"+FastMovingMAPeriod+", "+SlowMA+":"+SlowMovingMAPeriod+")");
   int findsymbol = StringFind(Symbol(),"JPY",0);
   //Alert(findsymbol);
   if(findsymbol<0)
   {
      SetLevelStyle(1,1,SteelBlue);
      SetLevelValue(1,0.0089);
      SetLevelValue(2,0.0055);
      SetLevelValue(3,0.0034);
      SetLevelValue(4,0.0021);
      SetLevelValue(5,0.0013);
      SetLevelValue(6,-0.0013);
      SetLevelValue(7,-0.0021);
      SetLevelValue(8,-0.0034);
      SetLevelValue(9,-0.0055);
      SetLevelValue(10,-0.0089);
   }
   else
   {
      SetLevelStyle(1,1,SteelBlue);
      SetLevelValue(1,0.89);
      SetLevelValue(2,0.55);
      SetLevelValue(3,0.34);
      SetLevelValue(4,0.21);
      SetLevelValue(5,0.13);
      SetLevelValue(6,-0.13);
      SetLevelValue(7,-0.21);
      SetLevelValue(8,-0.34);
      SetLevelValue(9,-0.55);
      SetLevelValue(10,-0.89);
   }

   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();

//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd
   for(int i=0; i<limit; i++)
      CAOBuffer0[i]=iMA(NULL,0,FastMovingMAPeriod,0,FastMovingMAType,PRICE_CLOSE,i)-iMA(NULL,0,SlowMovingMAPeriod,0,SlowMovingMAType,PRICE_CLOSE,i);

//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=CAOBuffer0[i];
      prev=CAOBuffer0[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         CAOBuffer2[i]=current;
         CAOBuffer1[i]=0.0;
        }
      else
        {
         CAOBuffer1[i]=current;
         CAOBuffer2[i]=0.0;
        }
     }

   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 

Keltner_Channels.mq4

//+------------------------------------------------------------------+
//|                                             Keltner Channels.mq4 |
//|                                                  Coded by Gilani |
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 White

double upper[], middle[], lower[];
extern int period = 10;

int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexShift(0,0);
   SetIndexDrawBegin(0,0);
   SetIndexBuffer(0,upper);

   SetIndexStyle(1,DRAW_LINE);
   SetIndexShift(1,0);
   SetIndexDrawBegin(1,0);
   SetIndexBuffer(1,middle);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexShift(2,0);
   SetIndexDrawBegin(2,0);
   SetIndexBuffer(2,lower);

return(0);
}
int deinit(){return(0);}
int start() {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   double avg;

   for(int x=0; x<limit; x++) {
      middle[x] = iMA(NULL, 0, period, 0, MODE_SMA, PRICE_CLOSE, x);
      avg  = findAvg(period, x);
      upper[x] = middle[x] + avg;
      lower[x] = middle[x] - avg;
   }
   return(0);
  }
//+------------------------------------------------------------------+

   double findAvg(int period, int shift) {
      double sum=0;
      for (int x=shift;x<(shift+period);x++) {
         sum += High[x]-Low[x];
      }
      sum = sum/period;
      return (sum);
   }

[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 

Keltner_ATR_Band.mq4

//+------------------------------------------------------------------+
//|                                           Keltner ATR Bands .mq4 |
//|                                     This is not Keltner Channels |
//|                                                                  |
//|                                        Converted by : Dr. Gaines |
//|                                      dr_richard_gaines@yahoo.com |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright " Copyright ? 2005, MetaQuotes Software Corp."
#property link      " http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White
#include <stdlib.mqh>
//+------------------------------------------------------------------+
//| Common External variables                                        |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| External variables                                               |
//+------------------------------------------------------------------+
extern double MAPeriod = 50;
extern double ATRMult = 3.75;

//+------------------------------------------------------------------+
//| Special Convertion Functions                                     |
//+------------------------------------------------------------------+

double ExtHistoBuffer[];
double ExtHistoBuffer2[];

//+------------------------------------------------------------------+
//| Initialization                                                   |
//+------------------------------------------------------------------+

int init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(0, ExtHistoBuffer);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(1, ExtHistoBuffer2);
   return(0);
}
int start()
{
//+------------------------------------------------------------------+
//| Local variables                                                  |
//+------------------------------------------------------------------+
double ma = 0;
double atr = 0;
double KU = 0;
double KL = 0;
   int limit, shift;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

/*[[
    Name := Keltner ATR Bands
    Author := Copyright ? 2005, MetaQuotes Software Corp.
    Link := http://www.metaquotes.net/
    Separate Window := No
    First Color := White
    First Draw Type := Line
    First Symbol := 217
    Use Second Data := Yes
    Second Color := White
    Second Draw Type := Line
    Second Symbol := 218
]]*/

// loop from first bar to current bar (with shift=0)
for(shift=limit;shift>=0 ;shift--){
    ma = iMA(NULL, 0, MAPeriod, 0,  MODE_SMA, PRICE_CLOSE,  shift);
    atr = iATR(NULL, 0, MAPeriod, shift);
    KU = ma + ATRMult*atr;
    KL = ma - ATRMult*atr;

  ExtHistoBuffer[shift] = KU;
  ExtHistoBuffer2[shift] = KL;

}
  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 

Keltner_ATR_Band mt4.mq4

//+------------------------------------------------------------------+
//|                                           Keltner ATR Bands .mq4 |
//|                                     This is not Keltner Channels |
//|                                                                  |
//|                                        Converted by : Dr. Gaines |
//|                                      dr_richard_gaines@yahoo.com |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright " Copyright ? 2005, MetaQuotes Software Corp."
#property link      " http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White
#include <stdlib.mqh>
//+------------------------------------------------------------------+
//| Common External variables                                        |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| External variables                                               |
//+------------------------------------------------------------------+
extern double MAPeriod = 50;
extern double ATRMult = 3.75;

//+------------------------------------------------------------------+
//| Special Convertion Functions                                     |
//+------------------------------------------------------------------+

int LastTradeTime;
double ExtHistoBuffer[];
double ExtHistoBuffer2[];

void SetLoopCount(int loops)
{
}

void SetIndexValue(int shift, double value)
{
  ExtHistoBuffer[shift] = value;
}

void SetIndexValue2(int shift, double value)
{
  ExtHistoBuffer2[shift] = value;
}

//+------------------------------------------------------------------+
//| End                                                              |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Initialization                                                   |
//+------------------------------------------------------------------+

int init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(0, ExtHistoBuffer);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(1, ExtHistoBuffer2);
   return(0);
}
int start()
{
//+------------------------------------------------------------------+
//| Local variables                                                  |
//+------------------------------------------------------------------+
int shift = 0;
double ma = 0;
double atr = 0;
double KU = 0;
double KL = 0;

/*[[
    Name := Keltner ATR Bands
    Author := Copyright ? 2005, MetaQuotes Software Corp.
    Link := http://www.metaquotes.net/
    Separate Window := No
    First Color := White
    First Draw Type := Line
    First Symbol := 217
    Use Second Data := Yes
    Second Color := White
    Second Draw Type := Line
    Second Symbol := 218
]]*/

SetLoopCount(0);
// loop from first bar to current bar (with shift=0)
for(shift=Bars-1;shift>=0 ;shift--){
    ma = iMA(NULL, 0, MAPeriod, 0,  MODE_SMA, PRICE_CLOSE,  shift);
    atr = iATR(NULL, 0, MAPeriod, shift);
    KU = ma + ATRMult*atr;
    KL = ma - ATRMult*atr;
    SetIndexValue(shift, KU);
    SetIndexValue2(shift, KL);
}
  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 

Keltner Channels.mq4

//+------------------------------------------------------------------+
//|                                             Keltner Channels.mq4 |
//|                                                  Coded by Gilani |
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 White

double upper[], middle[], lower[];
extern int period = 10;

int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexShift(0,0);
   SetIndexDrawBegin(0,0);
   SetIndexBuffer(0,upper);

   SetIndexStyle(1,DRAW_LINE);
   SetIndexShift(1,0);
   SetIndexDrawBegin(1,0);
   SetIndexBuffer(1,middle);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexShift(2,0);
   SetIndexDrawBegin(2,0);
   SetIndexBuffer(2,lower);

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

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

   double avg;

   for(int x=0; x<limit; x++) {
      middle[x] = iMA(NULL, 0, period, 0, MODE_SMA, PRICE_TYPICAL, x);
      avg  = findAvg(period, x);
      upper[x] = middle[x] + avg;
      lower[x] = middle[x] - avg;
   }
   return(0);
  }
//+------------------------------------------------------------------+

   double findAvg(int period, int shift) {
      double sum=0;
      for (int x=shift;x<(shift+period);x++) {
         sum += High[x]-Low[x];
      }
      sum = sum/period;
      return (sum);
   }

[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 46  1  2  3  4  5 » ...  Last » 

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