MultiSSRC





//+------------+-----------------------------------------------------+
//| v.27.04.07 |                                       MultiSSRC.mq4 |
//+------------+                                                     |
//|            |              Bookkeeper, 2007, yuzefovich@gmail.com |
//+------------+-----------------------------------------------------+
/********************************************************************/ 
/************ Presence  SSRC.mq4 v.12.04.07 is necessary ************/ 
/********************************************************************/ 
/***  Working window        Additional windows should be          ***/  
/***  with indicator        open for loading quotations           ***/ 
/***  M1....................M5,M15,M30,H1                         ***/ 
/***  M5....................M5,M15,M30,H1                         ***/ 
/***  M15...................M30,H1,H4                             ***/ 
/***  M30...................H1,H4                                 ***/ 
/***  H1....................H4                                    ***/ 
/***  H4....................D1                                    ***/ 
/***  If the terminal has been switched off,                      ***/
/***  and then again included,                                    ***/
/***  after loading quotations it is necessary                    ***/
/***  to restart the indicator                                    ***/
/********************************************************************/ 
#property copyright ""
#property link      "http://www.forexter.land.ru/indicators.htm"
//----
#property indicator_separate_window
#property indicator_maximum  1.3
#property indicator_minimum -1.3
#property indicator_level1   0.9
#property indicator_level2  -0.9
#property indicator_level3   0.8
#property indicator_level4  -0.8
#property indicator_level5   0.7
#property indicator_level6  -0.7
#property indicator_buffers  4
#property indicator_color1   Crimson 
#property indicator_color2   MediumVioletRed 
#property indicator_color3   BlueViolet 
#property indicator_color4   Blue 
/********************************************************************/ 
//---- Snake
extern int    SnakeRange   =3; 
extern int    FilterPeriod =21; 
extern double MartFiltr    =2;
extern int    PriceConst   =0; // 0 - Close
                               // 1 - Open
                               // 2 - High
                               // 3 - Low
                               // 4 - (H+L)/2
                               // 5 - (H+L+C)/3
                               // 6 - (H+L+2*C)/4
/********************************************************************/ 
double SRC1[];
double SRC2[];
double SRC3[];
double SRC4[];
/********************************************************************/ 
int rangeN=14,Maxrange=30,p1,p2,p3,p4,q;
bool First=true;
/********************************************************************/ 
void deinit() { return; }
/********************************************************************/ 
void init() { string str; int n=Period(); IndicatorBuffers(4); 
SetIndexBuffer(0,SRC1); SetIndexStyle(0,DRAW_LINE,EMPTY,3);
SetIndexBuffer(1,SRC2); SetIndexStyle(1,DRAW_LINE,EMPTY,2);
SetIndexBuffer(2,SRC3); SetIndexStyle(2,DRAW_LINE,EMPTY,2);
SetIndexBuffer(3,SRC4); SetIndexStyle(3,DRAW_LINE,EMPTY,2);
switch(n) {
case   1: str="M5,M15,M30,H1"; break;
case   5: str="M5,M15,M30,H1"; break;
case  15: str="M15,M30,H1,H4"; break;
case  30: str="M30,H1,H4";     break;
case  60: str="H1,H4";         break;
case 240: str="H4,D1";         break; }
IndicatorShortName("MultiSSRC("+str+") "); return; }
/********************************************************************/ 
void start() { int counted_bars=IndicatorCounted();
int n,n1,n2,n3,n4,limit; 
if(Period()>240) { Alert("Period()>H4 - error!"); return; }
if(counted_bars<0) return(-1); 
if(First==true) { n=Period(); switch(n) {
case   1: p1=5;   p2=15;   p3=30;  p4=60;  q=120; break;
case   5: p1=5;   p2=15;   p3=30;  p4=60;  q=24;  break;
case  15: p1=15;  p2=30;   p3=60;  p4=240; q=32;  break;
case  30: p1=30;  p2=60;   p3=240; p4=0;   q=16;  break;
case  60: p1=60;  p2=240;  p3=0;   p4=0;   q=8;   break;
case 240: p1=240; p2=1440; p3=0;   p4=0;   q=12;  break; }
limit=Bars-(rangeN+FilterPeriod+SnakeRange+4);
for(n=0;n<=limit;n++) { 
n1=iBarShift(Symbol(),p1,Time[n]);
SRC1[n]=iCustom(NULL,p1,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n1);
if(p2>0) { n2=iBarShift(Symbol(),p2,Time[n]);
SRC2[n]=iCustom(NULL,p2,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n2); }
if(p3>0) { n3=iBarShift(Symbol(),p3,Time[n]);
SRC3[n]=iCustom(NULL,p3,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n3); }
if(p4>0) { n4=iBarShift(Symbol(),p4,Time[n]);  
SRC4[n]=iCustom(NULL,p4,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n4); }
} First=false; }
else { limit=Bars-counted_bars+q+1; 
for(n=0;n<=limit;n++) {
n1=iBarShift(Symbol(),p1,Time[n]);
SRC1[n]=iCustom(NULL,p1,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n1);
if(p2>0) { n2=iBarShift(Symbol(),p2,Time[n]);
SRC2[n]=iCustom(NULL,p2,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n2); }
if(p3>0) { n3=iBarShift(Symbol(),p3,Time[n]);
SRC3[n]=iCustom(NULL,p3,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n3); }
if(p4>0) { n4=iBarShift(Symbol(),p4,Time[n]);
SRC4[n]=iCustom(NULL,p4,"SSRC",
   SnakeRange,FilterPeriod,MartFiltr,PriceConst,0,n4); } } } return; }
/********************************************************************/ 





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:



Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen