//主題 創新高新低
//條件1:允許加碼一次(允許兩個紅箭頭OR綠箭頭)
//條件2:量要比前一次高
variable:ihigh(0),ilow(0);
variable:bsflag(0); //bs變數作為訊號不重複出現使用
variable:bcount(0),scount(0); //作為計算次數用
if barfreq<>"D" then return;
//if barfreq<>"min" or barinterval<>5 then return; //限定5分鐘寫法
ihigh=highest(h[1],3);
ilow=lowest(l[1],3);
//買進訊號
if c>ihigh and bcount<2 and v>v[1] then
begin
bcount+=1;
bsflag=1;
plot1(l*0.98);
end;
if bsflag=-1 then bcount=0;
//賣出訊號
if c<ilow and scount<2 and v>v[1] then
begin
scount+=1;
bsflag=-1;
plot2(h*1.02);
end;
if bsflag=1 then scount=0;
/////////////////////////////////////////////////////////////////////////////////////
//主題 創新高創新低副圖指標
//條件:允許加碼一次(允許兩個紅箭頭OR綠箭頭)
variable:ihigh(0),ilow(0);
variable:bsflag(0); //bs變數作為訊號不重複出現使用
variable:bcount(0),scount(0); //作為計算次數用
variable:profit(0),bscost(0); //profit損益
if barfreq<>"D" then return;
//if barfreq<>"min" or barinterval<>5 then return; //限定5分鐘寫法
ihigh=highest(h[1],3);
ilow=lowest(l[1],3);
//買進訊號
if c>ihigh and bcount<2 then
begin
bcount+=1;
bsflag=1;
//plot1(l*0.98); //附圖的箭頭指標不需要
bscost=c;
end;
if bsflag=-1 then bcount=0;
//賣出訊號
if c<ilow and scount<2 then
begin
scount+=1;
bsflag=-1;
//plot2(h*1.02); //附圖的箭頭指標不需要
bscost=c;
end;
if bsflag=1 then scount=0;
profit=iff(bsflag=1,c-bscost,bscost-c);
//等同下面的程式碼
{
if bsflag=1 then
profit=c-bscost
else
profit=bscost-c
}
if profit>0 then plot3(profit,"獲利") else plot4(profit,"損失");
//新增附圖指標,設定改柱圖
留言列表