#property copyright "2005-2014, MetaQuotes Software Corp." #property link "http://www.mql4.com" #property description "Stochs" #property strict #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_level1 80.0 #property indicator_level2 20.0 #property indicator_levelcolor clrSilver #property indicator_levelstyle STYLE_DOT input string firstsymbol="EURUSD"; input string secondsymbol="GBPUSD"; input int kperiod=100; input int dperiod=1; input int slowing=1; double ExtRSIBuffer[]; double ExtPosBuffer[]; double ExtNegBuffer[]; int OnInit(void){ string short_name; string short_name1; string short_name2; IndicatorBuffers(2); SetIndexBuffer(0,ExtRSIBuffer); SetIndexBuffer(1,ExtPosBuffer); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtRSIBuffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtPosBuffer); short_name="Stoch Double Pairs ("+string(kperiod)+","+string(dperiod)+","+string(slowing)+")"; short_name1=Symbol()+" period ("+string(kperiod)+")"; short_name2=secondsymbol+" period ("+string(kperiod)+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name1); SetIndexLabel(1,short_name2); SetIndexDrawBegin(0,kperiod); SetIndexDrawBegin(1,kperiod); return(INIT_SUCCEEDED); } int start(){ int i; //if(Bars<=kperiod || kperiod<2)return(0); //ArraySetAsSeries(ExtRSIBuffer,false); //ArraySetAsSeries(ExtPosBuffer,false); for(i=2000; i>=0; i--){ ExtRSIBuffer[i]=iStochastic(firstsymbol,0,kperiod,dperiod,slowing,MODE_SMA,0,MODE_MAIN,i); ExtPosBuffer[i]=iStochastic(secondsymbol,0,kperiod,dperiod,slowing,MODE_SMA,0,MODE_MAIN,i); } return(0); } //+------------------------------------------------------------------+