//+------------------------------------------------------------------+ //| ATM Machine with Alert.mq4 | //| Copyright © 2009 | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009" #property link "http://www.extremeideologies.blogspot.com" #property indicator_chart_window extern int CCI_Trend = 140; extern int CCI_Entry = 100; extern int CCI_Power = 42; //+------------------------------------------------------------------+ //| 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, cciEntryNow, cciEntryPrevious, cciFilterNow , cciFilterPrevious ; cciTrendNow = iCCI(NULL,0,CCI_Trend, PRICE_MEDIAN,0); cciTrendPrevious = iCCI(NULL,0, CCI_Trend, PRICE_MEDIAN,1); cciEntryNow = iCCI(NULL,0,CCI_Entry, PRICE_MEDIAN,0); cciFilterNow = iCCI(NULL,0,CCI_Power,PRICE_MEDIAN,0); cciFilterPrevious = iCCI(NULL,0,CCI_Power,PRICE_MEDIAN,1); cciEntryPrevious = iCCI(NULL,0,CCI_Entry,PRICE_MEDIAN,1); //---- //Print(cciTrendNow, "...", cciTrendPrevious, "...", cciEntryNow, "...", cciFilterNow, "...", cciFilterPrevious, "...", cciEntryPrevious); if ((cciEntryNow < 0) && (cciEntryPrevious >= 0 )){ if(((cciTrendNow < 0) && (cciTrendPrevious >= 0)) && ((cciFilterNow < 0) && (cciFilterPrevious >= 0))){ Alert(Symbol(), " M", Period(), " ....SELL...."); } } else if((cciEntryNow > 0) && (cciEntryPrevious <= 0)) { if(((cciTrendNow > 0) && (cciTrendPrevious <= 0)) && ((cciFilterNow > 0) && (cciFilterPrevious >=0))){ Alert(Symbol(), " M", Period(), " ....BUY...."); } } Comment("Trend CCI: ", cciTrendNow, " Entry CCI: ", cciEntryNow , "Power CCI:", cciFilterNow); //---- return(0); } //+------------------------------------------------------------------+