以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请问如何实现开仓用K线走完,平仓用固定时间间隔  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=80905)

--  作者:IF左边
--  发布时间:2015/7/14 11:47:19
--  请问如何实现开仓用K线走完,平仓用固定时间间隔
我想开仓用一根K线走完的模式,平仓用固定时间间隔的模式,如何能实现。
--  作者:COMBOY
--  发布时间:2015/7/14 12:37:20
--  

if cross(c,上轨) and time>091500 and time<150000  then
begin
buy(holding=0,ss,limitr,上轨);
end
if cross(下轨,c) and time>091500 and time<150000 then
begin
buyshort(holding=0,ss,limitr,下轨);
end
if holding>0 and cross(中轨,c) then
begin
sell(1,0,limitr,中轨);
end
if holding<0 and cross(c,中轨) then
begin
sellshort(1,0,limitr,中轨);
end

 

 

 

上面这段代码如何实现走完k线开仓,平仓固定轮询?请教高手帮助

[此贴子已经被作者于2015/7/14 12:38:30编辑过]

--  作者:jinzhe
--  发布时间:2015/7/14 13:08:14
--  

if ref(cross(c,上轨),1) and time>091500 and time<150000  then
begin
buy(holding=0,ss,limitr,上轨);
end
if ref(cross(下轨,c),1) and time>091500 and time<150000 then
begin
buyshort(holding=0,ss,limitr,下轨);
end
if holding>0 and cross(中轨,c) then
begin
sell(1,0,limitr,中轨);
end
if holding<0 and cross(c,中轨) then
begin
sellshort(1,0,limitr,中轨);
end

 

 

使用固定时间间隔模式,时间间隔设置为1秒