GentorCCIM_v[1].0.0
Download scriptThis technical indicator is designed to provide a comprehensive visual overview of market momentum and trend direction by combining several different analytical methods into a single view. Instead of relying on just one type of data, it layers multiple types of price calculations to help identify whether the market is trending or potentially reversing.
Core Components and Logic
1. Dual CCI Momentum Analysis The script utilizes two versions of the Commodity Channel Index (CCI)—a "Fast" and a "Slow" version.
- The Fast CCI reacts quickly to recent price fluctuations, making it useful for spotting immediate movements.
- The Slow CCI filters out "noise" to show the broader underlying momentum. By displaying these together with historical data, the indicator allows you to see how short-term price action aligns with longer-term trends.
2. Exponential Moving Average (EMA) Filtering The tool incorporates an EMA, which acts as a dynamic baseline for price. The logic uses this to create a visual "gate." It essentially checks if the current market price is trading above or below this average. This helps traders distinguish between a bullish environment (where price stays above the average) and a bearish environment (where it stays below).
3. Linear Weighted Moving Average (LSMA) A significant portion of the script is dedicated to the Linear Weighted Moving Average. Unlike simple averages that treat all days equally, this calculation gives more importance to the most recent price data.
- Weighting Logic: The script calculates a specific weight based on the period length to ensure the most current data points have a stronger influence on the resulting line.
- Visual Trend Confirmation: The indicator uses this LSMA to provide color-coded signals. It compares the current price against the LSMA value:
- If the price is interacting with the LSMA in a specific way, it highlights one color (Red).
- If the price moves in the opposite direction relative to that average, it switches to another color (Green/Lime).
Summary of Visual Behavior
When you view this on your chart, you are seeing a multi-layered analysis:
- Momentum: The CCI lines show how much the price is deviating from its normal range.
- Trend Strength: The EMA and LSMA provide the "skeleton" of the trend.
- Dynamic Signaling: The color changes are the primary visual cues. They represent the "agreement" between current price action and the weighted moving averages, helping to identify when a trend is gaining strength or starting to lose steam.
//+------------------------------------------------------------------+
//| GentorCCIM.mq4 |
//| Egorov Gennadiy |
//| 2005.08.20 KimIV v.0.0 |
//| Íåìíîãî ìîäåðíèçèðîâàë, äîáàâèâ LSMA è ïîìåíÿâ å¸ ìåñòàìè ñ ÅÌÀ |
//+------------------------------------------------------------------+
#property copyright "Egorov Gennadiy, FX Sniper, KimIV"
#property link "http://www.kimiv.ru"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Black
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_color5 Lime
#property indicator_color6 Red
#property indicator_color7 Lime
#property indicator_level1 300
#property indicator_level2 200
#property indicator_level3 100
#property indicator_level4 50
#property indicator_level5 -50
#property indicator_level6 -100
#property indicator_level7 -200
#property indicator_level8 -300
//---- Âíåøíèå ïàðàìåòðû ---------------------------------------------
extern int SlowCCIPeriod = 14; // Ïåðèîä ìåäëåííîãî CCI
extern int FastCCIPeriod = 6; // Ïåðèîä áûñòðîãî CCI
extern int EMAPeriod = 34; // Ïåðèîä ÅÌÀ
extern int LSMAPeriod = 25; // Ïåðèîä LSMA
//---- Áóôåðû èíäèêàòîðà ---------------------------------------------
double FastWoodieCCI[];
double SlowWoodieCCI[];
double HistWoodieCCI[];
double LineHighEMA[];
double LineLowEMA[];
double LSMABuffer1[];
double LSMABuffer2[];
double wt[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
IndicatorBuffers(8);
IndicatorDigits(2);
SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 1);
SetIndexBuffer(0, FastWoodieCCI);
SetIndexStyle (1, DRAW_LINE, STYLE_SOLID, 2);
SetIndexBuffer(1, SlowWoodieCCI);
SetIndexStyle (2, DRAW_HISTOGRAM, STYLE_SOLID, 1);
SetIndexBuffer(2, HistWoodieCCI);
SetIndexStyle (3, DRAW_LINE, STYLE_SOLID, 3);
SetIndexBuffer(3, LineHighEMA);
SetIndexStyle (4, DRAW_LINE, STYLE_SOLID, 3);
SetIndexBuffer(4, LineLowEMA);
SetIndexBuffer(5, LSMABuffer1);
SetIndexStyle (5, DRAW_LINE, STYLE_SOLID, 3);
SetIndexBuffer(6, LSMABuffer2);
SetIndexStyle (6, DRAW_LINE, STYLE_SOLID, 3);
SetIndexBuffer(7, wt);
Comment("");
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int i, shift, counted_bars = IndicatorCounted();
int Draw4HowLong, loopbegin;
double sum, lengthvar, tmp ;
if (counted_bars<0) return;
if (counted_bars>0) counted_bars--;
counted_bars = Bars - counted_bars;
for (shift=0; shift<counted_bars; shift++) {
FastWoodieCCI[shift] = iCCI(NULL, 0, FastCCIPeriod, PRICE_TYPICAL, shift);
SlowWoodieCCI[shift] = iCCI(NULL, 0, SlowCCIPeriod, PRICE_TYPICAL, shift);
HistWoodieCCI[shift] = iCCI(NULL, 0, SlowCCIPeriod, PRICE_TYPICAL, shift);
//---------------- color coding ----------------------------------
LineLowEMA[shift] = -250;
LineHighEMA[shift] = -250;
double EmaValue = iMA(NULL, 0, EMAPeriod, 0, MODE_EMA, PRICE_TYPICAL, shift);
if (Close[shift] > EmaValue) LineHighEMA[shift] = EMPTY_VALUE;
else
if (Close[shift] < EmaValue) LineLowEMA[shift] = EMPTY_VALUE;
}
Draw4HowLong = Bars-LSMAPeriod - 5;
loopbegin = Draw4HowLong - LSMAPeriod - 1;
for(shift=loopbegin; shift>=0; shift--) {
sum = 0;
for (i=LSMAPeriod; i>=1; i--) {
lengthvar = LSMAPeriod + 1;
lengthvar /= 3;
tmp = 0;
tmp = (i - lengthvar)*Close[LSMAPeriod-i+shift];
sum+=tmp;
}
wt[shift] = sum*6/(LSMAPeriod*(LSMAPeriod+1));
//========== COLOR CODING ===========================================
LSMABuffer1[shift] = wt[shift]; //red
LSMABuffer2[shift] = wt[shift]; //green
if (wt[shift] > Close[shift]) LSMABuffer2[shift] = EMPTY_VALUE;
else
if (wt[shift] < Close[shift]) LSMABuffer1[shift] = EMPTY_VALUE;
}
}
//+------------------------------------------------------------------+
Comments