Bonjour a tous,
j'aurai besoin d'ajouter une 5eme courbe a cet indicateur (Price Rate Of Change) mais je bloque completement, la formule est simple :
courbe 1 + courbe 2 + courbe 3 + courbe 4 = courbe 5
Merci d'avance pour votre aide précieuse
VOILA LE CODE :
#property indicator_separate_window
#property indicator_buffers 4
extern int TimeFrame=0; //1=1minute;5=5minutes;15=15minutes;30=30minutes;60= 1Hour;240=4Hour;1440=Daily;
extern double level1= 300;
extern double level2= 200;
extern double level3= 100;
extern double level4=-100;
extern double level5=-200;
extern double level6=-300;
//---- indicator buffers
double ROC_EURUSD[];
double ROC_USDJPY[];
double ROC_EURGBP[];
double ROC_GBPJPY[];
string pair1="EURUSD";
string pair2="USDJPY";
string pair3="EURGBP";
string pair4="GBPJPY";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetLevelStyle(STYLE_DOT,1,LightSlateGray);
SetLevelValue(0,level1);
SetLevelValue(1,level2);
SetLevelValue(2,level3);
SetLevelValue(3,level4);
SetLevelValue(4,level5);
SetLevelValue(5,level6);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,RoyalBlue) ;
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,LimeGreen) ;
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1,Yellow);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1,Red);
IndicatorDigits(Digits+1);
SetIndexDrawBegin(0,0);
SetIndexDrawBegin(1,0);
SetIndexDrawBegin(2,0);
SetIndexDrawBegin(3,0);
//----
SetIndexBuffer(0,ROC_EURUSD);
SetIndexBuffer(1,ROC_USDJPY);
SetIndexBuffer(2,ROC_EURGBP);
SetIndexBuffer(3,ROC_GBPJPY);
//----
switch(TimeFrame)
{
case 1 : string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN1"; break;
default : TimeFrameStr="";
}
IndicatorShortName("ROC "+TimeFrameStr);
SetIndexLabel(0,pair1);
SetIndexLabel(1,pair2);
SetIndexLabel(2,pair3);
SetIndexLabel(3,pair4);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i,limit=1000;
double EURUSD[1000];
double USDJPY[1000];
double EURGBP[1000];
double GBPJPY[1000];
int limitEURUSD=ArraySize(EURUSD);
ArraySetAsSeries(EURUSD,true);
for(i=0; i<limitEURUSD; i++)
EURUSD[i]=((iClose(pair1,TimeFrame,i)-iClose(pair1,TimeFrame,i+1))/iClose(pair1,TimeFrame,i+1))*100;
ROC_EURUSD[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_EURUSD[i]=ROC_EURUSD[i+1]+EURUSD[i];
int limitUSDJPY=ArraySize(USDJPY);
ArraySetAsSeries(USDJPY,true);
for(i=0; i<limitUSDJPY; i++)
USDJPY[i]=((iClose(pair2,TimeFrame,i)-iClose(pair2,TimeFrame,i+1))/iClose(pair2,TimeFrame,i+1))*100;
ROC_USDJPY[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_USDJPY[i]=ROC_USDJPY[i+1]+USDJPY[i];
int limitEURGBP=ArraySize(EURGBP);
ArraySetAsSeries(EURGBP,true);
for(i=0; i<limitEURGBP; i++)
EURGBP[i]=((iClose(pair3,TimeFrame,i+1)-iClose(pair3,TimeFrame,i))/iClose(pair3,TimeFrame,i+1))*100;
ROC_EURGBP[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_EURGBP[i]=ROC_EURGBP[i+1]+EURGBP[i];
int limitGBPJPY=ArraySize(GBPJPY);
ArraySetAsSeries(GBPJPY,true);
for(i=0; i<limitGBPJPY; i++)
GBPJPY[i]=((iClose(pair4,TimeFrame,i+1)-iClose(pair4,TimeFrame,i))/iClose(pair4,TimeFrame,i+1))*100;
ROC_GBPJPY[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_GBPJPY[i]=ROC_GBPJPY[i+1]+GBPJPY[i];
//---- done
return(0);
}
![]() |
|


LinkBack URL
About LinkBacks
, la formule est simple :
Répondre avec citation
