以文本方式查看主题

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

--  作者:18943320033
--  发布时间:2019/12/15 12:57:26
--  请教程序化公式
老师,您好:
     初次学习程序化交易,想老师帮写一个交易公式,以便参考学习编写方式和方法,以及公式的基本结构。
    策略一:以小时图为交易周期,小时图收盘价大于周线开盘价时平空买多,小时图收盘价保持在周线开盘价以上时持多;
               小时图收盘价小于周线开盘价时平多卖空,收盘价保持在周线开盘价以下时持空;连续交易

    策略二:以小时图为交易周期,小时图收盘价大于60均线平空买多;小时图小于60均线时平多卖空。连续交易

--  作者:FireScript
--  发布时间:2019/12/16 9:51:22
--  
 1.

week_c:CALLSTOCK(\'\',vtOPEN,7,0);//调用周期数据

sellshort(c>WEEK_C and holding<0,1,market);//平空
buy(c>WEEK_C and holding=0,1,market);//开多
sell(c< WEEK_C and holding>0,holding,market);//平多
buyshort(c<WEEK_C and holding<0,1,market);//开空

2.

ma60:ma(c,60);
平多开空:c<ma60;
平空开多:c>ma60;

sellshort(平空开多 and holding<0,1,market);
buy(平空开多 and holding=0,1,market);
sell(平多开空 and holding>0,holding,market);
buyshort(平多开空 and holding<0,1,market);