kino_2CCI_Cross_Alert

Download script
Author: Copyright � 2008 KINONEN.
kino_2CCI_Cross_Alert

This tool is designed as a technical analysis assistant for the MetaTrader platform. Its primary purpose is to monitor market momentum by tracking two different Commodity Channel Index (CCI) settings simultaneously and providing real-time notifications when specific price action patterns occur.

Core Functionality

The script monitors two separate "speeds" of market momentum:

  • Slow Momentum (CCI1): Set at a period of 170, this tracks long-term trends.
  • Fast Momentum (CCI2): Set at a period of 34, this tracks shorter-term fluctuations.

By comparing these two different timeframes, the script helps identify moments where both short-term and long-term momentum are moving in the same direction at once.

How the Logic Works

The tool acts as a "sentinel," constantly checking the values of these two indicators against two specific price thresholds (set at 0 and 250). It triggers an alert only when a "crossover" occurs, which means the indicator value moved from one side of the threshold to the other between the previous candle and the current candle.

The logic follows these specific conditions:

1. Downward Momentum Alerts: If both indicators move from above a threshold to below it (crossing downward), the script sends an alert. This typically signals a shift toward bearish sentiment or a cooling off of upward price pressure. It checks this for both your primary target (0) and your secondary boundary (250).

2. Upward Momentum Alerts: If both indicators move from below a threshold to above it (crossing upward), the script sends an alert. This typically signals a shift toward bullish sentiment or increasing buying pressure. Again, it monitors this for both the primary target (0) and the secondary boundary (250).

User Experience

  • Real-Time Alerts: Instead of requiring you to watch the charts constantly, the tool pushes a pop-up notification on your screen the moment both momentum indicators agree on a crossover.
  • On-Screen Data: The script displays the live numerical values of both CCI1 and CCI2 directly on your chart, allowing you to see exactly how close the momentum is to your desired thresholds at any given time.

In summary, this tool filters out "noise" by ensuring that you are only notified when both short-term and long-term momentum indicators synchronize to cross a specific price level.

Indicators Used
Commodity channel index
Miscellaneous
It issuies visual alerts to the screen
16 Views
0 Downloads
0 Favorites
kino_2CCI_Cross_Alert
//+------------------------------------------------------------------+
//|                                   kino_    2CCI_Cross_Alert.mq4  |
//|                   Copyright © 2008, KINONEN                      |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008 KINONEN."
#property indicator_chart_window

extern int CCI1   =  170;
extern int CCI2   =   34;
extern int value1 =    0;
extern int value2 = 250;

//+------------------------------------------------------------------+
//| 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 CCI1_0, CCI1_1, CCI2_0;
   
   CCI1_0 = iCCI(NULL, 0, CCI1, PRICE_TYPICAL, 0);
   CCI1_1 = iCCI(NULL, 0, CCI1, PRICE_TYPICAL, 1);
   CCI2_0 =         iCCI(NULL, 0, CCI2, PRICE_TYPICAL, 0);
   
//---- 
   //Print(CCI1_0, "...", CCI1_1, "...", CCI2_0);

   if(CCI2_0 < value1) 
     {
      if((CCI1_0 < value1) && (CCI1_1 >= value1))
      {
         Alert(Symbol(), " M", Period(), " CCI1&CCI2 have both crossed below " + value1);
      }
     }
   else if(CCI2_0 > value1) 
     {
      if((CCI1_0 > value1) && (CCI1_1 <= value1)) 
      {
         Alert(Symbol(), " M", Period(), " CCI1&CCI2 have both crossed above "+ value1);
      }
     }
   if(CCI2_0 < value2) 
     {
      if((CCI1_0 < value2) && (CCI1_1 >= value2))
      {
         Alert(Symbol(), " M",Period(), " CCI1&CCI2 have both crossed below " + value2);
      }
     }
   else if(CCI2_0 > value2) 
     {
      if((CCI1_0 > value2) && (CCI1_1 <= value2)) 
      {
         Alert(Symbol(), " M",Period(), " CCI1&CCI2 have both both crossed above "+ value2);
      }
     }  
   Comment("        ");  
   Comment("CCI1: ", CCI1_0, " CCI2: ", CCI2_0);

   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments