//+------------------------------------------------------------------+ //| #JGrx.mq4 | //| Copyright © 2009, masemus | //| masemus@yahoo.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, masemus" #property link "masemus@yahoo.com" #property indicator_separate_window //-------------------------------------------------------------------- extern string RSI_ADX = "JGrx © 2009, masemus"; //-------------------------------------------------------------------- #property indicator_maximum 50 #property indicator_minimum -50 #property indicator_buffers 6 #property indicator_color1 SeaGreen #property indicator_color2 FireBrick #property indicator_color3 Gold #property indicator_color4 Lime #property indicator_color5 Red #property indicator_color6 Blue #property indicator_width1 3 #property indicator_width2 3 #property indicator_width3 2 #property indicator_width4 1 #property indicator_width5 1 #property indicator_width6 1 //---- indicator buffers double ExtTrend[]; double ExtTrend2[]; double ExtLimeBuffer[]; double ExtRedBuffer[]; double ExtLimeBuffer2[]; double ExtRedBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- additional buffers are used for counting IndicatorBuffers(6); //---- indicator buffers mapping SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexStyle(2,DRAW_LINE); SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexStyle(4,DRAW_HISTOGRAM); SetIndexStyle(5,DRAW_LINE); SetIndexBuffer(0,ExtLimeBuffer); SetIndexBuffer(1,ExtRedBuffer); SetIndexBuffer(2,ExtTrend); SetIndexBuffer(3,ExtLimeBuffer2); SetIndexBuffer(4,ExtRedBuffer2); SetIndexBuffer(5,ExtTrend2); SetIndexLabel(0,NULL); SetIndexLabel(1,NULL); SetIndexLabel(3,NULL); SetIndexLabel(4,NULL); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Trend | //+------------------------------------------------------------------+ int start() { int limit,counted_bars=IndicatorCounted(); double prev,current,crsi,prsi; //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; i=0; i--) { ExtTrend[i]=iRSI(Symbol(),0,14,PRICE_MEDIAN,i)-iRSI(Symbol(),0,70,PRICE_MEDIAN,i); current=iADX(Symbol(),0,14,PRICE_MEDIAN,MODE_PLUSDI,i)-iADX(Symbol(),0,14,PRICE_MEDIAN,MODE_MINUSDI,i); prev=iADX(Symbol(),0,14,PRICE_MEDIAN,MODE_PLUSDI,i+1)-iADX(Symbol(),0,14,PRICE_MEDIAN,MODE_MINUSDI,i+1); crsi=iRSI(Symbol(),0,14,PRICE_MEDIAN,i)-iRSI(Symbol(),0,70,PRICE_MEDIAN,i); prsi=iRSI(Symbol(),0,14,PRICE_MEDIAN,i+1)-iRSI(Symbol(),0,70,PRICE_MEDIAN,i+1); bool up1=true; if(crsi>prsi) up1=true; if(crsiprev) up2=true; if(current