 |
Rosetta
資深會員
註冊日期: Sep 2014
來 自:
文章數量: 125 |
|
高低連線問題
請問以下公式要如何修改,才能正確連到K棒的高低點,謝謝
例如1815富喬,從2025/12/16的低點79.00連到2025/12/29高點101.50,從2025/12/11高點91.00連到2025/12/16低點79.00
UP1 := H > REF(HHV(HIGH,3),1);
DOWN1 := L < REF(LLV(LOW,3),1);
UP1_BARS := BARSLAST(UP1) + 1;
HH_SINCE_UP1 := HHV(H, UP1_BARS);
DOWN1_BARS := BARSLAST(DOWN1) + 1;
LL_SINCE_DOWN1 := LLV(L, DOWN1_BARS);
A1 := IF(DOWN1, HH_SINCE_UP1, 0);
A2 := IF(UP1, LL_SINCE_DOWN1, 0);
DRAWLINE(DOWN1, A1, UP1, A2, 0);
DRAWLINE(UP1, A2,DOWN1, A1, 0);
|
|
向版主報告此篇 |  |
|
2026-03-23 12:05 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18332 |
|
回覆: 高低連線問題
引用: 最初由 Rosetta 發表
請問以下公式要如何修改,才能正確連到K棒的高低點,謝謝
例如1815富喬,從2025/12/16的低點79.00連到2025/12/29高點101.50,從2025/12/11高點91.00連到2025/12/16低點79.00
UP1 := H > REF(HHV(HIGH,3),1);
DOWN1 := L < REF(LLV(LOW,3),1);
UP1_BARS := BARSLAST(UP1) + 1;
HH_SINCE_UP1 := HHV(H, UP1_BARS);
DOWN1_BARS := BARSLAST(DOWN1) + 1;
LL_SINCE_DOWN1 := LLV(L, DOWN1_BARS);
A1 := IF(DOWN1, HH_SINCE_UP1, 0);
A2 := IF(UP1, LL_SINCE_DOWN1, 0);
DRAWLINE(DOWN1, A1, UP1, A2, 0);
DRAWLINE(UP1, A2,DOWN1, A1, 0);
此段公式並不是用來做高低點判斷的,故無法修改!
要判斷一個位置是否為高低點
其必須向前和向後比較數值,才能確立
|
|
向版主報告此篇 |  |
|
2026-03-23 14:35 |
|
|
|  |
 |
Rosetta
資深會員
註冊日期: Sep 2014
來 自:
文章數量: 125 |
|
回覆: 回覆: 高低連線問題
引用: 最初由 cgjj 發表
此段公式並不是用來做高低點判斷的,故無法修改!
要判斷一個位置是否為高低點
其必須向前和向後比較數值,才能確立
UP1 := H > REF(HHV(HIGH,3),1);
DOWN1 := L < REF(LLV(LOW,3),1);
A為UP1後第一個DOWN1,UP1與DOWN1二者所夾之最高點,例如 1815 富喬,2025/12/29 高點 101.50
B為DOWN1後第一個UP1,DOWN1與UP1二者所夾之最低點,例如 1815 富喬,2025/12/16 低點 79.00
請問如何寫公式,將A與B連線,謝謝
|
|
向版主報告此篇 |  |
|
2026-03-29 09:42 |
|
|
|  |
 |
Rosetta
資深會員
註冊日期: Sep 2014
來 自:
文章數量: 125 |
|
回覆: 回覆: 回覆: 回覆: 高低連線問題
引用: 最初由 cgjj 發表
UP1 有可能連續成立
DOWN1 也可能連續成立
UP1與DOWN1二者所夾之最高價
該價不一定只發生在一根K棒上(可能連續或不連續)
以上~~ 有想過要如何處理嗎?
>>UP1 有可能連續成立
>>DOWN1 ˋ也可能連續成立
應該說是只要UP1後接著是DOWN1,二者所夾之最高價當根K棒高點就定義為A,
例如 1815 富喬,2025/12/22開始都是連續UP1,之後發生第一個DOWN1在2026/01/02,因此最後一個UP1 2025/12/29與2026/01/02所夾之最高價當根K棒2025/12/29高點就定義為A
>>UP1 與 DOWN1 二者所夾之最高價
>>該價不一定只發生在一根 K 棒上 (可能連續或不連續)
若出現此狀況,請定義最後出現的最高價為A,例如 1815 富喬,2025/2/10與2/11高點相同,則定義2/11為A
|
|
向版主報告此篇 |  |
|
2026-03-30 09:52 |
|
|
|  |
 |
Rosetta
資深會員
註冊日期: Sep 2014
來 自:
文章數量: 125 |
|
回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 高低連線問題
引用: 最初由 cgjj 發表
此外,當 UP1 和 DOWN1 同時成立時,又如何處理?
當 UP1 和 DOWN1 同時成立時(以下稱貫穿線):
1.若貫穿線成立時,前面最後出現的是UP1,例如 1815 富喬,2024/11/28,則連線先從2024/11/19低點,連線到2024/11/28高點,再從2024/11/28高點,連線到2024/11/28低點
2.若貫穿線成立時,前面最後出現的是DOWN1,例如 1815 富喬,2024/11/01,則連線先從2024/10/22高點,連線到2024/11/01低點,再從2024/11/01低點,連線到2024/11/01高點
3.若貫穿線成立時,前面最後出現的是貫穿線,不管前面的貫穿線是先連低再連高,還是先連高再連低,一律先連到後面的貫穿線低點,再從後面的貫穿線低點,連到後面的貫穿線高點
例如 1904正隆,2026/03/20、3/23二根貫穿線,3/20是先連高再連低(符合條件1),則3/23這根是從3/20低點連到3/23低點,再從3/23低點連線到3/23高點
例如 3105穩懋,2015/11/10、11/11二根貫穿線,11/10是先連低再連高(符合條件2),則11/11這根是從11/10高點連到11/11低點,再從11/11低點連線到11/11高點
|
|
向版主報告此篇 |  |
|
2026-04-03 16:46 |
|
|
|  |
 |
Rosetta
資深會員
註冊日期: Sep 2014
來 自:
文章數量: 125 |
|
回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 回覆: 高低連線問題
引用: 最初由 cgjj 發表
若貫穿線連續成立呢?
上面第3點就是
|
|
向版主報告此篇 |  |
|
2026-04-07 14:46 |
|
|
|  |
 |
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18332 |
|
完成了,使用上請注意!!!
1.這個公式並非高低高低高低...一直如此反向。
2.這個公式有動用到未來數據!
原碼: DWP1:=C*0 linethick;
DWP2:=DWP1 linethick;
DWLEN:=DWP1 linethick;
HH:=H; LL:=L;
UP1:=HH > REF(HHV(HH,3),1) or barpos=0 linethick;
DOWN1:=LL < REF(LLV(LL,3),1) or barpos=0 linethick;
UD:=DOWN1+UP1*2;
UP1SP:=barslast(UP1); DOWN1SP:=barslast(DOWN1);
LastUD:=0; LastDW:=-1;
for i = 1 to datacount do begin
if UD[i]=1 and LastUD=2 or UD[i]=3 and LastUD=2 then begin
PP:=i-1;
for j = PP downto 1 do begin
if HH[j]>HH[PP] then PP:=j;
if UP1[j]=1 then break;
end;
if j>0 and DOWN1[PP]=0 then begin
DWP1[PP]:=HH[PP];
if LastDW > -1 then begin
DWLEN[PP]:=PP-LastDW; DWP2[PP]:=DWP1[LastDW];
end;
LastDW:=PP;
if UD[i]=3 then begin
DWP2[i]:=DWP1[PP]; DWP1[i]:=LL[i]; DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end;
end else if UD[i]=2 and LastUD=1 or UD[i]=3 and LastUD=1 then begin
PP:=i-1;
for j = PP downto 1 do begin
if LL[j]<LL[PP] then PP:=j;
if DOWN1[j]=1 then break;
end;
if j>0 and UP1[PP]=0 then begin
DWP1[PP]:=LL[PP];
if LastDW > -1 then begin
DWLEN[PP]:=PP-LastDW; DWP2[PP]:=DWP1[LastDW];
end;
LastDW:=PP;
if UD[i]=3 then begin
DWP2[i]:=DWP1[PP]; DWP1[i]:=LL[i]; DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end;
end else if UD[i]=3 and LastUD=3 then begin
DWP2[i]:=HH[LastDW]; DWP1[i]:=LL[i]; DWLEN[i]:=i-LastDW; LastDW:=i;
end;
if UD[i]>0 then LastUD:=UD[i];
end;
DRAWSL(DWP1>0 and DWP2>0 and DWLEN>0,DWP1,(DWP1-DWP2)/DWLEN,-DWLEN,1) coloryellow pxdn2;
STICKLINE(DWP1>0 and DWP2>0 and UD=3 and refx(UD,1)=3 and not(islastbar),H,L,0.1,0) coloryellow;
|
|
向版主報告此篇 |  |
|
2026-04-13 17:17 |
|
|
|  |
 |
Rosetta
資深會員
註冊日期: Sep 2014
來 自:
文章數量: 125 |
|
引用: 最初由 cgjj 發表
完成了,使用上請注意!!!
1.這個公式並非高低高低高低...一直如此反向。
2.這個公式有動用到未來數據!
原碼: DWP1:=C*0 linethick;
DWP2:=DWP1 linethick;
DWLEN:=DWP1 linethick;
HH:=H; LL:=L;
UP1:=HH > REF(HHV(HH,3),1) or barpos=0 linethick;
DOWN1:=LL < REF(LLV(LL,3),1) or barpos=0 linethick;
UD:=DOWN1+UP1*2;
UP1SP:=barslast(UP1); DOWN1SP:=barslast(DOWN1);
LastUD:=0; LastDW:=-1;
for i = 1 to datacount do begin
if UD[i]=1 and LastUD=2 or UD[i]=3 and LastUD=2 then begin
PP:=i-1;
for j = PP downto 1 do begin
if HH[j]>HH[PP] then PP:=j;
if UP1[j]=1 then break;
end;
if j>0 and DOWN1[PP]=0 then begin
DWP1[PP]:=HH[PP];
if LastDW > -1 then begin
DWLEN[PP]:=PP-LastDW; DWP2[PP]:=DWP1[LastDW];
end;
LastDW:=PP;
if UD[i]=3 then begin
DWP2[i]:=DWP1[PP]; DWP1[i]:=LL[i]; DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end;
end else if UD[i]=2 and LastUD=1 or UD[i]=3 and LastUD=1 then begin
PP:=i-1;
for j = PP downto 1 do begin
if LL[j]<LL[PP] then PP:=j;
if DOWN1[j]=1 then break;
end;
if j>0 and UP1[PP]=0 then begin
DWP1[PP]:=LL[PP];
if LastDW > -1 then begin
DWLEN[PP]:=PP-LastDW; DWP2[PP]:=DWP1[LastDW];
end;
LastDW:=PP;
if UD[i]=3 then begin
DWP2[i]:=DWP1[PP]; DWP1[i]:=LL[i]; DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end;
end else if UD[i]=3 and LastUD=3 then begin
DWP2[i]:=HH[LastDW]; DWP1[i]:=LL[i]; DWLEN[i]:=i-LastDW; LastDW:=i;
end;
if UD[i]>0 then LastUD:=UD[i];
end;
DRAWSL(DWP1>0 and DWP2>0 and DWLEN>0,DWP1,(DWP1-DWP2)/DWLEN,-DWLEN,1) coloryellow pxdn2;
STICKLINE(DWP1>0 and DWP2>0 and UD=3 and refx(UD,1)=3 and not(islastbar),H,L,0.1,0) coloryellow;
以下問題請板主協助修改,謝謝
根據穿線規則第一條:
6168宏齊,2023/9/21一根貫穿線,線的畫法應該是:09/15高→09/21低→09/21高→09/27低→10/24高
根據穿線規則第二條:
6168宏齊,2024/11/08、11/11二根貫穿線,線的畫法應該是:11/04高→11/08低→11/08高→11/11低→11/11高→11/18低
|
|
向版主報告此篇 |  |
|
2026-04-19 18:07 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18332 |
|
引用: 最初由 Rosetta 發表
以下問題請板主協助修改,謝謝
根據穿線規則第一條:
6168宏齊,2023/9/21一根貫穿線,線的畫法應該是:09/15高→09/21低→09/21高→09/27低→10/24高
根據穿線規則第二條:
6168宏齊,2024/11/08、11/11二根貫穿線,線的畫法應該是:11/04高→11/08低→11/08高→11/11低→11/11高→11/18低
注意!!! 它並非是像 ZIG 那樣的公式唷~~
1.這個公式並非高低高低高低...一直如此反向。
2.這個公式有動用到未來數據!
3.頂點和底點有可能在同一根
重新處理如下:
原碼: HH:=H; LL:=L;
UP1:=HH > REF(HHV(HH,3),1) or barpos=0 linethick;
DOWN1:=LL < REF(LLV(LL,3),1) or barpos=0 linethick;
UD:=DOWN1+UP1*2 linethick;
LastUD:=0; LastDW:=-1;
DWP1:=C*0 linethick;
DWP2:=DWP1 linethick;
DWPZ:=DWP1 linethick;
DWLEN:=DWP1;
for i = 1 to datacount do begin
if LastUD=UD[i] then begin
if LastUD=3 and LastDW>-1 then begin
DWP1[i]:=LL[i];
DWP2[i]:=HH[LastDW]; DWPZ[LastDW]:=DWP2[i];
DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end else begin
if UD[i]=1 or (UD[i]=3 and LastUD=2) then begin
PP:=i-1;
for j = PP downto 1 do begin
if HH[j]>HH[PP] then PP:=j;
if UP1[j]=1 then break;
end;
if j>0 and DWP1[PP]=0 then begin
DWP1[PP]:=HH[PP];
if LastDW > -1 then begin
DWP2[PP]:=LL[LastDW]; DWPZ[LastDW]:=DWP2[PP];
DWLEN[PP]:=PP-LastDW;
end;
LastDW:=PP;
if UD[i]=3 then begin
DWP1[i]:=LL[i]; DWP2[i]:=DWP1[LastDW];
DWPZ[LastDW]:=DWP2[i];
DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end;
end else if UD[i]=2 or (UD[i]=3 and LastUD=1) then begin
PP:=i-1;
for j = PP downto 1 do begin
if LL[j]<LL[PP] then PP:=j;
if DOWN1[j]=1 then break;
end;
if j>0 and DWP1[PP]=0 then begin
DWP1[PP]:=LL[PP];
if LastDW > -1 then begin
DWP2[PP]:=HH[LastDW]; DWPZ[LastDW]:=DWP2[PP];
DWLEN[PP]:=PP-LastDW;
end;
LastDW:=PP;
if UD[i]=3 then begin
DWP1[i]:=LL[i];
DWP2[i]:=DWP1[LastDW]; DWPZ[LastDW]:=DWP2[i];
DWLEN[i]:=i-LastDW; LastDW:=i;
end;
end;
end;
end;
if UD[i]>0 then LastUD:=UD[i];
end;
DRAWSL(DWP2>0,DWP1,(DWP1-DWP2)/DWLEN,-DWLEN,1) coloryellow pxdn2;
STICKLINE(DWPZ<>DWP1 and DWPZ>0 ,H,L,0.1,0) coloryellow;
|
|
向版主報告此篇 |  |
|
2026-04-20 22:20 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|