Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共21 条记录, 每页显示 10 条, 页签: [1] [2][3]
[浏览完整版]

标题:请问有谁知道我代码错在哪里了吗?研究了几天不知道哪里错了

1楼
超级兔子 发表于: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);


请问有谁知道我代码错在哪里了吗?研究了几天不知道哪里错了,谢谢谢谢!
2楼
FexTel 发表于:2014/6/25 9:46:48

A:=VALUEWHEN(TIME=094500,CLOSE);

//A的取值有问题把,:=VALUEWHEN(TIME=094500,CLOSE);

3楼
超级兔子 发表于:2014/6/25 9:52:33

A:=VALUEWHEN(TIME=094500,CLOSE);

//A的取值有问题把,:=VALUEWHEN(TIME=094500,CLOSE);


因为是在30分钟里面,所以我就取了时间=094500的收盘价,请问这样取错了吗?应该怎么修改呢?谢谢!

4楼
FexTel 发表于:2014/6/25 10:03:34

不是写错了,对应CLOSE前面符号的写的时候输入法有问题

 

函数应该是以淡蓝色显示

5楼
超级兔子 发表于:2014/6/25 10:10:08

是蓝色显示的

因为我测试了,进场是对的,但是都成本止损了,该止盈100的时候没有止盈100,而全部都是成本止损了
能帮忙看看止盈的代码那里是不是写错了啊???
6楼
FexTel 发表于:2014/6/25 10:17:17

1,止损12和止盈100是指变动价位还是指点?

 

12*MINDIFF //表示12个变动价位,股指即为2.4个点

如果不想在同根K线满足条件后止损或止盈,在平仓条件里加个ENTERBARS>0

[此贴子已经被作者于2014/6/25 10:17:27编辑过]
7楼
超级兔子 发表于:2014/6/25 10:22:16


1,止损12和止盈100是指变动价位还是指点?


答:止损12和止盈100是固定的,只是开仓价走出10点就用成本(开仓价)止损


 

12*MINDIFF //表示12个变动价位,股指即为2.4个点

如果不想在同根K线满足条件后止损或止盈,在平仓条件里加个ENTERBARS>0


答:我是测试的IF00

8楼
FexTel 发表于:2014/6/25 10:35:23

10个点就不要用10*MINDIFF这种方式,这个是表示10个变动价位,股指2个点

if CLOSE<=(enterprice+12) and holding>0 then sell(1,1,market);

 

9楼
超级兔子 发表于: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点还是没有起到作用。。。。。

10楼
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);

 

 

共21 条记录, 每页显示 10 条, 页签: [1] [2][3]


Powered By Dvbbs Version 8.3.0
Processed in 0.06250 s, 3 queries.