在之前的Daily Range Calculator有用到iHigh & iLow的函數
看起來似乎可以用在判別前幾根BAR的高點和低點
今日我就來測試看看
int start()
{
double low0 = iLow(NULL,PERIOD_M5,0);
double high0 = iHigh(NULL,PERIOD_M5,0);
Alert("low0="+low0);
Alert("high0=",high0);
return(0);
}
用五分線圖, 出現的是第0根BAR的高低點
int start()
{
double low0 = iLow(NULL,PERIOD_M5,1);
double high0 = iHigh(NULL,PERIOD_M5,1);
Alert("low0="+low0);
Alert("high0=",high0);
return(0);
}
往前Shift 1,得到第1根Bar的高低點
int start()
{
double low0 = iLow(NULL,PERIOD_M15,1);
double high0 = iHigh(NULL,PERIOD_M15,1);
Alert("low0="+low0);
Alert("high0=",high0);
return(0);
}
把時間改為M15,應該可以得到3根BAR的高低點,
結果很妙, 出現了11:15, 11:20, 11:25的高低點
所以說如果把Time_Period改成M15, 只能得到11:15~11:30的資料
同時我們也發現, MT4的時間指的是這根BAR的開始時間, 和TS裡用結束時間不一樣