//+------------------------------------------------------------------+ //| RSI_2SigMA_mtf RSI.mq4 | //| Copyright © 2005, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ //mtf2008fxtsd.com keris ki #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" //---- #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 RoyalBlue #property indicator_color2 Green #property indicator_color3 Red #property indicator_width1 1 #property indicator_width2 2 #property indicator_width3 1 #property indicator_level1 70 #property indicator_level2 50 #property indicator_level3 30 #property indicator_levelcolor DarkOliveGreen //---- extern int RSI_Period=14; extern int RSI_Price =0; extern int MA1_Period=3; extern int MA1_Mode =1;// MA_Price =0; - ma on array extern int MA2_Period=5; extern int MA2_Mode =1; double RSI_Buffer[]; double MA1_Buffer[]; double MA2_Buffer[]; double ExBuffer1[]; double ExBuffer2[]; extern int TimeFrame=0; 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"; //+---- int init() { IndicatorBuffers(5); SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexStyle(2, DRAW_LINE); //---- SetIndexBuffer(0, RSI_Buffer); SetIndexBuffer(1, MA1_Buffer); SetIndexBuffer(2, MA2_Buffer); SetIndexBuffer(3, ExBuffer1); SetIndexBuffer(4, ExBuffer2); //---- switch(TimeFrame) { case 1 : string TimeFrameStr="M1"; break; case 5 : TimeFrameStr="M5"; break; case 15 : TimeFrameStr="M15"; break; case 30 : TimeFrameStr="M30"; break; case 60 : TimeFrameStr="H1"; break; case 240 : TimeFrameStr="H4"; break; case 1440 : TimeFrameStr="D1"; break; case 10080 : TimeFrameStr="W1"; break; case 43200 : TimeFrameStr="MN1"; break; default : TimeFrameStr="TF0"; } IndicatorShortName("RSI_2SigMA ("+RSI_Period+","+MA1_Period+","+MA2_Period+") ["+TimeFrameStr+"]"); TimeFrame=MathMax(TimeFrame,Period()); return(0); } //+---- int deinit() { //---- return(0); } //+---- int start() { datetime TimeArray[],TimeArray1[],TimeArray2[]; int limit,i,y=0,counted_bars = IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; //---- ArrayCopySeries(TimeArray, MODE_TIME,Symbol(),TimeFrame); ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame); ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TimeFrame); limit = Bars - counted_bars; limit = MathMax(limit,TimeFrame/Period()); //---- for(i=0,y=0;i<limit;i++) { if (Time[i]<TimeArray[y]) y++; RSI_Buffer[i] = iRSI(NULL, TimeFrame, RSI_Period, RSI_Price, y); ExBuffer1[y] = RSI_Buffer[i]; } for(i=0,y=0;i<limit;i++) { if (Time[i]<TimeArray1[y]) y++; MA1_Buffer[i] = iMAOnArray(ExBuffer1,0,MA1_Period,0,MA1_Mode,y); ExBuffer2[y] = MA1_Buffer[i]; } for(i=0,y=0;i<limit;i++) { if (Time[i]<TimeArray1[y]) y++; MA2_Buffer[i] = iMAOnArray(ExBuffer2,0,MA2_Period,0,MA2_Mode,y); } return(0); } //+---
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Relative strength index
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: