日內動量指標的概念如下
1.當紅K棒時,把收盤價比開盤價高的部份視為多頭動能
2.當黑K棒時,把開盤價比收盤價高的部份視為空頭動能
3.計算過去一段時間的多頭動能及空頭動能
4.日內動量指標的算法是以多頭動能除以多頭動能+空頭動能
對應的腳本如下
input:length(10); setinputname(1, "天期"); variable:up(0),dn(0),upi(0),dni(0),imi(0); if close > open then up = close-open else up = 0; if close < open then dn = open-close else dn = 0; upi = summation(up,length); dni = summation(dn,length); if upi+dni = 0 then imi = 0 else imi = upi/(upi+dni)*100; plot1(imi, "IMI");
參考的圖形