有用戶問到如何撰寫 股價有觸及到EMA12的選股腳本
在這邊寫了一段範例供各位參考
規則如下:
今日的價格有觸碰或小於EMA12的值,但在收盤時,收盤價是大於EMA12的

程式碼如下:
input:totalbarLength(200,"資料讀取筆數"); input:Length(12,"指定長度"); settotalbar(totalbarLength); value1 = EMA(Close,12); if open > close then begin condition1 = close > value1; condition2 = low <= value1; end else if close > open then begin condition1 = open > value1; condition2 = low <= value1; end; if condition1 and condition2 then ret=1; outputfield(1,value1,"EMA");
如果有需要的用戶可以參考此篇範例喔。
6 評論