Navigation:Home > Content >

Stochastic_LSDs_MTF.mq4

Time: 2016-10-22 | Download file:Stochastic_LSDs_MTF.mq4

//+------------------------------------------------------------------+
//|                                               MTF_Stochastic.mq4 |
//|                                      Copyright © 2006, Keris2112 |
//|                                                                  |
//+------------------------------------------------------------------+
//2008fxtsd   ki

#property copyright "Copyright © 2006, Keris2112"
#property link      "http://www.forex-tsd.com"

#property indicator_separate_window

#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Maroon
#property indicator_color3 RoyalBlue
#property indicator_color4 Red
#property indicator_color5 DeepSkyBlue



#property indicator_level1 80
#property indicator_level2 50
#property indicator_level3 20
#property indicator_levelcolor DarkSlateGray


//---- 

extern int TimeFrame=60;

extern int KPeriod=8;
extern int DPeriod=3;
extern int Slowing=3;
extern int MAMethod=0;
extern int PriceField=0;

extern bool ShowLine     =true;
extern bool ShowSection  =true;
extern bool ShowDot      =true;
extern bool ShiftToTFClose  =true;



extern string PriceField_  = "0=Hi/Low   1=Close/Close";
extern string MA_Method_   = "SMA0 EMA1 SMMA2 LWMA3";
extern string TimeFrames   = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN";


double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];

//+------------------------------------------------------------------+

int init()
  {
   
//---- 
   IndicatorBuffers(5);

   TimeFrame =MathMax(TimeFrame,Period());
  
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle (0,DRAW_NONE);
   SetIndexStyle (1,DRAW_NONE);


   if (ShowLine)  
   {
   SetIndexStyle (0,DRAW_LINE);
   SetIndexStyle (1,DRAW_LINE);
   }
   
   if (ShowSection)  
      {
      SetIndexBuffer (2,ExtMapBuffer3);
      SetIndexStyle  (2,DRAW_SECTION);
      SetIndexShift  (2,0);
   
      SetIndexStyle  (3,DRAW_SECTION);
      SetIndexBuffer (3,ExtMapBuffer4);
      SetIndexShift  (3,0);   
      }


  if (ShowDot)   
         {
         SetIndexBuffer(4,ExtMapBuffer5);
         SetIndexStyle (4,DRAW_ARROW);
         SetIndexArrow (4,158);  // 250 177 251
         SetIndexShift (4,0);
         SetIndexEmptyValue(4,EMPTY_VALUE);
         }


   if(ShiftToTFClose)  {          SetIndexShift(2,TimeFrame/Period()-1);
                                  SetIndexShift(3,TimeFrame/Period()-1);
                                  SetIndexShift(4,TimeFrame/Period()-1);
                        } 
   
//----  
   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="MN"; break;
      default : TimeFrameStr="TF0";
   } 
   IndicatorShortName("Stochastic ("+KPeriod+","+DPeriod+","+Slowing+") "+TimeFrameStr);  
  }
//----
   return(0);
 
//+------------------------------------------------------------------+


int start()
  {
   datetime TimeArray[];
   int    i,y,limit,counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
    

   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 

   limit=Bars-counted_bars;
   limit=MathMax(limit,TimeFrame/Period());
   for(i=0,y=0;i        

Recommend