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
R :forex decode

R Archives

rvmGann_sv8_n.mq4

//+------------------------------------------------------------------+
//|                                                  rvmGann_sv8.mq4 |
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 DeepSkyBlue
#property indicator_color2 DeepSkyBlue
//#property indicator_color3 DeepSkyBlue
//#property indicator_color4 DeepSkyBlue
//#property indicator_color5 DeepSkyBlue
//#property indicator_color6 DeepSkyBlue
//#property indicator_color7 DeepSkyBlue
//#property indicator_color8 DeepSkyBlue
//---- input parameters
extern int GSv_tend=2;
//---- buffers
double Upz[];
double Dnz[];
double sH[];
double sL[];
double aH[];
double aL[];
double fB[];
double lB[];
//----------
double CurH,CurL;
int lb,sp,lbars;
bool draw_up,draw_dn;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(8);
   SetIndexStyle(0,DRAW_ZIGZAG,STYLE_SOLID);
   SetIndexStyle(1,DRAW_ZIGZAG,STYLE_SOLID);
   SetIndexStyle(2,DRAW_NONE);
   SetIndexStyle(3,DRAW_NONE);
   SetIndexStyle(4,DRAW_NONE);
   SetIndexStyle(5,DRAW_NONE);
   SetIndexStyle(6,DRAW_NONE);
   SetIndexStyle(7,DRAW_NONE);
   SetIndexBuffer(0,Upz);
   SetIndexBuffer(1,Dnz);
   SetIndexBuffer(2,sH);
   SetIndexBuffer(3,sL);
   SetIndexBuffer(4,aH);
   SetIndexBuffer(5,aL);
   SetIndexBuffer(6,fB);
   SetIndexBuffer(7,lB);
   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);
   SetIndexEmptyValue(2,0);
   SetIndexEmptyValue(3,0);
   SetIndexEmptyValue(4,-1);
   SetIndexEmptyValue(5,-1);
   SetIndexEmptyValue(6,-1);
   SetIndexEmptyValue(7,-1);
   SetIndexLabel(0,"z1");
   SetIndexLabel(1,"z2");
   SetIndexLabel(2,"sH");
   SetIndexLabel(3,"sL");
   SetIndexLabel(4,"aH");
   SetIndexLabel(5,"aL");
   SetIndexLabel(6,"fB");
   SetIndexLabel(7,"lB");
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int cb,index,limit,ai,i;
//----
   if( !counted_bars<0 )
   {
      index=Bars-1;
      if( index-counted_bars<2 )
      {
         limit=0;
      }
      else
      {
         limit=index-counted_bars-1;
      }
   }
   else
   {
      Alert("?? ???? ????? rvmGSv_mt");
      return(-1);
   }
//----
for( cb=limit; cb>=0; cb-- )
{
   ai=index-cb;
   if( lbars!=Bars && lb==ai )
   {
      lbars=Bars;
      continue;
   }
   if( lb!=ai )
   {
      lb=ai;
      if( Upz[cb+1]>0 || Dnz[cb+1]>0 )
      {
         aH[cb]=High[cb+1];
         aL[cb]=Low[cb+1];
      }
      else
      {
         if( High[cb+1]<=aH[cb+1] && Low[cb+1]>=aL[cb+1] )
         {
            aH[cb]=aH[cb+1];
            aL[cb]=aL[cb+1];
            sH[cb]=sH[cb+1];
            sL[cb]=sL[cb+1];
         }
         else
         {
            if( High[cb+1]>aH[cb+1] )
            {
               aH[cb]=High[cb+1];
            }
            else
            {
               aH[cb]=aH[cb+1];
            }
            if( aL[cb+1]>0 )
            {
               if( Low[cb+1]<aL[cb+1] )
               {
                  aL[cb]=Low[cb+1];
               }
               else
               {
                  aL[cb]=aL[cb+1];
               }
            }
            else
            {
               aL[cb]=Low[cb+1];
            }
         }
      }
      if( draw_up!=0 )
      {
         if( fB[cb+1]==1 )
         {
            sH[cb]=sH[cb+1]+1;
            if( lB[cb+1]==0 )
            {
               sH[cb]=0;
               sL[cb]=1;
            }
         }
         else
         {
            if( fB[cb+1]==0 )
            {
               sL[cb]=sL[cb+1]+1;
               if( lB[cb+1]==1 )
               {
                  sH[cb]=1;
                  sL[cb]=0;
               }
            }
         }
      }
      else
      {
         if( draw_dn!=0 )
         {
            if( fB[cb+1]==0 )
            {
               sL[cb]=sL[cb+1]+1;
               if( lB[cb+1]==1 )
               {
                  sH[cb]=1;
                  sL[cb]=0;
               }
            }
            else
            {
               if( fB[cb+1]==1 )
               {
                  sH[cb]=sH[cb+1]+1;
                  if( lB[cb+1]==0 )
                  {
                     sH[cb]=0;
                     sL[cb]=1;
                  }
               }
            }
         }
         else
         {
            if( fB[cb+1]==1 )
            {
               sH[cb]=sH[cb+1]+1;
               sL[cb]=sL[cb+1];
               if( lB[cb+1]==0 )
               {
                  sL[cb]++;
               }
            }
            else
            {
               if( fB[cb+1]==0 )
               {
                  sH[cb]=sH[cb+1];
                  sL[cb]=sL[cb+1]+1;
                  if( lB[cb+1]==1 )
                  {
                     sH[cb]++;
                  }
               }
            }
         }
      }
      if( GSv_tend>1 )
      {
         //?? ? ????? ??? ?? ?????? ??? ? ?? ????? ? ????? ? ????? + ????? ????
         if( sH[cb]==GSv_tend && Upz[cb+1]>0 && High[cb+1]>High[cb+2] && Low[cb+1]<Low[cb+2] && fB[cb+1]==1 )
         {
            sL[cb]=1;
         }
         else //??? ?? ? ????? ??? ???? ?? ?????? ???
         {
            //?? ? ????? ??? ?? ?????? ?? ? ?? ????? ? ????? ? ????? + ????? ????
            if( sL[cb]==GSv_tend && Dnz[cb+1]>0 && High[cb+1]>High[cb+2] && Low[cb+1]<Low[cb+2] && fB[cb+1]==0 )
            {
               sH[cb]=1;
            }
         }
      }
      //?????
      CurH=0;
      CurL=Low[cb];
   }
   if( High[cb]<=aH[cb] && Low[cb]>=aL[cb] )
   {
      continue;
   }
   if( High[cb]<=CurH && Low[cb]>=CurL )
   {
      continue;
   }
   if( High[cb]>CurH ) CurH=High[cb];
   if( Low[cb] <CurL ) CurL=Low[cb];
   Extr_seq(cb);
   //?? ??? ?? ? ??? ????, ? ?? ??? ??-????? ???? ????, ? ?? ???-??, ????? ???? ?????
   if( GSv_tend>1 )
   {
      if( fB[cb]>0 && sH[cb]==GSv_tend-1 && sL[cb]>0 )
      {
         sL[cb]=0;
      }
      else
      {
         if( fB[cb]>-1 && sL[cb]==GSv_tend-1 && sH[cb]>0 )
         {
            sH[cb]=0;
         }
      }
   }
   if( draw_up!=0 )
   {
      if( fB[cb]==1 )
      {
         if( sp!=ai )
         {
            Upz[index-sp]=0;
            sp=ai;
         }
         Upz[cb]=High[cb];
         if( lB[cb]==0 && (sL[cb]+1)>=GSv_tend && GSv_tend<2 )
         {
            Dnz[cb]=Low[cb];
            draw_up=0;
            draw_dn=1;
         }
      }
      else
      {
         if( fB[cb]==0 )
         {
            if( (sL[cb]+1)>=GSv_tend )
            {
               Dnz[cb]=Low[cb];
               sp=ai;
               draw_up=0;
               draw_dn=1;
               if( lB[cb]==1 && (sH[cb]+1)>=GSv_tend )
               {
                  Upz[cb]=High[cb];
                  draw_up=1;
                  draw_dn=0;
               }
            }
            else
            {
               if( lB[cb]==1 )
               {
                  Upz[index-sp]=0;
                  sp=ai;
                  Upz[cb]=High[cb];
               }
            }
         }
      }
   }
   else
   {
      if( draw_dn!=0 )
      {
         if( fB[cb]==1 )
         {
            if( (sH[cb]+1)>=GSv_tend )
            {
               Upz[cb]=High[cb];
               sp=ai;
               draw_up=1;
               draw_dn=0;
               if( lB[cb]==0 && (sL[cb]+1)>=GSv_tend )
               {
                  Dnz[cb]=Low[cb];
                  draw_up=0;
                  draw_dn=1;

               }
            }
            else
            {
               if( lB[cb]==0 )
               {
                  Dnz[index-sp]=0;
                  sp=ai;
                  Dnz[cb]=Low[cb];
               }
            }
         }
         else
         {
            if( fB[cb]==0 )
            {
               if( sp!=ai )
               {
                  Dnz[index-sp]=0;
                  sp=ai;
               }
               Dnz[cb]=Low[cb];
               if( lB[cb]==1 && (sH[cb]+1)>=GSv_tend && GSv_tend<2 )
               {
                  Upz[cb]=High[cb];
                  draw_up=1;
                  draw_dn=0;
               }
            }
         }
      }
      else
      {
         if( fB[cb]==1 && (sH[cb]+1)>=GSv_tend )
         {
            Dnz[index]=Low[index];
            Upz[cb]=High[cb];
            draw_up=1;
            sp=ai;
            if( lB[cb]==0 && (sL[cb]+1)>=GSv_tend )
            {
               Dnz[cb]=Low[cb];
               draw_up=0;
               draw_dn=1;
            }
         }
         else
         {
            if( fB[cb]==0 && (sL[cb]+1)>=GSv_tend )
            {
               Upz[index]=High[index];
               Dnz[cb]=Low[cb];
               draw_dn=1;
               sp=ai;
               if( lB[cb]==1 && (sH[cb]+1)>=GSv_tend )
               {
                  Upz[cb]=High[cb];
                  draw_up=1;
                  draw_dn=0;
               }
            }
         }
      }
   }
}
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

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

//+------------------------------------------------------------------+
//| ???? ?????? ????????? ?????? ??????      |
//+------------------------------------------------------------------+
void Extr_seq(int curb)
  {
//----
   if( fB[curb]<0 )
   {
      //?? ?? ???????? ? ???? ? ? ??? ????
      if( High[curb]>aH[curb] && Low[curb]<aL[curb] )
      {
         //?? ???? ? ??? ?????
         if( Open[curb]>aH[curb] )
         {
            fB[curb]=1;
            lB[curb]=0;
         }
         else //??? ?? ???? ? ??? ?????
         {
            //?? ???? ? ??? ????
            if( Open[curb]<aL[curb] )
            {
               fB[curb]=0;
               lB[curb]=1;
            }
            else
            {
               //?? ???? ? ??? ????? ? ?? ?? ?? ??? ?????
               if( Close[curb]>aH[curb] && Close[curb]>=Open[curb] )
               {
                  fB[curb]=0;
                  lB[curb]=1;
               }
               else //??? ?? ???? ? ??? ????? ? ?? ?? ?? ??? ?????
               {
                  //?? ???? ? ??? ???? ? ?? ?? ??? ????
                  if( Close[curb]>aL[curb] && Close[curb]<=Open[curb] )
                  {
                     fB[curb]=1;
                     lB[curb]=0;
                  }
                  else //??? ?? ???? ? ??? ???? ? ?? ?? ??? ????
                  {
                     //?? ?? ?? ???
                     if( Close[curb]>Open[curb] )
                     {
                        fB[curb]=0;
                        lB[curb]=1;
                     }
                     else //??? ?? ?? ?? ???
                     {
                        //?? ?? ?? ???
                        if( Close[curb]<Open[curb] )
                        {
                           fB[curb]=1;
                           lB[curb]=0;
                        }
                        else //??? ?? ?? ?? ???
                        {
                           //?? ?? ??? ? ????? ????
                           if( MathAbs(Open[curb]-aL[curb])<MathAbs(Open[curb]-aH[curb]) )
                           {
                              fB[curb]=0;
                              lB[curb]=1;
                           }
                           else //??? ?? ?? ??? ? ????? ????
                           {
                              //?? ?? ??? ? ????? ?????
                              if( MathAbs(Open[curb]-aL[curb])>MathAbs(Open[curb]-aH[curb]) )
                              {
                                 fB[curb]=1;
                                 lB[curb]=0;
                              }
                              else //??? ??? ?? ?? ??? ? ????? ?????
                              {
                                 //?? ?? ??? ?? ?????? ? ????
                                 if( MathAbs(Open[curb]-Low[curb])>=MathAbs(Open[curb]-High[curb]) )
                                 {
                                    fB[curb]=0;
                                    lB[curb]=1;
                                 }
                                 else
                                 {
                                    fB[curb]=1;
                                    lB[curb]=0;
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
      else
      {
         if( High[curb]>aH[curb] )
         {
            fB[curb]=1;
         }
         else
         {
            fB[curb]=0;
         }
      }
   }
   else
   {
      //?? ???? ?? ??? ????? ? ?? ?? ?? ???? ? ?? ?? ????-???
      if( (Low[curb]>=aL[curb] || Close[curb]==High[curb] ) && High[curb]>aH[curb] )
      {
         lB[curb]=1;
      }
      else //??? ?? ?? ??? ????? ? ??
      {
         //?? ?? ??? ???? ? ?? ?? ?? ??? ????? ? ?? ?? ???? - ???
         if( (High[curb]<=aH[curb] || Close[curb]==Low[curb]) && Low[curb]<aL[curb] )
         {
            lB[curb]=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 

rvmGann_sv2.mq4

//+------------------------------------------------------------------+
//|                                                  rvmGann_sv2.mq4 |
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                      rvm_fam ? fromru ??? ?? |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link      "rvm_fam ? fromru ??? ??"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 DodgerBlue
//---- input parameters
extern int       GSv_tend=2;
//---- buffers
double GSv_sl[];
double GSv_Up[];
bool initfl,draw_up,draw_dn;
bool curH,curL;
int sH,sL,lb,lhi,lli,fpoint,spoint;
int idFile;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION,STYLE_DOT);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID);
   SetIndexBuffer(0,GSv_sl);
   SetIndexBuffer(1,GSv_Up);
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexLabel(0,"Dawn trend");
   SetIndexLabel(1,"Up trend");

   //FileDelete("GSv.txt");
   //idFile=FileOpen("GSv.txt",FILE_WRITE);
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int cb,ai,i,limit,index;
//----
   if( initfl!=1 )
   {
      myInit();
      if( initfl!=1 )
      {
         Alert("?? ??????? ?????!");
         return(-1);
      }
   }
   index=Bars-1;
   if( counted_bars>=0 )
   {
      if( index-counted_bars<=0 )
      {
         limit=0;
      }
      else
      {
         limit=index-counted_bars;
         if( limit>index-GSv_tend )
         {
            limit=index-GSv_tend;
         }
      }
   }
   else
   {
      Alert("?? ???? ?????!");
      return(-1);
   }
//FileWrite(idFile,"  Bars="+Bars+" index="+index+" limit="+limit+" counted_bars="+counted_bars);
//-------------------->> ??? ??? ? ??? -------------------------------
for( cb=limit;cb>=0;cb-- )
{
   ai=index-cb;
//-------------------->> ????? ?????? ?? ????? ??? ?? --------
if( lb!=ai )
{
   //FileWrite(idFile,"**??? ??, ai="+ai+" "+TimeToStr(Time[cb]));
   lb=ai;
   //?? ????? ?? ????? - ????? ????
   if( High[cb+1]<=High[cb+2] && Low[cb+1]>=Low[cb+2] )
   {
      sH=0;
      sL=0;
      //FileWrite(idFile,"  ????? ?? ?????, ???? ???? "+sH+"  "+sL);
   }
   else
   {
      //?? ????? ??? ????
      if( High[cb+1]>High[cb+2] && Low[cb+1]>=Low[cb+2] )
      {
         sL=0;
         //FileWrite(idFile,"  ?????-??? ????, ???? ????? ???? "+sL);
      }
      else
      {
         //?? ????? ??? ????
         if( High[cb+1]<=High[cb+2] && Low[cb+1]<Low[cb+2] )
         {
            sH=0;
            //FileWrite(idFile,"  ?????-??? ????, ???? ????? ???? "+sH);
         }
      }
   }
   //?? ????? ????? ???
   if( draw_up==1 )
   {
      //FileWrite(idFile,"  ????? ????? ???");
      //?? ???? ????? ??? ???? ?????
      if( sL==GSv_tend )
      {
         //FileWrite(idFile,"  ???? ????? ??? ???? ?????");
         // ? ????? ???? ?? ???? ????? ? ??? ???? ?????
         if( curL==1 || sH!=GSv_tend )
         {
            draw_up=0;
            draw_dn=1;
            fpoint=spoint;
            spoint=ai-1;
            //FileWrite(idFile,"  ????? ?? ????, draw_up="+draw_up+" draw_dn="+draw_dn+" fpoint="+fpoint+" spoint="+spoint+" ?? ???? ????? ? ??? ???? ?????");
         }
      }
      else
      {
         //??? ?? ???? ????? ? ??? ???? ?????
         //?? ? ????? ??? ?? ???? ? ? ?? ?????? ???????
         if( High[cb+1]>High[cb+2] && High[cb+1]>High[index-spoint] )
         {
            spoint=ai-1;
            //FileWrite(idFile,"  ???? ? ??.??? ?? ?????? ???????, ???? spoint="+spoint);
         }
      }
   }
   else
   {
      //??? ?? ????? ????? ??
      if( draw_dn==1 )
      {
         //FileWrite(idFile,"  ????? ????? ??");
         //?? ???? ????? ??? ???? ?????
         if( sH==GSv_tend )
         {
            //FileWrite(idFile,"  ???? ????? ??? ???? ?????");
            //? ????? - ???? ?? ???? ????? ? ??? ???? ?????
            if( curH==1 || sL!=GSv_tend )
            {
               draw_up=1;
               draw_dn=0;
               fpoint=spoint;
               spoint=ai-1;
               //FileWrite(idFile,"  ????? ?? ????, draw_up="+draw_up+" draw_dn="+draw_dn+" fpoint="+fpoint+" spoint="+spoint+" ?? ???? ????? ? ??? ???? ?????");
            }
         }
         else
         {
            //??? ?? ???? ????? ? ??? ???? ?????
            //?? ? ????? ??? ?? ???? ? ? ?? ?????? ???????
            if( Low[cb+1]<Low[cb+2] && Low[cb+1]<Low[index-spoint] )
            {
               spoint=ai-1;
               //FileWrite(idFile,"  ???? ? ??.??? ?? ?????? ???????, ???? spoint="+spoint);
            }
         }
      }
   }
   //FileWrite(idFile,"  ??? ???, ????? ???? ?????, ????");
   curH=0;
   curL=0;
}
//--------------------<< ??? ???? ?????? ?? ????? ??? ?? --
//?? ???? ?? "?????" ????? ? ????? ???
if( High[cb]<=High[cb+1] && Low[cb]>=Low[cb+1] )
{
   //FileWrite(idFile,"  ?? ?????, ????? ? ????? ???");
   continue;
}
//-------------------->> ????? ???? ?????? ?? -------------------
//?? ?? ????
if( cb!=0 || counted_bars==0 )
{
   //FileWrite(idFile,"  ? ????...");
   if( High[cb]>High[cb+1] )
   {
      if( sH<GSv_tend ) sH++;
      curH=1;
      //FileWrite(idFile,"  ???? ????? ????, ????? ???? "+sH);
   }
   if( Low[cb]<Low[cb+1] )
   {
      if( sH<GSv_tend ) sL++;
      curL=1;
      //FileWrite(idFile,"  ???? ????? ????, ????? ???? "+sL);
   }
   if( curH==curL && curH==1 )
   {
      if( Close[cb]>=(High[cb]+Low[cb])/2 )
      {
         curL=0;
         //FileWrite(idFile,"  ???? ??, ?????, ????? ????");
      }
      else
      {
         curH=0;
         //FileWrite(idFile,"  ???? ??, ?????, ????? ????");
      }
   }
}
else
{
   //FileWrite(idFile,"  ??-??...");
   if( Close[cb]==High[cb] )
   {
      if( sH<GSv_tend && lhi!=ai )
      {
         lhi=ai;
         sH++;
      }
      curH=1;
      curL=0;
      //FileWrite(idFile,"  ????? ????");
   }
   else
   {
      if( Close[cb]==Low[cb] )
      {
         if( sL<GSv_tend && lli!=ai )
         {
            lli=ai;
            sL++;
         }
         curH=0;
         curL=1;
         //FileWrite(idFile,"  ????? ????");
      }
   }
}
//--------------------<< ??? ?????? ???? ?????? ?? -------------
//FileWrite(idFile,"  ????? ?????...");
//?? ????? ?? ?????
if( draw_up!=draw_dn )
{
   //FileWrite(idFile,"  ????? ?? ????? "+draw_up+"  "+draw_dn);
   //?? ????? ???????? ???
   if( draw_dn!=1 )
   {
      //?? ???? ????? ??? ???? ????? ? ????? ???? ?? ???? ????? ? ??? ???? ?????
      if( (sL==GSv_tend && curL==1) || (sL==GSv_tend && sH!=GSv_tend) )
      {
         //FileWrite(idFile,"  ???? ????? ??? ???? ????? ? ????? ???? ?? ???? ????? ? ??? ???? ?????");
         GSv_sl[cb]=Low[cb];
      }
      else
      {
         //?? ????? ???? ?? ????? ???????
         if( High[cb]>High[index-spoint] )
         {
            GSv_sl[cb]=High[cb];
            for( i=cb+1;i<index-fpoint;i++ )
            {
               GSv_sl[i]=0;
            }
         }
      }
   }
   else
   {
      //??? ?? ???????? ??
      //?? ???? ????? ??? ???? ????? ? ???? ????? ?? ???? ????? ? ??? ???? ?????
      if( (sH==GSv_tend && curH==1) || (sH==GSv_tend && sL!=GSv_tend) )
      {
         //FileWrite(idFile,"  ???? ????? ??? ???? ????? ? ????? ???? ?? ???? ????? ? ??? ???? ?????");
         GSv_sl[cb]=High[cb];
      }
      else
      {
         //?? ????? ???? ?? ????? ???????
         if( Low[cb]<Low[index-spoint] )
         {
            GSv_sl[cb]=Low[cb];
            for( i=cb+1;i<index-fpoint;i++ )
            {
               GSv_sl[i]=0;
            }
         }
      }
   }
}
else
{
   //FileWrite(idFile,"  ????? ?? ? ??????? "+draw_up+"  "+draw_dn);
   //??? ?? ????? ?? ? ?????
   //?? ???? ????? ??? ???? ?????
   if( sH==GSv_tend )
   {
      //FileWrite(idFile,"  ???? ????? ??? ???? ?????");
      if( sL!=GSv_tend || curH==1 )
      {
         //FileWrite(idFile,"  ????? ???? ?? ???? ????? ??? ????");
         GSv_sl[index-fpoint]=Low[index-fpoint];
         GSv_sl[cb]=High[cb];
         draw_up=1;
         draw_dn=0;
         //FileWrite(idFile,"  ????? ??? "+fpoint+" "+GSv_sl[index-fpoint]+" ????? ??? "+ai+" "+GSv_sl[cb]);
      }
   }
   //?? ???? ????? ??? ???? ?????
   if( sL==GSv_tend )
   {
      //FileWrite(idFile,"  ???? ????? ??? ???? ?????");
      if( sH!=GSv_tend || curL==1 )
      {
         //FileWrite(idFile,"  ????? ???? ?? ???? ????? ??? ????");
         GSv_sl[index-fpoint]=High[index-fpoint];
         GSv_sl[cb]=Low[cb];
         draw_up=0;
         draw_dn=1;
         //FileWrite(idFile,"  ????? ??? "+fpoint+" "+GSv_sl[index-fpoint]+" ????? ??? "+ai+" "+GSv_sl[cb]);
      }
   }
}
//--------------------<< ??? ??? ? ??? --------------------------------
}
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   //FileClose(idFile);
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| ???? ????? ??????? ?????                       |
//+------------------------------------------------------------------+
int myInit()
  {
//----
   //?? ?????? ???
   if( Bars<GSv_tend+1 )
   {
      Alert("?????? ??? ? ????!");
      return(-1);
   }
   if( GSv_tend<1 )
   {
      Alert("???? ???? ?????!");
      return(-1);
   }
   if( High[Bars-2]>High[Bars-1] ) sH++;
   if( Low[Bars-2]<Low[Bars-1] ) sL++;
   initfl=1;
   //FileWrite(idFile,TimeToStr(CurTime())+" ????? ????????");
   //FileWrite(idFile,"  ??? ? ???? = "+Bars+", ??? ???? ?? = "+TimeToStr(Time[Bars-1]));
   //FileWrite(idFile,"  ???? ????? = "+sH+", ???? ????? = "+sL);
//----
   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 

rvmFractalsLevel.mq4

//+------------------------------------------------------------------+
//|                                             rvmFractalsLevel.mq4 |
//|                                        Copyright ? 2005, Profi_R |
//|                                               rvm_fam@fromru.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Profi_R"
#property link      "rvm_fam@fromru.com"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 DeepSkyBlue
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Black
#property indicator_color7 Black
#property indicator_color8 Black
//---- input parameters
extern int nLeft=50;
extern int nRight=50;
extern int filter=10;
//---- buffers
double UpBuffer[];
double DnBuffer[];
double f_2[];
double f_3[];
double f_4[];
double f_5[];
double f_6[];

//----
int draw_begin1=0, draw_begin2=0, d_b3=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   double nfUp;
//---- indicators
   IndicatorBuffers(8);
   SetIndexStyle(0,DRAW_LINE,0,3);
   SetIndexStyle(1,DRAW_LINE,0,3);
   SetIndexStyle(2,DRAW_LINE,2);
   SetIndexStyle(3,DRAW_LINE,2);
   SetIndexStyle(4,DRAW_LINE,2);
   SetIndexStyle(5,DRAW_LINE,2);
   SetIndexStyle(6,DRAW_LINE,2);
   SetIndexBuffer(0,UpBuffer);
   SetIndexBuffer(1,DnBuffer);
   SetIndexBuffer(2,f_2);
   SetIndexBuffer(3,f_3);
   SetIndexBuffer(4,f_4);
   SetIndexBuffer(5,f_5);
   SetIndexBuffer(6,f_6);

//---- name for DataWindow and indicator subwindow label
   string short_name; //????? ????? short_name ?? "?????"
   //????? short_name ?????? ????? ???? ??? ?????
   short_name="rvmFractalsLevel("+nLeft+","+nRight+","+filter+")";
   IndicatorShortName(short_name); //?? ?????? ? ???? ???? ????? ????
                                   //??????
   //?? ?????? ? ???? ???? ??? ?????? ????? 0 ??? ?? Up Channel
   SetIndexLabel(0,"Up Level ("+nLeft+","+nRight+","+filter+")");
   //?? ?????? ? ???? ???? ??? ?????? ????? 1 ??? ?? Down Channel
   SetIndexLabel(1,"Down Level ("+nLeft+","+nRight+","+filter+")");
   SetIndexLabel(2,"f_2 ("+nLeft+","+nRight+","+filter+")");
   SetIndexLabel(3,"f_3 ("+nLeft+","+nRight+","+filter+")");
   SetIndexLabel(4,"f_4 ("+nLeft+","+nRight+","+filter+")");
   SetIndexLabel(5,"f_5 ("+nLeft+","+nRight+","+filter+")");
   SetIndexLabel(6,"f_6 ("+nLeft+","+nRight+","+filter+")");

//---- ??? ????? ????? ??? ?? ????? ?????
   int n,k,i,Range=nLeft+nRight+1;
   //????? ??? ? (??? ??? ??? ???? ??? ???) ? (???? ??? ???)
   for(n=Bars-1-nLeft;n>=nRight;n--)
   {
      //???? ????
      //?? ??? ????? ???? ???? ? ?????
      if(draw_begin1==0)
      {
      //???? ??? ???? ? ????? ??????
      if(High[n]>=High[Highest(NULL,0,MODE_HIGH,Range,n-nRight)])
      {
         int fRange=nvnLeft(n,nLeft)+nvnRight(n,nRight)+1;
         //?? ?? ? - ????
         if(High[n]>=High[Highest(NULL,0,MODE_HIGH,fRange,n-nvnRight(n,nRight))])
         {
            draw_begin1=Bars-n;//??? ????? ???? ???? ?????
            for(i=Bars-1;i>draw_begin1;i--)
            {
               UpBuffer[i]=High[Bars-draw_begin1];
            }
         }
      }//??? ???? ?? if(High[n]>=High[Highest(NULL,0,MODE_HIGH,Range,n-nRight)]=???
      }//??? ???? if(draw_begin1==0)

      //??? ????
      //?? ??? ????? ???? ???? ? ?????
      if(draw_begin2==0)
      {
      //???? ??? ???? ? ????? ??????
      if(Low[n]<=Low[Lowest(NULL,0,MODE_LOW,Range,n-nRight)])
      {
         fRange=nvnLeft(n,nLeft)+nvnRight(n,nRight)+1;
         //?? ?? ? - ????
         if(Low[n]<=Low[Lowest(NULL,0,MODE_HIGH,fRange,n-nvnRight(n,nRight))])
         {
            draw_begin2=Bars-n;//??? ????? ???? ???? ?????
            for(i=Bars-1;i>draw_begin2;i--)
            {
               DnBuffer[i]=Low[Bars-draw_begin2];
            }
         }
      }//??? ???? if(Low[n]<=Low[Lowest(NULL,0,MODE_LOW,Range,n-nRight)])=true
      }//??? ???? if(draw_begin2==0)

      //?? ?? ??? ????? ???? ?????, ???? ? ??? for(n=Bars-1-nLeft;n>=nRight;n--)
      if(draw_begin1>0&&draw_begin2>0) break;
   }//??? ??? for(n=Bars-1-nLeft;n>=nRight;n--)
//----
   if(draw_begin1>draw_begin2)
   {
      d_b3=draw_begin1;
   }
   else
   {
      d_b3=draw_begin2;
   }
   SetIndexDrawBegin(0,draw_begin1); //????? ????? ??? ????? ?? 0 ???
   SetIndexDrawBegin(1,draw_begin2); //????? ????? ??? ????? ?? 1 ???
   SetIndexDrawBegin(2,d_b3);
   SetIndexDrawBegin(3,d_b3);
   SetIndexDrawBegin(4,d_b3);
   SetIndexDrawBegin(5,d_b3);
   SetIndexDrawBegin(6,d_b3);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double UpStage=0.0,DnStage=0.0;
   int i,j,fRange,Range=nLeft+nRight+1;
   int counted_bars=IndicatorCounted();
//----
   //????? ??? ? (Bars-counted_bars-nLeft) ? (nRight) ??????
   for(i=Bars-1-counted_bars-nLeft;i>=nRight;i--)
   {
      //?? ??? ????? ????
      if(High[i]>=High[Highest(NULL,0,MODE_HIGH,Range,i-nRight)])
      {
         //Print(TimeToStr(Time[i]), "******????? ????");
         fRange=nvnLeft(i,nLeft)+nvnRight(i,nRight)+1;
         //?? ?? ? - ????
         if(High[i]>=High[Highest(NULL,0,MODE_HIGH,fRange,i-nvnRight(i,nRight))])
         {
            UpStage=High[i];
            //Print("    ?? ? ????");
         }
         else
         {
            if(High[i]<=UpBuffer[i+1])
            {
               UpStage=UpBuffer[i+1];
               //Print("    ? ????, ? ?? ?????? ????");
            }
            else
            {
               UpStage=nfUp(i);
               //Print("    ? ????, ?? ?????? ????");
            }
         }
      }
      else
      {
         //Print(TimeToStr(Time[i]), "******? ????? ????");
         if(High[i]<=UpBuffer[i+1])
         {
            UpStage=UpBuffer[i+1];
            //Print("    ?? ?????? ????");
         }
         else
         {
            UpStage=nfUp(i);
            //Print("    ?? ?????? ????");
         }
      }

      //?? ??? ????? ????
      if(Low[i]<=Low[Lowest(NULL,0,MODE_LOW,Range,i-nRight)])
      {
         fRange=nvnLeft(i,nLeft)+nvnRight(i,nRight)+1;
         //Print(TimeToStr(Time[i])," ",nvnLeft(i,nLeft)," ",nvnRight(i,nRight)+1);
         //?? ?? ? - ????
         if(Low[i]<=Low[Lowest(NULL,0,MODE_HIGH,fRange,i-nvnRight(i,nRight))])
         {
            DnStage=Low[i];
         }
         else
         {
            if(Low[i]>=DnBuffer[i+1])
            {
               DnStage=DnBuffer[i+1];
            }
            else
            {
               DnStage=nfDn(i);
            }
         }
      }
      else
      {
         if(Low[i]>=DnBuffer[i+1])
         {
            DnStage=DnBuffer[i+1];
         }
         else
         {
            DnStage=nfDn(i);
         }
      }
      UpBuffer[i]=UpStage;
      DnBuffer[i]=DnStage;
//---- ??? ????? ????
      f_2[i]=NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])/6,4);
      f_3[i]=NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])/3,4);
      f_4[i]=NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])/2,4);
      f_5[i]=NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])*2/3,4);
      f_6[i]=NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])*5/6,4);

   }//??? ??? for(i=Bars-counted_bars-nLeft;i>=nRight;i--)
   for(i=nRight-1;i>=0;i--)
   {
      if(High[i]<=UpBuffer[i+1])
      {
         UpStage=UpBuffer[i+1];
      }
      else
      {
         UpStage=nfUp(i);
      }
      if(Low[i]>=DnBuffer[i+1])
      {
         DnStage=DnBuffer[i+1];
      }
      else
      {
         DnStage=nfDn(i);
      }
      UpBuffer[i]=UpStage;
      DnBuffer[i]=DnStage;
//---- ??? ????? ????
      f_2[i] =NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])/6,4);
      f_3[i] =NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])/3,4);
      f_4[i] =NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])/2,4);
      f_5[i] =NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])*2/3,4);
      f_6[i] =NormalizeDouble(DnBuffer[i]+(UpBuffer[i]-DnBuffer[i])*5/6,4);

   }
//---- ????? ??? ?????
   double LastUp, LastDn, st_h, st_l, st_3, y1, y2, y3;
   int tmp, x1=0, x2=0, x3=0, cb, dn_x, up_x;
   string fibo="Fibo 1", fibo2="Fibo 2";
   LastDn=DnBuffer[0];
   for(cb=1;cb<=Bars-1;cb++)
   {
      if(tmp!=1 && LastDn>DnBuffer[cb])
      {
         tmp=1;
         continue;
      }
      if(tmp==1 && DnBuffer[cb]>DnBuffer[cb-1])
      {
         tmp=0;
         dn_x=cb-1;
         break;
      }
   }
   LastUp=UpBuffer[0];
   for(cb=1;cb<=Bars-1;cb++)
   {
      if(tmp!=1 && LastUp<UpBuffer[cb])
      {
         tmp=1;
         continue;
      }
      if(tmp==1 && UpBuffer[cb]<UpBuffer[cb-1])
      {
         tmp=0;
         up_x=cb-1;
         break;
      }
   }
   st_h=High[Highest(NULL,0,MODE_HIGH,MathMax(dn_x,up_x),0)];
   st_l=Low[Lowest(NULL,0,MODE_LOW,MathMax(dn_x,up_x),0)];
   //y1=MathMin(Open[x1],Close[x1]);
   //y1=MathMax(Open[x1],Close[x1]);
   for(cb=MathMax(dn_x,up_x)-1;cb>=0;cb--)
   {
      if(High[cb]==st_h || Low[cb]==st_l)
      {
         if(High[cb]==st_h && (x1==0 || x2==0) )
         {
            if(x1==0)
            {
               x1=cb;
               y1=High[x1];
               continue;
            }
            else
            {
               x2=cb;
               y2=High[x2];
               break;
            }
         }
         else
         {
            if(x1==0)
            {
               x1=cb;
               y1=Low[x1];
               continue;
            }
            else
            {
               x2=cb;
               y2=Low[x2];
               break;
            }
         }
      }
   }
   //Print("x1="+x1+" y1="+y1+" x2="+x2+" y2="+y2);
   if( ObjectFind(fibo)!=-1 )
   {
      ObjectSet(fibo,OBJPROP_TIME1,Time[x1]);
      ObjectSet(fibo,OBJPROP_PRICE1,y1);
      ObjectSet(fibo,OBJPROP_TIME2,Time[x2]);
      ObjectSet(fibo,OBJPROP_PRICE2,y2);
   }
   else
   {
      ObjectCreate(fibo,OBJ_FIBOFAN,0,Time[x1],y1,Time[x2],y2);
      ObjectSet(fibo,OBJPROP_COLOR,DodgerBlue);
      ObjectSet(fibo,OBJPROP_STYLE,STYLE_DOT);
   }
//----- ? ?? ????? ???????? ??? ?????
   if(y2>y1)
   {
      st_3=Low[Lowest(NULL,0,MODE_LOW,x2,0)];
   }
   else
   {
      st_3=High[Highest(NULL,0,MODE_HIGH,x2,0)];
   }

   for(cb=0;cb<x2;cb++)
   {
      if(y2>y1 && Low[cb]==st_3)
      {
         x3=cb;
         y3=Low[cb];
         break;
      }
      else
      {
         if(y2<y1 && High[cb]==st_3)
         {
            x3=cb;
            y3=High[cb];
            break;
         }
      }
   }
   if( ObjectFind(fibo2)!=-1 )
   {
      ObjectSet(fibo2,OBJPROP_TIME1,Time[x2]);
      ObjectSet(fibo2,OBJPROP_PRICE1,y2);
      ObjectSet(fibo2,OBJPROP_TIME2,Time[x3]);
      ObjectSet(fibo2,OBJPROP_PRICE2,y3);
   }
   else
   {
      ObjectCreate(fibo2,OBJ_FIBOFAN,0,Time[x2],y2,Time[x3],y3);
      ObjectSet(fibo2,OBJPROP_COLOR,Yellow);
      ObjectSet(fibo2,OBJPROP_STYLE,STYLE_DOT);
   }

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

//****************************************************************************//
// ???? nfUp ????? ????? ??? ? ????? ??? ???? ??? //
// ?????, ???? ?? ??? ???? High(Close) ?? ????? ???   //
//****************************************************************************//
double nfUp(int i)
   {
   int l,flag=0;
   double Price=0.0;
//----------
   for(l=i+1;l<Bars-draw_begin1-1;l++)
   {
      if(filter>0)
      {
         if(Close[i]<=UpBuffer[l]+(UpBuffer[l]-DnBuffer[l])*filter/100)
         {
            Price=UpBuffer[l];
            flag=1;
            //Print(TimeToStr(Time[i])," ",l," ",Bars," ",Price," ",UpBuffer[l]);
         }
      }
      else
      {
         if(High[i]<=UpBuffer[l])
         {
            Price=UpBuffer[l];
            flag=1;
         }
      }
      if(Price>0) break;
   }
   if(flag==0) Price=High[i];
//----------
   return(Price);
   }
//+------------------------------------------------------------------+

//****************************************************************************//
// ???? nfDn ????? ????? ??? ? ????? ??? ???? ??? //
// ?????, ???? ?? ??? ???? Low(Close) ?? ????? ???    //
//****************************************************************************//
double nfDn(int i)
   {
   int l,flag=0;
   double Price=0.0;
//----------
   for(l=i+1;l<Bars-draw_begin2-1;l++)
   {
      if(filter>0)
      {
         if(Close[i]>=DnBuffer[l]-(UpBuffer[l]-DnBuffer[l])*filter/100)
         {
            Price=DnBuffer[l];
            flag=1;
         }
      }
      else
      {
         if(Low[i]>=DnBuffer[l])
         {
            Price=DnBuffer[l];
            flag=1;
         }
      }
      if(Price>0) break;
   }
   if(flag==0) Price=Low[i];
//----------
   return(Price);
   }
//+------------------------------------------------------------------+

//*****************************************************************************************//
// ???? ????? ?? ????? ? ???, ?????? ????? ??? ???         //
// ???? "?????", ?? ??, ??? ??? ? ????? ??? ? ????? ????? //
// ?? ? ???, ?? ???? ? ??? ?????                                         //
//*****************************************************************************************//
int nvnLeft(int i,int n)
   {
   int k=0,l;
   for(l=i+1;l<=Bars-1;l++)
   {
      if(High[l]<High[l+1]&&Low[l]>Low[l+1]) continue;
      k++;
      if(k==n)
      {
         k=l-i;
         break;
      }
   }
//----------
   return(k);
   }
//+------------------------------------------------------------------+

//*****************************************************************************************//
// ???? ????? ?? ????? ? ???, ?????? ????? ??? ???        //
// ???? "?????", ?? ??, ??? ??? ? ????? ??? ? ????? ????? //
// ?? ? ???, ?? ???? ? ??? ?????                                         //
//*****************************************************************************************//
int nvnRight(int i,int n)
   {
   int k=0,l;
   for(l=i-1;l>=0;l--)
   {
      if(High[l]<High[l+1]&&Low[l]>Low[l+1]) continue;
      k++;
      if(k==n)
      {
         k=i-l;
         break;
      }
   }
//----------
   return(k);
   }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   string fibo="Fibo 1", fibo2="Fibo 2";
   ObjectDelete(fibo);
   ObjectDelete(fibo2);
//----
   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 

RSX_MTF.mq4

//+------------------------------------------------------------------+
//|                                                     MTF_PSAR.mq4 |
//|                                      Copyright ? 2006, Keris2112 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2006, Keris2112"
#property link      "http://www.forex-tsd.com"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
//#property indicator_level1 70
//#property indicator_level2 30
//#property indicator_level3 50
#property indicator_maximum 100
#property indicator_minimum 0

//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
**************************************************************************/
extern int TimeFrame=0;
extern int PPeriod=14;

double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicator line
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
  // SetIndexArrow(0,159);
//---- name for DataWindow and indicator subwindow label
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="M1"; break;
      case 5 : TimeFrameStr="M5"; break;
      case 15 : TimeFrameStr="M15"; break;
      case 30 : TimeFrameStr="M30"; break;
      case 60 : TimeFrameStr="H1"; break;
      case 240 : TimeFrameStr="H4"; break;
      case 1440 : TimeFrameStr="D1"; break;
      case 10080 : TimeFrameStr="W1"; break;
      case 43200 : TimeFrameStr="MN1"; break;
      default : TimeFrameStr="Current Timeframe";
   }
   IndicatorShortName("RSX_MTF ("+PPeriod+", "+TimeFrameStr+")");
  }
//----
   return(0);

//+------------------------------------------------------------------+
//| MTF Parabolic Sar                                         |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++;

/***********************************************************
   Add your main indicator loop below.  You can add the full
      indicator code or you can just reference an existing
      indicator with its iValue or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values
   Rule 2:  Use 'TimeFrame' for the indicator time frame
   Rule 3:  Use 'y' for your indicator's shift value
 **********************************************************/

   ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"RSX",PPeriod,0,y) ;

   }

//

   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 

RSX_CD.mq4

//+------------------------------------------------------------------+
//| macd-2.mq4 |
//| Copyright ?2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_color3 Black
#property indicator_color4 Black
//---- indicator parameters
extern int FastRSX=13;
extern int SlowRSX=17;
extern int SignalRSX=9;
//---- indicator buffers
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
double ind_buffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(5);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2 );
SetIndexDrawBegin(0,SignalRSX);
SetIndexDrawBegin(1,SignalRSX);
//---- 4 indicator buffers mapping
if(!SetIndexBuffer(0,ind_buffer1) &&
!SetIndexBuffer(1,ind_buffer2) &&
!SetIndexBuffer(2,ind_buffer3) &&
!SetIndexBuffer(3,ind_buffer4))
Print("cannot set indicators\' buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("RSX_CD ("+FastRSX+","+SlowRSX+","+SignalRSX+")");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Oscillator |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
double prev,current;
//---- 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;
//---- RSX_CD counted in the 1-st additional buffer
for(int i=0; i<limit; i++)
ind_buffer3[i]=iCustom(Symbol(),Period(),"RSX",FastRSX,0,i)-iCustom(Symbol(),Period(),"RSX",SlowRSX,0,i);
//---- signal line counted in the 2-nd additional buffer
for(i=0; i<limit; i++)
ind_buffer4[i]=iMAOnArray(ind_buffer3,Bars,SignalRSX,0,MODE_EMA, i);
//---- dispatch values between 2 buffers
bool up=true;
for(i=limit-1; i>=0; i--)
{
current=ind_buffer3[i]-ind_buffer4[i];
prev=ind_buffer3[i+1]-ind_buffer4[i+1];
if(current>prev) up=true;
if(current<prev) up=false;
if(!up)
{
ind_buffer2[i]=3*current;
ind_buffer1[i]=0.0;
}
else
{
ind_buffer1[i]=3*current;
ind_buffer2[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 

rsx.mq4

//+------------------------------------------------------------------+
//|                                                          rsx.mq4 |
//|                Copyright ? 2005, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Nick Bilak"
#property link      "http://metatrader.50webs.com/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Magenta
#property indicator_level1 70
#property indicator_level2 30
#property indicator_level3 50
#property indicator_maximum 100
#property indicator_minimum 0
//---- input parameters
extern int       Len=14;
//---- buffers
double rsx[];

double f88, f90;
double f0, v4, v8, vC, v10, v14, v18, v20;
double f8, f10, f18, f20, f28, f30, f38, f48, v1C;
double f50, f58, f60, f68, f70, f78, f80, f40;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,rsx);
   IndicatorShortName("rsx("+Len+")");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   int counted_bars=IndicatorCounted(),limit,shift;

   if (counted_bars<0) return(-1);
   if (counted_bars>0) counted_bars--;
   limit=Bars-Len-1;
   if(counted_bars>Len) limit=Bars-counted_bars-1;
   if (limit<2) limit=100;

   for (shift=limit;shift>=0;shift--)   {
      if (f90 == 0.0) {
         f90 = 1.0;
         f0 = 0.0;
         if (Len-1 >= 5) f88 = Len-1.0; else f88 = 5.0;
         f8 = 100.0*(High[shift]+Low[shift]);
         f18 = 3.0 / (Len + 2.0);
         f20 = 1.0 - f18;
      } else {
         if (f88 <= f90)
            f90 = f88 + 1;
         else
            f90 = f90 + 1;
         f10 = f8;
         f8  = 100*(High[shift]+Low[shift]);
         v8  = f8 - f10;
         f28 = f20 * f28 + f18 * v8;
         f30 = f18 * f28 + f20 * f30;
         vC  = f28 * 1.5 - f30 * 0.5;
         f38 = f20 * f38 + f18 * vC;
         f40 = f18 * f38 + f20 * f40;
         v10 = f38 * 1.5 - f40 * 0.5;
         f48 = f20 * f48 + f18 * v10;
         f50 = f18 * f48 + f20 * f50;
         v14 = f48 * 1.5 - f50 * 0.5;
         f58 = f20 * f58 + f18 * MathAbs(v8);
         f60 = f18 * f58 + f20 * f60;
         v18 = f58 * 1.5 - f60 * 0.5;
         f68 = f20 * f68 + f18 * v18;
         f70 = f18 * f68 + f20 * f70;
         v1C = f68 * 1.5 - f70 * 0.5;
         f78 = f20 * f78 + f18 * v1C;
         f80 = f18 * f78 + f20 * f80;
         v20 = f78 * 1.5 - f80 * 0.5;
         if ((f88 >= f90) && (f8 != f10)) f0 = 1.0;
         if ((f88 == f90) && (f0 == 0.0)) f90 = 0.0;
      }

      if ((f88 < f90) && (v20 > 0.0000000001)) {
         v4 = (v14 / v20 + 1.0) * 50.0;
         if (v4 > 100.0) v4 = 100.0;
         if (v4 < 0.0) v4 = 0.0;
      } else {
         v4 = 50.0;
      }

      rsx[shift]=v4;
   }
   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 

RSTL.mq4

//+------------------------------------------------------------------+
//| RSTL.mq4
//|
//+------------------------------------------------------------------+
#property copyright "Copyright 2002, Finware.ru Ltd."
#property link "http://www.finware.ru/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DarkViolet

//---- buffers
double RSTLBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,RSTLBuffer);
SetIndexDrawBegin(0,98);
//----
return(0);
}
//+------------------------------------------------------------------+
//| RSTL |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=98) return(0);
//---- initial zero
if(counted_bars<98)
for(i=1;i<=0;i++) RSTLBuffer[Bars-i]=0.0;
//----
i=Bars-98-1;
if(counted_bars>=98) i=Bars-counted_bars-1;
while(i>=0)
{
RSTLBuffer[i]=
-0.00514293*Close[i+0]
-0.00398417*Close[i+1]
-0.00262594*Close[i+2]
-0.00107121*Close[i+3]
+0.00066887*Close[i+4]
+0.00258172*Close[i+5]
+0.00465269*Close[i+6]
+0.00686394*Close[i+7]
+0.00919334*Close[i+8]
+0.01161720*Close[i+9]
+0.01411056*Close[i+10]
+0.01664635*Close[i+11]
+0.01919533*Close[i+12]
+0.02172747*Close[i+13]
+0.02421320*Close[i+14]
+0.02662203*Close[i+15]
+0.02892446*Close[i+16]
+0.03109071*Close[i+17]
+0.03309496*Close[i+18]
+0.03490921*Close[i+19]
+0.03651145*Close[i+20]
+0.03788045*Close[i+21]
+0.03899804*Close[i+22]
+0.03984915*Close[i+23]
+0.04042329*Close[i+24]
+0.04071263*Close[i+25]
+0.04071263*Close[i+26]
+0.04042329*Close[i+27]
+0.03984915*Close[i+28]
+0.03899804*Close[i+29]
+0.03788045*Close[i+30]
+0.03651145*Close[i+31]
+0.03490921*Close[i+32]
+0.03309496*Close[i+33]
+0.03109071*Close[i+34]
+0.02892446*Close[i+35]
+0.02662203*Close[i+36]
+0.02421320*Close[i+37]
+0.02172747*Close[i+38]
+0.01919533*Close[i+39]
+0.01664635*Close[i+40]
+0.01411056*Close[i+41]
+0.01161720*Close[i+42]
+0.00919334*Close[i+43]
+0.00686394*Close[i+44]
+0.00465269*Close[i+45]
+0.00258172*Close[i+46]
+0.00066887*Close[i+47]
-0.00107121*Close[i+48]
-0.00262594*Close[i+49]
-0.00398417*Close[i+50]
-0.00514293*Close[i+51]
-0.00609634*Close[i+52]
-0.00684602*Close[i+53]
-0.00739452*Close[i+54]
-0.00774847*Close[i+55]
-0.00791630*Close[i+56]
-0.00790940*Close[i+57]
-0.00774085*Close[i+58]
-0.00742482*Close[i+59]
-0.00697718*Close[i+60]
-0.00641613*Close[i+61]
-0.00576108*Close[i+62]
-0.00502957*Close[i+63]
-0.00423873*Close[i+64]
-0.00340812*Close[i+65]
-0.00255923*Close[i+66]
-0.00170217*Close[i+67]
-0.00085902*Close[i+68]
-0.00004113*Close[i+69]
+0.00073700*Close[i+70]
+0.00146422*Close[i+71]
+0.00213007*Close[i+72]
+0.00272649*Close[i+73]
+0.00324752*Close[i+74]
+0.00368922*Close[i+75]
+0.00405000*Close[i+76]
+0.00433024*Close[i+77]
+0.00453068*Close[i+78]
+0.00465046*Close[i+79]
+0.00469058*Close[i+80]
+0.00466041*Close[i+81]
+0.00457855*Close[i+82]
+0.00442491*Close[i+83]
+0.00423019*Close[i+84]
+0.00399201*Close[i+85]
+0.00372169*Close[i+86]
+0.00342736*Close[i+87]
+0.00311822*Close[i+88]
+0.00280309*Close[i+89]
+0.00249088*Close[i+90]
+0.00219089*Close[i+91]
+0.00191283*Close[i+92]
+0.00166683*Close[i+93]
+0.00146419*Close[i+94]
+0.00131867*Close[i+95]
+0.00124645*Close[i+96]
+0.00126836*Close[i+97]
-0.00401854*Close[i+98];

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 

RSIFilter_v1.mq4

//+------------------------------------------------------------------+
//|                                                 RSIFilter_v1.mq4 |
//|                                  Copyright ? 2006, Forex-TSD.com |
//|                         Written by IgorAD,igorad2003@yahoo.co.uk |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2006, Forex-TSD.com "
#property link      "http://www.forex-tsd.com/"

#property indicator_separate_window
#property indicator_minimum -2
#property indicator_maximum 2
#property indicator_buffers 2
#property indicator_color1 SkyBlue
#property indicator_color2 Orange

//---- input parameters
extern int PeriodRSI=14;
//---- indicator buffers
double UpBuffer[];
double DnBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
  int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexBuffer(0,UpBuffer);
   SetIndexBuffer(1,DnBuffer);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
   short_name="RSI Filter("+PeriodRSI+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"UpTrend");
   SetIndexLabel(1,"DownTrend");
//----
   SetIndexDrawBegin(0,PeriodRSI);
   SetIndexDrawBegin(1,PeriodRSI);
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| RSIFilter_v1                                                         |
//+------------------------------------------------------------------+
int start()
  {
   int shift,trend;
   double RSI0;

   for(shift=Bars-PeriodRSI-1;shift>=0;shift--)
   {
   RSI0=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,shift);

	  if (RSI0>70)  trend=1;
	  if (RSI0<30)  trend=-1;

	  if (trend>0)
	  {
	  if (RSI0 > 40) UpBuffer[shift]=1.0;
	  else UpBuffer[shift] = EMPTY_VALUE;
	  DnBuffer[shift]=0;
	  }
	  if (trend<0)
	  {
	  if (RSI0 < 60) DnBuffer[shift]=-1.0;
	  else DnBuffer[shift] = EMPTY_VALUE;
	  UpBuffer[shift]=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 

rsier1m2.mq4

//+------------------------------------------------------------------+
//| ADX Crossing.mq4
//| Amir
//+------------------------------------------------------------------+
#property  copyright "Author - Amir"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_color2 Red

//---- input parameters
extern int Timeframe_in_Minutes=15;
extern int RSIperiod=14;
extern int CountBars=350;

//---- buffers
double val1[];
double val2[];
double rsib4,rsinow;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {
  // if (CountBars>=500) CountBars=500;
  // SetIndexDrawBegin(0,500-CountBars);
  // SetIndexDrawBegin(1,500-CountBars);
  int i,shift,counted_bars=IndicatorCounted();

   //---- check for possible errors
  // if(counted_bars<0) return(-1);

   //---- initial zero
  // if(counted_bars<1)
   //  {
    //  for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
    //  for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
    // }

for ( shift = 250; shift>=0; shift--)
{

	rsib4=iCustom(NULL,0,"#MTF_RSI",Timeframe_in_Minutes,14,0,shift+1) ;
	rsinow=iCustom(NULL,0,"#MTF_RSI",Timeframe_in_Minutes,14,0,shift);
Comment (rsib4," ",rsinow);
	val1[shift]=0;
		val2[shift]=0;
if (rsinow>=30.00 && rsib4<= 30.00)
{
	val1[shift]=Low[shift]-5*Point;
}
if (rsib4>=70.00 && rsinow<=70.00)
{
	val2[shift]=High[shift]+5*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 

rsier1m.mq4

//+------------------------------------------------------------------+
//| ADX Crossing.mq4
//| Amir
//+------------------------------------------------------------------+
#property  copyright "Author - Amir"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_color2 Red

//---- input parameters
extern int Timeframe_in_Minutes=15;
extern int RSIperiod=14;
extern int CountBars=900;

//---- buffers
double val1[];
double val2[];
double rsib4,rsinow;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=500) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars);
   SetIndexDrawBegin(1,Bars-CountBars);
   int i,shift,counted_bars=IndicatorCounted();

   //---- check for possible errors
   if(counted_bars<0) return(-1);

   //---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
     }

for (shift = CountBars; shift>=0; shift--)
{

	rsib4=iCustom(NULL,0,"#MTF_RSI",Timeframe_in_Minutes,RSIperiod,0,shift+1) ;
	rsinow=iCustom(NULL,0,"#MTF_RSI",Timeframe_in_Minutes,RSIperiod,0,shift);
Comment (rsib4," ",rsinow);
	val1[shift]=0;
		val2[shift]=0;
if (rsinow>=30.00 && rsib4<= 30.00)
{
	val1[shift]=Low[shift]-5*Point;
}
if (rsib4>=70.00 && rsinow<=70.00)
{
	val2[shift]=High[shift]+5*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 

 Page 1 of 4  1  2  3  4 »

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