以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 公式模型编写问题提交 (http://222.73.7.161/bbs/list.asp?boardid=4) ---- 交易信号只显示开多和平多,请教 (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=155627) |
-- 作者:新华字典1949 -- 发布时间:2017/7/2 21:26:15 -- 交易信号只显示开多和平多,请教 老师好! 我写了一个系统,可是它只显示开多和平多止多的信号,没有开空和平空的信号,不知道错在哪了?特请教!谢谢! //交易系统 //开多------------------------------------------------------------------------------------------------------------- if KDDiBLTJ and holding<=0 then begin KD先平空:sellshort(KDDiBLTJ and holding<0,0,market); //按语法要求先平仓再开仓 KDDiBL开多:buy(holding=0,1,market); StopLow:=BoDuanLLV; //设低点为止损价 end
//开空-------------------------------------------------------------------------------------------------------------- if KDDingBLTJ and holding>=0 then begin KD先平多:sell(KDDingBLTJ and holding>0,0,market);//按语法要求先平仓再开仓 KDDIngBL开空:buyshort(holding=0,1,market); StopHigh:=BoDuanHHV; //设高点为止损价 end
//跟踪止损----------------------------------------------------------------------------------------------------------------- //多单 if holding>0 and KcrossD then StopLow:=BoDuanLLV; //若再金叉,止损价跟踪波段最低价 //注意不能将下句平仓语句放在上面一段begin-end中,因为金叉时未必下破止损,下破止损时可能已叉多时。上段只是用金叉来确定止损点 if l<StopLow then 止损平多:sell(holding>0,0,market);//跌破止损 if h>UpperEst then 布林极值平多: sell(holding>0,0,market);//布林平多赢
//空单 if holding<0 and DcrossK then StopHigh:=BoDuanHHV;//若再死叉,止损价跟踪波段最低价 //注意不能将下句平仓语句放在上面一段begin-end中,因为死叉时未必上破止损,上破止损时可能已死叉多时。上段只是用死叉来确定止损高点 if h>StopHigh then 止损平空:sellshort(holding<0,0,market); if l<LowerEst then 布林极值平空: sellshort(holding<0,0,market);//布林平空赢 |
-- 作者:wenarm -- 发布时间:2017/7/2 23:22:42 -- 把你KDDiBLTJ KDDingBLTJ 条件贴出来、 另外交易的品种和周期
[此贴子已经被作者于2017/7/2 23:23:40编辑过]
|