Rss & SiteMap

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

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

标题:有盈利程序,求进一步修改,我有策略

1楼
何拥华 发表于:2015/6/2 20:39:16

input:jg(10,5,100,1),T1(8,3,20,1),n(0,0,10,1),dy(20,3,30,1),fl(0,0,1,1);

hp:=CALLSTOCK(STKLABEL,vtHIGH,6,-1);
lp:=CALLSTOCK(STKLABEL,vtLow,6,-1);
jjp:=(hp+lp)/2,POINTDOT;

jw:=MINDIFF; //价位
hh:jjp+jg*jw,POINTDOT;
LL:jjp-jg*jw,POINTDOT;

ss:=if(h>hp or l<lp,2,1);
if fl=1 then
 BEGIN
  maxss:=asset/(MULTIPLIER*c*0.15);
  ss:=if(h>hp or l<lp,intpart(maxss*0.5),INTPART(maxss*0.25));;
 end

n1:=9;p1:=3;p2:=3;
RSV:=(CLOSE-LLV(LOW,N1))/(HHV(HIGH,N1)-LLV(LOW,N1))*100;
K:=SMA(RSV,P1,1);
D:=SMA(K,P2,1);
J:=3*K-2*D;

H1p:=ref(h,1);
L1p:=ref(l,1);

entb:=if(NUMPROFIT(1)>dy*1000,EXITBARS>=10,1);

//k2dt:=if(TYPE(1)=4,EXITBARS>=8,1);  //空转多间隔
//d2kt:=if(TYPE(1)=2,EXITBARS>=8,1);

kd:=h>hh and h>h1p and k>d and k-d>15 and k<80;
kdjc:=h1p>ref(h,2) and l<L1p and c>L1p;
if kd and entb then buy(holding=0,ss,limitr,max(h1p+1*jw,HH));
if kdjc and holding=ss then djc:buy(1,ss,limitr,L1p);
cyc:=ENTERBARS;

pd100:=L<L1p and l<AVGENTERPRICE;  pdp10:=min(L1p-jw,AVGENTERPRICE);
pd101:=k<d and cyc>0;  pdp11:=c;
pd102:=L<ref(L,2);     pdp12:=ref(L,2)-jw;
pd20:=H1p<ref(h,2) ;        
pd200:=L1p<ref(L,2);
pdp2:=ref(h,5)+n*jw;
pd40:=k>80 and j>100;

if pd100 then pd10:sell(holding>0,holding,limitr,pdp10);
if pd101 then pd11:sell(holding>0,holding,limitr,pdp11);
if pd102 then pd12:sell(holding>0,holding,limitr,pdp12);
if (pd20 or pd200) and cyc>T1 and h>AVGENTERPRICE and H>=pdp2 then pd2:sell(holding>0,holding,limitr,max(l,pdp2));
//if pd30 or pd300 then pd3:sell(holding>0,holding,limitr,c);
if pd40 then pd4:sell(holding<0,holding,limitr,c);

kk:=L<LL and L<L1p and k<d and d-k>15 and k>20;
kkjc:=L1p<ref(l,2) and h>H1p and c<H1p;

if kk and entb then buyshort(holding=0,ss,limitr,min(L1p-1*jw,LL));
if kkjc and holding=ss then kjc:buyshort(1,ss,limitr,h1p);
cyc:=ENTERBARS;

pk100:=h>H1p and h>AVGENTERPRICE;  pkp10:=max(H1p+jw,AVGENTERPRICE);
pk101:=k>d and cyc>0;  pkp11:=c;
pk102:=H>ref(H,2);     pkp12:=ref(H,2)+jw;
pk20:=L1p>ref(l,2);
pk200:=H1p>ref(H,2);
pkp2:=ref(L,5)-n*jw; 
//pk30:=k>d and k-d>1;
pk40:=k<20 and j<0;

if pk100 then pk10:sellshort(holding<0,-holding,limitr,pkp10);
if pk101 then pk11:sellshort(holding<0,-holding,limitr,pkp11);
if pk102 then pk12:sellshort(holding<0,-holding,limitr,pkp12);
if (pk20 or pk200) and cyc>T1 and L<AVGENTERPRICE and L<=pkp2 then pk2:sellshort(holding<0,-holding,limitr,min(h,pkp2));
//if pk30 then pk3:sellshort(holding<0,-holding,limitr,c);
if pk40 then pk4:sellshort(holding<0,-holding,limitr,c);

if time>=151300 THEN
 BEGIN
  sell(1,holding,limitr,o);
  sellshort(1,-holding,limitr,o);
 end

ry:=asset-ref(asset,TODAYBAR);
持:holding,colorwhite,linethick0;
盈:asset-1000000,noaxis,COLORcyan ,linethick1;
日盈:ry,noaxis,colorred,linethick0;
浮盈:OPENPROFIT,linethick0;
日次:TOTALDAYTRADE,linethick0;
数:totaltrade,colorwhite,linethick0;
回撤:MAXDRAWDOWN,linethick0,colorgray;

rr1:=barslast(month<>ref(month,1));
月盈利:asset-ref(asset,rr1+1),linethick0;

{

买持:tbuyholdingex('','',0),linethick0;
卖持:tsellholdingex('','',0),linethick0;

if K5>D5 and K5<75 THEN            //K值大于D值,且K值小于75后
tbuy(DYNAINFO(7)>hp and 买持=0 ,1,lmt,DYNAINFO( 34));
tbuy(买持>0 and DYNAINFO(7)>TENTERPRICE+jg*jw,1,lmt,DYNAINFO(34)),;
tsell(DYNAINFO(7)<ref(l,1),0,lmt,TAVGENTERPRICEEX2('' ,'' ,0)+jw);       //以持仓均价上方可委托价挂单
//止损部分
if K5<D5 then 
 BEGIN
  TCANCELex(1,2,'',STKLABEL);
  tsell(1,0,mkt);
 end
//止盈部分
if K5>D5 and K5>75 THEN
tsell(K1>D1 and k1>80,0,lmt,DYNAINFO( 34));

//开空部分
if k5<D5 and k5>25 then tbuyshort(DYNAINFO(7)<lp and 卖持=0,1,lmt,DYNAINFO(28));
tbuyshort(卖持>0 and DYNAINFO(7)<TENTERPRICE-jg*jw,1,lmt,DYNAINFO(28));
tsellshort(DYNAINFO(7)>ref(H,1),0,lmt,TAVGENTERPRICEEX2('' ,'' ,1)-jw); 

if k5>d5 then
 BEGIN
  TCANCELex(1,4,'',STKLABEL);
  tsellshort(1,0,mkt);
 end

if k5<d5 and k5<25 then tsellshort(k1<d1 and k1<20,0,lmt,DYNAINFO(28));

t2:=time>=185800 and time<=185900 or (time>=025800 and time<=025900);
if t2 THEN
 BEGIN
  tsell(买持>0,0,mkt);
  tsellshort(卖持>0,0,mkt);
 end

  

 

有能修改的,和我 联系QQ,248734337   微信;h13971030404

<!--EndFragment-->
2楼
衡山掌门 发表于:2015/6/3 11:37:02
再好好检查下代码 偷了价格。
3楼
6_6 发表于:2015/6/6 17:50:10
limitr的时候条件最好是ref或者o

包含当日c,kdj的都是预知了,导致偷价格

[此贴子已经被作者于2015/6/6 17:51:39编辑过]
4楼
a450171 发表于:2016/1/21 14:40:13
限价交易我这样写对吗朋友,是用o+0.1
 BUY(多开条件 and holding=0,n,LIMITr,o+0.1),colorYELLOW;
5楼
陈伟明 发表于:2016/2/23 11:30:50
不对。起码一跳嘛。1*MINDIFF。而且为何是开盘价不是收盘价?前面用REF了吗?
6楼
6_6 发表于:2016/2/23 14:57:43
以下是引用a450171在2016/1/21 14:40:13的发言:
限价交易我这样写对吗朋友,是用o+0.1
 BUY(多开条件 and holding=0,n,LIMITr,o+0.1),colorYELLOW;

多开条件里必须只能是ref和当前的open做条件,否则偷价

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


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