2012 Feb: Trade Breakouts And Retracements With TMV by Barbara Star

ICE Data Services -

Volume_Peaks.efs, ADX_MA_Price_Relation.efs, KeltnerChannel-TMV.efs  

EFSLibrary - Discussion Board  

 

File Name: Volume_Peaks.efs, ADX_MA_Price_Relation.efs, KeltnerChannel-TMV.efs

 

Description:
Trade Breakouts And Retracements With TMV by Barbara Star

 

Formula Parameters:

Volume_Peaks.efs

  • Short Volume Average Period: 1
  • Long Volume Average Period: 20
  • Level, %: 50

ADX_MA_Price_Relation.efs

  • ADX Period: 10
  • ADX Smoothing: 10
  • MA Period: 8
  • MA Type: Simple

KeltnerChannel-TMV.efs

  • nInputLength: null
  • nConst: null

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

 

Download File:
Volume_Peaks.efs
ADX_MA_Price_Relation.efs
KeltnerChannel-TMV.efs

Volume_Peaks.efs, ADX_MA_Price_Relation.efs,KeltnerChannel-TMV.efs



EFS Code:

Volume_Peaks.efs

/*********************************
Provided By:  
    Interactive Data Corporation (Copyright © 2011) 
    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:        
    Trade Breakouts And Retracements With TMV
	
Version:            1.00  8/11/2011

Formula Parameters:                     Default:
Short Volume Average Period             1
Long Volume Average Period              20
Level, %                                50

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()
{      
    setPriceStudy(true);
    
    setStudyTitle("Volume Peaks");
    
    setShowSeries(false, 0);
    
    var x=0;      
    fpArray[x] = new FunctionParameter("shortVolPeriod", FunctionParameter.NUMBER);
    with(fpArray[x++])
    {
	setName("Short Volume Average Period");
	setLowerLimit(1);
        setUpperLimit(1000);
        setDefault(1);
    }
    
    fpArray[x] = new FunctionParameter("longVolPeriod", FunctionParameter.NUMBER);
    with(fpArray[x++])
    {
	setName("Long Volume Average Period");
	setLowerLimit(1);
        setUpperLimit(1000);
        setDefault(20);
    }  
    
    fpArray[x] = new FunctionParameter("level", FunctionParameter.NUMBER);
    with(fpArray[x++])
    {
	setName("Level, %");
	setLowerLimit(1);
        setUpperLimit(100);
        setDefault(50);
    }  
}

var bInit = false;
var bVersion = null; 

var xShortVolAvg = null;
var xLongVolAvg = null;
var xVol = null;

function main(shortVolPeriod, longVolPeriod, level)
{
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (!bInit)
    { 
        xVol = volume();        

        xShortVolAvg = sma(shortVolPeriod, xVol);
        xLongVolAvg = sma(longVolPeriod, xVol);
        
        bInit = true;
    }
    
    var nShortVolAvg = xShortVolAvg.getValue(0);
    var nLongVolAvg = xLongVolAvg.getValue(0);
    
    if (nLongVolAvg == null)
        return;   
    
    var res = (nShortVolAvg - nLongVolAvg) * 100 / nLongVolAvg;
    
    if (res > level)
    {
        drawShape(Shape.TRIANGLE, BottomRow2, Color.red);
        
        setBarFgColor(Color.red, 0);
        
        return res;
    }
    
    return;
}


// verify version
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;
}


ADX_MA_Price_Relation.efs

/*********************************
Provided By:  
    Interactive Data Corporation (Copyright © 2011) 
    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:        
    Trade Breakouts And Retracements With TMV
	
Version:            1.00  8/11/2011

Formula Parameters:                     Default:
ADX Period                              10
ADX Smoothing                           10
MA Period                               8
MA Type                                 Simple

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()
{      
    setPriceStudy(true);
    
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.grey);
    
    setStudyTitle("ADX_MA_Price_Relation");
    
    var x=0;      
    fpArray[x] = new FunctionParameter("adxPeriod", FunctionParameter.NUMBER);
    with(fpArray[x++])
    {
	setName("ADX Period");
	setLowerLimit(1);
        setUpperLimit(1000);
        setDefault(10);
    }
    
    fpArray[x] = new FunctionParameter("adxSmoothing", FunctionParameter.NUMBER);
    with(fpArray[x++])
    {
	setName("ADX Smoothing");
	setLowerLimit(1);
        setUpperLimit(1000);
        setDefault(10);
    }
 
    fpArray[x] = new FunctionParameter("maPeriod", FunctionParameter.NUMBER);
    with(fpArray[x++])
    {
	setName("MA Period");
	setLowerLimit(1);
        setUpperLimit(1000);
        setDefault(8);
    } 
 
    fpArray[x] = new FunctionParameter("maType", FunctionParameter.STRING);
    with(fpArray[x++])
    {
	setName("MA Type");
        addOption("Simple");
        addOption("Exponential");
        addOption("Weighted");
        addOption("Volume Weighted");
        setDefault("Simple");
    } 
}

var bInit = false;
var bVersion = null; 

var xADX = null;
var xMA = null;

function main(adxPeriod, adxSmoothing, maPeriod, maType)
{
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (!bInit)
    {               
        switch (maType)
        {
            case "Simple" :
                xMA = sma(maPeriod);
                break;
            case "Exponential" : 
                xMA = ema(maPeriod);
                break;
            case "Weighted" :
                xMA = wma(maPeriod);
                break;
            case "Volume Weighted" :
                xMA = vwma(maPeriod);
                break;
            default : return;
        }
        
        xADX = adx(adxPeriod, adxSmoothing);
        
        bInit = true;
    }
    
    var nMA = xMA.getValue(0);
    
    var nADX = xADX.getValue(0);
    var nnADX = xADX.getValue(-1);
    
    if (nMA == null || nADX == null)
        return;
    
    if (nADX > nnADX)
    {       
        if (close(0) > nMA)
            setPriceBarColor(Color.green);
        else if (close(0) < nMA)
            setPriceBarColor(Color.red);
    }
    
    return;
}


// verify version
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;
}


KeltnerChannel-TMV.efs

/*******************************************************************
Description	: This Indicator plots Keltner Bands as shown in TASC_Feb_2012 article by Barbara Star: 
Trade Breakouts And Retracements With TMV  

Provided By	: TS Support, LLC. (c) Copyright 2002 

Modified KeltnerChannels.efs with change Factor = 2.5 to = 1  


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

function preMain() {
    setPriceStudy(true);
    
    /* Set the title that will appear in the study pane */
    setStudyTitle("Keltner");

    /* Set the label that will appear in the cursor window */
    setCursorLabelName("K-Upper", 0);
    setCursorLabelName("K-Basis", 1);
    setCursorLabelName("K-Lower", 2);

    setDefaultBarFgColor(Color.blue, 0); // upper
	setDefaultBarFgColor(Color.red, 1); // basis
	setDefaultBarFgColor(Color.blue, 2); // lower
}


function main(nInputLength, nConst) {
	if(nInputLength == null)
		nInputLength = 20;
	if(nInputLength <= 0)
		nInputLength = 20;
	
	var Factor = 1;//Changed from 2.5
	if (nConst != null) Factor = nConst;


	var vHigh = getValue("High", 0, -nInputLength);
	var vLow = getValue("Low", 0, -nInputLength);
	var vClose = getValue("Close", 0, -nInputLength);
	if(vHigh == null || vLow == null || vClose == null)
		return;

	var vHLC3 = 0;
	var vHminL = 0;
	var i;

	for(i = 0; i < nInputLength; i++) {
		vHLC3 += (vHigh[i] + vLow[i] + vClose[i]) / 3;
		vHminL += vHigh[i] - vLow[i];
	}

	vHLC3 /= nInputLength;
	vHminL /= nInputLength;
	vHminL *= Factor;


	return new Array(vHLC3 + vHminL, vHLC3, vHLC3 - vHminL);
}