//今天开盘跳空昨天,同时要第一个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);
请问有谁知道我代码错在哪里了吗?研究了几天不知道哪里错了,谢谢谢谢!
A:=VALUEWHEN(TIME=094500,CLOSE);
//A的取值有问题把,:=VALUEWHEN(TIME=094500,CLOSE);
不是写错了,对应CLOSE前面符号的写的时候输入法有问题
函数应该是以淡蓝色显示
是蓝色显示的
因为我测试了,进场是对的,但是都成本止损了,该止盈100的时候没有止盈100,而全部都是成本止损了
能帮忙看看止盈的代码那里是不是写错了啊???
1,止损12和止盈100是指变动价位还是指点?
12*MINDIFF //表示12个变动价位,股指即为2.4个点
如果不想在同根K线满足条件后止损或止盈,在平仓条件里加个ENTERBARS>0
[此贴子已经被作者于2014/6/25 10:17:27编辑过]
1,止损12和止盈100是指变动价位还是指点?
答:止损12和止盈100是固定的,只是开仓价走出10点就用成本(开仓价)止损
12*MINDIFF //表示12个变动价位,股指即为2.4个点
如果不想在同根K线满足条件后止损或止盈,在平仓条件里加个ENTERBARS>0
答:我是测试的IF00
10个点就不要用10*MINDIFF这种方式,这个是表示10个变动价位,股指2个点
if CLOSE<=(enterprice+12) and holding>0 then sell(1,1,market);
//中间变量
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点还是没有起到作用。。。。。
1,上面说的变动价位和点你明白了没?
100表示100个点,及K线图上价格变化100快,那该变动多大区间啊。
没止盈是因为止盈没达到条件就给你止损掉了
if CLOSE<=(enterprice-12) and holding>0 and enterbars>0 then sell(1,1,market);