input:C1(True); setinputname(1,"使用相對無量");
input:P1(150); setinputname(2,"絕對無量張數定義");
if barfreq <> "Tick" then
RaiseRuntimeError("請設定頻率為TICK");
variable:BarNumberOfToday(0); if Date
<> Date[1] then BarNumberOfToday=1
else BarNumberOfToday+=1;{記錄今天的Bar數}
if q_DailyHigh > q_DailyOpen *1.01 and {開盤拉高1%以上}
q_Last < q_DailyHigh*0.99 and q_Last < q_DailyOpen *0.98 and {現價跌破開盤價且從高點大幅回檔}
currenttime < 93000 and date =currentdate {必需在9:30以前發生}
then begin {計算拉升時總張數}
variable:
HighBar(NthHighestBar(1,Close,BarNumberOfToday)); {找到出現最高價那根Bar}
variable:idx(BarNumberOfToday-1),PullVolume(0),DropVolume(0);
for
idx = BarNumberOfToday-1 to HighBar {從開盤那個Bar,拉升到最高點那個Bar,上漲過程累計量}
begin
PullVolume += volume[idx]; {拉升的量}
end;
if
C1 then begin {相對無量判斷開關}
for idx = 0 to HighBar {從現在這個Bar,往回到最高點那個Bar,下跌過程所有累計量}
begin
DropVolume
+= volume[idx]; {下跌的量}
end;
if DropVolume > PullVolume *3 then ret=1; {相對下跌過程而言,上漲無量的話,觸發}
end;
if
PullVolume < P1 then ret=1; {上漲時,絕對量小於150的話,觸發}
end;
沒有留言:
張貼留言