//+------------------------------------------------------------------+ //| Dynamic Zone Stoch.mq4 | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Dynamic Zone RSI.mq4 | //| Copyright © 2005-07, Pavel Kulko. | //| polk@alba.dp.ua | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005-07, Pavel Kulko" #property link "polk@alba.dp.ua" #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Lime //Stoch K% line //#property indicator_color2 DarkGreen //Stoch D% line #property indicator_color2 DarkGray //upper band #property indicator_color3 DimGray //lower band #property indicator_color4 Red // BB median line #property indicator_color5 Blue //EMA extern string note1 = "Stochastic"; extern int StochPeriod = 14; extern int DPeriod = 3; extern int Slowing = 3; extern bool DrawStochastic = true; extern string note2 = "Bollinger Band"; extern int BandPeriod = 18; extern bool DrawBollingerBand = true; extern string note3 = "Exponential Moving Average"; extern int EMAPeriod = 3; extern bool DrawEMA = true; double StochK[],StochD[],BBUpperBand[],BBLowerBand[], BBMedianLine[], ExpMA[]; //+------------------------------------------------------------------+ int init() { IndicatorBuffers(5); if (DrawStochastic) { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,StochK); } // SetIndexStyle(1,DRAW_LINE); // SetIndexBuffer(1,StochD); if (DrawBollingerBand) { SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,BBUpperBand); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,BBLowerBand); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,BBMedianLine); } if (DrawEMA) { SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,ExpMA); } IndicatorShortName("Dynamic Zone Stoch("+StochPeriod+","+DPeriod+","+Slowing+") BB("+BandPeriod+") EMA("+EMAPeriod+") values: "); return(0); } //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ double Variance(double& Data[], int Per) { double sum, ssum; for (int i=0; i=0; i--) { StochK[i] = iStochastic(NULL,0,StochPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_MAIN,i); // StochD[i] = iStochastic(NULL,0,StochPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_SIGNAL,i); MA = 0; for(int j=i; j=0; i--) { ExpMA[i] = iMAOnArray (StochK,0,EMAPeriod,0,MODE_EMA,i); } return(0); } //+------------------------------------------------------------------+