|
Markchu7
資深會員
註冊日期: Nov 2007
來 自:
文章數量: 1439 |
[問題]限制CKMM60根K棒數
N:=10; CC:=C; VV:=V;
KL:=SYSPARAM(2); KR:=SYSPARAM(3)-(SYSPARAM(3)=datacount);
當沖:=(DATATYPE<>12 AND ISREGULARFBAR) or TRADEDATE<>REF(TRADEDATE,1) or BARPOS=1;// OR (DATATYPE=12 AND TIME=084520);
for i=datacount downto lbound(當沖) do begin
if 當沖[i] and i>KL then begin
KL:=i; break;
end;
end;
KN:=barpos-KL; KZ:=KR-KL; if KZ<0 then exit;
PH:=HHV(H,KZ+1);PH:=PH[KR];
PL:=LLV(L,KZ+1);PL:=PL[KR];
PS:=(PH-PL)/10;
VARIABLE:MH[N]=0,MZ[N]=0,ML[N]=0,MP[N]=0,MPS[N]=0;
PS2:=PS/2; VZ:=0; MaxMZ:=0;
for i=1 to N do begin
MH[i]:=PH-PS*(i-1);
for k=KL to KR do begin
if CC[k]<=MH[i] and CC[k]>MH[i]-PS-PS*(i=N) then MZ[i]:=MZ[i]+VV[k];
end;
VZ:=VZ+MZ[i]; if MZ[i]>MaxMZ then MaxMZ:=MZ[i];
end;
for i=1 to N do begin
ML[i]:=MZ[i]/MaxMZ; MP[i]:=MZ[i]/VZ*100; MPS[i]:=MP[i];
end;
x:=sortpos(MPS,1,1,N);
for i=4 to N do ML[MPS[i]]:=0;
FILLRGN(ML[01]>=KN/KZ and KN>0,MH[01],MH[01]-PS) color555555;
FILLRGN(ML[02]>=KN/KZ and KN>0,MH[02],MH[02]-PS) color888888;
FILLRGN(ML[03]>=KN/KZ and KN>0,MH[03],MH[03]-PS) color555555;
FILLRGN(ML[04]>=KN/KZ and KN>0,MH[04],MH[04]-PS) color888888;
FILLRGN(ML[05]>=KN/KZ and KN>0,MH[05],MH[05]-PS) color555555;
FILLRGN(ML[06]>=KN/KZ and KN>0,MH[06],MH[06]-PS) color888888;
FILLRGN(ML[07]>=KN/KZ and KN>0,MH[07],MH[07]-PS) color555555;
FILLRGN(ML[08]>=KN/KZ and KN>0,MH[08],MH[08]-PS) color888888;
FILLRGN(ML[09]>=KN/KZ and KN>0,MH[09],MH[09]-PS) color555555;
FILLRGN(ML[10]>=KN/KZ and KN>0,MH[10],MH[10]-PS) color888888;
RT:=barpos<KL+KZ*0.25;
DRAWTEXT(barpos=KL+floor(KZ*ML[01]) and RT=0,MH[01]-PS2,numtostr(MP[01],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[02]) and RT=0,MH[02]-PS2,numtostr(MP[02],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[03]) and RT=0,MH[03]-PS2,numtostr(MP[03],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[04]) and RT=0,MH[04]-PS2,numtostr(MP[04],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[05]) and RT=0,MH[05]-PS2,numtostr(MP[05],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[06]) and RT=0,MH[06]-PS2,numtostr(MP[06],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[07]) and RT=0,MH[07]-PS2,numtostr(MP[07],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[08]) and RT=0,MH[08]-PS2,numtostr(MP[08],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[09]) and RT=0,MH[09]-PS2,numtostr(MP[09],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[10]) and RT=0,MH[10]-PS2,numtostr(MP[10],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[01]) and RT=1,MH[01]-PS2,' '+numtostr(MP[01],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[02]) and RT=1,MH[02]-PS2,' '+numtostr(MP[02],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[03]) and RT=1,MH[03]-PS2,' '+numtostr(MP[03],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[04]) and RT=1,MH[04]-PS2,' '+numtostr(MP[04],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[05]) and RT=1,MH[05]-PS2,' '+numtostr(MP[05],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[06]) and RT=1,MH[06]-PS2,' '+numtostr(MP[06],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[07]) and RT=1,MH[07]-PS2,' '+numtostr(MP[07],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[08]) and RT=1,MH[08]-PS2,' '+numtostr(MP[08],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[09]) and RT=1,MH[09]-PS2,' '+numtostr(MP[09],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[10]) and RT=1,MH[10]-PS2,' '+numtostr(MP[10],2)+'%') ALIGN1 pxup8 color000000;
FILLRGN(ML[01]>=KN/KZ and KN>0,MH[01],MH[01]-PS) colorFF99FF;
FILLRGN(ML[02]>=KN/KZ and KN>0,MH[02],MH[02]-PS) color00FF00;
FILLRGN(ML[03]>=KN/KZ and KN>0,MH[03],MH[03]-PS) colorFF99FF;
FILLRGN(ML[04]>=KN/KZ and KN>0,MH[04],MH[04]-PS) color00FF00;
FILLRGN(ML[05]>=KN/KZ and KN>0,MH[05],MH[05]-PS) colorFF99FF;
FILLRGN(ML[06]>=KN/KZ and KN>0,MH[06],MH[06]-PS) color00FF00;
FILLRGN(ML[07]>=KN/KZ and KN>0,MH[07],MH[07]-PS) colorFF99FF;
FILLRGN(ML[08]>=KN/KZ and KN>0,MH[08],MH[08]-PS) color00FF00;
FILLRGN(ML[09]>=KN/KZ and KN>0,MH[09],MH[09]-PS) colorFF99FF;
FILLRGN(ML[10]>=KN/KZ and KN>0,MH[10],MH[10]-PS) color00FF00;
kline(O,H,L,C,0);
以上源碼為之前總版主指導協助之主圖疊加成交量前3大量橫條圖之公式,希望修改為限制CKMM60根K棒數的效果!
以下為CKMM60的公式:
分鐘首K:=ISREGULARFBAR;
換日首K:=TRADEDATE<>REF(TRADEDATE,1);
歷史首K:=BARPOS=1;
DBCK:=IF((DATATYPE=1 OR DATATYPE=12) AND STKLABEL='FITX1+',TIME=084600 OR TIME=150100,IF(DATATYPE=1 OR DATATYPE=11 OR DATATYPE=2,分鐘首K OR 換日首K,歷史首K)),LINETHICK;
CKSP:=BARSLAST(DBCK)+1,LINETHICK;
CKMM60:=IF(DATATYPE=12 OR DATATYPE=11 OR DATATYPE=1 OR DATATYPE=2,IF(CKSP<=2,CKSP,60),60),LINETHICK;
1,使用於商品'FITX1',週期為多秒線!
2,個人限於能力,無法判斷以下效果可否達成,還請總版主裁量!
就是希望從歷史的第一根K棒就開始記錄前3大量的歷史橫條圖,而非僅最新之CKMM60根K棒的橫條圖!
以上如有思慮疏漏處還請總版主指正!
謝謝!
|
|
向版主報告此篇 | |
|
2024-02-16 09:27 |
|
|
| |
|
cgjj
總版主
註冊日期: Oct 2003
來 自:
文章數量: 17629 |
回覆: [問題]限制CKMM60根K棒數
引用: 最初由 Markchu7 發表
N:=10; CC:=C; VV:=V;
KL:=SYSPARAM(2); KR:=SYSPARAM(3)-(SYSPARAM(3)=datacount);
當沖:=(DATATYPE<>12 AND ISREGULARFBAR) or TRADEDATE<>REF(TRADEDATE,1) or BARPOS=1;// OR (DATATYPE=12 AND TIME=084520);
for i=datacount downto lbound(當沖) do begin
if 當沖[i] and i>KL then begin
KL:=i; break;
end;
end;
KN:=barpos-KL; KZ:=KR-KL; if KZ<0 then exit;
PH:=HHV(H,KZ+1);PH:=PH[KR];
PL:=LLV(L,KZ+1);PL:=PL[KR];
PS:=(PH-PL)/10;
VARIABLE:MH[N]=0,MZ[N]=0,ML[N]=0,MP[N]=0,MPS[N]=0;
PS2:=PS/2; VZ:=0; MaxMZ:=0;
for i=1 to N do begin
MH[i]:=PH-PS*(i-1);
for k=KL to KR do begin
if CC[k]<=MH[i] and CC[k]>MH[i]-PS-PS*(i=N) then MZ[i]:=MZ[i]+VV[k];
end;
VZ:=VZ+MZ[i]; if MZ[i]>MaxMZ then MaxMZ:=MZ[i];
end;
for i=1 to N do begin
ML[i]:=MZ[i]/MaxMZ; MP[i]:=MZ[i]/VZ*100; MPS[i]:=MP[i];
end;
x:=sortpos(MPS,1,1,N);
for i=4 to N do ML[MPS[i]]:=0;
FILLRGN(ML[01]>=KN/KZ and KN>0,MH[01],MH[01]-PS) color555555;
FILLRGN(ML[02]>=KN/KZ and KN>0,MH[02],MH[02]-PS) color888888;
FILLRGN(ML[03]>=KN/KZ and KN>0,MH[03],MH[03]-PS) color555555;
FILLRGN(ML[04]>=KN/KZ and KN>0,MH[04],MH[04]-PS) color888888;
FILLRGN(ML[05]>=KN/KZ and KN>0,MH[05],MH[05]-PS) color555555;
FILLRGN(ML[06]>=KN/KZ and KN>0,MH[06],MH[06]-PS) color888888;
FILLRGN(ML[07]>=KN/KZ and KN>0,MH[07],MH[07]-PS) color555555;
FILLRGN(ML[08]>=KN/KZ and KN>0,MH[08],MH[08]-PS) color888888;
FILLRGN(ML[09]>=KN/KZ and KN>0,MH[09],MH[09]-PS) color555555;
FILLRGN(ML[10]>=KN/KZ and KN>0,MH[10],MH[10]-PS) color888888;
RT:=barpos<KL+KZ*0.25;
DRAWTEXT(barpos=KL+floor(KZ*ML[01]) and RT=0,MH[01]-PS2,numtostr(MP[01],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[02]) and RT=0,MH[02]-PS2,numtostr(MP[02],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[03]) and RT=0,MH[03]-PS2,numtostr(MP[03],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[04]) and RT=0,MH[04]-PS2,numtostr(MP[04],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[05]) and RT=0,MH[05]-PS2,numtostr(MP[05],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[06]) and RT=0,MH[06]-PS2,numtostr(MP[06],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[07]) and RT=0,MH[07]-PS2,numtostr(MP[07],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[08]) and RT=0,MH[08]-PS2,numtostr(MP[08],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[09]) and RT=0,MH[09]-PS2,numtostr(MP[09],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[10]) and RT=0,MH[10]-PS2,numtostr(MP[10],2)+'% ') ALIGN2 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[01]) and RT=1,MH[01]-PS2,' '+numtostr(MP[01],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[02]) and RT=1,MH[02]-PS2,' '+numtostr(MP[02],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[03]) and RT=1,MH[03]-PS2,' '+numtostr(MP[03],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[04]) and RT=1,MH[04]-PS2,' '+numtostr(MP[04],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[05]) and RT=1,MH[05]-PS2,' '+numtostr(MP[05],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[06]) and RT=1,MH[06]-PS2,' '+numtostr(MP[06],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[07]) and RT=1,MH[07]-PS2,' '+numtostr(MP[07],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[08]) and RT=1,MH[08]-PS2,' '+numtostr(MP[08],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[09]) and RT=1,MH[09]-PS2,' '+numtostr(MP[09],2)+'%') ALIGN1 pxup8 color000000;
DRAWTEXT(barpos=KL+floor(KZ*ML[10]) and RT=1,MH[10]-PS2,' '+numtostr(MP[10],2)+'%') ALIGN1 pxup8 color000000;
FILLRGN(ML[01]>=KN/KZ and KN>0,MH[01],MH[01]-PS) colorFF99FF;
FILLRGN(ML[02]>=KN/KZ and KN>0,MH[02],MH[02]-PS) color00FF00;
FILLRGN(ML[03]>=KN/KZ and KN>0,MH[03],MH[03]-PS) colorFF99FF;
FILLRGN(ML[04]>=KN/KZ and KN>0,MH[04],MH[04]-PS) color00FF00;
FILLRGN(ML[05]>=KN/KZ and KN>0,MH[05],MH[05]-PS) colorFF99FF;
FILLRGN(ML[06]>=KN/KZ and KN>0,MH[06],MH[06]-PS) color00FF00;
FILLRGN(ML[07]>=KN/KZ and KN>0,MH[07],MH[07]-PS) colorFF99FF;
FILLRGN(ML[08]>=KN/KZ and KN>0,MH[08],MH[08]-PS) color00FF00;
FILLRGN(ML[09]>=KN/KZ and KN>0,MH[09],MH[09]-PS) colorFF99FF;
FILLRGN(ML[10]>=KN/KZ and KN>0,MH[10],MH[10]-PS) color00FF00;
kline(O,H,L,C,0);
以上源碼為之前總版主指導協助之主圖疊加成交量前3大量橫條圖之公式,希望修改為限制CKMM60根K棒數的效果!
以下為CKMM60的公式:
分鐘首K:=ISREGULARFBAR;
換日首K:=TRADEDATE<>REF(TRADEDATE,1);
歷史首K:=BARPOS=1;
DBCK:=IF((DATATYPE=1 OR DATATYPE=12) AND STKLABEL='FITX1+',TIME=084600 OR TIME=150100,IF(DATATYPE=1 OR DATATYPE=11 OR DATATYPE=2,分鐘首K OR 換日首K,歷史首K)),LINETHICK;
CKSP:=BARSLAST(DBCK)+1,LINETHICK;
CKMM60:=IF(DATATYPE=12 OR DATATYPE=11 OR DATATYPE=1 OR DATATYPE=2,IF(CKSP<=2,CKSP,60),60),LINETHICK;
1,使用於商品'FITX1',週期為多秒線!
2,個人限於能力,無法判斷以下效果可否達成,還請總版主裁量!
就是希望從歷史的第一根K棒就開始記錄前3大量的歷史橫條圖,而非僅最新之CKMM60根K棒的橫條圖!
以上如有思慮疏漏處還請總版主指正!
謝謝!
a. 以上源碼為之前總版主指導協助之主圖疊加成交量前3大量橫條圖之公式,希望修改為限制CKMM60根K棒數的效果!
b.希望從歷史的第一根K棒就開始記錄前3大量的歷史橫條圖,而非僅最新之CKMM60根K棒的橫條圖
問題前後矛盾!!!
a. vs b. 無法確定您要怎樣做!
|
|
向版主報告此篇 | |
|
2024-02-16 10:04 |
|
|
| |
|
Markchu7
資深會員
註冊日期: Nov 2007
來 自:
文章數量: 1439 |
此為個人力有未逮之處!
我不知道可否做到如此-->不足60根時,從第1根就開始畫,直到K棒累積超過60根後,就畫最新的60根!
如果無法達到這樣的效果,就放棄!
使用前一篇主題即可!
感謝您!
|
|
向版主報告此篇 | |
|
2024-02-16 10:56 |
|
|
| |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|