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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 帮我看下我编写的东西好吗为什么出现句末木有分号

   

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


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

主题:帮我看下我编写的东西好吗为什么出现句末木有分号

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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
帮我看下我编写的东西好吗为什么出现句末木有分号  发帖心情 Post By:2013/7/30 9:03:28    Post IP:113.97.242.117[只看该作者]

刚刚用金字塔格式的传上去不能正常显示,这个是TXT文档的类型
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:123.txt


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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
  发帖心情 Post By:2013/7/30 9:23:07    Post IP:113.97.242.117[只看该作者]

以前说程序不能直接复制到回复区,现在就放在TXT文档中


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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
  发帖心情 Post By:2013/7/30 9:26:18    Post IP:113.97.242.117[只看该作者]

已经出现了好几次这种情况了。有点郁闷


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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/7/30 9:30:41    Post IP:58.246.57.26[只看该作者]


//开始编写属于您自己的交易指标吧!GO!

//该模型为简单示范模型,用户需根据自己交易经验,修改完善后再实际应用!!!

//author: fjasmine


input: t20(20,15,60,1);//参数名,缺省值,最小值,最大值,步长
input: t10(10,10,30,1);

input: atrlen(20,15,30,1);

input: posnum(1,1,20,1);

variable:daycount=1,positioncount=1,sellsign=0;//定义了三个常数变量,分别赋值

variable:entandexitsign=1,entpoint=0,exitpoint=0;//定义了三个常数变量,分别赋值

variable:n=0;//定义常数变量N,初始化值为0

 
ma1:ma(c,5);//输出五日均价

ma2:ma(c,10);//输出十日均价

m:=ma(tr,20);//输出20日均价

buyhhv:=hhv(h,20);//20日最高价

sellllv:=llv(l,10);//20日最低价

 

ss:n,linethick0;


nt:=1;//调试信息带有时间戳

buyorderthisbar:=0;//当前BAR有过交易

 
variable: _debug = 1; //是否输出前台的交易指令

variable: _tdebug = 1;    //是否输出后台的交易指令

variable: _debugout = 0;  //是否输出后台交易的调试信息

 

variable: myentryprice = 0;//开仓价格

variable: myxitprice = 0;//平仓价格

 

variable: turtleunits = 0;//交易单位

variable: position = 0;//仓位状态

 

//0表示没有仓位,1表示持有多头,-1表示持有空头

 

variable: t20hi=close;

variable: t20lo=close;

 

variable: t10hi=close;

variable: t10lo=close;

 

//需要准备计算的变量

t20hi=:ref(hhv(h,t20),1);//

t20lp=:ref(llv(h,t20),1);//

 

t10hi=:ref(hhv(h,t10),1);

t10lo=:ref(llv(h,t10),1);

 

avgtr:=ref(ma(tr,atrlen),1);

 

//开始执行时,初始化数据

 

if barpos = 1 then begin

 //position : = 0;

 

 end//if

 

 //如果是当时没有持仓的状态

if position=0 and barpos > t20 andh>l then begin

 

       //建立多头进场条件

     

       long:=h>t20hi;

     

       //多头进场

       iflong then begin

              myentryprice:=if(open>t20hi+mindiff,open,t20hi+mindiff);

              buy(_debug,posnum,limitr,myentryprice);

              position:=1;

              turtleunits:=1;

              n:=avgtr;

              buyorderthisbar:=1;

            

              end//IF

     

       //建立空头进场条件

       short:=l<t20lo;

     

       //空头进场

       ifshort and position=0 then begin

                     myentryprice:=if(open<t20lo-mindiff,open,t20lo-mindiff);

                     buyshort(_debug,posnum,limitr,myentryprice);

                     position:=-1;

                     turtleunits:=1;

                     n:=avgtr;

                     buyorderthisbar:=1;

              end

             //不要转跳,让程序检查同一根K线是否可以加仓

              //gotocontinueline;

            

       end//if

     

       //如果当前持有多头仓位的状态

       ifposition=1 and barpos>t20 and h>l then begin

              //多头加仓条件

              while(high>myentryprice+0.5*n) and turtleunits < 4 do begin

              myentryprice:=if(open>myentryprice+0.5*n,open,myentryprice+0.5*n);

              myentryprice:=ceiling(myentryprice/mindiff)*mindiff;

              buy(_debug,posnum,limitr,myentryprice);

              turtleunits:=turtleunits+1;

              buyorderthisbar:=1;

            

       end//while循环结束

     

     

       //建立多头离场条件

       longx1:=(low<t10lo);

     

       iflongx1 and buyorderthisbar=0 then begin

              myexitprice:=if(open<t10lo-mindiff,open,t10lo-mindiff);

              sell(_debug,0,limitr,myexitprice);

              position:=0;

              turtleunits:=0;

       end

     

     

       //建立多头止损条件

       longx2:= (low<myentryprice-2*n);

     

       iflongx2 and position = 1 and buyorderthisbar=0 then begin

              myexitprice:=if(open<myentryprice-2*n,open,myentryprice-2*n);

              myexitprice:=floor(myexitprice/mindiff)*mindiff;

              sell(_debug,0,limitr,myexitprice);

              position:=0;

              turtleunits:=0;

       end

     

       goto  continueline;

 

end //if

if barpos >= 21  or barpos=21 then begin//如果从上市到交易日大于21天那么

if barpos =21 then//如果从上市到现在加以日等于21,那么

n:=m;//n=m

if daycount =6 or barpos = 21 then begin//五天调整N值

n:=(19*n+tr)/20;//计算N的值

daycount:=2;

end

daycount:=daycount+1;

entpoint:=enterbars+1;

if entpoint=entandexitsign then begin//说明stop指令买进头寸成功

positioncount:=positioncount+1;//头寸计数

sellsign:=true;//开始以stop卖出,如果达到指定的价格

end

if positioncount=1 then begin//第一头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open1:buy(h>=enterprice+0.5*n,how,market);//在20日新高stop指令买进

end

if positioncount = 2 then begin//第二头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open2:buy(h>enterprice+0.5*n,how,market);//在上头寸(即第一头寸)+0.5个N新高stop指令买进

end

if positioncount=3 then begin//第三头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open3:buy(h>=enterprice+0.5*n,how,market);//在上头寸(即第二头寸)+0.5个N新高stop指令买进

end

if positioncount = 4 then begin //第四头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open4:buy(h>=enterprice+0.5*n,how,market);     //在上头寸(即第三头寸)+0.5个N新高stop指令买进

end

 

if sellsign = true then begin

       exitpoint:=exitbars+1;

       ifexitpoint = entandexitsign then begin //说明卖出成功

              positioncount:=1;{头寸计算复原}

              sellsign:=false;

       end

       ifenterprice-2*n then sell(l<sellllv,100%,market);{退出亏损头寸}

              else

              sell(l<enterprice-2*n,100%,market);

       end

end

 
 
//显示账号信息:

 

continueline@ mycount:asset,linethick0;//显示我的资产

available_cash:cash(0),linethick0;//可用现金

pos:holding,linethick0;

toaldaytrade1:totaldaytrade,linethick0;//总交易次数

 

if _debugout>0 then begin

       debugfile2('c:debugfile.txt','barpos=%.of',barpos,nt);

       debugfile2('c:debugfile.txt','t20hi=%.2f',t20hi,nt);

       debugfile2('c:debugfile.txt','n=%.2f',n,nt);

       debugfile2('c:debugfile.txt','close=%.2f',c,nt);

       debugfile2('c:debugfile.txt','position=%.2f',position,nt);

       debugfile2('c:debugfile.txt','turtleunits=%.of',turtleunits,nt);

       debugfile2('c:debugfile.txt','myentryprice=%.of',myentryprice,nt);

       debugfile2('c:debugfile.txt','myexitprice=%.of',myexitprice,nt);

end


the currentposition:holding,colorgray,linethick0;//当前持仓

the currentcaptal:asset,noaxis,colorgray;//当前资产

 

 

 

改好了,但是你这个很多变量后面少了空格是什么情况?

[此贴子已经被作者于2013/7/30 9:31:14编辑过]


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
  发帖心情 Post By:2013/7/30 9:46:22    Post IP:113.97.242.117[只看该作者]

以下是引用jinzhe在2013/7/30 9:30:41的发言:


//开始编写属于您自己的交易指标吧!GO!

//该模型为简单示范模型,用户需根据自己交易经验,修改完善后再实际应用!!!

//author: fjasmine


input: t20(20,15,60,1);//参数名,缺省值,最小值,最大值,步长
input: t10(10,10,30,1);

input: atrlen(20,15,30,1);

input: posnum(1,1,20,1);

variable:daycount=1,positioncount=1,sellsign=0;//定义了三个常数变量,分别赋值

variable:entandexitsign=1,entpoint=0,exitpoint=0;//定义了三个常数变量,分别赋值

variable:n=0;//定义常数变量N,初始化值为0

 
ma1:ma(c,5);//输出五日均价

ma2:ma(c,10);//输出十日均价

m:=ma(tr,20);//输出20日均价

buyhhv:=hhv(h,20);//20日最高价

sellllv:=llv(l,10);//20日最低价

 

ss:n,linethick0;


nt:=1;//调试信息带有时间戳

buyorderthisbar:=0;//当前BAR有过交易

 
variable: _debug = 1; //是否输出前台的交易指令

variable: _tdebug = 1;    //是否输出后台的交易指令

variable: _debugout = 0;  //是否输出后台交易的调试信息

 

variable: myentryprice = 0;//开仓价格

variable: myxitprice = 0;//平仓价格

 

variable: turtleunits = 0;//交易单位

variable: position = 0;//仓位状态

 

//0表示没有仓位,1表示持有多头,-1表示持有空头

 

variable: t20hi=close;

variable: t20lo=close;

 

variable: t10hi=close;

variable: t10lo=close;

 

//需要准备计算的变量

t20hi=:ref(hhv(h,t20),1);//

t20lp=:ref(llv(h,t20),1);//

 

t10hi=:ref(hhv(h,t10),1);

t10lo=:ref(llv(h,t10),1);

 

avgtr:=ref(ma(tr,atrlen),1);

 

//开始执行时,初始化数据

 

if barpos = 1 then begin

 //position : = 0;

 

 end//if

 

 //如果是当时没有持仓的状态

if position=0 and barpos > t20 andh>l then begin

 

       //建立多头进场条件

     

       long:=h>t20hi;

     

       //多头进场

       iflong then begin

              myentryprice:=if(open>t20hi+mindiff,open,t20hi+mindiff);

              buy(_debug,posnum,limitr,myentryprice);

              position:=1;

              turtleunits:=1;

              n:=avgtr;

              buyorderthisbar:=1;

            

              end//IF

     

       //建立空头进场条件

       short:=l<t20lo;

     

       //空头进场

       ifshort and position=0 then begin

                     myentryprice:=if(open<t20lo-mindiff,open,t20lo-mindiff);

                     buyshort(_debug,posnum,limitr,myentryprice);

                     position:=-1;

                     turtleunits:=1;

                     n:=avgtr;

                     buyorderthisbar:=1;

              end

             //不要转跳,让程序检查同一根K线是否可以加仓

              //gotocontinueline;

            

       end//if

     

       //如果当前持有多头仓位的状态

       ifposition=1 and barpos>t20 and h>l then begin

              //多头加仓条件

              while(high>myentryprice+0.5*n) and turtleunits < 4 do begin

              myentryprice:=if(open>myentryprice+0.5*n,open,myentryprice+0.5*n);

              myentryprice:=ceiling(myentryprice/mindiff)*mindiff;

              buy(_debug,posnum,limitr,myentryprice);

              turtleunits:=turtleunits+1;

              buyorderthisbar:=1;

            

       end//while循环结束

     

     

       //建立多头离场条件

       longx1:=(low<t10lo);

     

       iflongx1 and buyorderthisbar=0 then begin

              myexitprice:=if(open<t10lo-mindiff,open,t10lo-mindiff);

              sell(_debug,0,limitr,myexitprice);

              position:=0;

              turtleunits:=0;

       end

     

     

       //建立多头止损条件

       longx2:= (low<myentryprice-2*n);

     

       iflongx2 and position = 1 and buyorderthisbar=0 then begin

              myexitprice:=if(open<myentryprice-2*n,open,myentryprice-2*n);

              myexitprice:=floor(myexitprice/mindiff)*mindiff;

              sell(_debug,0,limitr,myexitprice);

              position:=0;

              turtleunits:=0;

       end

     

       goto  continueline;

 

end //if

if barpos >= 21  or barpos=21 then begin//如果从上市到交易日大于21天那么

if barpos =21 then//如果从上市到现在加以日等于21,那么

n:=m;//n=m

if daycount =6 or barpos = 21 then begin//五天调整N值

n:=(19*n+tr)/20;//计算N的值

daycount:=2;

end

daycount:=daycount+1;

entpoint:=enterbars+1;

if entpoint=entandexitsign then begin//说明stop指令买进头寸成功

positioncount:=positioncount+1;//头寸计数

sellsign:=true;//开始以stop卖出,如果达到指定的价格

end

if positioncount=1 then begin//第一头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open1:buy(h>=enterprice+0.5*n,how,market);//在20日新高stop指令买进

end

if positioncount = 2 then begin//第二头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open2:buy(h>enterprice+0.5*n,how,market);//在上头寸(即第一头寸)+0.5个N新高stop指令买进

end

if positioncount=3 then begin//第三头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open3:buy(h>=enterprice+0.5*n,how,market);//在上头寸(即第二头寸)+0.5个N新高stop指令买进

end

if positioncount = 4 then begin //第四头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open4:buy(h>=enterprice+0.5*n,how,market);     //在上头寸(即第三头寸)+0.5个N新高stop指令买进

end

 

if sellsign = true then begin

       exitpoint:=exitbars+1;

       ifexitpoint = entandexitsign then begin //说明卖出成功

              positioncount:=1;{头寸计算复原}

              sellsign:=false;

       end

       ifenterprice-2*n then sell(l<sellllv,100%,market);{退出亏损头寸}

              else

              sell(l<enterprice-2*n,100%,market);

       end

end

 
 
//显示账号信息:

 

continueline@ mycount:asset,linethick0;//显示我的资产

available_cash:cash(0),linethick0;//可用现金

pos:holding,linethick0;

toaldaytrade1:totaldaytrade,linethick0;//总交易次数

 

if _debugout>0 then begin

       debugfile2('c:debugfile.txt','barpos=%.of',barpos,nt);

       debugfile2('c:debugfile.txt','t20hi=%.2f',t20hi,nt);

       debugfile2('c:debugfile.txt','n=%.2f',n,nt);

       debugfile2('c:debugfile.txt','close=%.2f',c,nt);

       debugfile2('c:debugfile.txt','position=%.2f',position,nt);

       debugfile2('c:debugfile.txt','turtleunits=%.of',turtleunits,nt);

       debugfile2('c:debugfile.txt','myentryprice=%.of',myentryprice,nt);

       debugfile2('c:debugfile.txt','myexitprice=%.of',myexitprice,nt);

end


the currentposition:holding,colorgray,linethick0;//当前持仓

the currentcaptal:asset,noaxis,colorgray;//当前资产

 
图片点击可在新窗口打开查看此主题相关图片如下:8$n0{ih0v12k2gdd557psg.jpg
图片点击可在新窗口打开查看

 

 

改好了,但是你这个很多变量后面少了空格是什么情况?



刚刚用你改好的:


[此贴子已经被作者于2013/7/30 9:31:14编辑过]


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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
  发帖心情 Post By:2013/7/30 9:47:09    Post IP:113.97.242.117[只看该作者]

还是出现的是这个问题我确定我用的全部都是你帮我改好的代码因为我看不出来语法什么的错在哪儿了


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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
  发帖心情 Post By:2013/7/30 9:54:27    Post IP:113.97.242.117[只看该作者]

能不能 @JINZE 试试

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/7/30 9:55:59    Post IP:58.246.57.26[只看该作者]

input: t20(20,15,60,1);//参数名,缺省值,最小值,最大值,步长
input: t10(10,10,30,1);

input: atrlen(20,15,30,1);

input: posnum(1,1,20,1);

variable:daycount=1,positioncount=1,sellsign=0;//定义了三个常数变量,分别赋值

variable:entandexitsign=1,entpoint=0,exitpoint=0;//定义了三个常数变量,分别赋值

variable:n=0;//定义常数变量N,初始化值为0

 
ma1:ma(c,5);//输出五日均价

ma2:ma(c,10);//输出十日均价

m:=ma(tr,20);//输出20日均价

buyhhv:=hhv(h,20);//20日最高价

sellllv:=llv(l,10);//20日最低价

 

ss:n,linethick0;


nt:=1;//调试信息带有时间戳

buyorderthisbar:=0;//当前BAR有过交易

 
variable: _debug = 1; //是否输出前台的交易指令

variable: _tdebug = 1;    //是否输出后台的交易指令

variable: _debugout = 0;  //是否输出后台交易的调试信息

 

variable: myentryprice = 0;//开仓价格

variable: myxitprice = 0;//平仓价格

 

variable: turtleunits = 0;//交易单位

variable: position = 0;//仓位状态

 

//0表示没有仓位,1表示持有多头,-1表示持有空头

 

variable: t20hi=close;

variable: t20lo=close;

 

variable: t10hi=close;

variable: t10lo=close;

 

//需要准备计算的变量

t20hi=:ref(hhv(h,t20),1);//

t20lp=:ref(llv(h,t20),1);//

 

t10hi=:ref(hhv(h,t10),1);

t10lo=:ref(llv(h,t10),1);

 

avgtr:=ref(ma(tr,atrlen),1);

 

//开始执行时,初始化数据

 

if barpos = 1 then begin

 //position : = 0;

 

 end//if

 

 //如果是当时没有持仓的状态

if position=0 and barpos > t20 and h>l then begin

 

       //建立多头进场条件

     

       long:=h>t20hi;

     

       //多头进场

       if long then begin

              myentryprice:=if(open>t20hi+mindiff,open,t20hi+mindiff);

              buy(_debug,posnum,limitr,myentryprice);

              position:=1;

              turtleunits:=1;

              n:=avgtr;

              buyorderthisbar:=1;

            

              end//IF

     

       //建立空头进场条件

       short:=l<t20lo;

     

       //空头进场

       if short and position=0 then begin

                     myentryprice:=if(open<t20lo-mindiff,open,t20lo-mindiff);

                     buyshort(_debug,posnum,limitr,myentryprice);

                     position:=-1;

                     turtleunits:=1;

                     n:=avgtr;

                     buyorderthisbar:=1;

              end

             //不要转跳,让程序检查同一根K线是否可以加仓

              //gotocontinueline;

            

       end//if

     

       //如果当前持有多头仓位的状态

       if position=1 and barpos>t20 and h>l then begin

              //多头加仓条件

              while high>myentryprice+0.5*n and turtleunits < 4 do begin

              myentryprice:=if(open>myentryprice+0.5*n,open,myentryprice+0.5*n);

              myentryprice:=ceiling(myentryprice/mindiff)*mindiff;

              buy(_debug,posnum,limitr,myentryprice);

              turtleunits:=turtleunits+1;

              buyorderthisbar:=1;

            

       end//while循环结束

     

     

       //建立多头离场条件

       longx1:=(low<t10lo);

     

       if longx1 and buyorderthisbar=0 then begin

              myexitprice:=if(open<t10lo-mindiff,open,t10lo-mindiff);

              sell(_debug,0,limitr,myexitprice);

              position:=0;

              turtleunits:=0;

       end

     

     

       //建立多头止损条件

       longx2:= (low<myentryprice-2*n);

     

       if longx2 and position = 1 and buyorderthisbar=0 then begin

              myexitprice:=if(open<myentryprice-2*n,open,myentryprice-2*n);

              myexitprice:=floor(myexitprice/mindiff)*mindiff;

              sell(_debug,0,limitr,myexitprice);

              position:=0;

              turtleunits:=0;

       end

     

       goto  continueline;

 

end //if

if barpos >= 21  or barpos=21 then begin//如果从上市到交易日大于21天那么

if barpos =21 then//如果从上市到现在加以日等于21,那么

n:=m;//n=m

if daycount =6 or barpos = 21 then begin//五天调整N值

n:=(19*n+tr)/20;//计算N的值

daycount:=2;

end

daycount:=daycount+1;

entpoint:=enterbars+1;

if entpoint=entandexitsign then begin//说明stop指令买进头寸成功

positioncount:=positioncount+1;//头寸计数

sellsign:=true;//开始以stop卖出,如果达到指定的价格

end

if positioncount=1 then begin//第一头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open1:buy(h>=enterprice+0.5*n,how,market);//在20日新高stop指令买进

end

if positioncount = 2 then begin//第二头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open2:buy(h>enterprice+0.5*n,how,market);//在上头寸(即第一头寸)+0.5个N新高stop指令买进

end

if positioncount=3 then begin//第三头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open3:buy(h>=enterprice+0.5*n,how,market);//在上头寸(即第二头寸)+0.5个N新高stop指令买进

end

if positioncount = 4 then begin //第四头寸

how:=cash(0)*0.01/n;//波动性百分比决定头寸规模

open4:buy(h>=enterprice+0.5*n,how,market);     //在上头寸(即第三头寸)+0.5个N新高stop指令买进

end

 

if sellsign = true then begin

       exitpoint:=exitbars+1;

       if exitpoint = entandexitsign then begin //说明卖出成功

              positioncount:=1;{头寸计算复原}

              sellsign:=false;

       end

       if enterprice-2*n then sell(l<sellllv,100%,market);{退出亏损头寸}

              else

              sell(l<enterprice-2*n,100%,market);

       end

end

 
 
//显示账号信息:

 

continueline@ mycount:asset,linethick0;//显示我的资产

available_cash:cash(0),linethick0;//可用现金

pos:holding,linethick0;

toaldaytrade1:totaldaytrade,linethick0;//总交易次数

 

if _debugout>0 then begin

       debugfile2('c:debugfile.txt','barpos=%.of',barpos,nt);

       debugfile2('c:debugfile.txt','t20hi=%.2f',t20hi,nt);

       debugfile2('c:debugfile.txt','n=%.2f',n,nt);

       debugfile2('c:debugfile.txt','close=%.2f',c,nt);

       debugfile2('c:debugfile.txt','position=%.2f',position,nt);

       debugfile2('c:debugfile.txt','turtleunits=%.of',turtleunits,nt);

       debugfile2('c:debugfile.txt','myentryprice=%.of',myentryprice,nt);

       debugfile2('c:debugfile.txt','myexitprice=%.of',myexitprice,nt);

end


the currentposition:holding,colorgray,linethick0;//当前持仓

the currentcaptal:asset,noaxis,colorgray;//当前资产

 

{
KD:=;          //开多条件
PD:=;          //平多条件
KK:=;          //开空条件
PK:=;          //平空条件


平空:SELLSHORT(PK,1,THISCLOSE);                  //平空信号
开多:BUY(KD AND HOLDING=0,1,THISCLOSE);          //开多信号
平多:SELL(PD,1,THISCLOSE);                       //平多信号
开空:BUYSHORT(KK AND HOLDING=0,1,THISCLOSE);     //开空信号

}
{
信号语句排列规则——先平后开
“费率设置”按钮——用于合理设置模型“费率”,以便在图形上正确输出如下帐户信息:

持仓:holding,linethick0;
资产:asset,noaxis;
可用现金:cash(0),linethick0;

您可以在查看菜单->交易系统模板 中设置自己需要的模板
}

[此贴子已经被作者于2013/7/30 9:57:41编辑过]


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

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


加好友 发短信 大佐
等级:论坛游侠 帖子:239 积分:0 威望:0 精华:0 注册:2013/7/8 16:40:03
  发帖心情 Post By:2013/7/30 9:57:57    Post IP:113.97.242.117[只看该作者]

以下是引用jinzhe在2013/7/30 9:55:59的发言:
我改过后编译,没问题了,

我直接是复制你的代码进编译器的

 回到顶部