Navigation´╝ÜHome > Content >

OnChart_Stochastic_Channel_3TFx3.mq4

Time: 2012-03-10 | Download file:OnChart_Stochastic_Channel_3TFx3.mq4

//+------------------------------------------------------------------+
//|OnChart_Stochastic_Channel(FL_MTF)[cw]mod  OnChart Stochastic.mq4 |
//|                                                           mladen |
//|  mtf  Fibo Levels [forexTSD.com; 2007]                           |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 DarkGreen          //80//
#property indicator_color2 DarkSlateGray      //70   //L_overBough
#property indicator_color3 DarkGreen          //L_50
#property indicator_color4 DarkSlateGray      //30   //L_overSold
#property indicator_color5 DarkGreen          //20//
#property indicator_color6 Red
#property indicator_color7 Aqua
#property indicator_color8 Gold

#property indicator_style3 STYLE_DOT
//#property indicator_style6 STYLE_DOT


//---- parameters
//
//
//
//

extern int KPeriod    = 14;
extern int DPeriod    =  3;
extern int Slowing    =  3;
extern int maPeriod   = 14;
extern int maMethod   =  1;
extern int maPrice    =  0;
extern double L_overBought1 = 76.4;//80
extern double L_overBought  = 61.8;//70
extern double L_50          = 50.0;
extern double L_overSold    = 38.2;//30
extern double L_overSold1   = 23.6;//20

extern string timeFrame = "Current Timeframe";
extern string note_TimeFrames = "M1;5,15,30,60(H1);H4;D1;W1;MN";
extern int      TimeFrame2 = 60;
extern int      TimeFrame3 = 240;

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

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
datetime RTimeArray[];
datetime TTimeArray[];
datetime TTimeArray2[];
datetime TTimeArray3[];
int      TimeFrame;
int      atrTimeFrame;
string   shortName;

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

int init()
{
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexBuffer(7,ExtMapBuffer8);

  IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);

   //
   //
   //
   //
   //
   
   TimeFrame = stringToTimeFrame(timeFrame);
   atrTimeFrame=PERIOD_D1;
   if (TimeFrame >= atrTimeFrame)
      switch (TimeFrame)
         {
            case PERIOD_D1: atrTimeFrame = PERIOD_W1; break;
            default:        atrTimeFrame = PERIOD_MN1;
         }

   IndicatorShortName("OnChart_Stoch["+TimeFrame+"/"+Period()+"]("+KPeriod+","+DPeriod+","+Slowing+")["+maPeriod+"]");  
 
   SetIndexLabel(0,"Stoch["+TimeFrame+"] L"+DoubleToStr(L_overBought1,2)+"");
   SetIndexLabel(1,"Stoch["+TimeFrame+"] L"+DoubleToStr(L_overBought ,2)+"");
   SetIndexLabel(2,"Stoch["+TimeFrame+"] L"+DoubleToStr(L_50         ,2)+"");
   SetIndexLabel(3,"Stoch["+TimeFrame+"] L"+DoubleToStr(L_overSold   ,2)+"");
   SetIndexLabel(4,"Stoch["+TimeFrame+"] L"+DoubleToStr(L_overSold1  ,2)+"");
   SetIndexLabel(5,"Stoch["+TimeFrame3+"]("+KPeriod+","+DPeriod+","+Slowing+")Main");
   SetIndexLabel(6,"Stoch["+TimeFrame2+"]("+KPeriod+","+DPeriod+","+Slowing+")Main");
   SetIndexLabel(7,"Stoch["+TimeFrame+"]("+KPeriod+","+DPeriod+","+Slowing+")Main");

 
   return(0);
}
int deinit()
{
   return(0);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
{
   double maValue;
   double avgRange;
   double stochValue;
   double stochValue2;   
   double stochValue3;  
//   double signalValue;

   int    counted_bars=IndicatorCounted();
   int    limit;
   int    i,r,y,y2,y3;
   
//----
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
      limit=MathMax(Bars-counted_bars,TimeFrame/Period());   
      limit=MathMax(           limit,TimeFrame2/Period());   
      limit=MathMax(           limit,TimeFrame3/Period()); 

      ArrayCopySeries(RTimeArray, MODE_TIME,NULL,atrTimeFrame);
      ArrayCopySeries(TTimeArray, MODE_TIME,NULL,TimeFrame);
      ArrayCopySeries(TTimeArray2,MODE_TIME,NULL,TimeFrame2);
      ArrayCopySeries(TTimeArray3,MODE_TIME,NULL,TimeFrame3);
  
         if (TimeFrame2= 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