打印本文打印本文 关闭窗口关闭窗口

求助ALEX都是,关于移动止盈止损问题

作者:MC 来源:cxh99.com 发布时间:2018年04月22日
: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;" />: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;" /> 1.如何设计获利15-30点时,回撤80%止盈;获利30-50点时,回撤60%止盈;获利50点以上时,回撤0%止盈;: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;" /> 2.在回撤止盈的同时,下反手单,不必等到K线结束时上单,如已经回撤止盈下单,等此K线结束时,不再下单;无回撤止盈现象发生时,K线结束正常下单;: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;" />: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;" /> 谢谢。

 

  • MC回复讨论一:

    您有两个问题,以下两个回复分别对应您的两个问题:

    第一、这个帖子您看一下,可以解决您的第一个问题,链接:https://forum.multicharts.cn/forum/cat/0/thread/431

    第二、这个问题可能有点麻烦,您需要根据我的提示一点点弄:1、使用两个信号(方便叙述,这里使用test1和test2),由于您的策略不开启bar内模式,那么test1不开启bar内模式,而将test2开启bar内模式;2、“策略属性”-“自动交易”-“重新计算”-“委托单成交”-勾选一下;3、将下面这段代码加入test1中:

    if barstatus=1 and postradeexitname(1,0)="Stop Loss" then

    gvsetnamedint("var",1)

    else gvsetnamedint("var",0);

    也就是通过全局变量将setstoploss停损单平仓的信息利用全局变量传递给test2;4、在test2信号中加入代码:

    if gvgetnamedint("var",-1)=1 then

    sellshort("s1") next bar at market;

    也就是当识别到全局变量中有信号之后,在test2中反向下单。

    注意事项:全局变量可以用于同一个策略不同信号之间的回测中。

  • 打印本文打印本文 关闭窗口关闭窗口