Typical Price

ICE Data Services -

TypicalPrice.efs  
EFSLibrary - Discussion Board  

File Name: TypicalPrice.efs

Description:
Typical Price

Formula Parameters:

  • Typical Price: Blue
  • AVG: Red
  • Length: 9
  • Typical Price Thickness: 1
  • AVG Thickness: 1
  • Display Title Value: False

Notes:

The Typical Price for each bar is calculated as an average of 3 values: high, low and close.

This value is then plotted on the chart. An average of the Typical Price from the most recent number of bars specified by the input Length is also plotted. Using the Typical Price instead of the close in calculating and plotting, say, a moving average weighs the high and low into the calculation.
This indicator can be used in a manner similar to the Mov Avg 2 Lines, with attention given to the direction and relative position of prices, Typical Price and the average of the Typical Price. (Typical Price is
known to some traders as the pivot point.)

Download File:
TypicalPrice.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:        
    Typical Price 


Version:            1.0  08/08/2008

Notes:
    The Typical Price for each bar is calculated as an average of 3 values:
    high, low and close. This value is then plotted on the chart. An average
    of the Typical Price from the most recent number of bars specified by the
    input Length is also plotted. Using the Typical Price instead of the close
    in calculating and plotting, say, a moving average weighs the high and low
    into the calculation.
    This indicator can be used in a manner similar to the Mov Avg 2 Lines,
    with attention given to the direction and relative position of prices,
    Typical Price and the average of the Typical Price. (Typical Price is 
    known to some traders as the pivot point.)

Formula Parameters:                     Default:
    * Typical Price                     Blue
       Color of Typival Price line
    * AVG                               Red  
       Color of AVG line
    * Length                            9
    * Typical Price Thickness           1
    * AVG Thickness                     1
    * Display Title Value               False

**********************************/

var fpArray = new Array();
var bInit = false;
var TypPrice = null;

function preMain() {
    setPriceStudy(true);
    setStudyTitle("Typical Price ");
    setCursorLabelName("TypicalPrice", 0);
    setCursorLabelName("AVG", 1);    
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);    
    setPlotType(PLOTTYPE_LINE, 0); 
    setPlotType(PLOTTYPE_LINE, 1);     
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);    

    askForInput();

    var x=0;
    fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Typical Price");
        setDefault(Color.blue);
    }    


    fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("AVG");
        setDefault(Color.red);
    }    

    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
    with(fpArray[x++]){
        setLowerLimit(1);        
        setDefault(9);
    }

    fpArray[x] = new FunctionParameter("LineThickness1", FunctionParameter.NUMBER);
    with(fpArray[x++]){
        setName("Typical Price Thickness");
        setLowerLimit(1);        
        setDefault(1);
    }

    fpArray[x] = new FunctionParameter("LineThickness2", FunctionParameter.NUMBER);
    with(fpArray[x++]){
        setName("AVG Thickness");    
        setLowerLimit(1);        
        setDefault(1);
    }

    fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
       setName("Display Title Value");
       setDefault(false);
    }    
}



function main(Length, LineColor1, LineThickness1, LineColor2, LineThickness2, ViewValue) {
var nTypPrice;
var nAFC;

   if ( bInit == false ) { 
        setDefaultBarFgColor(LineColor1, 0);
        setDefaultBarFgColor(LineColor2, 1);    
        setDefaultBarThickness(LineThickness1, 0);
        setDefaultBarThickness(LineThickness2, 1);    
        TypPrice = hlc3();
        xAFC = sma(Length,TypPrice);
        setShowTitleParameters( ViewValue );
        bInit = true; 
    } 

    
    nTypPrice = TypPrice.getValue(0);
    nAFC = xAFC.getValue(0);
   
    if(nTypPrice==null||nAFC==null) return;

    return new Array (nTypPrice, nAFC); 
}