2026-01-28 XQ部落格 P&L Chart 指標的藍色"臨界值直線"是如何畫出?試著寫成選股腳本,請問有無錯誤或改善之處?

  •   21 
  • 最後發表   塞繆爾  3 天前
塞繆爾 發文於   2026/02/28

當然還會搭配其他均線糾結/多頭排列/上揚、股價乖離、成交量...等條件
var: Flag_PLChart1(false);   // 股價長期低於P&L Chart,近日站上

Flag_PLChart1 = (countIf(C[10]<=LastPoint[10],40)>=32 and countIf(C>=LastPoint,10)>=8 and C>=LastPoint) or 

                (countIf(C[10]<=LastPoint[10],80)>=64 and countIf(C>=LastPoint,10)>=8 and C>=LastPoint) or

                (countIf(C[10]<=LastPoint[10],120)>=96 and countIf(C>=LastPoint,10)>=8 and C>=LastPoint) or

                (countIf(C[15]<=LastPoint[15],40)>=32 and countIf(C>=LastPoint,15)>=12 and C>=LastPoint) or 

                (countIf(C[15]<=LastPoint[15],80)>=64 and countIf(C>=LastPoint,15)>=12 and C>=LastPoint) or

                (countIf(C[15]<=LastPoint[15],120)>=96 and countIf(C>=LastPoint,15)>=12 and C>=LastPoint) or 

                (countIf(C[20]<=LastPoint[20],40)>=32 and countIf(C>=LastPoint,20)>=16 and C>=LastPoint) or 

                (countIf(C[20]<=LastPoint[20],80)>=64 and countIf(C>=LastPoint,20)>=16 and C>=LastPoint) or

                (countIf(C[20]<=LastPoint[20],120)>=96 and countIf(C>=LastPoint,20)>=16 and C>=LastPoint);

 

if Flag_PLChart1 or 

   Flag_PLChart1[1]

then counts=counts+1;

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

其實真的看不懂你的問題,感覺沒頭沒尾的。什麼臨界值直線?LastPoint是什麼?都沒宣告,也沒計算,怎麼看出哪裡有問題?

塞繆爾 發文於   2026/03/01

感謝許教授回覆,由於問題資料繁雜,請參考XQ部落格文章:https://www.xq.com.tw/xstrader/points-and-line-pl-chart/
在我的P&L選股腳本中,當然前半段會貼上P&L的指標程式,其中就會宣告 LastPoint,在上方網址中都有詳細說明。
感謝

虎科大許教授 發文於   2026/03/01

(1)我還是不懂你所謂的極端值直線指的是什麼。請詳細描述或繪圖表達。

(2)countif(c[1]<=Lastpoint[10], 40)>=32,以及其他的countif必須在最後一根K棒處理,不然可能會有邏輯錯誤問題。

發表回覆
Close