//+------------------------------------------------------------------+ //| Composite Index.mq4 | //| Dominique Noel | //| | //+------------------------------------------------------------------+ #property copyright "Dominique Noel" #property link "" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Blue #property indicator_width1 2 //---- buffers double ExtMapBuffer1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i; double RSI14, RSI14_9; double RSI3, RSI3_1, RSI3_2; //---- if (Bars <= 24) return(0); //---- Initialize to Close if (counted_bars < 1) for (i=1; i<=24; i++) ExtMapBuffer1[Bars-i] = 0.0; //---- i = Bars-24-1; if (counted_bars>=24) i = Bars-counted_bars-1; while(i>=0) { RSI14 = iRSI(Symbol(),0,14,PRICE_CLOSE,i); RSI14_9 = iRSI(Symbol(),0,14,PRICE_CLOSE,i+9); RSI3 = iRSI(Symbol(),0,14,PRICE_CLOSE,i); RSI3_1 = iRSI(Symbol(),0,14,PRICE_CLOSE,i+1); RSI3_2 = iRSI(Symbol(),0,14,PRICE_CLOSE,i+2); ExtMapBuffer1[i] = ((RSI3 + RSI3_1 + RSI3_2)/3) + RSI14 - RSI14_9; i--; } //---- //---- return(0); } //+------------------------------------------------------------------+