Navigation´╝ÜHome > Content >

All_Stochastic.mq4

Time: 2016-04-12 | Download file:All_Stochastic.mq4

//+------------------------------------------------------------------+
//|                                               All Stochastic.mq4 |
//|                                                           mladen |
//+------------------------------------------------------------------+
#property copyright   "mladen"
#property link        ""
#define indicatorName "All Stochastic"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1  Gold
#property indicator_color2  Red
#property indicator_style2  STYLE_DOT
#property indicator_level1  20
#property indicator_level3  80
#property indicator_levelcolor DimGray

//---- input parameters
//
//
//
//
//

extern int    Kperiod              = 5;
extern int    Dperiod              = 3;
extern int    Slowing              = 3;
extern int    MAMethod             = 0;
extern int    PriceField           = 0;
extern string __                   = "Chose timeframes (as in periodicity bar)";
extern string timeFrames           = "M1;M5;M15;M30;H1;H4;D1;W1;MN";
extern int    barsPerTimeFrame     = 35;
extern bool   shiftRight           = False;
extern color  txtColor             = Silver; 
extern color  separatorColor       = DimGray; 

//---- buffers
//
//
//
//
//

double ExtMapBuffer1[];
double ExtMapBuffer2[];

//
//
//
//
//

string shortName;
string labels[];
int    periods[];
int    Shift; 

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
      if (shiftRight) Shift = 1;
      else            Shift = 0;
      SetIndexStyle(0,DRAW_LINE);
      SetIndexBuffer(0,ExtMapBuffer1);
      SetIndexStyle(1,DRAW_LINE);
      SetIndexBuffer(1,ExtMapBuffer2);
      SetIndexShift(0,Shift*(barsPerTimeFrame+1));
      SetIndexShift(1,Shift*(barsPerTimeFrame+1));
   
      //
      //
      //
      //
      //

      barsPerTimeFrame    = MathMax(barsPerTimeFrame,30);      
      SetIndexLabel(0,"Stochastic");
      SetIndexLabel(1,"Signal");      
      shortName = indicatorName+" ("+Kperiod+","+Dperiod+","+Slowing+")";
         IndicatorShortName(shortName);

      //
      //
      //
      //
      //

      
      timeFrames = StringUpperCase(StringTrimLeft(StringTrimRight(timeFrames)));
      if (StringSubstr(timeFrames,StringLen(timeFrames),1) != ";")
                       timeFrames = StringConcatenate(timeFrames,";");

         //
         //
         //
         //
         //                                   
            
         int s = 0;
         int i = StringFind(timeFrames,";",s);
         int time;
         string current;
            while (i > 0)
            {
               current = StringSubstr(timeFrames,s,i-s);
               time    = stringToTimeFrame(current);
               if (time > 0) {
                     ArrayResize(labels ,ArraySize(labels)+1);
                     ArrayResize(periods,ArraySize(periods)+1);
                                 labels[ArraySize(labels)-1] = current; 
                                 periods[ArraySize(periods)-1] = time; }
                                 s = i + 1;
                                     i = StringFind(timeFrames,";",s);
            }
      
      //
      //
      //
      //
      //

      for (i=1;i0; k--)
                     {
                        labels[k]  = labels[k-1];
                        periods[k] = periods[k-1];
                     }                     
               labels[0]  = tmpLbl;
               periods[0] = tmpPer;
            }

   return(0);
}


//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   for(int l=0;l= 0)
      {
         char = StringGetChar(s, lenght);
         
         //
         //
         //
         //
         //
         
         if((char > 96 && char < 123) || (char > 223 && char < 256))
                  s = StringSetChar(s, lenght, char - 32);
          else 
              if(char > -33 && char < 0)
                  s = StringSetChar(s, lenght, char + 224);
                  
         //
         //
         //
         //
         //
                                 
         lenght--;
   }
   
   //
   //
   //
   //
   //
   
   return(s);
}

Recommend