以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 帮忙编个程序 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=71894) |
-- 作者:yhl99414 -- 发布时间:2014/11/12 9:11:08 -- 帮忙编个程序 10点以后突破前20根k线最高价以最高限价做多n手,突破最低以最低限价做空n手, 开仓后设置止损a点,如果止损按照前面规则突破20根k线继续开仓, 盈利到m点,止盈一半,另一半如果出现反向走势以突破前20根k线最高最低反手开仓(开仓数为n手)或者收盘前清仓。 开仓后没有止损和止盈的,在出现反向突破20根k线的情况下反手,或者收盘前清仓 |
-- 作者:jinzhe -- 发布时间:2014/11/12 9:18:59 -- 处理中,请稍等 |
-- 作者:pyd -- 发布时间:2014/11/12 9:43:53 -- “盈利到m点,止盈一半,另一半如果出现反向走势以突破前20根k线最高最低反手开仓(开仓数为n手)或者收盘前清仓。”
图表不支持锁仓,也就是止盈一半还有一半仓位时不能反手开仓。
|
-- 作者:yhl99414 -- 发布时间:2014/11/12 9:49:19 -- 先平掉剩下的一半,然后反向开仓 |
-- 作者:pyd -- 发布时间:2014/11/12 10:22:22 -- 什么条件下平掉剩下的一半? 请把平仓条件补充下,把1楼的完善后再写一遍。 |
-- 作者:yhl99414 -- 发布时间:2014/11/12 11:22:12 -- 1、开仓条件:10点以后突破前20根k线最高价以最高限价做多n手,突破最低以最低限价做空n手; 2、止损:开仓后设置止损a点; 3、止损后处理:按照规则突破前面20根k线继续开仓n手; 4、分批止盈的情况:盈利到m点,止盈一半仓位;另一半仓位以反向突破前20根k线最高最低平仓反手(反手数为n手)或者收盘前清仓;例:橡胶做多2手,到目标位盈利100点止盈一手后,剩下一手出现突破前面最低点则止盈或者止损,然后开空仓2手,如果当天走势是大单边没有出现反向最低点就拿到收盘平仓。
5、开仓后没有止损和止盈的,在出现反向突破20根k线的情况下反手,或者收盘前清仓 |
-- 作者:pyd -- 发布时间:2014/11/12 15:03:16 -- t:=100000; hh:hhv(h,20); ll:llv(l,20); if t and h>ref(hh,20) then buy(holding=0,n,market); if t and l<ref(ll,20) then buy(holding=0,n,market); //止损 if ENTERPRICE-l>=a then sell(holding>0,holding,market); if h-enterprice>=a then sellshort(holding<0,holding,market); //止盈一半 if h-ENTERPRICE>=m then sell(holding>0,0.5*holding,market); if ENTERPRICE-l>=m then sellshort(holding<0,0.5*holding,market); //另一半 if l<ref(ll,20) then begin sell(holding>0,0.5*holding,market); buyshort(holding=0,n,market); end if h>ref(hh,20) then begin sellshort(holding<0,0.5*holding,market); buy(holding=0,n,market); end //收盘清仓 这个是假设用在5分钟周期上收盘前5分钟平仓,根据你的周期自己设置time的时间 if time=145500 then begin sell(holding>0,holding,market); sellshort(holding<0,holding,market); end |
-- 作者:yhl99414 -- 发布时间:2014/11/13 9:15:08 -- 用了下不符合要求啊,1、开盘后突破就开仓了;2、后面反向突破了没有反手开仓;3、止损没有看到 |
-- 作者:jinzhe -- 发布时间:2014/11/13 9:54:35 -- input:n(2,1,100,1); h20:ref(hhv(h,20),1); if tt and h>h20 then begin if tt and l<l20 then begin if holding>0 and enterprice-l>a then 止损多:sell(1,0,thisclose); if bj=0 and holding=n and h-enterprice>m then begin if bj=0 and abs(holding)=n and enterprice-l>m then begin
|
-- 作者:yhl99414 -- 发布时间:2014/11/14 8:33:34 -- 谢谢版主,刚才看了下,应该是符合的,有问题可能还要麻烦你 |