Author:
MultiSSRC

This script is designed as a multi-timeframe analysis tool for MetaTrader 4, specifically built to provide a comprehensive view of market trends by aggregating data from several different time horizons simultaneously. Instead of looking at just one chart interval at a time, it calculates and displays data from multiple periods to help traders identify overarching trends that might be invisible on a smaller timeframe.

Core Logic Overview

The primary function of this tool is to act as a "bridge" between different timeframes. It automatically detects which timeframe you are currently viewing (e.g., 1-minute, 5-minute, 1-hour, etc.) and then pulls the corresponding trend data from several higher timeframes to display them in a single window.

For example, if you are trading on a 5-minute chart, the script automatically fetches and aligns data from larger windows like the 15-minute, 30-minute, 60-minute, and 4-hour charts.

Key Operational Features

  • Dynamic Timeframe Mapping: The script contains a built-in logic system that adjusts its behavior based on your current view. It knows which higher timeframes are relevant for specific periods—for instance, if you are viewing the 4-hour chart, it shifts its focus to the Daily chart to provide the necessary context.
  • Integrated Data Source: The script relies on a secondary component called "SSRC." It reaches out to this specific indicator to gather technical values, ensuring that the information displayed remains consistent with established mathematical models.
  • Synchronized Alignment: Because different timeframes naturally have different amounts of data points, the script performs a "shift" calculation. This ensures that the data from a 4-hour chart, for example, is perfectly aligned with the current moment on your 5-minute chart, allowing you to see exactly where the market stands across all scales at once.
  • Visual Customization: The tool organizes this information into four distinct visual buffers (lines). This allows a trader to observe the "flow" of the market, identifying when multiple timeframes are moving in harmony or when a smaller timeframe is beginning to deviate from the larger trend.

User Requirements

For this logic to function correctly, the script requires the base "SSRC" indicator to be present in your platform's folder. Additionally, for the most accurate visual experience, it is recommended to have additional windows open for the relevant timeframes listed in the script's internal directory to ensure all necessary quotations are loaded and ready for processing.

Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
14 Views
0 Downloads
0 Favorites
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; }
/********************************************************************/ 

Comments