以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  金字塔软件问题提交  (http://222.73.7.161/bbs/list.asp?boardid=2)
----  老师,如何控制一个小时内只第一次上穿指标线买人。  (http://222.73.7.161/bbs/dispbbs.asp?boardid=2&id=63832)

--  作者:zyglys
--  发布时间:2014/4/13 0:24:27
--  老师,如何控制一个小时内只第一次上穿指标线买人。
老师,如何控制一个小时内只第一次上穿指标线时买人
--  作者:netfox
--  发布时间:2014/4/13 14:29:51
--  
time<100000  这样吗?
--  作者:qwer123
--  发布时间:2014/4/13 16:47:04
--  
比如1分钟k线
r1:=ma(c,5);
r2:=ma(c,10);

if barpos=1 then buyshort(holding=0,1,thisclose);
if holding=0 and enterbars>=60 and cross(r1,r2) then buy(holding=0,1,thisclose);
if holding=0 and enterbars>=60 and cross(r2,r1) then buyshort(holding=0,1,thisclose);

if holding>0 and cross(r2,r1) then sell(holding>0,0,thisclose);
if holding<0 and cross(r1,r2) then sellshort(holding<0,0, thisclose);


注意:1.这个程序只能做测试用,如果实盘交易限制k线数量,会引起信号变化;
        2.对于日内交易要考虑第一次开仓的问题;