Range Extension for eSignal

A couple of months ago I posted a study for thinkorswim that would plot the difference between the opening price and the current price (range extension). Recently, I've been evaluating eSignal and decided to reproduce that study.

This is a simple study for eSignal that plots the range from an opening price to the current price for the current bar. The difference in the two prices is shown in either ticks or absolute price depending on the input setting.








In this example the Euro is up 8 ticks from the opening. For those of you that looked at the TOS study, you might have noticed that we had the ability to set alerts. I have not included it here.

Enjoy,

Andy



//plotExtension
// Plots the realtime difference in ticks between
// the opening and the closing price.
// DeltaLatitude © April 2011       
//
// This work is licensed under the Creative Commons Attribution
// 3.0 Unported License. To view a copy of this license, visit
// http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 171 Second Street,
// Suite 300, San Francisco, California, 94105, USA.                      


function preMain() {

    setPriceStudy(true);
    setStudyTitle("plotExtension");
    setCursorLabelName("plotExt",0);
    
    var fp1 = new FunctionParameter("useTick", FunctionParameter.BOOLEAN);
        fp1.setName("Plot Tick Values");
        fp1.setDefault(true);
}

function main(useTick) {

    var barState = getBarState();
    
    var extension;
    if (useTick) {
       extension = (Math.round((close(0) - open(0))/getMinTick())).toFixed(0);
    } else {
        extension = (close(0) - open(0)).toFixed(4);
    }
    
    if (barState == BARSTATE_CURRENTBAR)  {
        drawTextRelative(0, close(0), "  " + extension, Color.red, null,
            Text.Bold|Text.LEFT|Text.VCENTER, null, 12, "current");
    }
    

    return extension;
    
}



1 comment:

Dean said...

Awesome! just a few days ago I was searching forums and the web for this exact indie. Thanks for posting!