2014年1月3日 星期五

反常必有妖

input:TXT("僅適用60分鐘"); setinputname(1,"使用限制");

if barinterval <> 60  or barfreq<> "Min" then return;

if Close > close[1] * 1.02  then
begin
value2=average(truerange,30);
value3=average(truerange,3);
if truerange>value3 and value3>value2 then ret=1;
end;

連續數日拉尾盤

input:Length(3); setinputname(1,"拉尾盤日數");
input:Ratio(1); setinputname(2,"拉尾盤幅度%");
input:closetime(132500); setinputname(3,"尾盤前時間");
input:ratiotoLow(7); setinputname(4,"低檔起算漲幅%");//距離區間最低價多少%
input:daystoLow(5); setinputname(5,"距離最低價天數");//輸入區間最低價的區間是幾天
input:TXT1("最高算5天"); setinputname(6,"拉尾盤日數使用限制");
input:TXT2("限用5分鐘"); setinputname(7,"頻率限制");

if barfreq <> "Min" or barinterval <> 5  or Length>5 or daystoLow >5 then return;

variable:i(0);
variable:TodayBars(270/barinterval);

if close >= lowest(close,daystoLow * TodayBars) *( 1 + ratiotoLow*0.01) then return;

if time >= closetime then
begin
  for i = 0 to Length-1
  begin
// 判斷是否拉尾盤
    if close[TodayBars*i] <= close[TodayBars*i+1] * (1+ Ratio/100) then return;
  end;
  ret=1;
end;

暴量剛起漲

input: Length(20);       setinputname(1,"計算期數");
input: VLength(10);      setinputname(2,"均量期數");
input: volpercent(50);   setinputname(3,"爆量增幅%");
input: Rate(5);          setinputname(4,"離低點幅度%");

if Close >  Close[1] and
   Volume >=  average(volume,VLength) *(1+ volpercent/100) and
   Close <= lowest(close,Length) * (1+Rate/100)
then ret=1;

盤整後噴出

input:length(30); setinputname(1, "計算期間");
input:percent(2.5); setinputname(2, "設定盤整區間%");

value1=highest(high[1],length);
value2=lowest(low[1],length);

if close crosses above value1
and value1 < value2 *( 1 + percent * 0.01) //最近幾根bar的收盤價高點與低點差不到N%
then ret=1;

突破下降趨勢

input:Length(20); setinputname(1,"下降趨勢計算期數");
input:Rate(150); setinputname(2,"反轉率%");
variable: Factor(0);

Factor = 100/Close[Length];

value1 = linearregslope(high*Factor,Length);
value2 = linearregslope(high*Factor,3);

if close > open and close < close[length]
 and  value1 < 0
and value2-value1 > Rate*0.01
 then ret=1;