原程序:
//止損3個點
if ENTERPRICE-l>=3*mindiff then
sell(1,holding,market);
if h-ENTERPRICE>=3*mindiff then
sellshort(1,holding,market);
//回落到1個點止盈
if h-enterprice>=3*mindiff THEN
n:=1;
if n=1 and h-ENTERPRICE<=1*mindiff then
sell(1,holding,market);
if enterprice-l>=3*mindiff then
m:=1;
if m=1 and ENTERPRICE-l<=1*mindiff then
sellshort(1,holding,market);
改成帶“后臺”程序按下述安求:
A.當虧損:1個點 平倉
B.賺錢:1個點或以上,自動設置止盈:0.2個點,如果價格沒有回到止盈價格,讓利潤去漂。
如果價格回到止盈價格,自動平倉。
if dynainfo(7)-tenterprice>1 and tsellholding(0)>0 then tsellshort(1,0,mkt);
if tenterprice-dynainfo(7)>1 and tbuyholding(0)>0 then tsell(1,0,mkt);
if dynainfo(7)-tenterprice>1 and dynainfo(7)<hhv(h,tenterbars+1)-0.2 and tbuyholding(0)>0 then tsell(1,0,mkt);
if tenterprice-dynainfo(7)>1 and dynainfo(7)>llv(l,tenterbars+1)+0.2 and tsellholding(0)>0 then tsellshort(1,0,mkt);