2001 Aug: Balance Of Market Power

ICE Data Services -

BalanceOfMarketPower.efs  

EFSLibrary - Discussion Board  

File Name: BalanceOfMarketPower.efs

Description:
Balance Of Market Power, by Igor Livshin

 

Formula Parameters:

  • Length: 14
  • Line Thickness: 2
  • Line Color: Green
  • Display Cursor Labels: True

Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com

 

Download File:
BalanceOfMarketPower.efs


EFS Code:

/*********************************
Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2008. 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:        
    Balance Of Market Power, by Igor Livshin

Version:            1.0  12/05/2008

Formula Parameters:                     Default:
    Length                              14
    Line Thickness                      2
    Line Color                          Green
    Display Cursor Labels               True
    
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();
var bInit = false;
var bVersion = null;

function preMain() {
    setPriceStudy(false);
    setShowCursorLabel(false);
    setShowTitleParameters( false );
    setStudyTitle("Balance Of Market Power");
    setCursorLabelName("BMP", 0);
    setDefaultBarFgColor(Color.red, 0);
    setPlotType(PLOTTYPE_LINE, 0); 
    setDefaultBarThickness(2, 0);
   
    askForInput();
    var x=0;
    fpArray[x] = new FunctionParameter("LineColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Line Color");
        setDefault(Color.green);
    }    
    fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
        setName("Display Cursor Labels");
        setDefault(true);
    }    
    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setLowerLimit(1);		
        setDefault(14);
    }
    fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setName("Line Thickness");
        setLowerLimit(1);		
        setDefault(2);
    }
}

var xPrev_BMP = null;
var xBMP = null;

function main(Length, Thickness, LineColor, ViewValue) {
var nBMP = 0;
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;   

    if ( bInit == false ) { 
        setDefaultBarFgColor(LineColor, 0);
        setDefaultBarThickness(Thickness, 0);
        setShowCursorLabel(ViewValue);        
        xPrev_BMP = efsInternal("Calc_BMP");
        xBMP = sma(Length, xPrev_BMP);
        bInit = true; 
    } 

    nBMP = xBMP.getValue(0);
    return nBMP; 
}

function Calc_BMP(){
var nRes = 0;
    if (high(0) - low(0) == 0) return;
    nRes = (close(0) - open(0)) / (high(0) - low(0));
    if (nRes == null) nRes = 1;
    return nRes;
}

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;
}