# 請老師幫個忙,關於引用大周期數據跑小周期的問題

11
2008.04.15 08:34

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 MediumSpringGreen
#property indicator_color2 DeepPink

extern int COUNT=5;
double HighBuffer[];
double LowBuffer[];

int init()
{
SetIndexStyle(0,DRAW_LINE,2,2);
SetIndexStyle(1,DRAW_LINE,2,2);

IndicatorDigits(Digits);
SetIndexBuffer(0,HighBuffer);
SetIndexBuffer(1,LowBuffer);
SetIndexLabel(0,"UAT");
SetIndexLabel(1,"DAT");
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;

for(int i=limit; i>=0;i--)
{
double up=High[Highest(NULL,PERIOD_H4,MODE_HIGH,count,i+1)];
double dp=Low[Lowest(NULL,PERIOD_H4,MODE_LOW,count,i+1)];

HighBuffer[i]=up;
LowBuffer[i]=dp;
}
return(0);
}

1629
2008.04.16 12:32

11
2008.04.17 08:02
DxdCn:

double up=High[Highest(NULL,PERIOD_H4,MODE_HIGH,count,i+1)];
double dp=Low[Lowest(NULL,PERIOD_H4,MODE_LOW,count,i+1)];

1629
2008.04.17 13:18

HighBuffer[i]

LowBuffer[i]

i 相同, period不同, 对应的X坐标位置不同,

1629
2008.04.17 13:41

```int mm = PERIOD_H4 /Period()+1;

for(i=Bars/mm; i>=0; i--)
{
double up=High[Highest(NULL,PERIOD_H4,MODE_HIGH,count,i+1)];
double dp=Low[Lowest(NULL,PERIOD_H4,MODE_LOW,count,i+1)];
n =  iBarShift(NULL, 0,iTime(NULL,PERIOD_H4 ,i));
for (int j=1; j<mm; j++)
{
HighBuffer[n+j]=up;
LowBuffer[n+j]=dp;

}
}```

11
2008.04.18 09:54

DxdCn老師

MT4 H1圖

/