MFI的計算方法如下
對應的腳本
1Input: Length(6); 2variable: tp(0), tv(0), utv(0), dtv(0), pmf(0), nmf(0), mfivalue(0); 3 4SetInputName(1, "天數"); 5 6tp = TypicalPrice; 7tv = tp * Volume; 8 9if tp > tp[1] then 10 begin 11 utv = tv; 12 dtv = 0; 13 end 14else 15 begin 16 utv = 0; 17 dtv = tv; 18 end; 19 20pmf = Average(utv, MinList(CurrentBar, length)); 21nmf = Average(dtv, MinList(CurrentBar, length)); 22 23 24if CurrentBar < Length or (pmf + nmf) = 0 then 25 mfivalue = 50 26else 27 mfivalue = 100 * pmf /(pmf + nmf); 28 29Plot1(mfivalue, "MFI");
參考的圖