File Name: MFO.efs
Description:
The Money Flow Oscillator by Vitali Apirine
Formula Parameters:
MFO.efs
Length: 20
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
MFO.efs
MFO.efs
EFS Code:
Description:
The Money Flow Oscillator by Vitali Apirine
Formula Parameters:
MFO.efs
Length: 20
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
MFO.efs
MFO.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
Interactive Data Corporation (Copyright В© 2015)
All rights reserved. This sample eSignal Formula Script (EFS)
is for educational purposes only. Interactive Data Corporation
reserves the right to modify and overwrite this EFS file with
each new release.
Description:
The Money Flow Oscillator by Vitali Apirine
Formula Parameters: Default:
Length 20
Version: 1.00 08/06/2015
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
**********************************/
var fpArray = new Array();
function preMain(){
setStudyTitle("MFO");
setCursorLabelName("Center Line", 0);
setCursorLabelName("MFO", 1);
setDefaultBarFgColor(Color.grey, 0);
setShowCursorLabel(false, 0);
setShowCursorLabel(true, 1);
setDefaultBarStyle(PS_DASH, 0);
setDefaultBarStyle(PS_SOLID, 1);
var x = 0;
fpArray[x] = new FunctionParameter("fpLength", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Length");
setLowerLimit(1);
setDefault(20);
};
}
var bInit = false;
var bVersion = null;
var xIntSeries = null;
var xMFlowVol = null;
var xVolAvoidZero = null;
var xSumMFlowVol = null;
var xSumVolAvoidZero = null;
function main(fpLength){
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (!bInit){
xIntSeries = efsInternal('Calc_MFlowVol', fpLength);
xMFlowVol = getSeries(xIntSeries, 0);
xVolAvoidZero = getSeries(xIntSeries, 1);
xSumMFlowVol = sma(fpLength, xMFlowVol);
xSumVolAvoidZero = sma(fpLength, xVolAvoidZero);
bInit = true;
};
var nSumMFlowVol = xSumMFlowVol.getValue(0);
var nSumVolAvoidZero = xSumVolAvoidZero.getValue(0);
if (nSumMFlowVol == null || nSumVolAvoidZero == null)
return;
var nMFO = nSumMFlowVol / nSumVolAvoidZero;
return [0, nMFO];
}
var xHigh = null;
var xLow = null;
var xVolume = null;
function Calc_MFlowVol(nLength){
if (getBarState() == BARSTATE_ALLBARS){
xHigh = high();
xLow = low();
xVolume = volume();
}
var nHigh = xHigh.getValue(0);
var nPrevHigh = xHigh.getValue(-1);
var nLow = xLow.getValue(0);
var nPrevLow = xLow.getValue(-1);
var nVolume = xVolume.getValue(0);
if (nHigh == null || nPrevHigh == null || nLow == null || nPrevLow == null || nVolume == null)
return;
var nDvs = (nHigh - nPrevLow) + (nPrevHigh - nLow);
if (nDvs == 0) nDvs = 0.00001;
var nMltp = (nHigh < nPrevLow) ? -1 : (nLow > nPrevHigh) ? 1 : ((nHigh - nPrevLow) - (nPrevHigh - nLow)) / nDvs;
var nMFlowVol = nMltp * nVolume;
if (nVolume == 0) nVolume = 0.00001;
return [nMFlowVol, nVolume];
}
function verify(){
var b = false;
if (getBuildNumber() < 779){
drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "upgrade");
return b;
}
else
b = true;
return b;
}