//+------------------------------------------------------------------+ //| 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); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Commodity channel index
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen