以文本方式查看主题

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

--  作者:ZCLam
--  发布时间:2014/12/18 11:18:00
--  [求助]请教老师个问题!
 正常盘中程序运行每次都是在K线走完后,下一根K线的开盘价进场的。

如果想在收盘前信号出现时提前中进场的话,应该怎么设置 !

--  作者:jinzhe
--  发布时间:2014/12/18 11:24:04
--  

固定时间间隔1秒模式

代码写

not(islastbar) or (time0-timetot0(currentime)<=n)

n是你想要k线走完提前进场的秒数


--  作者:ZCLam
--  发布时间:2014/12/18 11:53:20
--  
请问下老师,
固定时间间隔1秒模式
代码写
not(islastbar) or (time0-timetot0(currentime)<=n)
n是你想要k线走完提前进场的秒数

应该加再以下代码的哪个地方:
ma1:=ma(close,5);
ma2:=ma(close,10);
ma3:=ma(close,21);
ma4:=ma(close,50);
//上面是4条ma均线
if cross(ma1,ma2) then sellshort(1,0,market);//满足cross(ma1,ma2),,平空
if cross(ma2,ma3) and close>ma4 then buy(holding=0,1,market);//满足cross(ma2,ma3)和close>ma4,开多
if cross(ma2,ma1) then sell(1,0,market);//满足cross(ma2,ma1),平多
if cross(ma3,ma2) and close<ma4 then buyshort(holding=0,1,market);//满足cross(ma3,ma2)&和close<ma4,开空


--  作者:jinzhe
--  发布时间:2014/12/18 13:45:02
--  

加在开平仓条件里面

if cross(ma1,ma2) or  上面那一段


--  作者:ZCLam
--  发布时间:2014/12/18 14:46:14
--  
按老师你说的那样加,提示“未定义变量 :CURRENTIME”

该怎么解决呀?

--  作者:jinzhe
--  发布时间:2014/12/18 14:49:07
--  

CURRENtTIME

少写了一个t,加上就好