input:hittimes(3); setInputName(1,"設定觸頂次數");
input:rangeratio(1); setInputName(2,"設定頭部區範圍寬度");
input:length(20); setInputName(3,"計算期數");
variable: thehigh(0); thehigh=highest(high[1],length); //找到過去期間的最高點
variable:highlowerbound(0); highlowerbound=thehigh*(100-rangeratio)/100; //設為瓶頸區間上界
variable:touchrangtimes(0); //期間中進入瓶頸區間的低點次數,每根K棒要歸0
//回算在此區間中 進入瓶頸區間的次數
touchrangtimes =countIf(high[1] >highlowerbound,length);
if touchrangtimes>=hittimes and (q ask > thehigh or close>thehigh) then ret=1;
3 評論