查看: 14344|回复: 79
打印 上一主题 下一主题

[公式] 基于 金字塔平台 编写的一些经典交易系统案例

  [复制链接]
跳转到指定楼层
1
发表于 2011-12-9 00:52:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 金字塔客服 于 2011-12-9 16:54 编辑

基于 金字塔 平台编写的一些经典交易系统案例
(金字塔z7c9版主原创 )

--------------------------------------
分形通道突破

runmode:0;
sfx:=ref(high,1)<ref(high,2) and ref(high,2)>ref(high,3);
xfx:= ref(low,1)>ref(low,2) and ref(low,2)<ref(low,3);

upperband:=valuewhen(sfx,ref(high,2));
lowerband:=valuewhen(xfx,ref(low,2));

exittime:=time>=150000;

if holding=0 then begin
if high>=upperband then
  buy(1,1,limitr,max(open,upperband));
end

if holding=0 then begin
if low<=lowerband then
  buyshort(1,1,limitr,min(open,lowerband));
end

if holding>0 then begin
if time>=150000 then
  sell(1,holding,limitr,close);
end

if holding<0 then begin
if time>=150000 then
  sellshort(1,holding,limitr,close);
end

盈亏:asset-50000,noaxis,colorred,linethick2;
--------------------------------
考夫曼自适应移动均线系统
runmode:0;
input:length1(10,5,60,5);
input:length2(5,5,60,5);

ama:=md(close,length1);
ama1:=ema(ama,length2);
entrylongcond:=ref(cross(ama,ama1),1);
entryshortcond:=ref(cross(ama1,ama),1);

if holding=0 then begin
if entrylongcond then
  buy(1,1,limitr,open);
end

if holding=0 then begin
if entryshortcond then
  buyshort(1,1,limitr,open);
end

if holding>0 then begin
if entryshortcond then begin
  sell(1,holding,limitr,open);
  buyshort(1,1,limitr,open);
end
end

if holding<0 then begin
if entrylongcond then begin
  sellshort(1,holding,limitr,open);
  buy(1,1,limitr,open);
end
end

盈亏:asset-50000,noaxis,colorred,linethick2;
--------------------------------
鳄鱼线与分形图
1 Y:=(H+L)/2;
2 AA:=REF((SMA(Y,5,1)),3);
3 BB:=REF((SMA(Y,8,1)),5);
4 CC:=REF((SMA(Y,13,1)),8);
5 MA1:=MA(CLOSE,5),COLORWHITE,LINETHICK3;
6 MA2:=MA(CLOSE,10),COLORYELLOW,LINETHICK3;
7 MA3:=MA(CLOSE,30),COLORDB7093,LINETHICK3;
8 鳄:CC,COLORFF6600;
9 齿:BB,COLORRED;
10 唇:AA,COLORGREEN;
11 R2:=REF(齿,5);
12 KU1:=IF(HIGH=HHV(HIGH,3),1,0);
13 KD1:=IF(LOW=LLV(LOW,3),1,0);
14 UL:=IF(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0,REF(HIGH,2),REF(HIGH,2+BARSLAST(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0)));
15 DL:=IF(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0)));
16 上分形:IF(HIGH>=R2,UL,REF(UL,BARSLAST(HIGH>R2))),POINTDOT,LINETHICK3,COLORMAGENTA;
17 下分形:IF(LOW<=R2,DL,REF(DL,BARSLAST(LOW<=R2))),POINTDOT,LINETHICK3,COLORYELLOW;
18
19 AO:=MA(Y,5)-MA(Y,34);
20 MAO:=MA(AO,5);
21 AC:=AO-MAO;
22 AC1:=REF(AC,1);
23 AO1:=REF(AO,1);
24 KAC:=IF(AC>AC1 AND AO>AO1,1,0);
25 KAO:=IF(AC<AC1 AND AO<AO1,-1,0);
26 STICKLINE(KAC=1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORRED;
27 STICKLINE(KAO=-1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORGREEN;
28 STICKLINE(KAO=0 AND KAC=0 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORDDDDDD;
29 STICKLINE(CLOSE>=OPEN,HIGH,CLOSE,0.0,1.0),COLORRED;
30 STICKLINE(CLOSE>=OPEN,OPEN,LOW,0.0,1),COLORRED;
31 STICKLINE(KAC=1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORRED;
32 STICKLINE(KAO=-1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORGREEN;



------------------------------------

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册入住  

x

评分

3

查看全部评分






推荐
 楼主| 发表于 2011-12-9 17:27:39 | 只看该作者
两仪四象
///////////////////////////////////////////

runmode:0;

input:length(20);

variable:stopline=0;

if barpos<=30 then exit;

up:=count(close>ref(close,1),length);
down:=count(close<REF(CLOSE,1),LENGTH);
<ref(c,1),length);
entrylongcond:=up/down>=2/3;
entryshortcond:=down/up>=2/3;

upperband:=ref(hhv(high,length),1);
lowerband:=ref(llv(low,length),1);

hh:=ref(high,1);
ll:=ref(low,1);

if holding=0 then begin
if ref(entrylongcond,1) then begin
buy(1,1,limitr,open);
stopline:=lowerband;
end

if ref(entryshortcond,1) then begin
buyshort(1,1,limitr,open);
stopline:=upperband;
end
end

if holding>0 and enterbars>=1 then begin
//if lowerband>stopline then
stopline:=lowerband;

if low<=stopline then
sell(1,holding,limitr,min(open,stopline));
end

if holding<0 and enterbars>=1 then begin
//if upperband<STOPLINE
stopline:=upperband;

if high>=stopline then
sellshort(1,holding,limitr,max(open,stopline));
end

ss:stopline,linethick0;
drawicon(holding<>0,stopline,11);
盈亏:asset-500000,noaxis,coloryellow,linethick2;
//////////////////////////////////////////
回复 支持 1 反对 0

使用道具 举报

3
 楼主| 发表于 2011-12-9 00:52:54 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 16:56 编辑

Zig System
////////////////////////////////////////
input:entrystop(0.5,0.1,1,0.1);
input:exitstop(0.5,0,1,1,0.1);

dayopen:=valuewhen(day>ref(day,1),open);
if holding=0 then begin
if high>=dayopen*(1+entrystop/100) then begin
  myentryprice:=dayopen*(1+entrystop/100);
  myentryprice:=trimprice(myentryprice);
  buy(1,volunit,limitr,myentryprice);
  exit;
end
end

if holding=0 then begin
if low<=dayopen*(1-entrystop/100) then begin
  myentryprice:=dayopen*(1-entrystop/100);
  myentryprice:=trimprice(myentryprice);
  buyshort(1,volunit,limitr,myentryprice);
  exit;
end
end

if holding>0 then begin
if low<=dayopen*(1-exitstop/100) then begin
  myexitprice:=dayopen*(1-exitstop/100);
  myexitprice:=trimprice(myexitprice);
  sell(1,holding,limitr,myexitprice);
  exit;
end

if time>=closetime(0) then
  sell(1,holding,limitr,close);
end

if holding<0 then begin
if high>=dayopen*(1+exitstop/100) then begin
  myexitprice:=dayopen*(1+exitstop/100);
  myexitprice:=trimprice(myexitprice);
  sellshort(1,holding,limitr,myexitprice);
  exit;
end

if time>=closetime(0) then
  sellshort(1,holding,limitr,close);
end

资产:asset,noaxis,colorred,linethick2;
///////////////////////////////////////////////////////////////

DTS

runmode:0;
input:money(0,0,5,1);
input:ratio(2,1,10,1);

variable:trend=0;
variable:callback=0;
variable:stoplossprice=0;
variable:takeprofitprice=0;
variable:daytradecounter=0;

if day>ref(day,1) then begin
callback:=0;
daytradecounter:=0;

if close=open then
  trend:=0;
  
if close>open then
  trend:=1;
  
if close<open then
  trend:=-1;
end

if trend=0 then begin
if close>open then
  trend:=1;

if close<open then
  trend:=-1;
end

dist:=barslast(day>ref(day,1))+1;
highest:=ref(hhv(high,dist),1);
lowest:=ref(llv(low,dist),1);

if trend=1 and low<=lowest then
trend:=-1;

if trend=-1 and high>=highest then
trend:=1;

dist1:=barslast(high<ref(high,1) and low<ref(low,1));
stoplossprice1:=ref(low,dist1);

dist2:=barslast(high>ref(high,1) and low>ref(low,1));
stoplossprice2:=ref(high,dist2);

if trend=1 and ref(high,1)<ref(high,3) and ref(high,2)<ref(high,3)  and ref(high,3)=highest then
callback:=1;

if trend=-1 and ref(low,1)>ref(low,3) and ref(low,2)>ref(low,3)  and ref(low,3)=lowest then
callback:=-1;

if holding=0 then begin
myentryprice:=0;
lots:=0;

if daytradecounter=0 and dist>=4 and trend=1 and callback=1 and high>=highest+mindiff then
  myentryprice:=max(open,highest+mindiff);  

if myentryprice>0 then  begin
  if dist1<=dist then
   stoplossprice:=stoplossprice1;
  else
   stoplossprice:=lowest;
   
  initialstopnum:=myentryprice-stoplossprice;
  
  takeprofitprice:=myentryprice+initialstopnum*ratio;
   
  if money=0 then begin
   lots:=1;
  end else begin
   mycash:=cash(0);
   lots1:=intpart(mycash/(myentryprice*multiplier*taccount(41)));
   lots2:=intpart(mycash*(money/100)/(initialstopnum*multiplier));
   lots:=min(lots1,lots2);
  end
end
  
if lots>=1 then begin
  buy(1,lots,limitr,myentryprice);
  daytradecounter:=1;
end
end  

if holding=0 then begin
myentryprice:=0;
lots:=0;

if daytradecounter=0 and dist>=4 and trend=-1 and callback=-1 and low<=lowest-mindiff then
  myentryprice:=min(open,lowest-mindiff);  

if myentryprice>0 then  begin
  if dist2<=dist then
   stoplossprice:=stoplossprice2;
  else
   stoplossprice:=highest;
   
  initialstopnum:=stoplossprice-myentryprice;
  
  takeprofitprice:=myentryprice-initialstopnum*ratio;
   
  if money=0 then begin
   lots:=1;
  end else begin
   mycash:=cash(0);
   lots1:=intpart(mycash/(myentryprice*multiplier*taccount(41)));
   lots2:=intpart(mycash*(money/100)/(initialstopnum*multiplier));
   lots:=min(lots1,lots2);
  end
end
  
if lots>=1 then begin
  buyshort(1,lots,limitr,myentryprice);
  daytradecounter:=1;
end
end

if holding>0 then begin
myexitprice:=0;
lots:=holding;

if stricmp(marketlabel,'zj')=0 then begin
  if time>=151500 then
   myexitprice:=open;
end else begin
  if time>=150000 then
   myexitprice:=open;
end

if high>=takeprofitprice then
  myexitprice:=max(open,takeprofitprice);

if low<=stoplossprice then
  myexitprice:=min(open,stoplossprice);
  
if myexitprice>0 then  
  sell(1,lots,limitr,myexitprice);
end

if holding<0 then begin
myexitprice:=0;
lots:=-holding;

if stricmp(marketlabel,'zj')=0 then begin
  if time>=151500 then
   myexitprice:=open;
end else begin
  if time>=150000 then
   myexitprice:=open;
end

if low<=takeprofitprice then
  myexitprice:=min(open,takeprofitprice);
  
if high>=stoplossprice then
  myexitprice:=max(open,stoplossprice);
   
if myexitprice>0 then  
  sellshort(1,lots,limitr,myexitprice);
end

drawicon(holding<>0,stoplossprice,11);
drawicon(holding<>0,takeprofitprice,10);

资产:asset,noaxis,linethick2;


////////////////////////////////////////////////////////////////////////

MACD策略
runmode:0;
input:period(70,5,90,5);
input:initialstop(2,0,3,1),coststop(2,1,3,1),trailingstop(3,1,6,1);
input:money(0,0,10,1);
input:slippage(1,0,1,1);
input:debug(1,0,1,1);

variable:myasset=500000;
variable:costprice=0,stopline=0;

begin
if stricmp(marketlabel,'sh')=0 then begin
  commission:=0.001;
  stamptax:=0.001;
  transferfee:=0.001;
end

if stricmp(marketlabel,'sz')=0 then begin
  commission:=0.001;
  stamptax:=0.001;
  transferfee:=0;
end

diff:=ema(close,12)-ema(close,26);
dea:=ema(diff,9);
macd:=2*(diff-dea);

buycond:=ref(cross(dea,diff),1);

topband:=ref(hhv(high,period),1)+mindiff;

atr:=ref(ma(tr,10),1);

initialstopnum:=trimprice(initialstop*atr);
coststopnum:=trimprice(coststop*atr);
trailingstopnum:=trimprice(trailingstop*atr);
slippagenum:=slippage*mindiff;
end

if holding=0 then begin
price:=0;
lots:=0;

if barpos>=period and buycond then
  price:=close+slippagenum;

if price>0 then begin  
  mycash:=cash(0);
  
  lots1:=intpart(mycash/(price*volunit))*volunit;   
  
  if money=0 then begin
   lots:=lots1;
  end else begin
   lots2:=intpart(mycash*0.01*money/(initialstopnum*volunit))*volunit;
   lots:=min(lots1,lots2);
  end
end  
  
if lots>=1 then begin
  buy(1,lots,limitr,price);
  
  if workmode=1 then
   tbuy(1,lots,limitr,price);
end
end

if holding>0 then begin
price:=0;
lots:=holding;

if initialstop>0 then begin
  if stopline>0 and low<=stopline then
   price:=close-slippagenum;
   
  if stopline=0 then begin
   costprice:=trimprice((enterprice*(1+commission)+2*transferfee)/(1-commission-stamptax))+mindiff;
   
   stopline:=costprice-initialstopnum;
  end
   
  if stopline<costprice and high-coststopnum>=costprice then
   stopline:=costprice;
  
  if stopline>=costprice and high-trailingstopnum>stopline then
   stopline:=high-trailingstopnum;   
end

if price>0 then begin
  sell(1,lots,limitr,price);
  costprice:=0;
  stopline:=0;
  
  myasset:=asset;
  
  if workmode=1 then
   tsell(1,lots,limitr,price);
end
end

partline(debug=1 and holding=0,topband,colorred,1);
if initialstop>0 then begin
if holding>0 then begin
  drawicon(stopline<costprice,stopline,11);
  drawicon(stopline=costprice,stopline,12);
  drawicon(stopline>costprice,stopline,10);
end
end

if debug=1 then begin
盈亏:myasset,noaxis,colormagenta;      
收益:(myasset-500000)/500000,linethick0;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
end


//////////////////////////////////////////////////////////
4
 楼主| 发表于 2011-12-9 00:52:59 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 16:59 编辑

NFS
//////////////////////////////////////////////////////

runmode:0;
input:entryperiod(1,1,5,1);
input:initialstop(3,2,4,1);
input:breakevenstop(4,2,4,1);
input:trailingstop(5,4,8,1);
input:exitperiod(2,1,5,1);
input:intraday(1,0,1,1);
input:money(0,0,10,1);
input:offset(0,0,2,1);
input:debug(0,0,1,1);

variable:costprice=0;
variable:stopline=0;
variable:myasset=30000;

begin
if stricmp(marketlabel,'sq')=0 then
  label:=strleft(stklabel,2);
   
if stricmp(marketlabel,'dq')=0 then
  label:=strleft(stklabel,1);

if stricmp(marketlabel,'zq')=0 then
  label:=strleft(stklabel,2);
  
if stricmp(marketlabel,'zj')=0 then
  label:=strleft(stklabel,2);

if stricmp(label,'if')=0 then begin
  marginratio:=15/100;
  commission:=0.6/10000;
  tradeable:=1;
   
  entrytime:=time>=093100 and time<=151400;
  exittime:=time>=151500;
  
  stoplossunit:=25*mindiff;  
  length:=60;
end else begin
  if stricmp(label,'cf')=0 then begin
   marginratio:=17/100;
   commission:=12;
   tradeable:=1;
  end  
  
  if stricmp(label,'sr')=0 then begin
   marginratio:=18/100;
   commission:=6;
   tradeable:=1;
  end   
   
  entrytime:=time>=091600 and time<=145900;
  exittime:=time>=150000;
  
  stoplossunit:=5*mindiff;  
  length:=225;
end  
end

if tradeable=0 then exit;
if not(datatype=1) then exit;
begin  
cond:=date>ref(date,1) or barpos=1;
dist:=barpos-valuewhen(cond,barpos)+1;
averageprice:=trimprice(sum(amount,dist)/sum(vol,dist)/multiplier);
settlementprice:=trimprice(sum(amount,length)/sum(vol,length)/multiplier);
  
entryupperband:=ref(hhv(high,60*entryperiod),1)+mindiff;
entrylowerband:=ref(llv(low,60*entryperiod),1)-mindiff;
  
exitupperband:=ref(hhv(high,30*exitperiod),2)+mindiff;
exitlowerband:=ref(llv(low,30*exitperiod),2)-mindiff;

initialstopnum:=stoplossunit*initialstop;
breakevenstopnum:=stoplossunit*breakevenstop;
trailingstopnum:=stoplossunit*trailingstop;
offsetnum:=mindiff*offset;
end

if holding=0 then begin
myentryprice:=0;
lots:=0;

if year>=2011 and entrytime and high>=entryupperband then
  myentryprice:=max(open,entryupperband);  
  
if myentryprice>0 then begin
  mycash:=cash(0);   
  
  if money=0 then begin
   lots:=1;
  end else begin
   lots1:=intpart(mycash/(myentryprice*multiplier*marginratio));   
   lots2:=intpart(mycash*(money/100)/(initialstopnum*multiplier));
   lots:=min(lots1,lots2);
  end
end

if lots>=1 then
  buy(1,lots,limitr,myentryprice+offsetnum);
end

if holding=0 then begin
myentryprice:=0;
lots:=0;

if year>=2011 and entrytime and low<=entrylowerband then
  myentryprice:=min(open,entrylowerband);
  
if myentryprice>0 then begin
  mycash:=cash(0);   
  
  if money=0 then begin
   lots:=1;
  end else begin
   lots1:=intpart(mycash/(myentryprice*multiplier*marginratio));   
   lots2:=intpart(mycash*(money/100)/(initialstopnum*multiplier));
   lots:=min(lots1,lots2);
  end
end

if lots>=1 then
  buyshort(1,lots,limitr,myentryprice-offsetnum);
end

if holding>0 then begin
myexitprice:=0;

if exittime then begin
  if intraday=0 then begin
   myexitprice:=open;
  end else begin
   if not(costprice<averageprice and averageprice<stopline) then
    myexitprice:=open;
  end
end

if stopline>0 and low<=stopline then
  myexitprice:=min(open,stopline);
  
if stopline=0 then begin
  if commission>1 then
   costprice:=enterprice+2*commission/multiplier;
  else
   costprice:=enterprice*(1+commission)/(1-commission);
  
  costprice:=ceiling(costprice/mindiff)*mindiff;
  
  stopline:=costprice-initialstopnum;
end
  
if stopline<costprice and high-breakevenstopnum>=costprice then
  stopline:=costprice;  

if stopline>=costprice and high-trailingstopnum>stopline then
  stopline:=high-trailingstopnum;  

if exitlowerband>stopline then
  stopline:=exitlowerband;

if myexitprice>0 then begin
  sell(1,holding,limitr,myexitprice-offsetnum);
  costprice:=0;
  stopline:=0;
  myasset:=asset;
end
end

if holding<0 then begin
myexitprice:=0;

if exittime then begin
  if intraday=0 then begin
   myexitprice:=open;
  end else begin
   if not(costprice>averageprice and averageprice>stopline) then
    myexitprice:=open;
  end
end

if stopline>0 and high>=stopline then
  myexitprice:=max(open,stopline);
  
if stopline=0 then begin
  if commission>1 then
   costprice:=enterprice-2*commission/multiplier;
  else
   costprice:=enterprice*(1-commission)/(1+commission);
   
  costprice:=floor(costprice/mindiff)*mindiff;
  
  stopline:=costprice+initialstopnum;
end

if stopline>costprice and low+breakevenstopnum<=costprice then
  stopline:=costprice;
   
if stopline<=costprice and low+trailingstopnum<stopline then
  stopline:=low+trailingstopnum;   
  
if exitupperband<stopline then
  stopline:=exitupperband;  

if myexitprice>0 then begin
  sellshort(1,holding,limitr,myexitprice+offsetnum);
  costprice:=0;
  stopline:=0;
  myasset:=asset;
end
end

保证金:round(close*multiplier*marginratio),linethick0;
partline(1,averageprice,colorblue,2);
partline(entrytime and holding=0,entryupperband,colorred,2);
partline(entrytime and holding=0,entrylowerband,colorgreen,2);

if entrytime and holding=0 then begin
上轨:entryupperband,linethick0;
下轨:entrylowerband,linethick0;
end

if holding>0 then begin
多头成本:costprice,linethick0;
多头止损:stopline,linethick0;
多头盈亏:(stopline-costprice)*multiplier,linethick0;

drawicon(stopline<costprice,stopline,11);
drawicon(stopline=costprice,stopline,12);
drawicon(stopline>costprice,stopline,10);
end

if holding<0 then begin
空头成本:costprice,linethick0;
空头止损:stopline,linethick0;
空头盈亏:(costprice-stopline)*multiplier,linethick0;

drawicon(stopline>costprice,stopline,11);
drawicon(stopline=costprice,stopline,12);
drawicon(stopline<costprice,stopline,10);  
end

if debug=1 then begin
资产:myasset,noaxis,linethick2,colormagenta;      
收益:(myasset-30000)/30000,linethick0;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
end
///////////////////////////////////////////////////////////////////////////


网格交易法

input:grid(3,1,60,1);
variable:level=0;
dist:=barslast(date<>ref(date,1));
oo:=ref(open,dist);

if holding=0 then begin
dnprice:=oo-grid*mindiff;

if low<=dnprice then begin
  buy(1,1,limitr,dnprice);
  level:=-1;
end
end

if holding=0 then begin
upprice:=oo+grid*mindiff;

if high>=upprice then begin
  buyshort(1,1,limitr,upprice);
  level:=1;
end
end

if holding>0 then begin
upprice:=oo+(level+1)*grid*mindiff;
dnprice:=oo+(level-1)*grid*mindiff;

if high>=upprice then begin
  sell(1,1,limitr,upprice);
  level:=level+1;
end

if low<=dnprice then begin
  buy(1,1,limitr,dnprice);
  level:=level-1;
end

if time=closetime(0) then
  sell(1,holding,limitr,close);
end

if holding<0 then begin
upprice:=oo+(level+1)*grid*mindiff;
dnprice:=oo+(level-1)*grid*mindiff;

if low<=dnprice then begin
  sellshort(1,1,limitr,dnprice);
  level:=level-1;
end

if high>=upprice then begin
  buyshort(1,1,limitr,upprice);
  level:=level+1;
end

if time=closetime(0) then
  sellshort(1,holding,limitr,close);
end
      
盈亏:asset,noaxis,colormagenta;      
收益:(asset-50000)/50000,linethick0;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;



///////////////////////////////////////////////////////////////////////////
时空交易

input:n(11,1,20,1);
input:m(35,5,120,5);

longcond:=ref(close,1)-ref(close,n)>=m*mindiff;
longprice:=open;

shortcond:=ref(close,n)-ref(close,1)>=m*mindiff;
shortprice:=open;

if holding=0 then begin
if longcond then
  buy(1,1,limitr,longprice);
end

if holding=0 then begin
if shortcond then
  buyshort(1,1,limitr,shortprice);
end

if holding>0 then begin
if time=closetime(0) then
  sell(1,holding,limitr,close);
end

if holding<0 then begin
if time=closetime(0) then
  sellshort(1,holding,limitr,close);
end
     
收益:asset,noaxis,colormagenta;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;



//////////////////////////////////////////////////////////////////////////

5
 楼主| 发表于 2011-12-9 00:53:03 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:01 编辑

///////////////////////////////////////////////////////////////////////////////
区间突破
runmode:0;
variable:maysset=0;
entertime:=time>=091500 and time<=145500;
exittime:=time>=150000;

dist1:=barslast(date<>ref(date,1))+1;
dist2:=ref(dist1,dist1);
hh:=ref(hhv(high,dist2),dist1);
ll:=ref(llv(low,dist2),dist1);
oo:=ref(open,dist1-1);

tt:=hh-ll;
highest:=oo+tt+mindiff;
lowest:=oo-tt-mindiff;

if holding=0 then begin
if high>=highest then
  buy(1,1,limitr,highest);
end

if holding=0 then begin
if low<=lowest then
  buyshort(1,1,limitr,lowest);
end

if holding>0 then begin
if exittime then
  sell(1,holding,limitr,close);
end

if holding<0 then begin
if exittime then
  sellshort(1,holding,limitr,close);
end

if exittime then
myasset:=asset;

收益:(myasset-30000)/30000,noaxis,colormagenta;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;



////////////////////////////////////////////////////////////////////////////////
闪灵交易系统
runmode:0;
input:length1(60);
input:length2(30);

variable:myholding=0;
variable:myprofit=0;
variable:myentryprice=0;
variable:myexitprice=0;
variable:myfailtrade=0;

entryupperband:=ref(hhv(high,length1),1);
entrylowerband:=ref(llv(low,length1),1);

entrylongcond:=high>=entryupperband;
entryshortcond:=low<=entrylowerband;

exitupperband:=ref(hhv(high,length2),1);
exitlowerband:=ref(llv(low,length2),1);

exitlongcond:=low<=exitlowerband;
exitshortcond:=high>=exitupperband;

if myholding=0 then begin
if entrylongcond then begin
  myholding:=1;
  myentryprice:=max(open,entryupperband);
end
end

if myholding=0 then begin
if entryshortcond then begin
  myholding:=2;
  myentryprice:=min(open,entrylowerband);
end
end

if myholding=1 then begin
if exitlongcond then begin
  myholding:=0;
  myexitprice:=min(open,exitlowerband);
  myprofit:=myexitprice-myentryprice;
  if myprofit<0 then
   myfailtrade:=myfailtrade+1;
  else
   myfailtrade:=0;
end
end

if myholding=2 then begin
if exitshortcond then begin
  myholding:=0;
  myexitprice:=max(open,exitupperband);
  myprofit:=myentryprice-myexitprice;
  if myprofit<0 then
   myfailtrade:=myfailtrade+1;
  else
   myfailtrade:=0;
end
end

if holding=0 and myfailtrade=1 then begin
if entrylongcond then
  buy(1,1,limitr,max(open,entryupperband));
end

if holding=0 and myfailtrade=1 then begin
if entryshortcond then
  buyshort(1,1,limitr,min(open,entrylowerband));
end

if holding>0 then begin
if exitlongcond then
  sell(1,holding,limitr,min(open,exitlowerband));
end

if holding<0 then begin
if exitshortcond then
  sellshort(1,holding,limitr,max(open,exitupperband));
end

盈亏:asset-50000,noaxis,colorred,linethick2;




////////////////////////////////////////////////////////////////////////////////

涨三跌三

runmode:0;
ds:=ref(all(close<open,3),1);
zs:=ref(all(close>open,3),1);

if holding=0 then begin
if ds then
  buy(1,1,limitr,open);
end

if holding=0 then begin
if zs then
  buyshort(1,1,limitr,open);
end

if holding>0 then begin
sell(1,holding,limitr,close);
end

if holding<0 then begin
sellshort(1,holding,limitr,close);
end

盈亏:asset-50000,noaxis,colorred,linethick2;

///////////////////////////////////////////////////////////////////////////////

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册入住  

x
6
 楼主| 发表于 2011-12-9 00:53:07 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:02 编辑

[技术指标]内包日外包日
insideday:=high<ref(high,1) and low>ref(low,1);
outsideday:=high>ref(high,1) and low<ref(low,1);

drawicon(insideday,low*0.99,10);
drawicon(outsideday,high*1.01,11);




//////////////////////////////////////////////////////////////////////////////////
[交易系统]外包日系统
----------------------------------------------------------------------
runmode:0;

variable:stopline=0;

entrylongcond:=ref(high,1)>ref(high,2) and ref(high,2)>ref(high,3) and ref(low,2);
<REF(LOW,3);
entryshortcond:=ref(low,1)ref(high,3) and ref(low,2)<REF(LOW,3);
;

atr:=3*ma(tr,15);

hh:=ref(high,1);
ll:=ref(low,1);

if holding=0 then begin
if entrylongcond then begin
buy(1,1,limitr,open);
stopline=:enterprice-atr;
end

if entryshortcond then begin
buyshort(1,1,limitr,open);
stopline:=enterprice+atr;
end
end

if holding>0 and enterbars>=1 then begin
if hh-atr>stopline then
stopline:=hh-atr;

if low<=stopline then
sell(1,holding,limitr,min(open,stopline));
end

if holding<0 and enterbars>=1 then begin
if ll+atr<STOPLINE
stopline:=ll+atr;

if high>=stopline then
sellshort(1,holding,limitr,max(open,stopline));
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;

//////////////////////////////////////////////////////////////////////////////////

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册入住  

x
7
 楼主| 发表于 2011-12-9 00:53:22 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:03 编辑

openbreaksystem
/////////////////////////////////////////////////
runmode:0;

input:entrystop(0.5);
input:exitstop(0.5);
input:malength(120);

myma:=ma(open,malength);

entrylongcond:=open>myma and high>=open*(1+entrystop/100);
exitlongcond:=low<=open*(1-exitstop/100);

entryshortcond:=open<MYMA low<="open*(1-entrystop/100);"
exitshortcond:=high>=open*(1+exitstop/100);

if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,open*(1+entrystop/100));

if entryshortcond then
buyshort(1,1,limitr,open*(1-entrystop/100));
end

if holding>0 then begin
if exitlongcond then
sell(1,holding,limitr,open*(1-exitstop/100));
end

if holding<0 then begin
if exitshortcond then
sellshort(1,holding,limitr,open*(1+exitstop/100));
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;
////////////////////////////////////////////////
8
发表于 2011-12-9 06:55:07 | 只看该作者
{:05:}
9
发表于 2011-12-9 08:55:36 | 只看该作者
靠,看不懂啊......
10
发表于 2011-12-9 09:44:57 | 只看该作者
{:soso__1392141386446400320_2:}
11
 楼主| 发表于 2011-12-9 13:32:07 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:03 编辑

克罗均线策略
/////////////////////////////////////////////////////////////////////////
1 runmode:0;
2
3 input:n1(4,1,100,1);
4 input:n2(9,1,100,1);
5 input:n3(18,1,100,1);
6
7 ma1:=ma(close,n1);
8 ma2:=ma(close,n2);
9 ma3:=ma(close,n3);
10
11 if holding=0 then begin
12     if close>ma1 and ma1>ma2 and ma2>ma3 then
13         buy(1,1,limitr,close);
14 end
15
16 if holding=0 then begin
17     if close<ma1 and ma1<ma2 and ma2<ma3 then
18         buyshort(1,1,limitr,close);
19 end
20
21 if holding>0 then begin
22     if ma1<ma2 then
23         sell(1,holding,limitr,close);
24 end
25
26 if holding<0 then begin
27     if ma1>ma2 then
28         sellshort(1,holding,limitr,close);
29 end
30
31 资产:asset,noaxis,colormagenta;
32 次数:totaltrade,linethick0;
33 收益:(asset-40000)/40000,linethick0;
34 胜率:percentwin,linethick0;
35 出击:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
36 连亏:maxseqloss,linethick0;
37 连赢:maxseqwin,linethick0;

////////////////////////////////////////////////////////////////////////
12
 楼主| 发表于 2011-12-9 15:42:59 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:04 编辑

周期共振系统
/////////////////////////////////////////////////////
runmode:0;

min5open:=callstock(stklabel,vtopen,2,-1);
min5close:=callstock(stklabel,vtclose,2,-1);

min15open:=callstock(stklabel,vtopen,3,-1);
min15close:=callstock(stklabel,vtclose,3,-1);

min30open:=callstock(stklabel,vtopen,4,-1);
min30close:=callstock(stklabel,vtclose,4,-1);

entrylongcond:=min5close>min5open and min15close>min15open and min30close>min30open;
entryshortcond:=min5close
if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,open);

if entryshortcond then
buyshort(1,1,limitr,open);
end

if holding>0 then begin
if time>=closetime(0) then
sell(1,holding,limitr,close);
end

if holding<0 then begin
if time>=closetime(0) then
sellshort(1,holding,limitr,close);
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;
////////////////////////////////////////////////////
13
 楼主| 发表于 2011-12-9 15:50:05 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:04 编辑

TurtleTradingSystem
/////////////////////////////////////////////////////////////////
runmode:0;

input:riskratio(1,0,2,1);
input:atrlength(20,5,30,5);
input:entryperiod(20,5,60,5);
input:exitperiod(10,5,60,5);

variable:times=0;

atr:=ref(ma(tr,atrlength),1);
marginratio:=10/100;

entryupperband:=ref(hhv(high,entryperiod),1)+mindiff;
entrylowerband:=ref(llv(low,entryperiod),1)-mindiff;

exitupperband:=ref(hhv(high,exitperiod),1)+mindiff;
exitlowerband:=ref(llv(low,exitperiod),1)-mindiff;

entrylongcond:=high>=entryupperband;
entryshortcond:=low<=entrylowerband;

exitlongcond:=low<=exitlowerband;
exitshortcond:=high>=exitupperband;

if holding=0 then begin
price:=0;
lots:=0;

if entrylongcond then
  price:=max(open,entryupperband);
  
if price>0 then begin
  mycash:=cash(0);
  
  lots1:=intpart(mycash/(price*multiplier*marginratio));
  lots2:=intpart((mycash*riskratio/100)/(atr*multiplier));
  lots:=max(1,min(lots1,lots2));
end

if lots>=1 then begin
  buy(1,lots,limitr,price);
  times:=1;
end
end

if holding>0 then begin
while high>=enterprice+atr/2 and times<4 do begin
  price:=max(open,enterprice+atr/2);
  lots:=0;
  
  if price>0 then begin
   mycash:=cash(0);
   
   lots1:=intpart(mycash/(price*multiplier*marginratio));
   lots2:=intpart((mycash*riskratio/100)/(atr*multiplier));
   lots:=max(1,min(lots1,lots2));
  end
  
  if lots>=1 then begin
   buy(1,lots,limitr,price);
   times:=times+1;
  end
end
end

if holding=0 then begin
price:=0;
lots:=0;

if entryshortcond then
  price:=min(open,entrylowerband);
  
if price>0 then begin
  mycash:=cash(0);
  
  lots1:=intpart(mycash/(price*multiplier*marginratio));
  lots2:=intpart((mycash*riskratio/100)/(atr*multiplier));
  lots:=max(1,min(lots1,lots2));
end

if lots>=1 then begin
  buyshort(1,lots,limitr,price);
  times:=1;
end
end

if holding<0 then begin
while low<=enterprice-atr/2 and times<4 do begin
  price:=min(open,enterprice-atr/2);
  lots:=0;
  
  if price>0 then begin
   mycash:=cash(0);
   
   lots1:=intpart(mycash/(price*multiplier*marginratio));
   lots2:=intpart((mycash*riskratio/100)/(atr*multiplier));
   lots:=max(1,min(lots1,lots2));
  end
  
  if lots>=1 then begin
   buyshort(1,lots,limitr,price);
   times:=times+1;
  end
end
end

if holding>0 then begin
price:=0;

if exitlongcond then
  price:=min(open,exitlowerband);
  
if low<=enterprice-2*atr and enterbars>=1 then
  price:=min(open,enterprice-2*atr);
  
if price>0 then
  sell(1,holding,limitr,price);
end

if holding<0 then begin
price:=0;

if exitshortcond then
  price:=max(open,exitupperband);

if high>=enterprice+2*atr and enterbars>=1 then
  price:=max(open,enterprice+2*atr);
  
if price>0 then
  sellshort(1,holding,limitr,price);
end

盈亏:asset-500000,noaxis,colorred,linethick2;

////////////////////////////////////////////////////////////////
14
 楼主| 发表于 2011-12-9 16:31:54 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:05 编辑

抛物线转向系统
/////////////////////////////////////////////////////////////////////
runmode:0;

input:p(120);
input:n(120);
input:s(2);
input:m(20);

myma:=ma(open,p);
mysar:=sar(n,s,m);

entrylongcond:=open>myma and high>=mysar;
exitlongcond:=low<=mysar;

entryshortcond:=openexitshortcond:=high>=mysar;

if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,max(open,mysar));

if entryshortcond then
buyshort(1,1,limitr,min(open,mysar));
end

if holding>0 then begin
if exitlongcond then
sell(1,holding,limitr,min(open,mysar));
end

if holding<0 then begin
if exitshortcond then
sellshort(1,holding,limitr,max(open,mysar));
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;
/////////////////////////////////////////////////////////////////////
15
 楼主| 发表于 2011-12-9 17:06:51 | 只看该作者
小时交易法
///////////////////////////////////////////////

runmode:0;
dayopen:=callstock(stklabel,vtopen,6,0);
entrylongcond:=open>dayopen;
entryshortcond:=open<dayopen;

if holding=0 then begin
if entrylongcond then
  buy(1,1,limitr,open);
  
if entryshortcond then
  buyshort(1,1,limitr,open);
end

if holding>0 then begin
sell(1,holding,limitr,close);
end

if holding<0 then begin
sellshort(1,holding,limitr,close);
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;
//////////////////////////////////////////////
16
 楼主| 发表于 2011-12-9 17:15:54 | 只看该作者
本帖最后由 金字塔客服 于 2011-12-9 17:16 编辑

[技术指标]时空线
////////////////////////////////////////////////////////////////////////

runmode:0;
predayhigh:=callstock(stklabel,vthigh,6,-1);
predaylow:=callstock(stklabel,vtlow,6,-1);

dayopen:=callstock(stklabel,vtopen,6,0);
dist:=barslast(date>ref(date,1))+1;
highest:=ref(hhv(high,dist),1);
lowest:=ref(llv(low,dist),1);

昨高:predayhigh,linethick2;
昨低:predaylow,linethick2;
今开:dayopen,linethick2;
最高:highest,linethick2;
最低:lowest,linethick2;

9点:vertline(time=090500);
9点30分:vertline(time=093500);
10点:vertline(time=103500);
10点15分:vertline(time=101500);
10点30分:vertline(time=103500);
11点:vertline(time=110500);
11点30分:vertline(time=113000);
13点30分:vertline(time=133500);
14点:vertline(time=140500);
14点30分:vertline(time=143500);
15点:vertline(time=150000);


////////////////////////////////////////////////////////////////////////


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册入住  

x
17
 楼主| 发表于 2011-12-9 17:18:42 | 只看该作者
[技术指标]阻力支撑
/////////////////////////////////////////////////////

runmode:0;
涨停:dynainfo(54);
跌停:dynainfo(55);
昨结:dynainfo(62),linethick2;
开盘:dynainfo(4),linethick4;

阻力1:昨结+trimprice((涨停-昨结)*1/5);
阻力2:昨结+trimprice((涨停-昨结)*2/5);
阻力3:昨结+trimprice((涨停-昨结)*3/5);
阻力4:昨结+trimprice((涨停-昨结)*4/5);
支撑1:昨结-trimprice((昨结-跌停)*1/5);
支撑2:昨结-trimprice((昨结-跌停)*2/5);
支撑3:昨结-trimprice((昨结-跌停)*3/5);
支撑4:昨结-trimprice((昨结-跌停)*4/5);


////////////////////////////////////////////////////
18
 楼主| 发表于 2011-12-9 17:21:18 | 只看该作者
动态突破系统


////////////////////////////////////////////////////////////////
runmode:0;
input:ceilingamt(60),flooramt(20),bolbandtrig(2);
variable:lookbackdays=20;
todayvolatility:=std(close,30);
yesterdayvolatility:=std(ref(close,1),30);

deltavolatility:=(todayvolatility-yesterdayvolatility)/todayvolatility;
lookbackdays:=lookbackdays*(1+deltavolatility);
lookbackdays:=round(lookbackdays);
lookbackdays:=min(lookbackdays,ceilingamt);
lookbackdays:=max(lookbackdays,flooramt);

mid:=ma(close,lookbackdays);
upband:=mid+bolbandtrig*std(close,lookbackdays);
dnband:=mid-bolbandtrig*std(close,lookbackdays);

buypoint:=ref(hhv(high,lookbackdays),1);
sellpoint:=ref(llv(low,lookbackdays),1);

longliqpoint:=ma(close,lookbackdays);
shortliqpoint:=ma(close,lookbackdays);

if holding=0 then begin
if close>upband then
  buy(1,1,limitr,max(open,buypoint));
end

if holding=0 then begin
if close<dnband then
  buyshort(1,1,limitr,min(open,sellpoint));
end

if holding>0 then begin
if close<dnband then begin
  sell(1,holding,limitr,min(open,sellpoint));
  buyshort(1,1,limitr,min(open,sellpoint));
end

if low<=longliqpoint then
  sell(1,holding,limitr,min(open,longliqpoint));
end

if holding<0 then begin
if close>upband then begin
  sellshort(1,holding,limitr,max(open,buypoint));
  buy(1,1,limitr,max(open,buypoint));
end

if high>=shortliqpoint then
  sellshort(1,holding,limitr,max(open,shortliqpoint));
end

盈亏:asset-50000,noaxis,colorred,linethick2;
//////////////////////////////////////////////////////////////
19
 楼主| 发表于 2011-12-9 17:22:51 | 只看该作者
恒温器系统

////////////////////////////////////////////
runmode:0;
input:bollingerlengths(50);
input:trendliqlength(50);
input:numstddevs(2);
input:swingprcnt1(0.5);
input:swingprcnt2(0.75);
input:atrlength(10);
input:swingtrendswitch(20);

variable:swing=false;
cmival:=abs(close-ref(close,30))/(hhv(high,30),1)-llv(low,30);
buyeasierday:=0;
selleasierday:=0;

trendlokbuy:=ma(low,3);
trendloksell:=ma(high,3);

keyofday:=(high+low+close)/3;
if close>keyofday then
selleasierday:=1;
else
buyeasierday:=1;

atr:=ma(tr,atrlength);

if ref(buyeasierday,1)=1 then begin
swingbuypt:=open+swingprcnt1*atr;
swingsellpt:=open-swingprcnt2*atr;
end

if ref(selleasierday,1)=1 then begin
swingbuypt:=open+swingprcnt2*atr;
swingsellpt:=open-swingprcnt1*atr;
end

swingbuypt:=max(swingbuypt,trendlokbuy);
swingsellpt:=min(swingsellpt,trendloksell);

ma1:=ma(close,trendliqlength);
mid:=ma(close,bollingerlengths);
trendbuypt:=mid+numstddevs*std(close,bollingerlengths);
trendsellpt:=mid-numstddevs*std(close,bollingerlengths);

if cmival<swingtrendswitch then begin
if holding=0 then begin
  if high>=swingbuypt then begin
   buy(1,1,limitr,max(open,swingbuypt));
   swing:=true;
  end
end

if holding=0 then begin
  if low<=swingsellpt then begin
   buyshort(1,1,limitr,min(open,swingsellpt));
   swing:=true;
  end
end

if holding>0 then begin
  if low<=swingsellpt then begin
   sell(1,holding,limitr,min(open,swingsellpt));
   buyshort(1,1,limitr,min(open,swingsellpt));
   swing:=true;
  end
end

if holding<0 then begin
  if high>=swingbuypt then begin
   sellshort(1,holding,limitr,max(open,swingbuypt));
   buy(1,1,limitr,max(open,swingbuypt));
   swing:=true;
  end
end
end else begin
swingprotstop:=3*atr;

if holding=0 then begin
  if high>=trendbuypt then begin
   buy(1,1,limitr,max(open,trendbuypt));
   swing:=false;
  end
end

if holding=0 then begin
  if low<=trendsellpt then begin
   buyshort(1,1,limitr,min(open,trendsellpt));
   swing:=false;
  end
end

if holding>0 then begin
  if swing then begin
   if low<=enterprice-swingprotstop then
    sell(1,holding,limitr,min(open,enterprice-swingprotstop));
  end else begin
   if low<=ma1 then
    sell(1,holding,limitr,min(open,ma1));
  end
end

if holding<0 then begin
  if swing then begin
   if high>=enterprice+swingprotstop then
    sellshort(1,holding,limitr,max(open,enterprice+swingprotstop));
  end else begin
   if high>=ma1 then
    sellshort(1,holding,limitr,max(open,ma1));
  end
end
end

盈亏:asset-50000,noaxis,colorred,linethick2;

///////////////////////////////////////////
20
 楼主| 发表于 2011-12-9 17:24:22 | 只看该作者
R-Breaker

/////////////////////////////////////////////////
runmode:0;
input:notbef(090000);
input:notaft(145500);
input:f1(0.35);
input:f2(0.07);
input:f3(0.25);
input:myreverse(1);
input:rangemin(0.2);
input:xdiv(3);

variable:ssetup=0;
variable:bsetup=0;
variable:senter=0;
variable:benter=0;
variable:bbreak=0;
variable:sbreak=0;
variable:ltoday=0;
variable:hitoday=999999;
variable:startnow=0;
variable:div=0;
variable:rfilter=false;

i_reverse:=myreverse*(callstock(stklabel,vtopen,6,0)/100);
i_rangemin:=rangemin*(callstock(stklabel,vtopen,6,0)/100);

if barpos=1 then begin
startnow:=0;
div:=max(xdiv,1);
end

hh:=ref(hitoday,1);
cc:=ref(close,1);
ll:=ref(ltoday,1);

if date>ref(date,1) then begin
startnow:=startnow+1;

ssetup:=hh+f1*(cc-ll);
senter:=((1+f2)/2)*(hh+cc)-f2*ll;
benter:=((1+f2)/2)*(ll+cc)-f2*hh;
bsetup:=ll-f1*(hh-cc);
bbreak:=ssetup+f3*(ssetup-bsetup);
sbreak:=bsetup-f3*(ssetup-bsetup);

hitoday:=high;
ltoday:=low;

rfilter:=hh-cc>=rangemin;
end

if high>hitoday then hitoday:=high;
if low<ltoday then ltoday:=low;

if time>=notbef and time<notaft and startnow>=2 and rfilter then begin
if hitoday>=ssetup and holding>=0 then begin
  if low<=senter+(hitoday-ssetup)/div then begin
   sell(1,holding,limitr,senter+(hitoday-ssetup)/div);
   sellshort(1,1,limitr,senter+(hitoday-ssetup)/div);
  end
end

if ltoday<=bsetup and holding<=0 then begin
  if high>=benter-(bsetup-ltoday)/div then begin
   if high>=benter-(bsetup-ltoday)/div then begin
    sellshort(1,holding,limitr,benter-(bsetup-ltoday)/div);
    buy(1,1,limitr,benter-(bsetup-ltoday)/div);
   end
  end
end

if holding<0 then begin
  if high-enterprice>=i_reverse then
   sellshort(1,enterprice+i_reverse);
end

if holding>0 then begin
  if enterprice-low>=i_reverse then
   sell(1,enterprice-i_reverse);
end

if holding=0 then begin
  if high>=bbreak then
   buy(1,bbreak);
end

if holding=0 then begin
  if low<=sbreak then
   sellshort(1,sbreak);
end
end

if time>=notaft then begin
if holding<0 then
  sellshort(1,holding,limitr,open);
  
if holding>0 then
  sell(1,holding,limitr,open);
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;


////////////////////////////////////////////////
您需要登录后才可以回帖 登录 | 注册入住  

本版积分规则

易家网  ©2015-2023  郑州期米信息技术有限公司版权所有  豫公网安备 41010502005136号 豫ICP备16010300号