加仓与分批出场

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

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


风险提示及免责条款

市场有风险,投资需谨慎。本文不构成个人投资建议,也未考虑到个别用户特殊的投资目标、财务状况或需要。用户应考虑本文中的任何意见、观点或结论是否符合其特定状况。据此投资,责任自负。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部