Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共8 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请教一个自动选择模型的问题

1楼
qazplm 发表于:2012/10/30 15:35:51
我想在一个模型里分别运行两种不同开仓条件的子模型A和B,但是不用子模型A和B直接真实交易。是跟据子模型A和B的模拟盈利状态自动进行选择。当子模型A的模拟盈利大于子模型B的模拟盈利的百分之十时用子模型A进行真实交易,子模型B停止交易。当子模型B的模拟盈利大于子模型A的模拟盈利的百分之十时用子模型B进行真实交易,子模型A停止交易。请教该怎么写?
2楼
qazplm 发表于:2012/10/30 15:39:33
当真实交易切换时模拟交易A和B继续运行并不中断。
3楼
jinzhe 发表于:2012/10/30 15:44:16

在A,B两个公式里面使用openprofit记录各自公式的理论浮动盈亏,然后引用出来进行比较

 

盈亏1:=stkindi();

盈亏2:=stkindi();

if 盈亏1>盈亏2 then begin

 

公式A

 

end

 

if 盈亏1<盈亏2 then begin

 

公式B

 

end

4楼
qazplm 发表于:2012/10/31 13:01:54

模型A

hh:=ma(high,30);

ll:=ma(low,30);      
      if cross(high,hh) then  begin         //平空
       sellShort (  holding < 0 ,0 , limitr, c);
        end  
      if cross(high,hh) then  begin      //开多
       Buy (  holding= 0 , 1, limitr, c) ;
         end  

      if cross(ll,low) then   begin       //平多
       sell (  holding > 0 , 0 , limitr, c) ;
        end
      if cross(ll,low) then  begin        //开空
       buyshort(holding = 0  , 1 ,  limitr, c) ;
        end   
模型B

LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),7,1)/SMA(ABS(CLOSE-LC),7,1)*100;

      if ref(rsi1,1)<30 and rsi1>ref(rsi1,1)  then  begin         //平空
       sellShort (  holding < 0 ,0 , limitr, c);
        end  
      if ref(rsi1,1)<30 and rsi1>ref(rsi1,1)  then  begin      //开多
       Buy (  holding= 0 , 1, limitr, c) ;
         end  

      if ref(rsi1,1)>70 and rsi1<ref(rsi1,1)  then   begin       //平多
       sell (  holding > 0 , 0 , limitr, c) ;
        end
      if ref(rsi1,1)>70 and rsi1<ref(rsi1,1)  then  begin        //开空
       buyshort(holding = 0  , 1 ,  limitr, c) ;
        end   
怎么用openprofit记录各自公式的理论浮动盈亏?

是不是还要在第三个公式里才能实现我说的想法?

用一个公式不能实现吗?

5楼
jinzhe 发表于:2012/10/31 13:35:27
需要公式A,公式B,和引用公式一共3个
6楼
qazplm 发表于:2012/10/31 13:53:14

不好意思请问

怎么用openprofit记录各自公式的理论浮动盈亏?

7楼
jinzhe 发表于:2012/10/31 13:59:37

把这个写每个公式的最后,

O1:openprofit;

 

然后引用o1

8楼
qazplm 发表于:2012/10/31 14:05:51
谢谢,我试一下
共8 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03516 s, 3 queries.