等级: 新手上路
- 注册:
- 2024-8-11
- 曾用名:
|
老师,我觉得您上面的分段止盈非常好,但我想分段分批止盈,我自己摸索写的程序,您看看能不能帮我调整下:
最大浮动盈亏:if(holding<>0,maxprofit,0);
浮动盈亏:win;
if (c-avgenterprice)>=a then 多止损a:sell(1,holding,market);
if (avgenterprice-c)>=a then 空止损a:sellshort(1,holding,market);
//分段回撤多止盈
if maxprofit>=2*A and win>0 and win<=0.5*A then 多止盈1:sell(1,10%,market);//卖出平仓10%仓位
if maxprofit>=3*A and win>0 and win<=1*A then 多止盈2:sell(1,20%,market);//卖出平仓20%仓位
if maxprofit>=4*A and win>0 and win<=2*A then 多止盈3:sell(1,30%,market);卖出平仓30%仓位
if maxprofit>=5*A and win>0 and win<=3*A then 多止盈4:sell(1,holding,market);卖出剩余全部仓位平仓
//分段回升空止盈
if maxprofit>=2*A and win>0 and win<=0.5*A then 空止盈1:sellshort(1,10%,market);
if maxprofit>=3*A and win>0 and win<=1*A then 空止盈2:sellshort(1,20%,market);
if maxprofit>=4*A and win>0 and win<=2*A then 空止盈3:sellshort(1,30%,market);
if maxprofit>=5*A and win>0 and win<=3*A then 空止盈4:sellshort(1,holding,market);
|
|