 |
tycoon868
資深會員

註冊日期: Oct 2008
來 自:
文章數量: 313 |
根據條件將十個數據作相對應處理
***********************************************原碼
DP1:=C-REF(C,10),linethick0,precision0,color33ff00;
DP2:=C-REF(C,20),linethick0,precision0,color00ff99;
DP3:=C-REF(C,30),linethick0,precision0,colorff00ff;
DP4:=C-REF(C,60),linethick0,precision0,colorff6600;
DP5:=C-REF(C,90),linethick0,precision0,color00cc99;
DP6:=C-REF(C,120),linethick0,precision0,colorff0066;
DP7:=C-REF(C,180),linethick0,precision0,color009999;
DP8:=C-REF(C,240),linethick0,precision0,colorred;
DP9:=C-REF(C,360),linethick0,precision0,color006699;
DP10:=C-REF(C,480),linethick0,precision0,color0066ff;
短分:DP1+DP2+DP3+DP4;
********************************************************
請總版主協助以下: (副圖用的,需要取得歷史每一個K棒上的數據[合一]、[合二])
1. 取一函數名稱[合一]:= 如果短分>=0,則將 DP1~DP10 這十個數據取出正數者(假設一共有7個),則從這七筆數據中取最大的前五名,計算這五筆數據的平均值;假設該筆K棒上只有四個正數DP,則處理方式為 四個正數DP合計之後除以4 (不足5筆者依此原則類推)
2. 第二個運算方式 [合二]:= 如果短分>=0,則將 DP1~DP10中所有屬於 正數者(假設一共有8個),則將這八筆數據合計之後除以8,如果十筆正數則除以10,如果只有三筆正數則除以3...............只有一筆則除以1
3. 如果短分<0,則將 DP1~DP10 這十筆數據取出負數者................(處理方式同 第1、2點)
感謝總版主!
|
最後由 tycoon868 在 2024-11-08 08:04 編輯 |
向版主報告此篇 |  |
|
2024-11-08 07:46 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18117 |
原碼: KN:=100; //設定僅算近期N根K棒(設0算全部)
DP1:C-REF(C,10),linethick0,precision0,color33ff00;
DP2:C-REF(C,20),linethick0,precision0,color00ff99;
DP3:C-REF(C,30),linethick0,precision0,colorff00ff;
DP4:C-REF(C,60),linethick0,precision0,colorff6600;
DP5:C-REF(C,90),linethick0,precision0,color00cc99;
DP6:C-REF(C,120),linethick0,precision0,colorff0066;
DP7:C-REF(C,180),linethick0,precision0,color009999;
DP8:C-REF(C,240),linethick0,precision0,colorred;
DP9:C-REF(C,360),linethick0,precision0,color006699;
DP10:C-REF(C,480),linethick0,precision0,color0066ff;
短分:DP1+DP2+DP3+DP4 linethick0,precision0,color777777;
VARIABLE:DPV[10]=0, DPN[10]=0;
DPV[1]:=lbound(DP1); DPV[2]:=lbound(DP2); DPV[3]:=lbound(DP3); DPV[4]:=lbound(DP4);
DPV[5]:=lbound(DP5); DPV[6]:=lbound(DP6); DPV[7]:=lbound(DP7); DPV[8]:=lbound(DP8);
DPV[9]:=lbound(DP10); DPV[10]:=lbound(DP10);
x:=SORT(DPV,0,1,10); if DPV[1]=0 then exit; //DP不足10條跳離
DPLB:=DPV[10]; StKNo:=datacount-KN+1;
if StKNo<DPLB or KN=0 then StKNo:=DPLB;
合一:C*0; x:=SETLBOUND(合一,StKNo);
合二:C*0; x:=SETLBOUND(合二,StKNo);
for PP = StKNo to datacount do begin
DPV[1]:=DP1[PP]; DPV[2]:=DP2[PP]; DPV[3]:=DP3[PP]; DPV[4]:=DP4[PP]; DPV[5]:=DP5[PP];
DPV[6]:=DP6[PP]; DPV[7]:=DP7[PP]; DPV[8]:=DP8[PP]; DPV[9]:=DP9[PP]; DPV[10]:=DP10[PP];
x:=SORT(DPV,1,1,10); DIR:=-1+(短分[PP]>=0)*2;
合一[PP]:=0; Z1:=0;
for i=1 to 10 do begin
if SGN(DPV[i])=DIR then begin
Z1:=Z1+1; 合一[PP]:=合一[PP]+DPV[i];
if Z1>=5 then break;
end;
end;
合二[PP]:=合一[PP]; Z2:=Z1;
for i=i+1 to 10 do begin
if SGN(DPV[i])=DIR then begin
Z2:=Z2+1; 合二[PP]:=合二[PP]+DPV[i];
end;
end;
合一[PP]:=合一[PP]/Z1;
合二[PP]:=合二[PP]/Z2;
end;
|
|
向版主報告此篇 |  |
|
2024-11-08 11:53 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18117 |
引用: 最初由 tycoon868 發表
請將 1. 取一函數名稱[RANK1]:= 如果短分>0...............
改成 短分>=0
原碼: KN:=100; //設定僅算近期N根K棒(設0算全部)
DP1:C-REF(C,10),linethick0,precision0,color33ff00;
DP2:C-REF(C,20),linethick0,precision0,color00ff99;
DP3:C-REF(C,30),linethick0,precision0,colorff00ff;
DP4:C-REF(C,60),linethick0,precision0,colorff6600;
DP5:C-REF(C,90),linethick0,precision0,color00cc99;
DP6:C-REF(C,120),linethick0,precision0,colorff0066;
DP7:C-REF(C,180),linethick0,precision0,color009999;
DP8:C-REF(C,240),linethick0,precision0,colorred;
DP9:C-REF(C,360),linethick0,precision0,color006699;
DP10:C-REF(C,480),linethick0,precision0,color0066ff;
短分:DP1+DP2+DP3+DP4 linethick0,precision0,color777777;
VARIABLE:DPV[10]=0, DPN[10]=0;
DPV[1]:=lbound(DP1); DPV[2]:=lbound(DP2); DPV[3]:=lbound(DP3); DPV[4]:=lbound(DP4);
DPV[5]:=lbound(DP5); DPV[6]:=lbound(DP6); DPV[7]:=lbound(DP7); DPV[8]:=lbound(DP8);
DPV[9]:=lbound(DP10); DPV[10]:=lbound(DP10);
x:=SORT(DPV,0,1,10); if DPV[1]=0 then exit; //DP不足10條跳離
DPLB:=DPV[10]; StKNo:=datacount-KN+1;
if StKNo<DPLB or KN=0 then StKNo:=DPLB;
合一:C*0; x:=SETLBOUND(合一,StKNo);
合二:合一;
RANK1:合一;
TOP:合一;
for PP = StKNo to datacount do begin
DPV[1]:=DP1[PP]; DPV[2]:=DP2[PP]; DPV[3]:=DP3[PP]; DPV[4]:=DP4[PP]; DPV[5]:=DP5[PP];
DPV[6]:=DP6[PP]; DPV[7]:=DP7[PP]; DPV[8]:=DP8[PP]; DPV[9]:=DP9[PP]; DPV[10]:=DP10[PP];
for i=1 to 10 do DPN[i]:=DPV[i];
x:=SORT(DPV,1,1,10); x:=SORTPOS(DPN,1,1,10);
if 短分[PP]>=0 then begin
RANK1[PP]:=DPN[1]; TOP[PP]:=DPV[1];
end else if 短分[PP]<0 then begin
RANK1[PP]:=DPN[10]; TOP[PP]:=DPV[10];
end;
DIR:=-1+(短分[PP]>=0)*2;
合一[PP]:=0; Z1:=0;
for i=1 to 10 do begin
if SGN(DPV[i])=DIR then begin
Z1:=Z1+1; 合一[PP]:=合一[PP]+DPV[i];
if Z1>=5 then break;
end;
end;
合二[PP]:=合一[PP]; Z2:=Z1;
for i=i+1 to 10 do begin
if SGN(DPV[i])=DIR then begin
Z2:=Z2+1; 合二[PP]:=合二[PP]+DPV[i];
end;
end;
合一[PP]:=合一[PP]/Z1;
合二[PP]:=合二[PP]/Z2;
end;
|
|
向版主報告此篇 |  |
|
2024-12-19 16:49 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|