Market Facilitation Index (MFI)

ICE Data Services -

MFI.efs  
EFSLibrary - Discussion Board  

File Name: MFI.efs

Description:

Market Facilitation Index (MFI)

Formula Parameters:

  • Source of Volume : Volume
  • Color Histogram : Green
  • Display Title Value : True

Notes:

The Market Facilitation Index is an indicator that relates price range to volume and measures the efficency of price movement. Use the indicator to determine if the market is trending. If the Market Facilitation Index increased, then the market is facilitating trade and is more efficient, implying that the market is trending. If the Market Facilitation Index decreased, then the market is becoming less efficient, which may indicate a trading range is developing that may be a trend reversal.

Download File:
MFI.efs


EFS Code:

/*********************************
Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2009. All rights reserved. This sample eSignal 
    Formula Script (EFS) is for educational purposes only and may be 
    modified and saved under a new file name.  eSignal is not responsible
    for the functionality once modified.  eSignal reserves the right 
    to modify and overwrite this EFS file with each new release.

Description:        
    Market Facilitation Index (MFI)

Version:            2.0  05/27/2009
 
Formula Parameters:                     Default:
    Source of Volume                    Volume
    Color Histogram                     Green
    Display Title Value                 True
    
Notes:
    The Market Facilitation Index is an indicator that relates price range to 
    volume and measures the efficency of price movement. Use the indicator to 
    determine if the market is trending. If the Market Facilitation Index increased, 
    then the market is facilitating trade and is more efficient, implying that the 
    market is trending. If the Market Facilitation Index decreased, then the market 
    is becoming less efficient, which may indicate a trading range is developing that 
    may be a trend reversal.

**********************************/
var fpArray = new Array();
var bInit = false;
var bBail = false; 

function preMain() {
    setPriceStudy(false);
    setShowCursorLabel(true);
    setShowTitleParameters(false);
    setStudyTitle("Market Facilitation Index ");
    setCursorLabelName("MFI", 0);
    setDefaultBarFgColor(Color.red, 0);
    setPlotType(PLOTTYPE_HISTOGRAM, 0); 
    setDefaultBarThickness(1, 0);
    askForInput();
    var x=0;
    fpArray[x] = new FunctionParameter("LineColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Color Histogram");
        setDefault(Color.green);
    }    
    fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
       setName("Display Title Value");
       setDefault(true);
    }    
    fpArray[x] = new FunctionParameter("sMyVol", FunctionParameter.STRING);
    with(fpArray[x++]){
       setName("Source of Volume");
       setDefault("volume");
    }        
}

var xMFI = null;

function main(sMyVol, LineColor, ViewValue) {
var nBarState = getBarState();
var nMFI; 
    if (nBarState == BARSTATE_ALLBARS)  {
        sMyVol = "volume";
        LineColor = Color.green;
        ViewValue = true;
    }
    if ( bBail == true ) { 
        return; 
    }     
    if ( bInit == false ) { 
        if (isRawTick() == true) { 
            setStudyTitle("Sorry. This script does not run in tick charts.")
            bBail = true; 
            return; 
        } else {
            setStudyTitle("Market Facilitation Index");
        }
        setDefaultBarFgColor(LineColor, 0);
        setShowCursorLabel(ViewValue);
        xMFI = efsInternal("Calc_MFI", sMyVol);
        bInit = true; 
    } 
    nMFI = xMFI.getValue(0);
    if (nMFI == null) return;
    return nMFI;
}

var bSecondInit = false;
var xmyVol = null;
var xmyhigh = null;
var xmylow = null;

function Calc_MFI(sMyVol) {
var nRes = 0;
var nmyhigh = 0;
var nmylow = 0;
    if (bSecondInit == false) {
        xmyVol = eval(sMyVol)();       
        xmyhigh = high();
        xmylow = low();
        bSecondInit = true;
    }
    nRes   = xmyVol.getValue(0);
    nmyhigh = xmyhigh.getValue(0);
    nmylow  = xmylow.getValue(0);
    if (nmyhigh == null) return;
    nRes = (nmyhigh - nmylow) / nRes * 10000;
    return nRes;     
}