TRUE Forex

Просмотр кода форекс индикатора !XPS v7 Inv Fisher.mq4

// +----------------------------------------------------------------------------------------+ //
// |    .-._______                           XARD777                          _______.-.    | //
// |---( )_)______)                 Knowledge of the ancients                (______(_( )---| //
// |  (    ()___)                              \¦/                             (___()    )  | //
// |       ()__)                              (o o)                             (__()       | //
// |--(___()_)__________________________oOOo___(_)___oOOo_________________________(_()___)--| //
// |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____|_____| //
// |                                                                                   2011 | //
// |----------------------------------------------------------------------------------------| //
// |                 File:     !XPS v7 Inv Fisher.mq4                                       | //
// | Programming language:     MQL4                                                         | //
// | Development platform:     MetaTrader 4                                                 | //
// |          End product:     THIS SOFTWARE IS FOR USE ONLY BY XARD777                     | //
// |                                                                                        | //
// |                                                         [Xard777 Proprietory Software] | //
// +----------------------------------------------------------------------------------------+ //

#property  indicator_separate_window
#property  indicator_buffers   5
#property  indicator_color1    DimGray
#property  indicator_color2    Gold
#property  indicator_color3    Gold
#property  indicator_color4    Aqua
#property  indicator_color5    Aqua
#property  indicator_width2    2
#property  indicator_width3    2
#property  indicator_width4    2
#property  indicator_width5    2
#property  indicator_maximum   1
#property  indicator_minimum  -1
#property  indicator_levelstyle 0
#property  indicator_levelcolor Silver//C'22,22,22'
#property indicator_levelwidth 1



extern string TimeFrame   = "Current time frame";
extern int    RSIPeriod   =  5;
extern int    RSIPrice    =  PRICE_CLOSE;
extern int    MAPeriod    =  21;
extern int    MAMode      =  MODE_SMMA;
extern double Level1      =  0.00;
extern double Level2      =  0.0;
extern double Level3      = -0.00;
extern bool   Interpolate = true;



double ifishua[];
double ifishub[];
double ifishda[];
double ifishdb[];
double ifisher[];
double rsi[];
double avg[];
double trend[];



string indicatorFileName;
bool   returnBars;
bool   calculateValue;
int    timeFrame;




int init()
{
   IndicatorBuffers(8);
      SetIndexBuffer(0,ifisher);

      
      
      indicatorFileName = WindowExpertName();
      returnBars        = TimeFrame=="returnBars";     if (returnBars)     return(0);
      calculateValue    = TimeFrame=="calculateValue";
         if (calculateValue)
         {
            SetIndexBuffer(1,trend);
            SetIndexBuffer(2,ifishda);
            SetIndexBuffer(3,ifishdb);
            SetIndexBuffer(4,ifishua);
            SetIndexBuffer(5,ifishub);
            SetIndexBuffer(6,rsi);
            SetIndexBuffer(7,avg);
            return(0);
         }         

     
      
         SetIndexBuffer(1,ifishda);
         SetIndexBuffer(2,ifishdb);
         SetIndexBuffer(3,ifishua);
         SetIndexBuffer(4,ifishub);
         SetIndexBuffer(5,rsi);
         SetIndexBuffer(6,avg);
         SetIndexBuffer(7,trend);
      
         SetLevelValue(0,Level1);
         SetLevelValue(1,Level2);
         SetLevelValue(2,Level3);

  
            
   timeFrame = stringToTimeFrame(TimeFrame);
   
   IndicatorShortName(timeFrameToString(timeFrame)+" X :-))");
   SetIndexLabel(0, NULL);
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
   SetIndexLabel(3, NULL);
   SetIndexLabel(4, NULL);
   return(0);
}
int deinit()
{
   return(0);
}





int start()
{
   int    limit, i; 
   int    counted_bars=IndicatorCounted();
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=MathMax(Bars-counted_bars,Bars-1);
           if (returnBars) { ifisher[0] = limit+1; return(0); }

  
   
   if (calculateValue || timeFrame==Period())
   {
      if (!calculateValue) if (trend[limit]== 1) CleanPoint(limit,ifishua,ifishub);
      if (!calculateValue) if (trend[limit]==-1) CleanPoint(limit,ifishda,ifishdb);

     
      
      for(i=limit; i>=0; i--) rsi[i] = 0.1*(iRSI(NULL,0,RSIPeriod,RSIPrice,i)-50);
      for(i=limit; i>=0; i--)
      {
         avg[i]     = iMAOnArray(rsi,0,MAPeriod,0,MAMode,i);
         ifisher[i] = (MathExp(2*avg[i])-1)/(MathExp(2*avg[i])+1);
         trend[i]   = trend[i+1];
            if (ifisher[i] < Level1 && ifisher[i] > Level3) trend[i] =  0;
            if (ifisher[i] > Level1)                        trend[i] =  1;
            if (ifisher[i] < Level3)                        trend[i] = -1;
            if (calculateValue) continue;
            
        

            ifishda[i] = EMPTY_VALUE; ifishdb[i] = EMPTY_VALUE;         
            ifishua[i] = EMPTY_VALUE; ifishub[i] = EMPTY_VALUE;         
               if (trend[i]== 1) PlotPoint(i,ifishua,ifishub,ifisher);
               if (trend[i]==-1) PlotPoint(i,ifishda,ifishdb,ifisher);
      }
      return(0);
   }      

  

   limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period()));

   if (trend[limit]== 1) CleanPoint(limit,ifishua,ifishub);
   if (trend[limit]==-1) CleanPoint(limit,ifishda,ifishdb);
   for(i=limit; i>=0; i--)
   {
      int y = iBarShift(NULL,timeFrame,Time[i]);
         trend[i]   = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",RSIPeriod,RSIPrice,MAPeriod,MAMode,Level1,Level2,Level3,1,y);
         ifisher[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",RSIPeriod,RSIPrice,MAPeriod,MAMode,Level1,Level2,Level3,0,y);
         ifishda[i] = EMPTY_VALUE; 
         ifishdb[i] = EMPTY_VALUE;         
         ifishua[i] = EMPTY_VALUE; 
         ifishub[i] = EMPTY_VALUE;         

       
      
         if (timeFrame <= Period() || y==iBarShift(NULL,timeFrame,Time[i-1])) continue;
         if (!Interpolate) continue;

        

         datetime time = iTime(NULL,timeFrame,y);
            for(int n = 1; i+n < Bars && Time[i+n] >= time; n++) continue;    
            double factor = 1.0 / n;
            for(int k = 1; k < n; k++)
               ifisher[i+k] = k*factor*ifisher[i+n] + (1.0-k*factor)*ifisher[i];
   }
   for(i=limit; i>=0; i--)
   {
      if (trend[i]== 1) PlotPoint(i,ifishua,ifishub,ifisher);
      if (trend[i]==-1) PlotPoint(i,ifishda,ifishdb,ifisher);
   }
   
   
   
   return(0);
}



void CleanPoint(int i,double& first[],double& second[])
{
   if ((second[i]  != EMPTY_VALUE) && (second[i+1] != EMPTY_VALUE))
        second[i+1] = EMPTY_VALUE;
   else
      if ((first[i] != EMPTY_VALUE) && (first[i+1] != EMPTY_VALUE) && (first[i+2] == EMPTY_VALUE))
          first[i+1] = EMPTY_VALUE;
}



void PlotPoint(int i,double& first[],double& second[],double& from[])
{
   if (first[i+1] == EMPTY_VALUE)
      {
         if (first[i+2] == EMPTY_VALUE) {
                first[i]   = from[i];
                first[i+1] = from[i+1];
                second[i]  = EMPTY_VALUE;
            }
         else {
                second[i]   =  from[i];
                second[i+1] =  from[i+1];
                first[i]    = EMPTY_VALUE;
            }
      }
   else
      {
         first[i]  = from[i];
         second[i] = EMPTY_VALUE;
      }
}




string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int    iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};



int stringToTimeFrame(string tfs)
{
   tfs = StringUpperCase(tfs);
   for (int i=ArraySize(iTfTable)-1; i>=0; i--)
         if (tfs==sTfTable[i] || tfs==""+iTfTable[i]) return(MathMax(iTfTable[i],Period()));
                                                      return(Period());
}
string timeFrameToString(int tf)
{
   for (int i=ArraySize(iTfTable)-1; i>=0; i--) 
         if (tf==iTfTable[i]) return(sTfTable[i]);
                              return("");
}



string StringUpperCase(string str)
{
   string   s = str;

   for (int length=StringLen(str)-1; length>=0; length--)
   {
      int char = StringGetChar(s, length);
         if((char > 96 && char < 123) || (char > 223 && char < 256))
                     s = StringSetChar(s, length, char - 32);
         else if(char > -33 && char < 0)
                     s = StringSetChar(s, length, char + 224);
   }
   return(s);
}
// ------------------------------------------------------------------------------------------ //
//                                     E N D   P R O G R A M                                  //
// ------------------------------------------------------------------------------------------ //
/*                                                         
                                        ud$$$**BILLION$bc.                          
                                    u@**"        PROJECT$$Nu                       
                                  J                ""#$$$$$$r                     
                                 @                       $$$$b                    
                               .F                        ^*3$$$                   
                              :% 4                         J$$$N                  
                              $  :F                       :$$$$$                  
                             4F  9                       J$$$$$$$                 
                             4$   k             4$$$$bed$$$$$$$$$                 
                             $$r  'F            $$$$$$$$$$$$$$$$$r                
                             $$$   b.           $$$$$$$$$$$$$$$$$N                
                             $$$$$k 3eeed$$b    XARD777."$$$$$$$$$                
              .@$**N.        $$$$$" $$$$$$F'L $$$$$$$$$$$  $$$$$$$                
              :$$L  'L       $$$$$ 4$$$$$$  * $$$$$$$$$$F  $$$$$$F         edNc   
             @$$$$N  ^k      $$$$$  3$$$$*%   $F4$$$$$$$   $$$$$"        d"  z$N  
             $$$$$$   ^k     '$$$"   #$$$F   .$  $$$$$c.u@$$$          J"  @$$$$r 
             $$$$$$$b   *u    ^$L            $$  $$$$$$$$$$$$u@       $$  d$$$$$$ 
              ^$$$$$$.    "NL   "N. z@*     $$$  $$$$$$$$$$$$$P      $P  d$$$$$$$ 
                 ^"*$$$$b   '*L   9$E      4$$$  d$$$$$$$$$$$"     d*   J$$$$$r   
                      ^$$$$u  '$.  $$$L     "#" d$$$$$$".@$$    .@$"  z$$$$*"     
                        ^$$$$. ^$N.3$$$       4u$$$$$$$ 4$$$  u$*" z$$$"          
                          '*$$$$$$$$ *$b      J$$$$$$$b u$$P $"  d$$P             
                             #$$$$$$ 4$ 3*$"$*$ $"$'c@@$$$$ .u@$$$P               
                               "$$$$  ""F~$ $uNr$$$^&J$$$$F $$$$#                 
                                 "$$    "$$$bd$.$W$$$$$$$$F $$"     
                                   ?k         ?$$$$$$$$$$$F'*                     
                                    9$$bL     z$$$$$$$$$$$F                       
                                     $$$$    $$$$$$$$$$$$$                        
                                      '#$$c  '$$$$$$$$$"            
                                       .@"#$$$$$$$$$$$$b                          
                                     z*      $$$$$$$$$$$$N.                       
                                   e"      z$$"  #$$$k  '*$$.                     
                                .u*      u@$P"      '#$$c   "$$c                   
                        u@$*"""       d$$"            "$$$u  ^*$$b.               
                      :$F           J$P"                ^$$$c   '"$$$$$$bL        
                     d$$  ..      @$#                      #$$b         '#$       
                     9$$$$$$b   4$$                          ^$$k         '$      
                      "$$6""$b u$$                             '$    d$$$$$P      
                        '$F $$$$$"                              ^b  ^$$$$b$       
                         '$W$$$$"                                'b@$$$$"         
                                                                  ^$$$*/

Комментарии к исходному коду форекс индикатора !XPS v7 Inv Fisher.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !XPS v7 Heiken Ashi.mq4
индикатор !XPS v7 MOMENTUM TREND.mq4 »