il existe la fonction qui appelle un indicateur, comme pour les MA = IMA
Pour que les moyennes mobiles soit calculées sur autre chose dans le code il y a la fonction = IMAonarray
Il est possible de faire ça avec le cci = iccionarray
les BBands, le standart deviation ect....
Donc en reprenant le code du MACD dans MT4, il y a deux buffer, le macd et sa moyenne mobile, la "signal sma", je disais qu'en mettant le macd en "none" on le rend donc ivinvisible, puis ensuite on remplace le calcul de la signal sma, par l'appel de la foncion CCIonarray, qui seras donc calculé sur le macd
ça donne ça :
//+------------------------------------------------------------------+
//| Custom MACD.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//|
MetaTrader 4, MetaTrader 5, TeamWox / MetaQuotes Software Corp. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Red
#property indicator_width1 2
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int CCIPeriod=9;
//---- indicator buffers
double MacdBuffer[];
double CCI[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,CCI);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,MacdBuffer);
SetIndexBuffer(1,CCI);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD CCI("+FastEMA+","+SlowEMA+","+CCIPeriod+")");
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"CCI");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
for(i=0; i<limit; i++)
CCI[i]=
iCCIOnArray(MacdBuffer,Bars,CCIPeriod,i);
//---- done
return(0);
}
//+------------------------------------------------------------------+
donc en fait c'est le code du macd, mais changé un ptit peux pour avoir le CCI de ce dernier

Toujours est il que ta première solution etait bonne aussi,
