比如开仓了10手,赚了5%后减仓5手,剩下5手如果行情下跌开仓位平,行情上涨打算赚了10%走。
如何写成语言
稍后我们的员工为您回复! |
仅供参考
没有开多条件,开多条件需要自己添加
盈利:=(c-ENTERPRICE)/ENTERPRICE;//计算盈利
//赚了5%后减仓5手
if 盈利>0.05 then begin
sell(holding>0,5,market);
if c<ref(c,1) then sell(holding>0,0,limit,ENTERPRICE);//剩下5手如果行情下跌开仓位平
if c>ref(c,1) and 盈利=0.1 then sell(holding>0,0,limit,ENTERPRICE);//行情上涨打算赚了10%走
end
谢谢提供
这公式能否改进下
盈利平仓点不一定是收盘价,只要账户中到过要求了就发出指令,
仅供参考
没有开多条件,开多条件需要自己添加
盈利:=(c-ENTERPRICE)/ENTERPRICE;//计算盈利
//赚了5%后减仓5手
if 盈利>0.05 then begin
sell(holding>0,5,market);
if c<ref(c,1) then sell(holding>0,0,limit,ENTERPRICE);//剩下5手如果行情下跌开仓位平
if c>ref(c,1) and 盈利=0.1 then sell(holding>0,0,limit,ENTERPRICE);//行情上涨打算赚了10%走
end
谢谢提供
这公式能否改进下
盈利平仓点不一定是收盘价,只要账户中到过要求了就发出指令,
有开仓信号,开仓10手,同时固定止损8个点(40元一手),如股价安开仓方向10个点(50元一手)走,先固定止盈4手,同时6手以开仓价加3个点保本止盈(设条件单),(6手继续安开仓方向走)用软件内设的要求平仓
测试的话品种用橡胶1205
ma5:ma(c,5);
ma10:ma(c,10);//这里开仓条件是5日均线金叉10日均线开多,反之开空
long:=cross(ma5,ma10) and time<145700;//开仓条件:金叉,14点57前开仓
if long then begin
sellshort(holding=-6,holding,thisclose);//满足条件后先平所有空单
buy(holding=0,10,thisclose);//然后开10手多单
end
longx:=c<enterprice-40 and holding>0;//止损条件8个点全平
if longx then begin
sell(1,0,market);
end
longx2:=c=enterprice+50;//盈利了10点平4手
if longx2 then begin
sell(holding=10,4,market);
end
longx3:=c=enterprice+15 and holding=6;//保本
if longx3 then begin
sell(1,6,market);
end
//下面是做空
short:=cross(ma10,ma5) and time<145700;
if short then begin
sell(holding=6,holding,thisclose);
buyshort(holding=0,10,thisclose);
end
shortx:=c>enterprice+40 and holding<0;
if shortx then begin
sellshort(1,0,market);
end
shortx2:=c=enterprice-50;//盈利了10点平4手
if shortx2 then begin
sellshort(holding=-10,4,market);
end
shortx3:=c=enterprice-15 and holding=6;//保本
if shortx3 then begin
sellshort(1,6,market);
end
这个公式好像有点问题,高手帮忙改进下 止损止盈只要账户到过就平,最好引用账户数据,不要用close
楼主的意思应该是止损止盈一单触发就进行操作。因此你用走完K线模式是无法达到你所要的效果的,用分笔当然就可以。你可以参考http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=9439
里面的走完K线与盘中模式并存的写法试试。