ok je vois
;
je t'envois un de mes mes codes qui est en mtf, car pour le mtf c'est plus "délicat", tu auras juste à modifier les buffers pour afficher ce que tu souhaite.
Code:
//+------------------------------------------------------------------+
//| Pascal H/L.mq4 |
//| Damien S pour Tallarida Pascal |
//| opendo@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Damien S pour Tallarida Pascal "
#property link "opendo@gmail.com"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 PaleTurquoise
#property indicator_width1 4
#property indicator_color2 BurlyWood
#property indicator_width2 4
#property indicator_color3 Black
#property indicator_color4 Green
#property indicator_width4 2
#property indicator_color5 Red
#property indicator_width5 2
extern int TimeFrame=1440;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexStyle(4,DRAW_LINE);
SetIndexDrawBegin(0,4);
SetIndexDrawBegin(1,3);
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
}
//----
return(0);
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=EMPTY_VALUE;
ExtMapBuffer2[i]=EMPTY_VALUE;
ExtMapBuffer3[i]=(iHigh(NULL,TimeFrame,y+1)+iLow(NULL,TimeFrame,y+1))/2;
ExtMapBuffer4[i]=iHigh(NULL,TimeFrame,y+1) ;
ExtMapBuffer5[i]=iLow(NULL,TimeFrame,y+1) ;
ExtMapBuffer1[i]=Close[i];
ExtMapBuffer2[i]=ExtMapBuffer3[i];
}
//
return(0);
}
//+------------------------------------------------------------------+