2CCI alerts





//+------------------------------------------------------------------+
//|                                         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
#include <WinUser32.mqh>

extern int CCI_Trend = 50;
extern int CCI_Entry = 14;
extern int SignalLevel = 0;
extern string Sound1 = "alert.wav";
extern string Sound2 = "alert2.wav";
//+------------------------------------------------------------------+
//| 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;
   static datetime prevtime = 0;
   
   if(prevtime == Time[0]) {
      return(0);
   }
   prevtime = Time[0];
   
   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);
   
//---- 
   
   if(cciEntry < -SignalLevel) {
      if((cciTrendNow < -SignalLevel ) && (cciTrendPrevious > -SignalLevel)) {
      PlaySound(Sound1);  
      Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed below ",-SignalLevel);
      Print(Symbol()+" M"+Period()+" Trend & Entry CCI Have both crossed below "+(-SignalLevel)+
      "\nContinue?");  
      }
   }
   else if(cciEntry > SignalLevel) {
      if((cciTrendNow > SignalLevel) && (cciTrendPrevious < SignalLevel)) {
      PlaySound(Sound2);
      Alert(Symbol()+" M"+Period()+" Trend & Entry CCI Have both crossed above ",SignalLevel);
      Print(Symbol()+" M"+Period()+" Trend & Entry CCI Have both crossed below "+SignalLevel+
      "\nContinue?");
      }
   }
   //Comment("Trend CCI: ", cciTrendNow, " Entry CCI: ", cciEntry); 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:


Indicators Used:

Commodity channel index


Custom Indicators Used:

Order Management characteristics:

Other Features:

It plays sound alerts
It issuies visual alerts to the screen