Bonjour à tous
Je poste ce petit bout de programme pour Macd, il ne donne que le début de ce que j'attends
il calcule bien ce que je veux mais qu"a partir du lancement. il ne calcule pas les barres precedentes.
ce n'est que le début d'une idée. placer 3 Macd avec des valeurs differente et faire des moyennes.
Mais je n'avance plus tant que je n'aurais pas solutionner le calcul sur les barres précédentes.
ça fait une semaine que je tourne en rond.
j'ai essayé dans tous les sens, avec des mises en buffers ou sans,
Mais ça donne rien.
Voila si Quelqu'un peut m'avancer .
merci d'avance
==========================
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Red
//---- indicator buffers
double Tot_Gen_M1_Pour_buffer1[];
double Moy_Gen_M1_Pour_buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,Tot_Gen_M1_Pour_buffer1);
SetIndexBuffer(1,Moy_Gen_M1_Pour_buffer2);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("nuho_indic_M1_3MACD_Pour");
SetIndexLabel(0,"Tot_Gen_M1_Pour_buffer1");
SetIndexLabel(1,"Tot_Gen_M1_Pour_buffer2");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0)
counted_bars--;
int limit=Bars-counted_bars;
//================================================== ========
double Macd6_M1_Main0 = iMACD(NULL, PERIOD_M1, 6, 13, 4, PRICE_CLOSE, MODE_MAIN, 0);
double Macd6_M1_Sign0 = iMACD(NULL, PERIOD_M1, 6, 13, 4, PRICE_CLOSE, MODE_SIGNAL, 0);
double Macd12_M1_Main0 = iMACD(NULL, PERIOD_M1, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double Macd12_M1_Sign0 = iMACD(NULL, PERIOD_M1, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double Macd24_M1_Main0 = iMACD(NULL, PERIOD_M1, 24, 52,18, PRICE_CLOSE, MODE_MAIN, 0);
double Macd24_M1_Sign0 = iMACD(NULL, PERIOD_M1, 24, 52, 18, PRICE_CLOSE, MODE_SIGNAL, 0);
// si Macd 6/13/4 > signal 1 point sinon moins 1
if (Macd6_M1_Main0 > Macd6_M1_Sign0) double Tot_Macd_M1_6 = 1; else Tot_Macd_M1_6 = -1 ;
// si Macd 12/26/9 > signal 2 point sinon moins 2
if (Macd12_M1_Main0 > Macd12_M1_Sign0) double Tot_Macd_M1_12 = 2; else Tot_Macd_M1_12 = -2 ;
// si Macd 24/52/18 > signal 3 point sinon moins 3
if (Macd24_M1_Main0 > Macd24_M1_Sign0) double Tot_Macd_M1_24 = 3; else Tot_Macd_M1_24 = -3 ;
// Total des 3 Macd
double Tot_Macd_M1 = Tot_Macd_M1_6 + Tot_Macd_M1_12 + Tot_Macd_M1_24;
// Total des 3 Macd mis dans une autre variable
double Total_Gen_M1 =(Tot_Macd_M1);
// Moyenne des 3 Macd
double Moyenne_Gen_M1_Pourcentage =((Tot_Macd_M1/6)*100);
//================================================== ====
//---- Tot_Gen_M1_Pour_buffer1[i]---counted in the 1-st buffer
for( int i=0; i<limit; i++)
// Resultat Total mis dans un buffer pour affichage
Tot_Gen_M1_Pour_buffer1[i]=Total_Gen_M1;
//---- Moy_Gen_M1_Pour_buffer2[i]----counted in the 2-nd buffer
for(i=0; i<limit; i++)
// Resultat Moyenne mis dans un buffer pour affichage
Moy_Gen_M1_Pour_buffer2[i]=Moyenne_Gen_M1_Pourcentage;
//---- done
return(0);
}
![]() |
|


LinkBack URL
About LinkBacks
Répondre avec citation
