奇狐社區論壇 總頁數 (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)


由 AA0753 在 2011-06-24 13:13 發表:

回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 設定出場

引用:
最初由 cgjj 發表
只看長紅那根, 您怎知 100% 沒有拉回30 點過呢
行情有時是振盪盤



的確沒辦法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 在 2011-06-27 11:15 發表:

回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 設定出場

引用:
最初由 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;



您原來的 CKU2 和 CKU3 已具備 出場(反手) 或平倉的控制
若再加入前面您說的 "當天停損不超過2次 以及不超過80點"

會影響原來的規則非常大唷


由 AA0753 在 2011-06-27 15:34 發表:

回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 設定出場

引用:
最初由 cgjj 發表
您原來的 CKU2 和 CKU3 已具備 出場(反手) 或平倉的控制
若再加入前面您說的 "當天停損不超過2次 以及不超過80點"

會影響原來的規則非常大唷



我知道
因為我要當執行到CKU2 和 CKU3 時還不對時當天就不再執行了


由 cgjj 在 2011-06-28 13:20 發表:

把範例程式看懂
再去調整修改細節, 更動為自己想要的方式, 再去使用

原碼:

DECK
:=date<>ref(date,1) or barpos=1
DESP:=barslast(DECK);
強平:=Time=134500;
買1:=買訊 and 強平=or barpos=0;
賣1:=賣訊 and 強平=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出價:=0CC:=CHH:=HLL:=L;
for 
i=1 to datacount do begin
  
if DECK[ithen 停損次:=0;
  if 
強平[ithen begin
    
if 多空<>0 then begin
      進出
[i]:=SGN(多空)*-4多空:=0;
    
end;
  
end else begin
    
if 買賣[i]<>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 在 2011-06-28 16:33 發表:

下標越界

引用:
最初由 cgjj 發表
把範例程式看懂
再去調整修改細節, 更動為自己想要的方式, 再去使用

原碼:

DECK
:=date<>ref(date,1) or barpos=1
DESP:=barslast(DECK);
強平:=Time=134500;
買1:=買訊 and 強平=or barpos=0;
賣1:=賣訊 and 強平=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出價:=0CC:=CHH:=HLL:=L;
for 
i=1 to datacount do begin
  
if DECK[ithen 停損次:=0;
  if 
強平[ithen begin
    
if 多空<>0 then begin
      進出
[i]:=SGN(多空)*-4多空:=0;
    
end;
  
end else begin
    
if 買賣[i]<>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 在 2011-06-28 16:52 發表:

回覆: 下標越界

引用:
最初由 AA0753 發表
請教
數組下標越界或超出有效數據區間
是哪裡要更改



這段程式我驗證過, 不會有此問題唷

請檢查您更動或添加的部份

並請注意
訊號要經 or barpos=0 處理 (讓有效位置自1開始)
才能帶入迴圈當中唷 (因為 i=1 to datacount )


全部時間均為台灣時間, 現在時間為04:26 總頁數 (2): « 1 [2]
在這個頁面顯示本主題全部的 21 個文章


Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.

簡愛洋行 製作 Copyright 2003-. All Rights Reserved.