原程序:
//止损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);
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);
经测试:相差0.2就自动平仓。 是不是你们软件定义:1个点止损,就是0.2????
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);
B.赚钱:1个点或以上,自动设置止盈:0.2个点,如果价格没有回到止盈价格,让利润去漂。
如果价格回到止盈价格,自动平仓。
经测试:不会自动设置止盈: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);
加了一个括号,让后面的计算先进行了,看看这个效果怎么样
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);
经测试:相差0.2就自动平仓。
第二个问题:
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);
经测试:说明一些股指1个点就是300元,是由5个0.2组成的。 赚1个或以上,自动设定止盈0.2 ,上面的0.2止盈,没有作用。