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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [交易系统]DTS

   

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


  共有11965人关注过本帖平板打印复制链接

主题:[交易系统]DTS

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


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[交易系统]DTS  发帖心情 Post By:2011/8/14 13:00:48 [只看该作者]

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;

 

 

图片点击可在新窗口打开查看 


 回到顶部