2CCI_ZeroCross_Alert_v1
Download scriptThis tool is designed to help traders identify specific momentum shifts in the market by monitoring two different types of "Commodity Channel Index" (CCI) indicators simultaneously. Think of the CCI as a measure of how far the price of an asset is deviating from its average; this script specifically looks for when these deviations cross a neutral starting point (zero).
The logic operates by comparing two distinct timeframes of market momentum:
1. The Dual-Indicator System The script tracks two different versions of the CCI:
- Trend CCI: This looks at a longer period to determine the broader direction of the market.
- Entry CCI: This looks at a shorter, faster period to identify immediate price movements.
2. The Detection Logic Instead of just looking at one indicator, the script waits for a specific "agreement" between both indicators. It monitors whether they are moving in harmony across the zero line:
- Bearish Signals (Downward Movement): The tool checks if the fast "Entry" indicator has dropped below zero. If it has, it then looks to see if the slower "Trend" indicator has also just crossed from positive territory into negative territory. If both occur, it triggers an alert that the market may be shifting downward.
- Bullish Signals (Upward Movement): Conversely, the tool checks if the fast "Entry" indicator has risen above zero. It then verifies if the slower "Trend" indicator has also just crossed from negative territory into positive territory. If both occur, it triggers an alert indicating a potential upward shift in momentum.
3. User Notifications When these specific conditions are met—where both the short-term and long-term momentum indicators align as they cross the zero mark—the script provides an immediate pop-up alert on your screen. Additionally, it displays the live numerical values of both indicators directly on your chart for real-time monitoring.
In essence, this script filters out minor market noise by requiring two different layers of momentum analysis to "agree" before notifying the trader of a potential trend change.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 2CCI_ZeroCross_Alert.mq4 |
//| Copyright © 2005, Jason Robinson (jnrtrading). |
//| http://www.jnrtrading.co.uk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Jason Robinson (jnrtrading)."
#property link "http://www.jnrtrading.co.uk"
#property indicator_chart_window
extern int CCI_Trend = 50;
extern int CCI_Entry = 14;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double cciTrendNow, cciTrendPrevious, cciEntry;
cciTrendNow = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, 0);
cciTrendPrevious = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, 1);
cciEntry = iCCI(NULL, 0, CCI_Entry, PRICE_TYPICAL, 0);
//----
//Print(cciTrendNow, "...", cciTrendPrevious, "...", cciEntry);
if(cciEntry < 0) {
if((cciTrendNow < 0) && (cciTrendPrevious >= 0)) {
Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed below zero");
}
}
else if(cciEntry > 0) {
if((cciTrendNow > 0) && (cciTrendPrevious <= 0)) {
Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed above zero");
}
}
Comment("Trend CCI: ", cciTrendNow, " Entry CCI: ", cciEntry);
//----
return(0);
}
//+------------------------------------------------------------------+
Comments