Rss & SiteMap

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

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

标题:[求助]当HOLDING=1的时候开不了空吗?

1楼
xian_0_9 发表于:2011/10/30 10:36:45
当HOLDING=1的时候开不了空吗?图表交易。
2楼
阿火 发表于:2011/10/30 10:59:37

问题描述不清

3楼
xian_0_9 发表于:2011/10/30 21:03:03

举例

C上穿120日均线开多1手。下穿120日均线平多。

C在大于120日均线上小于10天前最低价开空一手(就是在开空的时候HOLDING已经等于1了)。C大于10天前最高价平空。

4楼
xian_0_9 发表于:2011/10/30 21:09:41

这么写对不?我试验了好像没好使。得咋写啊?

VARIABLE:aa=0;

 

ma1:ma(c,10);
ma2:ma(c,110);

h20:ref(hhv(h,6),1);
l20:ref(llv(l,6),1);


kd1:= cross(c,ma2) and holding=0;

kd2:= cross(c,ma2) and holding=-1;

pd1:=cross(ma2,c) adn holding=1;


kk1:=cross(l20,c) and holding>-1;
kk2:=cross(l20,c) and holding=1;
kk3:=cross(l20,c) and c>ma2 and holding=1;

pk1:=cross(c,h20) and holding=-1;
pk2:=cross(c,h20) and holding=-1 and holding=1;
pk3:=cross(c,h20) and holding=0;
if pk1 or pk2 or pk3 then
begin
sellshort(1,1,limitr,c);
end

if pd1 then
begin
sell(1,1,limitr,c);
if pd1 then aa:=0;
end

if kd1 or kd2 then
begin
buy(1,1,limitr,c);
if  kd1 or kd2 then aa:=1;
end

if kk1  or kk2 or kk3 then
begin
if aa:=1 then buyshort(1,1,limitr,c);
end

5楼
fly 发表于:2011/10/31 9:34:51

图表程序化交易,最好不要锁仓.会造成判断持仓紊乱.

 

在同一个策略中,在持有多仓的情况下,不要开空仓.

也就是说,要么是持有多仓,要么是持有空仓.

6楼
xian_0_9 发表于:2011/10/31 11:03:40
谢谢!
7楼
xian_0_9 发表于:2011/11/1 9:11:40

对了。请问用全局变量做标记,不用HOLDING。能实现吗?

8楼
fly 发表于:2011/11/1 9:32:55

既然是同一个策略,在做多的同时又想做空.

你直接用两个策略,在多框架下就实现就可以了

共8 条记录, 每页显示 10 条, 页签: [1]


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