Time: 2011-12-24 | Download file:RSI_on_MA_2X2_mtf.mq4
//+------------------------------------------------------------------+ //| RSIonMA2x2mtf 2RSI on 2MA RSI.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //|2007fxtsd keris ki http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 LimeGreen #property indicator_color2 Crimson #property indicator_minimum -10 #property indicator_maximum 110 #property indicator_level1 80 #property indicator_level2 50 #property indicator_level3 20 #property indicator_levelstyle 2 #property indicator_levelcolor DarkSlateGray //---- input parameters extern int RSI1_Period =9; extern int MA1_Period =21; extern int RSI2_Period =14; extern int MA2_Period =34; extern int MA1_Mode = MODE_EMA; extern int MA2_Mode = MODE_EMA; extern int MA1_Price = PRICE_CLOSE; extern int MA2_Price = PRICE_CLOSE; extern int TimeFrame = 0; extern int MaxBarsToCount = 1500; extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF"; extern string MA_Method_Price = "SMA0 EMA1 SMMA2 LWMA3||0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6"; //---- buffers double RSI1_Buf[]; double RSI2_Buf[]; double MA1_Buf[]; double MA2_Buf[]; double MA1_Buf1[]; double MA2_Buf1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line IndicatorBuffers(6); SetIndexBuffer(0,RSI1_Buf); SetIndexStyle(0,DRAW_LINE); SetIndexLabel(0,""); SetIndexBuffer(1,RSI2_Buf); SetIndexStyle(1,DRAW_LINE); SetIndexLabel(1,""); SetIndexBuffer(2,MA1_Buf); SetIndexStyle(2,DRAW_NONE); SetIndexLabel(2,""); SetIndexBuffer(3,MA2_Buf); SetIndexStyle(3,DRAW_NONE); SetIndexLabel(3,""); SetIndexBuffer(4,MA1_Buf1); SetIndexBuffer(5,MA2_Buf1); //---- SetIndexDrawBegin(0,RSI1_Period); //---- IndicatorShortName("RSIonMA["+TimeFrame+"]: RSI1("+RSI1_Period+"|"+MA1_Period+") RSI2("+RSI2_Period+"|"+MA2_Period+")"); if (TimeFrame0) counted_bars--; ArrayCopySeries(TimeArray, MODE_TIME,Symbol(),TimeFrame); ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame); limit = Bars - counted_bars; limit = MathMax(limit,TimeFrame/Period()); limit= MathMin(limit,MaxBarsToCount); for(i=0,y=0;i