標示最大值的繪圖序列名稱

  •   317 
  • 最後發表   XQYi  2025 二月 21
XQYi 發文於   2024/12/11

plot1(nthMaxList(1,value1,value2,value3,value4,value5,value6,value7,value8,value9,value10,value11,value12,value13,value14,value15,value16,value17,value18,value19,value20,value21,value22),"1");

plot2(nthMaxList(2,value1,value2,value3,value4,value5,value6,value7,value8,value9,value10,value11,value12,value13,value14,value15,value16,value17,value18,value19,value20,value21,value22),"2");

........

假設

1. 找出Value7是最大值602,如何設置 序列名稱"1" 自動變更為 "Value7" ?

2. 找出Value21是第二大值590,如何設置 序列名稱"2" 自動變更為 "Value21" ?

 

排序方式: 標準 | 最新
XQYi 發文於   2024/12/12

Var: intraBarPersist V32(""), intraBarPersist V32t(0);

switch(V32t)

begin

case 7: 

V32= "2日高";

case 17: 

V32= "300高";

End;

 

value1 = NthExtremesArray(arrA,20,1,1,value31,V32t); 

plot1(value31,"1");

setplotlabel(1,V32);

 

value2 = NthExtremesArray(arrA,20,2,1,value31,V32t); 

plot2(value31,"2");

setplotlabel(2,V32);

........

只抓到第一次"2日高"

虎科大許教授 發文於   2024/12/12

Switch 的 Case 條件,最嚴格的要放在最上面。

XQYi 發文於   2024/12/12

Array: arrA[2](0); //陣列需求達20以上 ,使用2為方便測試程式用

arrA[1]=open;

arrA[2]=high;

Var: V32(""), V32t(0);

value1= NthExtremesArray(arrA,2,1,1,value51,value52);

plot1(value51,"1") ;

V32t=Value52;

value2= NthExtremesArray(arrA,2,2,1,value53,value54);

plot2(value53,"2");

V32t=Value54;

 

switch(V32t)

begin

case value52: 

V32= "開盤價";

 

case value54: 

V32= "最高價";

End;

setplotlabel(1,V32); 

setplotlabel(2,V32);

 

setplotlabe 如何讓序列名稱分別為 開盤價和最高價?

現況都是同一個名稱!!

XS小幫手 發文於   2025/02/21

xqyi 您好,

類似這樣寫就能隨情況改變指標名稱,請您再根據您的需求自行調整: 

var:V32("");
Value1 = mod(currentBar,2); //K棒編號只會有奇數或偶數

switch(Value1)
begin
   case 0: 
      V32 = "偶數";
   case 1: 
      V32 = "奇數";
end;

plot(1,currentBar);
setplotlabel(1,V32); 


 

 

發表回覆
Close