Rss & SiteMap

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

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

标题:[分享]基于唐安奇通道的OBV交易系统(附源码)

1楼
qwer123 发表于:2014/4/16 8:58:13
程序原理,基于OBV指标,使用唐安奇通道,OBV大于30个周期最大值做多,小于30个周期最小值做空
本程序只是给新手一个写模型的思路,不可实盘,因为此程序对周期过于敏感,对周期和参数敏感的程序都不可实盘。


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20140416085547.png
图片点击可在新窗口打开查看

源码:

//股指期货自动交易程序(7分钟日内OBV交易系统)
//编制:
//日期:
{
//加密及期限
drawtextex(1,1,200,800,engincode());
rzb:=strcmp(engincode(),'aaaaaaaaaa');
if rzb<>0 then 
begin
drawtextex(1,1,500,500,'程序不能在此计算机上运行');
exit;
end
有效期:1121230,linethick0;
账号:11111,linethick0;
zhh:=strtonum(taccount(1));
if zhh<>账号 then 
begin
drawtextex(1,1,500,500,'授权账号不正确,程序无法使用');
exit;
end
if date>有效期 then
begin
drawtextex(1,1,500,500,'已过授权时间,程序无法使用');
exit;
end
if datatype<>17 then 
begin
drawtextex(1,1,50,950,'本程序使用3分钟周期,请切换到3分钟周期');
exit;
end
}
//========================================================
//交易控制变量

//**********************************
//交易手数:
tn:=1;
//最大持仓量
cx:=1;
//提前下单量(秒)
xd:=3;
//交易时间区间
p1:=time>091800 and time<150000;
p2:=if(islastbar,dynainfo(207),time);
p3:=time0-timetot0(p2),linethick0;
//********************************
r1:=barslast(date<>ref(date,1));
r2:=ref(o,r1+1);
//********************************
hd:=if(islastbar,3,1);//即时下单加1点的滑点;
hd1:=if(islastbar,3,0.2);//k线走完提前3秒下单加0.2点的滑点;
//********************************
robv:=sum(if(close>ref(close,1),vol,if(close<ref(close,1),-vol,0)),0);
//********************************
rh:=ref(hhv(robv,n1),1);
rl:=ref(llv(robv,n1),1);
//********************************
if robv>rh and p1 then 
begin
sellshort(holding<0,0,thisclose);
buy(holding=0,tn,thisclose);
end
if robv<rl and p1 then
begin
sell(holding<0,0,thisclose);
buyshort(holding=0,tn,thisclose);
end
//***************************
if holding>0 and c<enterprice-3 and p1 then
begin
buy(holding<cx,tn,thisclose);
end
if holding<0 and c>enterprice+3 and p1 then
begin
buyshort(abs(holding)<cx,tn,thisclose);
end
//收盘前清仓
if p2>=151200 then
begin
sellshort(holding<0,0,limitr,c+hd1);
sell(holding>0,0,limitr,c-hd1);
end
//*************************************
交易总数:totaltrade,colorwhite,linethick0;
盈亏:asset-1000000,colorred,linethick1,noaxis;
日盈亏:asset-ref(asset,r1+1),noaxis,colorred,linethick0;
持仓:holding,colorwhite,linethick0;


[此贴子已经被作者于2014/4/16 8:59:15编辑过]
2楼
lsg2005616 发表于:2014/4/16 10:30:35
请教大侠,n1没有定义,编译通不过,谢谢了
3楼
qwer123 发表于:2014/4/16 11:16:56
前面加一句
input:n1(30,1,100,1);
4楼
lsg2005616 发表于:2014/4/16 11:30:18
谢谢了,向您学习!
5楼
lsg2005616 发表于:2014/4/16 11:34:21
能交个朋友吗?我的qq2867680087,我是一个新手,想学习程序化
共5 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.05664 s, 2 queries.