![]() |
總頁數 (2): « 1 [2] 在這個頁面顯示本主題全部的 21 個文章 |
奇狐社區論壇 (http://www.chiefox.com.tw/bbs/index.php)
- 問題交流 (http://www.chiefox.com.tw/bbs/forumdisplay.php?forumid=28)
-- 設定出場 (http://www.chiefox.com.tw/bbs/showthread.php?threadid=15763)
回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 設定出場
引用:
最初由 cgjj 發表
只看長紅那根, 您怎知 100% 沒有拉回30 點過呢
行情有時是振盪盤
回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 設定出場
引用:
最初由 AA0753 發表
的確沒辦法100%
上面有一篇還沒回覆 請幫忙
我該如何把當天停損不超過2次 以及不超過80點
加入以下整合完的買賣動作
CKU2:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0);
CKU3:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
買賣:=買1-賣1; CC:=C;
進出:C*0 NOAXIS; 多空:=0;
for i=1 to datacount do begin
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0; 強平價:=CC[i];
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) then begin
多空:=買賣[i]; 進出[i]:=多空; 進價:=CC[i];
end else if 多空<>0 then begin
if CKU2[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=CKU2[i]*2;
end else if CKU3[i]*2=-多空 then begin
進出[i]:=CKU3[i]*3; 多空:=0;
end;
end;
end;
end;
回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 設定出場
引用:
最初由 cgjj 發表
您原來的 CKU2 和 CKU3 已具備 出場(反手) 或平倉的控制
若再加入前面您說的 "當天停損不超過2次 以及不超過80點"
會影響原來的規則非常大唷
把範例程式看懂
再去調整修改細節, 更動為自己想要的方式, 再去使用
原碼:
DECK:=date<>ref(date,1) or barpos=1;
DESP:=barslast(DECK);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
控反:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0); //CKU2
控平:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0); //CKU3
買賣:=買1-賣1;
進出:C*0 NOAXIS;
多空:=0; 進價:=0; 出價:=0; CC:=C; HH:=H; LL:=L;
for i=1 to datacount do begin
if DECK[i] then 停損次:=0;
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0;
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) and 停損次<2 then begin
多空:=買賣[i]; 進出[i]:=多空;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 多空<>0 then begin
if 控反[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=控反[i]*2;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 控平[i]*2=-多空 then begin
進出[i]:=控平[i]*3; 多空:=0;
end else begin
盈虧:=(CC[i]-進價)*SGN(多空);
HL:=HH[i]; if 多空<0 then HL:=LL[i];
HLSP:=(HL-進價)*SGN(多空); //Max盈虧
if HLSP>MaxHLSP then MaxHLSP:=HLSP;
if MaxHLSP>80 then begin
出價:=進價+MaxHLSP*(2/3)*SGN(多空);
end else if MaxHLSP>50 then begin
出價:=進價+MaxHLSP*(1/2)*SGN(多空);
end else if MaxHLSP>20 then begin
出價:=進價+(MaxHLSP-30)*SGN(多空);
end else begin
出價:=進價-20*SGN(多空);
end;
if (CC[i]-出價)<0 then begin
進出[i]:=5*SGN(多空); 多空:=0; if 盈虧<0 then 停損次:=停損次+1;
end;
end;
end;
end;
end;
下標越界
引用:
最初由 cgjj 發表
把範例程式看懂
再去調整修改細節, 更動為自己想要的方式, 再去使用
原碼:
DECK:=date<>ref(date,1) or barpos=1;
DESP:=barslast(DECK);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
控反:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0); //CKU2
控平:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0); //CKU3
買賣:=買1-賣1;
進出:C*0 NOAXIS;
多空:=0; 進價:=0; 出價:=0; CC:=C; HH:=H; LL:=L;
for i=1 to datacount do begin
if DECK[i] then 停損次:=0;
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0;
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) and 停損次<2 then begin
多空:=買賣[i]; 進出[i]:=多空;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 多空<>0 then begin
if 控反[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=控反[i]*2;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 控平[i]*2=-多空 then begin
進出[i]:=控平[i]*3; 多空:=0;
end else begin
盈虧:=(CC[i]-進價)*SGN(多空);
HL:=HH[i]; if 多空<0 then HL:=LL[i];
HLSP:=(HL-進價)*SGN(多空); //Max盈虧
if HLSP>MaxHLSP then MaxHLSP:=HLSP;
if MaxHLSP>80 then begin
出價:=進價+MaxHLSP*(2/3)*SGN(多空);
end else if MaxHLSP>50 then begin
出價:=進價+MaxHLSP*(1/2)*SGN(多空);
end else if MaxHLSP>20 then begin
出價:=進價+(MaxHLSP-30)*SGN(多空);
end else begin
出價:=進價-20*SGN(多空);
end;
if (CC[i]-出價)<0 then begin
進出[i]:=5*SGN(多空); 多空:=0; if 盈虧<0 then 停損次:=停損次+1;
end;
end;
end;
end;
end;
回覆: 下標越界
引用:
最初由 AA0753 發表
請教
數組下標越界或超出有效數據區間
是哪裡要更改
| 全部時間均為台灣時間, 現在時間為04:26 | 總頁數 (2): « 1 [2] 在這個頁面顯示本主題全部的 21 個文章 |
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved.