Navigation:Home > Content >

Stochastic_Standard_4TF_cja.mq4

Time: 2018-09-07 | Download file:Stochastic_Standard_4TF_cja.mq4

//+------------------------------------------------------------------+
//|                             CIA     MTF Stochastic Standard .mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//|                                            MTF_4Period STOCH.mq4 |
//| mod ForexTSD.com ki                                              |
//|------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link      "http://www.forex-tsd.com"
#property link      " extra timeframes by cja" 

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Olive
#property indicator_color2 Olive
#property indicator_color3 SeaGreen
#property indicator_color4 SeaGreen
#property indicator_color5 Red
#property indicator_color6 Red
#property indicator_color7 DodgerBlue
#property indicator_color8 DodgerBlue
#property indicator_maximum	100
#property indicator_minimum	0
#property indicator_level1		76.4
#property indicator_level2		61.8
#property indicator_level3    50
#property indicator_level4    38.2
#property indicator_level5    23.6
#property indicator_levelcolor  DarkSlateGray
#property indicator_width1  4
#property indicator_width3  3
#property indicator_width5  2
#property indicator_width7  1
/*
Price Options
PRICE_CLOSE = 0 Close price. 
PRICE_OPEN = 1 Open price. 
PRICE_HIGH = 2 High price. 
PRICE_LOW = 3 Low price. 
PRICE_MEDIAN = 4 Median price, (high+low)/2. 
PRICE_TYPICAL = 5 Typical price, (high+low+close)/3. 
PRICE_WEIGHTED = 6 Weighted close price, (high+low+close+close)/4. 

Line Style Options
STYLE_SOLID = 0 The line is solid. 
STYLE_DASH = 1 The line is dashed. 
STYLE_DOT = 2 The line is dotted. 
STYLE_DASHDOT = 3 The line has alternating dashes and dots. 
STYLE_DASHDOTDOT = 4 The line has alternating dashes and double dots. 

Ma Options
MODE_SMA = 0 Simple moving average, 
MODE_EMA = 1 Exponential moving average, 
MODE_SMMA = 2 Smoothed moving average, 
MODE_LWMA = 3 Linear weighted moving average. 
*/
extern string IIIIIIIIIIIIIIIIIIIIIIIIIIII=">>> Stochastic #1 Settings >>>>>>>>>>>>>>>";
extern int  TimeFrame1=0;
extern bool Show_STOCH_1 = true;
extern int K_period1 = 14;
extern int D_period1 = 3;
extern int S_period1 = 3;
extern int STOCH_1_MAIN_Line_Style = 0;
extern int STOCH_1_SIGNAL_Line_Style = 2;
extern int STOCH_1_Price_field = 1;
extern int STOCH_1_MAIN_Ma_Mode = 1;
extern int STOCH_1_SIGNAL_Ma_Mode = 1;

extern string IIIIIIIIIIIIIIIIIIIIIIIIIIIII=">>> Stochastic #2 Settings >>>>>>>>>>>>>>>>>";
extern int  TimeFrame2=60;
extern bool Show_STOCH_2 = true;
extern int K_period2 = 14;
extern int D_period2 = 3;
extern int S_period2 = 3;
extern int STOCH_2_MAIN_Line_Style = 0;
extern int STOCH_2_SIGNAL_Line_Style = 2;
extern int STOCH_2_Price_field = 1;
extern int STOCH_2_MAIN_Ma_Mode = 1;
extern int STOCH_2_SIGNAL_Ma_Mode = 1;

extern string IIIIIIIIIIIIIIIIIIIIIIIIIIIIII=">>> Stochastic #3 Settings >>>>>>>>>>>>>>>>>>>";
extern int  TimeFrame3=240;
extern bool Show_STOCH_3 = true;
extern int K_period3 = 14;
extern int D_period3 = 3;
extern int S_period3 = 3;
extern int STOCH_3_MAIN_Line_Style = 0;
extern int STOCH_3_SIGNAL_Line_Style = 2;
extern int STOCH_3_Price_field = 1;
extern int STOCH_3_MAIN_Ma_Mode = 1;
extern int STOCH_3_SIGNAL_Ma_Mode = 1;

extern string IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII=">>> Stochastic #4 Settings >>>>>>>>>>>>>>>>>>>>>";
extern int  TimeFrame4=1440;
extern bool Show_STOCH_4 = true;
extern int K_period4 = 14;
extern int D_period4 = 3;
extern int S_period4 = 3;
extern int STOCH_4_MAIN_Line_Style = 0;
extern int STOCH_4_SIGNAL_Line_Style = 2;
extern int STOCH_4_Price_field = 1;
extern int STOCH_4_MAIN_Ma_Mode = 1;
extern int STOCH_4_SIGNAL_Ma_Mode = 1;


extern bool Show_StochLabels = true;
extern int  Labels_Corner = 0; 
extern int  Labels_Shift  = 0; 
extern int  Labels_X_Distance = 535; 
extern int  Labels_Y_Distance = 20; 


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


double MainBuffer1[];
double SignalBuffer1[];
double MainBuffer2[];
double SignalBuffer2[];
double MainBuffer3[];
double SignalBuffer3[];
double MainBuffer4[];
double SignalBuffer4[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() 
  {
   //---- indicator line
  if(Show_STOCH_1 ==true){Show_STOCH_1=DRAW_LINE; }
    else {Show_STOCH_1=DRAW_NONE; }
  SetIndexBuffer(6,MainBuffer1);
   SetIndexStyle(6,Show_STOCH_1 ,STOCH_1_MAIN_Line_Style);
   SetIndexLabel(6,"STO#1_Main["+TimeFrame1+"]("+K_period1+","+D_period1+", "+S_period1+" )");
   SetIndexBuffer(7,SignalBuffer1);
   SetIndexStyle(7,Show_STOCH_1 ,STOCH_1_SIGNAL_Line_Style);
   SetIndexLabel(7,"STO#1_Signal["+TimeFrame1+"]("+K_period1+","+D_period1+","+S_period1+" )");
   
 if(Show_STOCH_2 ==true){Show_STOCH_2=DRAW_LINE; }
    else {Show_STOCH_2=DRAW_NONE; }
  SetIndexBuffer(4,MainBuffer2);
   SetIndexStyle(4,Show_STOCH_2 ,STOCH_2_MAIN_Line_Style);
   SetIndexLabel(4,"STO#2_Main ["+TimeFrame2+"]("+K_period2+","+D_period2+","+S_period2+")");
   SetIndexBuffer(5,SignalBuffer2);
   SetIndexStyle(5,Show_STOCH_2 ,STOCH_2_SIGNAL_Line_Style);
   SetIndexLabel(5,"STO#2_Signal ["+TimeFrame2+"]("+K_period2+","+D_period2+","+S_period2+")");
   
 if(Show_STOCH_3 ==true){Show_STOCH_3=DRAW_LINE; }
    else {Show_STOCH_3=DRAW_NONE; }
  SetIndexBuffer(2,MainBuffer3);
   SetIndexStyle(2,Show_STOCH_3 ,STOCH_3_MAIN_Line_Style);
   SetIndexLabel(2,"STO#3_Main["+TimeFrame3+"]("+K_period3+","+D_period3+","+S_period3+")");
   SetIndexBuffer(3,SignalBuffer3);
   SetIndexStyle(3,Show_STOCH_3 ,STOCH_3_SIGNAL_Line_Style);
   SetIndexLabel(3,"STO#3_Signal["+TimeFrame3+"]("+K_period3+","+D_period3+","+S_period3+" )");
   
 if(Show_STOCH_4 ==true){Show_STOCH_4=DRAW_LINE; }
    else {Show_STOCH_4=DRAW_NONE; }
  SetIndexBuffer(0,MainBuffer4);
   SetIndexStyle(0,Show_STOCH_4 ,STOCH_4_MAIN_Line_Style);
   SetIndexLabel(0,"STO#4_Main ["+TimeFrame4+"]("+K_period4+","+D_period4+","+S_period4+")");
   SetIndexBuffer(1,SignalBuffer4);
   SetIndexStyle(1,Show_STOCH_4 ,STOCH_4_SIGNAL_Line_Style);
   SetIndexLabel(1,"STO#4_Signal["+TimeFrame4+"]("+K_period4+","+D_period4+","+S_period4+")");
   
//---- name for DataWindow and indicator subwindow label   
  
 
  IndicatorShortName("STOStd_4TF");  
  }
//----
   return(0);
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   ObjectDelete("stoLABEL1");
   ObjectDelete("stoLABEL2");
   ObjectDelete("stoLABEL3");
   ObjectDelete("stoLABEL4");

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

//+------------------------------------------------------------------+
//| MTF Stochastic                                                   |
//+------------------------------------------------------------------+

int start()
  {
   datetime TimeArray1[],TimeArray2[],TimeArray3[],TimeArray4[];
   int    i,shift,limit,y1=0,y2=0,y3=0,y4=0,counted_bars=IndicatorCounted();
    
// Plot defined timeframe on to current timeframe   
   
   ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame1); 
   ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TimeFrame2); 
   ArrayCopySeries(TimeArray3,MODE_TIME,Symbol(),TimeFrame3); 
   ArrayCopySeries(TimeArray4,MODE_TIME,Symbol(),TimeFrame4); 
  
   
        limit=MathMax(Bars-counted_bars,TimeFrame1/Period());     
        limit=MathMax(            limit,TimeFrame2/Period());   
        limit=MathMax(            limit,TimeFrame3/Period());  
        limit=MathMax(            limit,TimeFrame4/Period());  


   for(i=0,y1=0,y2=0,y3=0,y4=0;i        

Recommend