input: n(10,"search範圍");
input: hh(10,"N天前突破");
input: v0(50,"量超過均量趴數");
input: percent(4,"漲幅上限");
input:avg_3_line(0); //均線糾結開關 //距離n%以內
input:main_force(0); //主力買超次數開關
//input:Enable_5_line(0);
input:Enable_5_10_line(0);
//input:Enable_5_10_20_line(0);
settotalBar(n);
var: hasCrossOver(false);
var: BarCount(0);
//=====================================================
if close > highest(h[1],hh) and hasCrossOver=false
and ( (Volume > Average(Volume[1], 5) * 1.9) or (Volume > Volume[1] * 1.9) )
and close>close[1]*1.01
then
begin
hasCrossOver=true;
BarCount=currentBar;
value111 = close; //儲存突破k棒的收盤價
end;
if islastBar then
if hasCrossOver=true then
begin
//=====================================================
// 籌碼面: 主力or外資買超狀況。//有設開關 main_force=1=開
//-----------------------------------------------------
//n-BarCount = 當日與條件達成k棒之間的幾天
value1=summation(GetField("主力買賣超張數", "D"),n-BarCount);
value2=countIf(GetField("主力買賣超張數", "D")>0,n-BarCount); //買超
value3=countIf(GetField("主力買賣超張數", "D")<=0,n-BarCount);//賣超
value4=countIf(GetField("主力買賣超張數", "D")>0,n); //買超
value5=countIf(GetField("主力買賣超張數", "D")<=0,n);//賣超
condition1=value1>0;
condition2=value2>value3;
If main_force >0 then
Begin
If n-BarCount < 3 then //如果 達成k棒,跟當日 距離小於3 這條件不計算
Begin
condition1 = true;
condition2 = true;
End
Else
Begin
condition1 = true;
condition2 = value2>value3; //距離 : 達成k棒,跟當日之間
End;
End
Else
Begin
condition1 = true;
condition2 = true;
End;
//=====================================================
//達成站上均線條件後,未漲超過n%以上。
//-----------------------------------------------------
value44=rateOfChange(c,n-BarCount+1);
condition3=value44<percent;
//condition4=countIf( (high/value111) > 1.06 ,n-BarCount+1 ) <1; //突破到現在 最高價不能 曾超過6%
//似乎不能這樣使用
//=====================================================
Value11 = average(close, 5);
Value22 = average(close, 10);
Value33 = average(close, 20);
value55 = MaxList(Value11, Value22, Value33); //均線取最大
value66 = MaxList2(Value11, Value22, Value33); //均線第二大
value77 = MinList(Value11, Value22, Value33);
value88 = MinList2(Value11, Value22, Value33);
//=====================================================
//目前價位與均線位置
//-----------------------------------------------------
condition5 = (value55/value77 < 1.055) and (close/value55 < 1.036);
//最大最小均線距離,收盤與最大均線距離
condition6 = (close > value77) or ((close < value77) and (value77/close < 1.01) and (close[1] > value77[1]));
//大於最小均線 或者跌破,但離最小均線很近,且是剛跌破,還是選。
//=====================================================
//不抓剛剛達成條件的個股 (等回檔)
//condition6 = BarCount<n+1; //剛突破不抓 ,若突破根search日同一天,BarCount會=n+1
//=====================================================
//希望該股 非牛皮股,設定曾經單日漲幅
//-----------------------------------------------------
condition7= countif(close/close[1] > 1.039, 90) > 0; //過去三個月 曾經單日漲幅4%以上
//=====================================================
//(篩選機制,自己決定要不要開,預設先不開)抓 糾結程度高的(均線距離近,停損%數低)
If avg_3_line >0 then
Begin
//condition8= (close/value55) < 1.031 ;//and (close/value77 < 1.0519);
condition8= (close/value55) < 1.031 and (value55/value77 < 1.031);
End
Else
Begin
condition8 = true;
End;
if condition1 and condition2 and condition3 and condition5 and condition6 and condition8 then ret=1;
outputField1(date[n-BarCount],"突破日期");
//outputField2(value1,"突破至今的主力買賣超張數");
//outputField3(value2,"突破至今的主力買超天數");
//outputField4(value3,"突破至今的主力賣超天數
//outputField12(countIf( (high/value111) > 1.06 ,n-BarCount+1 ),"最高價,超過突破收盤價6%次數");
outputField2(n-BarCount,"n-BarCount");
outputField3(value44,"突破至今的漲跌幅");
outputField4(BarCount,"BarCount");
end;
//======================
4 評論