标题:
移动止盈 [MC函数]
[打印本页]
作者:
龙听
时间:
2018-5-12 23:14
标题:
移动止盈 [MC函数]
这次要来介绍的是一种止盈的方法, 以函数的方式呈现, 如此方便套用在任何策略中,要注意的是,此方法只有止盈,止损需要额外添加喔!
方法图解如下:
下载
(43.46 KB)
2018-5-12 23:11
函数:
NetTrailling(N,ratio)
说明:
N->进场后获利N点后,启动移动停利.
ratio ->拉回多少出场,分为拉回点数及百分比
从最高获利拉回50%,就填入0.5 ,
从最高获利拉回20点出场就写20。
利用highest(high,barssinceentry)-entryprice>10 条件成立
挂单在highest(high,barssinceentry)-(0.5)*(highest(high,barssinceentry)-entryprice)
这样的写法做移动停利取代Setpercenttrailing / Setdollartrailing
写法还蛮简单的,原本是个别拆开写在策略中.
为了方便大家使用,所以改成函数的方式.
可以自己测试看看..
举例:
买入后获利大于20点,拉回10点出场:NetTrailling(20,10)
if date<>date[1] and close>close[1] then buy next bar at market;
if marketposition>0 then sell next bar at NetTrailling(20,10) stop;
(放空相同NetTrailling(20,10)-> buytocover next bar at NetTrailling(20,10) stop)
下载
(25.23 KB)
2018-5-12 23:12
图片附件:
5391a0b1b555ae5552e0254642ea795d.jpg
(2018-5-12 23:11, 43.46 KB) / 下载次数 0
http://qhlt.club/attachment.php?aid=3935&k=f440edc489965a6f1e3fe14a39be3ddf&t=1719808477&sid=14860b
图片附件:
709809a2bc2abfeadb84a7975bfa8be0.jpg
(2018-5-12 23:12, 25.23 KB) / 下载次数 0
http://qhlt.club/attachment.php?aid=3936&k=a1d194b49d00652df9b88bea24d9c906&t=1719808477&sid=14860b
作者:
龙听
时间:
2018-5-12 23:14
回复
1#
龙听
明天贴完整的源码。
欢迎光临 龙听期货论坛 (http://qhlt.club/)
Powered by Discuz! 7.2