XScript的繪圖語法,能否畫出圖中的折線?

  •   17 
  • 最後發表   Elvisho  2 小時前
Elvisho 發文於   2026/07/10

請問XScript能夠寫出如同圖中綠色箭頭的K棒,在同一根K棒上的高低點,畫出線段連接到前後K棒嗎?

謝謝

 

排序方式: 標準 | 最新
虎科大許教授 發文於   2026/07/11

基本上,同一根K棒只能畫一次。也許用兩個PlotLine,賦予不同條件才繪製,說不定可以。只是沒試過。

Elvisho 發文於   2026/07/11

謝謝許教授 ~ 因為用Ai 奮戰了好久 ~ Token燒光也沒寫出來,才上來問問是不是PlotLine 底層的邏輯就沒辦法達成這樣的功能。

虎科大許教授 發文於   2026/07/12

Elvisho,

我試著寫一個特定條件符合時同時繪製高低點的指標腳本供你參考,希望能激起你的靈感以解決你的問題。

condition101 = h > h[1] and L < L[1];
condition102 = h < h[1] and L > L[1];
if condition101 or condition102 then
    begin       
        if condition101[1] and condition102 then
            noplot(1) else plot1(h);
        if condition102[1] and condition101 then
            noplot(2) else plot2(L);
        if condition101 then 
            begin
                condition1 = true; //符合繪製高點條件
                condition2 = false;
            end;
        if condition102 then 
            begin
                condition1 = false; 
                condition2 = true;//符合繪製低點條件
            end;
    end
else
    begin
        if condition1[1] = false then noplot(1) else plot1(h);
        if condition2[1] = false then noplot(2) else plot2(L);
    end;

Elvisho 發文於   2026/07/12

感謝許教授費心指導 ~ 我來試寫看看,謝謝您

發表回覆
Close