欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 关于调取其它模型状态的问题

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3674人关注过本帖树形打印复制链接

主题:关于调取其它模型状态的问题

帅哥哟,离线,有人找我吗?
FireScript
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2017/11/20 8:51:46    Post IP:180.169.30.6[显示全部帖子]

可以做到,使用STKINDI函数即可。

比如引用A模型日线周期下开仓条件:

STKINDI('','A.开仓',0,6,0);

 

每个参数都有自己的含义,可以指定品种,周期,指标等。



命数如织,当如磐石。
 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2017/11/21 9:09:11    Post IP:180.169.30.6[显示全部帖子]

按照你的说明,你这是要在一个指标(假设C指标)C,里面同时引用A和B的状态了。

 

模型a:
ma20:ma(c,20);
buycond:cross(c,ma20);
sellcond:cross(ma20,c);
if buycond then buy(holding=0,1,market);
if sellcond then sell(holding>0,holding,MARKET);
aholding:holding;

 


模型b:
ma30:ma(c,30);
buycond:cross(c,ma30);
sellcond:cross(ma30,c);
if buycond then buy(holding=0,1,market);
if sellcond then sell(holding>0,holding,MARKET);
bholding:holding;


模型c:
bholding:STKINDI('','b.bholding',0,7,0);//  引用a,b的变量
aholding:STKINDI('','a.holding',0,3,0);

asellcond:STKINDI('','a.sellcond',0,3,0);
bsellcond:STKINDI('','b.sellcond',0,7,0);

abuycond:STKINDI('','a.buycond',0,3,0);
bbuycond:STKINDI('','b.buycond',0,7,0);


if bholding>0 and aholding>0 and not(asellcond or bsellcond) then buy(holding=0,1,MARKET);//开仓
if (bholding>0 and asellcond) or bsellcond  then sell(holding>0,holding,MARKET);//平仓

 

 

 

 



命数如织,当如磐石。
 回到顶部