欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 关于全局变量

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有4256人关注过本帖树形打印复制链接

主题:关于全局变量

帅哥哟,离线,有人找我吗?
yekaicong
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
关于全局变量  发帖心情 Post By:2013/1/1 23:13:45    Post IP:218.73.240.70[显示全部帖子]

我的模型思路很简单,在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
按此在新窗口浏览图片

 回到顶部
帅哥哟,离线,有人找我吗?
yekaicong
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
  发帖心情 Post By:2013/1/4 10:32:36    Post IP:183.139.0.204[显示全部帖子]

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

 回到顶部
帅哥哟,离线,有人找我吗?
yekaicong
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
  发帖心情 Post By:2013/1/4 10:48:34    Post IP:183.139.0.204[显示全部帖子]

除了H1 H2 L1 L2四根线 其他的代码都写进去啦

 回到顶部
帅哥哟,离线,有人找我吗?
yekaicong
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
  发帖心情 Post By:2013/1/4 12:49:21    Post IP:183.139.0.204[显示全部帖子]

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

 回到顶部
帅哥哟,离线,有人找我吗?
yekaicong
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
  发帖心情 Post By:2013/1/4 13:31:22    Post IP:183.139.0.204[显示全部帖子]

H1 L1是操作线啊
向上突破H1 开空;向下突破L1开多 

 回到顶部
帅哥哟,离线,有人找我吗?
yekaicong
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
  发帖心情 Post By:2013/1/4 14:13:01    Post IP:183.139.0.204[显示全部帖子]

代码已经全放进去了。。。

 回到顶部
帅哥哟,离线,有人找我吗?
yekaicong
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:29 积分:220 威望:0 精华:0 注册:2012/11/17 12:02:25
  发帖心情 Post By:2013/1/4 14:13:47    Post IP:183.139.0.204[显示全部帖子]

拜托再给我看一下啊

 回到顶部