//+------------------------------------------------------------------+ //| 0-0-TANGO.mq4 | //| Copyright © 2009, MetaQL. | //| mrexpertforex@mail.ru | //+------------------------------------------------------------------+ #property copyright "MetaQL" #property link "mrexpertforex@mail.ru" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Blue #property indicator_color3 Red //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ extern int X=20; extern double POROG=20; extern int GJIYBUHA=100; extern int COUNTED_BARS=1000; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ double buf_1[]; double buf_2[]; double buf_3[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexBuffer(0,buf_1); SetIndexStyle(0,DRAW_ARROW,0,2); SetIndexArrow(0,233); SetIndexBuffer(1,buf_2); SetIndexStyle(1,DRAW_ARROW,0,2); SetIndexArrow(1,234); SetIndexBuffer(2,buf_3); SetIndexStyle(2,DRAW_ARROW,0,2); SetIndexArrow(2,111); //---- } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit=0; if(counted_bars>0)counted_bars--; limit=Bars-counted_bars; if(limit>COUNTED_BARS) limit=COUNTED_BARS; for(int i=1;i<=limit;i++) { //++++++++++++++++++++++ int rezult=0; //-- double HI_RSI=iRSI(NULL,0,X,0,i); double LO_RSI=iRSI(NULL,0,X,0,i); //-- int HI_RSI_b=i; int LO_RSI_b=i; //-- double RSI_1=iRSI(NULL,0,X,0,i); //-- for(int b1=i+1;b1<=i+GJIYBUHA;b1++) { //++++++++++++++++++++++++++++++ double RSI_2=iRSI(NULL,0,X,0,b1); //-- if(RSI_2>HI_RSI) { HI_RSI=RSI_2; HI_RSI_b=b1; } //--- if(RSI_2=RSI_1)||(Close[b1]>=Close[i] && RSI_2=UP) { rezult=1; } //--- double DOWN=LO_RSI+((HI_RSI-LO_RSI)/100)*POROG; //-- if(RSI_2<=DOWN) { rezult=-1; } //-- if( RSI_2>DOWN && RSI_20) { buf_1[i]=Low[i]; buf_2[i]=EMPTY_VALUE; buf_3[i]=EMPTY_VALUE; } //--- if(rezult<0) { buf_1[i]=EMPTY_VALUE; buf_2[i]=High[i]; buf_3[i]=EMPTY_VALUE; } //--- if(rezult==0) { buf_1[i]=EMPTY_VALUE; buf_2[i]=EMPTY_VALUE; buf_3[i]=Close[i]; } //--- //++++++++++++++++++++++ } //---- }