以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  改后台交易  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=150814)

--  作者:系统使用者
--  发布时间:2017/4/9 22:36:00
--  改后台交易
cc1:=stkindi(stklabel,\'趋势交易策略.cc(14,12)\',0,13,0);  //2小时,
cc2:=stkindi(stklabel,\'I号交易模式.cc(24,19)\',0,4,0);   //30分钟
cc3:=stkindi(stklabel,\'螺纹10分短波.cc\',0,18,0);  //10分钟
cc666888:=ss*cc1 + ss*cc2 + ss*cc3;//各个模型的仓位系数。
order:=cc666888-holding;
if order>0 then begin
 pc:=min(abs(min(holding,0)),order);
 kc:=order-pc;
 sellshort(pc>0,pc,marketr);
 buy(kc>0,kc,marketr);
end
if order<0 then begin
 pc:=min(max(holding,0),abs(order));
 kc:=abs(order)-pc;
 sell(pc>0,pc,marketr);
 buyshort(kc>0,kc,marketr); 
end

改为后台交易。

--  作者:系统使用者
--  发布时间:2017/4/9 22:38:31
--  

cc1:=stkindi(stklabel,\'趋势交易策略.cc(14,12)\',0,13,0);  //2小时,
cc2:=stkindi(stklabel,\'I号交易模式.cc(24,19)\',0,4,0);   //30分钟
cc3:=stkindi(stklabel,\'螺纹10分短波.cc\',0,18,0);  //10分钟
原图表化模式的,不需要改还是要改?
3个模型A、B、C,均为K线走完模式,且为逐K线模式,想组合在一起。并且改后台交易

--  作者:wenarm
--  发布时间:2017/4/10 8:42:39
--  
cc1:=stkindi(stklabel,\'趋势交易策略.cc(14,12)\',0,13,0);  //2小时,
cc2:=stkindi(stklabel,\'I号交易模式.cc(24,19)\',0,4,0);   //30分钟
cc3:=stkindi(stklabel,\'螺纹10分短波.cc\',0,18,0);  //10分钟
cc666888:=ss*cc1 + ss*cc2 + ss*cc3;//各个模型的仓位系数。
order:=cc666888-holding;
if order>0 then begin
 pc:=min(abs(min(holding,0)),order);
 kc:=order-pc;
 Tsellshort(pc>0,pc,marketr);
 Tbuy(kc>0,kc,marketr);
end
if order<0 then begin
 pc:=min(max(holding,0),abs(order));
 kc:=abs(order)-pc;
 Tsell(pc>0,pc,marketr);
 Tbuyshort(kc>0,kc,marketr); 
end
 
 
后台支持序列模式和逐K线模式。一般后台建议使用序列模式。
可以不修改。

--  作者:系统使用者
--  发布时间:2017/4/10 11:36:13
--  
哦,
cc1:=stkindi(stklabel,\'趋势交易策略.cc(14,12)\',0,13,0);  //2小时,
cc2:=stkindi(stklabel,\'I号交易模式.cc(24,19)\',0,4,0);   //30分钟
cc3:=stkindi(stklabel,\'螺纹10分短波.cc\',0,18,0);  //10分钟
这样引用的,在图表交易挂那个周期跑最好?

--  作者:wenarm
--  发布时间:2017/4/10 12:20:03
--  

不明白,你说的意思,看你要用在哪个周期了


--  作者:系统使用者
--  发布时间:2017/4/10 12:30:04
--  
根据这个来的。
我把自己的3个模型组合。
这需要在那个固定周期?
阿火模式
各个交易策略的组合(图表化版本):
 
比如,有3个模型A、B、C,均为K线走完模式,且为逐K线模式,想组合在一起。要如何实现呢?
 
方法如下:
第一步,在各个模型的最开头加入记录持仓的变量cc,如以下红色部分:
runmode:0;
cc:=holding;
ma5:=ma(c,5);
ma10:=ma(c,10);
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding=0 and ma5>ma10 then buy(1,1,thisclose);
if holding=0 and ma5<ma10 then buyshort(1,1,thisclose);
 
第二步,新建一个模型,把A、B、C 三个模型的变量“ CC ”引用过来,并加入蓝色部分的指令代码即可,如下:
cc1:=stkindi(stklabel,\'模型A.cc\',0,11,0);  //2分钟,多分钟设置为2
cc2:=stkindi(stklabel,\'模型B.cc\',0,2,0);   //5分钟
cc3:=stkindi(stklabel,\'模型C.cc\',0,18,0);  //10分钟
cc800988:=3*cc1 + 1*cc2 + 2*cc3;//各个模型的仓位系数。这里表示 A模型下3手,B模型下1手,C模型下2手
order:=cc800988-holding;
if order>0 then begin
 pc:=min(abs(min(holding,0)),order);
 kc:=order-pc;
 sellshort(pc>0,pc,limitr,o);
 buy(kc>0,kc,limitr,o);
end
if order<0 then begin
 pc:=min(max(holding,0),abs(order));
 kc:=abs(order)-pc;
 sell(pc>0,pc,limitr,o);
 buyshort(kc>0,kc,limitr,o); 
end

--  作者:系统使用者
--  发布时间:2017/4/10 12:30:49
--  
各个交易策略的组合(图表化版本),这样需要挂那个周期的图表?
--  作者:wenarm
--  发布时间:2017/4/10 12:33:19
--  

你要用在什么周期是你自己在策略编写之前,就应该决定的。

不是说自己什么都没想,直接拿一堆零部件后,组装完后,问其他人这个是干嘛用的。

这种模范范例没有严格限制周期要求的话,基本各个周期都可以,最多做个微调