cci_iCCI_M1+M5+M15
Download scriptThis tool is designed to provide traders with a multi-layered perspective on market momentum by consolidating data from different timeframes into a single visual display. Instead of looking at just one timeframe at a time, it allows you to see the "pulse" of the market across three distinct speeds simultaneously.
Core Logic and Functionality
The script functions by pulling information from three specific timeframes: the 1-minute (M1), 5-minute (M5), and 15-minute (M15) charts. It calculates a technical momentum value—known as the Commodity Channel Index (CCI)—for each of these periods independently.
By gathering this data, the tool creates three distinct lines on your chart:
- The Short-Term View (M1): This line tracks rapid, immediate price fluctuations. It is highly sensitive and reacts quickly to every small movement in the market.
- The Mid-Term View (M5): This provides a smoother look at the price action, filtering out some of the "noise" of the 1-minute chart to show slightly more established trends.
- The Longer-Term View (M15): This line represents the broader trend within the current session, showing where the overall momentum is heading over a larger span of time.
How it Works for the User
When you run this script, it scans the most recent price data (up to a user-defined number of bars) and plots these three different perspectives as separate lines in a dedicated window below your main price chart.
The primary goal of this logic is confluence. By viewing all three lines together, you can observe how they interact:
- If all three lines are moving in the same direction, it suggests a strong, unified trend across multiple timeframes.
- If the lines are diverging (e.g., the 1-minute line moves up while the 15-minute line stays flat or moves down), it may signal a temporary price spike that lacks long-term support.
In essence, this script simplifies complex multi-timeframe analysis by bringing the "big picture" and the "immediate picture" into one view, helping you identify where fast-moving price action aligns with broader market momentum.
//+------------------------------------------------------------------+
//| iCCI_M1+H1+D1.mq4 |
//| Yuriy Tokman |
//| yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "yuriytokman@gmail.com"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Blue
//---- input parameters
extern int barsToProcess=30;
extern int period=14;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(),
//----
limit;
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
if(limit>barsToProcess)
limit=barsToProcess;
for(int i=0;i<limit;i++)
{
ExtMapBuffer1[i]=iCCI(NULL,PERIOD_M1,period,PRICE_OPEN,i);
ExtMapBuffer2[i]=iCCI(NULL,PERIOD_M5,period,PRICE_OPEN,i);
ExtMapBuffer3[i]=iCCI(NULL,PERIOD_M15,period,PRICE_OPEN,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments