今天策略天地来教教大家如何根据各种状况来加仓进场或分批出场,

1.相同条件下的加仓:

if  condition1  then

buy next bar at market;

加仓设置

宽客网

加仓效果(这个的condition1=c>o):

宽客网

2.不同条件加仓

if  condition1  then

buy(“entry”) next bar at market;

if  condition2  then

buy(“jiacang1”) next bar at market;

if  condition3  then

buy(“jiacang2”)  next bar at market;  

这个的

condition1 =c>o and marketposition=0

condition2 =c>o and c[1]>o[1]

condition3 = c>o and c[1]>o[1] and c[2]>o[2]

加仓设置:

宽客网

加仓效果

宽客网

同一笔入场的多手持仓的相同条件的分笔出场

分批出场开关:SameExitFromOneEntryOnce

if c>o then

buy 3 shares  next bar at market;

[SameExitFromOneEntryOnce = false];

if co and marketposition=0   then

buy ("entry") next bar at market;

if  c>o and c[1]>o[1]   then

buy ("jiacang1") next bar at market;

if  c>o and c[1]>o[1] and c[2]>o[2]  then

buy ("jiacang2")  next bar at market;

if c[1]<o[1] then begin

sell from entry("entry") next bar at market;

sell from entry("jiacang1") next bar at market;

sell from entry("jiacang2") next bar at market;

end;

出场效果 :

宽客网
程序化交易, MultiCharts

点赞(0)
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部