CCI indicator modifciation

I got a indicator which simply displays arrows on the price chart so I dont need to display the actual CCI indicator below, hopefully this will remove the doubt from my decision making & just act on the signals.

Blue arrow when the CCI breaks above the -100 level.
Red arrow when the CCI drops below the +100 level.

It also gives an alert in these situations.

But I wish to include 2 more arrows (yellow) for the extreme levels:
Climbs above -200, drops below +200

Also if it could sound a different audio alert than the standard, as an alert for these extreme levels is much more important than the more frequent lower level crosses.

This is most likely a super easy modification & I did try myself with no luck.
Also by including it here other people may be interested in this.


//+------------------------------------------------------------------+
//|                                                     Sig_Soch.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

extern int PerCCI=24;
extern bool Al=true;
double CCI;
double CCIold;
double ArrShift;
double BufUp[];
double BufDn[];
int s,b;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
   SetIndexBuffer(0, BufUp);
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 233);
   
   SetIndexBuffer(1, BufDn);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 234);
   switch (Period()) {
   	case PERIOD_M1:	ArrShift = Point * 5;	break;
   	case PERIOD_M5:	ArrShift = Point * 10;	break;
   	case PERIOD_M15:	ArrShift = Point * 20;	break;
   	case PERIOD_M30:	ArrShift = Point * 20;	break;
   	case PERIOD_H1:	ArrShift = Point * 40;	break;
   	case PERIOD_H4:	ArrShift = Point * 80;	break;
   	case PERIOD_D1:	ArrShift = Point * 100;	break;
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, 
       Counted_bars=IndicatorCounted();
   i=Bars-Counted_bars-1;
//----
      while(i>=1)                      // Öèêë ïî íåïîñ÷èòàííûì áàðàì     
      {      
        
         CCI=iCCI(NULL,0,PerCCI,PRICE_TYPICAL,i);
         CCIold=iCCI(NULL,0,PerCCI,PRICE_TYPICAL,i+1);
         if (CCI>-100 && CCIold<-100) {BufUp[i]=Low[i] - ArrShift;if (b<2 && Al==true) {Alert(Symbol()+" CCI  "+Close[i]);b=b+1;s=0;}}
         if (CCI<100 && CCIold>100) {BufDn[i]=High[i] + ArrShift;if (s<2 && Al==true) {Alert(Symbol()+" CCI  "+Close[i]);s=s+1;b=0;}}         
         i--;                          // Ðàñ÷¸ò èíäåêñà ñëåäóþùåãî áàðà
              
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Simple, Click on the Indicator window, hit Remove, good to go.

CCI is a waist of time

ahhhh advice from a trading guru, that’s reading the newbee forum… priceless…

ahh, asking advise in a newbie Forum, priceless

Im just trying to stop you from waisting your time, but whatever, carry on,

Relax its just an “Indicator” not an entry signal in my strategy…

Huck, wish you the best

Look at chu go! :35:

I did have some minor success on my own, did get the arrows to show at the extreme levels +/- 190, but couldnt get them to change color, so merely swapped the up/down arrows to make them stand out…
Got no idea on how to change the Alert sound tho…

So any “real” help would be greatly appreciated… my respect for this forum is already lacking…

master contributor/honory-members :58: trolls maybe…

//+------------------------------------------------------------------+
//|                                                     Sig_Soch.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Yellow

extern int PerCCI=20;
extern bool Al=true;
double CCI;
double CCIold;
double ArrShift;
double BufUp[];
double BufDn[];
int s,b;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
   SetIndexBuffer(0, BufUp);
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 233);
   
   SetIndexBuffer(1, BufDn);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 234);
   switch (Period()) {
   	case PERIOD_M1:	ArrShift = Point * 5;	break;
   	case PERIOD_M5:	ArrShift = Point * 10;	break;
   	case PERIOD_M15:	ArrShift = Point * 20;	break;
   	case PERIOD_M30:	ArrShift = Point * 20;	break;
   	case PERIOD_H1:	ArrShift = Point * 40;	break;
   	case PERIOD_H4:	ArrShift = Point * 80;	break;
   	case PERIOD_D1:	ArrShift = Point * 100;	break;
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, 
       Counted_bars=IndicatorCounted();
   i=Bars-Counted_bars-1;
//----
      while(i>=1)                      // Öèêë ïî íåïîñ÷èòàííûì áàðàì     
      {      
        
         CCI=iCCI(NULL,0,PerCCI,PRICE_TYPICAL,i);
         CCIold=iCCI(NULL,0,PerCCI,PRICE_TYPICAL,i+1);
         if (CCI>-100 && CCIold<-100) {BufUp[i]=Low[i] - ArrShift;if (b<2 && Al==true) {Alert(Symbol()+" CCI "+Close[i]);b=b+1;s=0;}}
         if (CCI<100 && CCIold>100) {BufDn[i]=High[i] + ArrShift;if (s<2 && Al==true) {Alert(Symbol()+" CCI  "+Close[i]);s=s+1;b=0;}}         
         if (CCI>-190 && CCIold<-190) {BufDn[i]=Low[i] - ArrShift;if (b<3 && Al==true) {Alert(Symbol()+" CCI "+Close[i]);b=b+3;s=0;}}
         if (CCI<190 && CCIold>190) {BufUp[i]=High[i] + ArrShift;if (s<3 && Al==true) {Alert(Symbol()+" CCI  "+Close[i]);s=s+3;b=0;}} 
        
         i--;                          // Ðàñ÷¸ò èíäåêñà ñëåäóþùåãî áàðà
              
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

A rank in a forum means nothing, and that’s coming from a “Honorary” member.

At the same time, I wasn’t trying to criticize you, I enjoy bugging MoneyNVRSleeps, because he’s so easy to pick on. BTW, just to even the playing field, MoneyNVRSleeps also spent a good amount of time with the CCI, if I remember correctly. :wink: Hahaha

But, I “happen” to do some automated trading, I’ll give you the code you need in a minute.

Edit: Do you want to attach the .mq4 file as an attachment, because everytime I copy and paste it, it’s just one long line…

You’re going to need to download an audio file of the sound you would like the indicator to play.

oh ok, i thought just changing the Alarm from the standard “Alarm” event to something such as the “News” alarm event would be the way to go so it can be easily changed in the MT4 Options > Events.

Figured it out, discovered the PlaySound() function… thanx for the hint…