Rss & SiteMap

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

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

标题:请教:当赢利>=1%,回吐30%平仓,却怎么都实现不了

1楼
panjia1000 发表于:2013/9/22 14:40:30

请教我想达到:赢利超过1%,回吐到70%平仓的思路,如下程序却总是第一次开仓、平仓是对的,之后每次开仓之后马上就平仓,不知问题出在什么地方。

 

 

 If enterbars=0 then
 begin
 HigherAfterEntry:=enterprice;
 LowerAfterEntry:=enterprice;
 end;
else If enterbars>=1 then
 begin
 HigherAfterEntry:=max(HigherAfterEntry,h_1);
 LowerAfterEntry:=min(LowerAfterEntry,l_1);
 end;

 

//开多单的平仓
 
 if holding>0 and enterbars>0  then
 
 begin 
if  enterbars>=1  and HigherAfterEntry>=enterprice*(1+1/100)       //成交赢利超过1%,回吐到70%出场
 then
 begin
 price:=EnterPrice+(HigherAfterEntry-EnterPrice)*70/100;
 if low<=price then
 begin
 sell(1,holding,limitr,min(open,price)) ;
 count2:=1;
 end;
 end;
 

 

//开空单的平仓
 
 if holding<0 and enterbars>0  then
 
 begin
 
 
 
 if  enterbars>=1    and lowerAfterEntry<=enterprice*(1-1/100)       //成交赢利超过1%,回吐到70%赢利出场
 then
 begin
 price:=EnterPrice - (EnterPrice-LowerAfterEntry)*70/100;
 if high>=price then
 begin
 sellshort(1,holding,limitr,max(open,price)) ;
  count2:=1;
 end;
 end;

2楼
jinzhe 发表于:2013/9/22 15:02:54
代码帖全
共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.10156 s, 3 queries.