//+------------------------------------------------------------------+ //| CCI_MA.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_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Yellow #property indicator_level1 -150000 #property indicator_level2 150000 //---- input parameters extern int cci_p = 21; extern int ma = 27; extern int NumberOfBarsToCalculate = 10000; //---- indicator buffers double Buffer0[]; double Buffer1[]; double Ma[]; double Cci[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { Comment(""); IndicatorBuffers(4); //---- indicator line SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(2,DRAW_NONE); SetIndexStyle(3,DRAW_NONE); SetIndexBuffer(0,Buffer0); SetIndexBuffer(1,Buffer1); SetIndexBuffer(2,Ma); SetIndexBuffer(3,Cci); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); //---- SetIndexEmptyValue(0,0); SetIndexEmptyValue(1,0); SetIndexEmptyValue(2,0); SetIndexEmptyValue(3,0); //---- return(0); } int start() { string short_name; short_name = "CCI["+cci_p+"] \ MA => Max bars to count: |"+(Bars-1)+"| "; IndicatorShortName(short_name); int shift; double cci = 0; for(shift=NumberOfBarsToCalculate-1;shift>=0;shift--){ Cci[shift] = iCCI(NULL,0,cci_p,PRICE_CLOSE,shift); } for(shift=NumberOfBarsToCalculate-1;shift>=0;shift--){ Ma[shift] = iMAOnArray(Cci,0,ma,0,MODE_EMA,shift); Buffer0[shift] = Cci[shift]; Buffer1[shift] = Ma[shift]; } for(shift=NumberOfBarsToCalculate-1;shift>=0;shift--){ if (Ma[shift]>Cci[shift] && Ma[shift-1]<Cci[shift-1]) { ObjectCreate("arrow"+DoubleToStr(shift,0),OBJ_ARROW,0, iTime(Symbol(),0,shift),iLow(Symbol(),0,shift)+20*Point); ObjectSet("arrow"+DoubleToStr(shift,0),OBJPROP_ARROWCODE,SYMBOL_ARROWUP); ObjectSet("arrow"+DoubleToStr(shift,0),OBJPROP_COLOR,Green); } if (Ma[shift]<Cci[shift] && Ma[shift-1]>Cci[shift-1]) { ObjectCreate("arrow"+DoubleToStr(shift,0),OBJ_ARROW,0, iTime(Symbol(),0,shift),iLow(Symbol(),0,shift)); ObjectSet("arrow"+DoubleToStr(shift,0),OBJPROP_ARROWCODE,SYMBOL_ARROWDOWN); ObjectSet("arrow"+DoubleToStr(shift,0),OBJPROP_COLOR,Yellow); } } return(0); }
HI All,
I'm looking for something very similar to the above, crossing between CCI & MA but has the ability to to alerts, like email or pop up on MT4 would be great.
Really appreciate if anyone can help with the programming.
Thank you.
Cheers,
Bulltql
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Friends, I'm new in the forum and I found very good information about various indicators posted here.
I am using the CCI indicator with an exponential moving average which generates a signal to buy or sell when the CCI crosses this average up or down. I looked for it all over the internet and didn´t find the final code to show in the chart the signals of arrows up or down.
I would like to show this signals on the candles of the metatrader chart when crossings occur. I'm not a programmer and need your help. Someone could complete the programming code on cci_ma.mq4 attached, for the indicator operate this way? The indicator is the same used in ADVFN but I didn´t get this code with anyone!
The name in ADVFN is CCI-MA crossover.
Thanks and sorry for my English, is not my native language.
Regis