Rss & SiteMap

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

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

标题:关于全局变量

1楼
yekaicong 发表于:2013/1/1 23:13:45
我的模型思路很简单,在H1和L1之间,做震旦交易,向上突破H1做空,向下突破L1做多;一旦价格向上突破H2,空翻多;价格向下突破L2,多翻空。

用的是1秒轮询,而不是等K线走完

我现在的问题是E点会多翻空,但我想E点应该是继续持有多单的,求高手看看我的程序是不是有问题!

variable:x:=0;

if h>H2 then x:=1;

if l<l2 then x:=-1;

if h>h1 and x:=-1 then x:=0;

if l<l1 and x:=1 then x:=0;

//开头条件

long:=h>H2 and time>093000 and time<150500;

if long then
begin
sellshort(holding<0,0,mkt);
buy(holding=0,1,mkt);
end

long2:=l<l1 and l>L2 and x=0 and time>093000 and time<150500;

if long2 then
begin
sellshort(holding<0,0,mkt);
buy(holding=0,1,mkt);
end



//开空条件
short:=l<l2 and time>093000 and time<150500;

if short then
begin
sell(holding>0,0,mkt);
buyshort(holding=0,1,mkt);
end

short2:=h>h1 and h<H2 and x=0 and time>093000 and time<150500;

if short2 then
begin
sell(holding>0,0,mkt);
buyshort(holding=0,1,mkt);
end

//收盘前平仓
if time>151000 then
begin
x:=0;
sell(holding>0,0,thisclose);
sellshort(holding<0,0,thisclose);
end
此主题相关图片如下:img_1693.jpg
按此在新窗口浏览图片
2楼
jinzhe 发表于:2013/1/4 9:43:34
你好,能否描述一下问题
3楼
yekaicong 发表于:2013/1/4 10:32:36
我现在的问题是E点会多翻空,但我想E点应该是继续持有多单的,求高手看看我的程序是不是有问题!
4楼
jinzhe 发表于:2013/1/4 10:36:49

代码是不是掐头去尾了?看得有点不懂

5楼
yekaicong 发表于:2013/1/4 10:48:34
除了H1 H2 L1 L2四根线 其他的代码都写进去啦
6楼
jinzhe 发表于:2013/1/4 10:54:54
那么请把代码贴齐
7楼
yekaicong 发表于:2013/1/4 12:49:21
n:=barslast(date<>ref(date,1));
开盘价:=ref(open,n);

h2:开盘价+20;
h1:开盘价+10;
l1:开盘价-10;
l2:开盘价-20;

variable:x:=0;

if h>H2 then x:=1;

if l<l2 then x:=-1;

if h>h1 and x:=-1 then x:=0;

if l<l1 and x:=1 then x:=0;

//开头条件

long:=h>H2 and time>093000 and time<150500;

if long then
begin
sellshort(holding<0,0,mkt);
buy(holding=0,1,mkt);
end

long2:=l<l1 and l>L2 and x=0 and time>093000 and time<150500;

if long2 then
begin
sellshort(holding<0,0,mkt);
buy(holding=0,1,mkt);
end



//开空条件
short:=l<l2 and time>093000 and time<150500;

if short then
begin
sell(holding>0,0,mkt);
buyshort(holding=0,1,mkt);
end

short2:=h>h1 and h<H2 and x=0 and time>093000 and time<150500;

if short2 then
begin
sell(holding>0,0,mkt);
buyshort(holding=0,1,mkt);
end

//收盘前平仓
if time>151000 then
begin
x:=0;
sell(holding>0,0,thisclose);
sellshort(holding<0,0,thisclose);
end
8楼
jinzhe 发表于:2013/1/4 13:23:08

那么写H1L1等变量的意义何在

9楼
yekaicong 发表于:2013/1/4 13:31:22
H1 L1是操作线啊
向上突破H1 开空;向下突破L1开多 
10楼
jinzhe 发表于:2013/1/4 13:59:41

代码太少,我只能给你一个通用的答案

if 开仓条件 and not(条件e) then buy

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


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