以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请教后台程序化代码编写 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=147512) |
-- 作者:a383623133 -- 发布时间:2017/2/8 8:49:52 -- 请教后台程序化代码编写 后台程序化怎么写如下规则?: 1.开盘就开多仓2.如果止盈就继续开多仓,如果止损就开空仓 3.尾盘不留仓
|
-- 作者:jinzhe -- 发布时间:2017/2/8 9:16:21 -- if todaybar=1 then tbuy(tholding=0,1,mkt);
if tnumprofit(1)>0 then tbuy(tholding=0,1,mkt);
if tnumprofit(1)<0 then tbuyshort(tholding=0,1,mkt);
if time=closetime(0) then begin tsell(1,0,mkt); tsellshort(1,0,mkt); end |
-- 作者:a383623133 -- 发布时间:2017/2/8 12:55:27 -- 老师,再请教下: 1.开盘就开多仓2.不关盈利还是亏损,下一次开仓都是反向开仓 3.尾盘不留仓 后台该如何写?
|
-- 作者:jinzhe -- 发布时间:2017/2/8 12:59:10 -- if todaybar=1 then tbuy(tholding=0,1,mkt);
if ttype(1)=4 then tbuy(tholding=0,1,mkt);
if ttype(1)=2 then tbuyshort(tholding=0,1,mkt);
if time=closetime(0) then begin tsell(1,0,mkt); tsellshort(1,0,mkt); end |
-- 作者:a383623133 -- 发布时间:2017/2/8 14:19:14 -- 后台的跟踪止盈该怎么编写? 盈利回撤4跳就止盈
|
-- 作者:jinzhe -- 发布时间:2017/2/8 14:21:56 -- 盈利1跳也回撤4跳止损? |
-- 作者:a383623133 -- 发布时间:2017/2/8 14:27:02 -- 盈利4跳以上才用到止盈,没超过4跳的就等止损信号 |
-- 作者:jinzhe -- 发布时间:2017/2/8 14:45:45 -- if hhv(h,tenterbars+1)-tenterprice>=4*mindiff and c<=hhv(h,tenterbars+1)-4*mindiff then tsell(1,0,mkt); if tenterprice-llv(l,enterbars+1)>=4*mindiff and c>=llv(l,enterbars+1)+4*mindiff then tsell(1,0,mkt); |
-- 作者:a383623133 -- 发布时间:2017/2/9 8:53:47 -- 哪一句是跟踪止盈? |
-- 作者:jinzhe -- 发布时间:2017/2/9 8:58:58 -- if hhv(h,tenterbars+1)-tenterprice>=4*mindiff and c<=hhv(h,tenterbars+1)-4*mindiff then tsell(1,0,mkt); if tenterprice-llv(l,enterbars+1)>=4*mindiff and c>=llv(l,enterbars+1)+4*mindiff then tsellshort(1,0,mkt); 第一句是多头,第二句是空头 这两句都是,前面第二句疏忽了,没写成空头 |