請教:當贏利>=1%,回吐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; - 金字塔客服: 代碼帖全
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容