以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请问有谁知道我代码错在哪里了吗?研究了几天不知道哪里错了 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=66576) |
|
-- 作者:超级兔子 -- 发布时间:2014/6/25 9:31:59 -- 请问有谁知道我代码错在哪里了吗?研究了几天不知道哪里错了 //今天开盘跳空昨天,同时要第一个30分钟收阳 就下一个30分钟的开盘进场 止损12,止盈100,走出10点成本止损 //中间变量 N:=barslast(date<>ref(date,1))+1; preDayHigh:ref(hhv(h,N),N); //昨日最高价 preDayLOW:ref(LLv(L,N),N);//昨日最低价 A:=VALUEWHEN(TIME=094500,CLOSE); B:=VALUEWHEN(DATE<>REF(DATE,1),OPEN); //交易系统 if CLOSE>=(enterprice+12*mindiff) and holding<0 then sellshort(1,1,market); if llv(l,enterbars+1)<(enterprice-10*mindiff) and h>=enterprice and holding<0 then sellshort(1,1,market); if enterprice-l>=100 and holding<0 then sellshort(1,1,market); if OPEN>preDayHigh AND A>B AND TIME<101500 and holding=0 then buy(1,1,market); if CLOSE<=(enterprice+12*mindiff) and holding>0 then sell(1,1,market); if hhv(h,enterbars+1)>(enterprice+10*mindiff) and l<=enterprice and holding>0 then sell(1,1,market); if h-enterprice>100 and holding>0 then sell(1,1,market); if OPEN<preDayLOW AND A<B AND TIME<101500 and holding=0 then BUYSHORT(1,1,market); 请问有谁知道我代码错在哪里了吗?研究了几天不知道哪里错了,谢谢谢谢!
|
|
-- 作者:FexTel -- 发布时间:2014/6/25 9:46:48 -- A:=VALUEWHEN(TIME=094500,CLOSE); //A的取值有问题把,:=VALUEWHEN(TIME=094500,CLOSE); |
|
-- 作者:超级兔子 -- 发布时间:2014/6/25 9:52:33 --
|
|
-- 作者:FexTel -- 发布时间:2014/6/25 10:03:34 -- 不是写错了,对应CLOSE前面符号的写的时候输入法有问题
函数应该是以淡蓝色显示 |
|
-- 作者:超级兔子 -- 发布时间:2014/6/25 10:10:08 -- 是蓝色显示的 因为我测试了,进场是对的,但是都成本止损了,该止盈100的时候没有止盈100,而全部都是成本止损了 能帮忙看看止盈的代码那里是不是写错了啊???
|
|
-- 作者:FexTel -- 发布时间:2014/6/25 10:17:17 -- 1,止损12和止盈100是指变动价位还是指点?
12*MINDIFF //表示12个变动价位,股指即为2.4个点 如果不想在同根K线满足条件后止损或止盈,在平仓条件里加个ENTERBARS>0 [此贴子已经被作者于2014/6/25 10:17:27编辑过]
|
|
-- 作者:超级兔子 -- 发布时间:2014/6/25 10:22:16 -- 1,止损12和止盈100是指变动价位还是指点? 答:止损12和止盈100是固定的,只是开仓价走出10点就用成本(开仓价)止损
12*MINDIFF //表示12个变动价位,股指即为2.4个点 如果不想在同根K线满足条件后止损或止盈,在平仓条件里加个ENTERBARS>0 答:我是测试的IF00 |
|
-- 作者:FexTel -- 发布时间:2014/6/25 10:35:23 -- 10个点就不要用10*MINDIFF这种方式,这个是表示10个变动价位,股指2个点 if CLOSE<=(enterprice+12) and holding>0 then sell(1,1,market);
|
|
-- 作者:超级兔子 -- 发布时间:2014/6/25 11:10:34 -- ![]() ![]() ![]() ![]() ![]() //中间变量 N:=barslast(date<>ref(date,1))+1; preDayHigh:ref(hhv(h,N),N); //昨日最高价 preDayLOW:ref(LLv(L,N),N);//昨日最低价 A:=VALUEWHEN(TIME=094500,CLOSE); B:=VALUEWHEN(DATE<>REF(DATE,1),OPEN); //交易系统 if CLOSE>=(enterprice+12) and holding<0 then sellshort(1,1,market); if llv(l,enterbars+1)<(enterprice-10) and h>=enterprice and holding<0 then sellshort(1,1,market); if (enterprice-l>=100) and holding<0 then sellshort(1,1,market); if OPEN>preDayHigh AND A>B AND TIME<101500 and holding=0 then buy(1,1,market); if CLOSE<=(enterprice-12) and holding>0 then sell(1,1,market); if hhv(h,enterbars+1)>(enterprice+10) and l<=enterprice and holding>0 then sell(1,1,market); if (h-enterprice>100) and holding>0 then sell(1,1,market); if OPEN<preDayLOW AND A<B AND TIME<101500 and holding=0 then BUYSHORT(1,1,market); 改过来了,重新测试了,盈利100点还是没有起到作用。。。。。 |
|
-- 作者:FexTel -- 发布时间:2014/6/25 11:30:33 -- 1,上面说的变动价位和点你明白了没? 100表示100个点,及K线图上价格变化100快,那该变动多大区间啊。 没止盈是因为止盈没达到条件就给你止损掉了
if CLOSE<=(enterprice-12) and holding>0 and enterbars>0 then sell(1,1,market);
|