File Name: LMA_Channels.efs
Description:
LMA Channels
Formula Parameters:
Length : 20
Percentage : 0.5
Notes:
Download File:
LMA_Channels.efs
EFS Code:
Description:
LMA Channels
Formula Parameters:
Length : 20
Percentage : 0.5
Notes:
Download File:
LMA_Channels.efs
EFS Code:
PHP 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:
LMA Channels
Version: 1.0 10/29/2009
Formula Parameters: Default:
Length 20
Percentage 0.5
Notes:
**********************************/
var fpArray = new Array();
var bInit = false;
function preMain(){
setPriceStudy(true);
setShowCursorLabel(true);
setShowTitleParameters(false);
setStudyTitle("LMA Channels");
setCursorLabelName("Up Band", 0);
setPlotType(PLOTTYPE_LINE, 0);
setDefaultBarFgColor(Color.blue, 0);
setCursorLabelName("Dn Band", 1);
setPlotType(PLOTTYPE_LINE, 1);
setDefaultBarFgColor(Color.blue, 1);
var x = 0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(1);
setDefault(20);
}
fpArray[x] = new FunctionParameter("Percentage", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(0);
setDefault(0.5);
}
}
var xMAD2 = null;
var xMA = null;
function main(Length, Percentage) {
var nBarState = getBarState();
var nUpBand = 0;
var nDnBand = 0;
var nMAD2 = 0;
var nMA = 0;
if (nBarState == BARSTATE_ALLBARS) {
if(Length == null) Length = 20;
if(Percentage == null) Percentage = 0.5;
}
if (bInit == false) {
xMAD2 = wma(Math.round(Length / 2), low());
xMA = wma(Length, low());
bInit = true;
}
nMAD2 = xMAD2.getValue(0);
nMA = xMA.getValue(0);
if (nMAD2 == null || nMA == null) return;
nUpBand = (1 + Percentage / 100) * nMAD2 * 2 - nMA;
nDnBand = (1 - Percentage / 100) * nMAD2 * 2 - nMA;
return new Array(nUpBand, nDnBand);
}