TickiExtremes.efs

ICE Data Services -

TickiExtremes.efs    

File Name: TickiExtremes.efs

Description:
Non-price study of $TICKI draws HLC information and colors the bar red as the $TICKI High or Low exceeds the upper or lower extreme parameters.

Formula Parameters:

  • nTickiHigh: Default is 24
  • nTickiLow: Default is -24
  • nNumBars: Default is 150

Notes:
NA

Download File:
TickiExtremes.efs



EFS Code:

/*****************************************************************
Provided By : eSignal. (c) Copyright 2003
*****************************************************************/

/***  Updated:  5/30/03

*Changed logic for creating HL bars from histograms to drawLineRelative()
    lines similar to TickExtremes.efs.

***/

/***  Updated:  4/30/03

*Changed color scheme to red(extreme breach)/blue(no breach).
*Logic for High/Low of bar improved.
*Fixed bug for Edit Studies change of nTickiHigh/nTickiLow.

***/

function preMain() {
    setStudyTitle(" Ticki Extremes ");
    setCursorLabelName("TICKI  H", 0);
    setCursorLabelName("TICKI  L", 1);
    setCursorLabelName("TICKI  C", 2);
    setPlotType(PLOTTYPE_DOT, 0);
    setPlotType(PLOTTYPE_DOT, 1);
    setPlotType(PLOTTYPE_FLATLINES, 2);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setDefaultBarThickness(1, 2);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.blue, 1);
    setDefaultBarFgColor(Color.black, 2);    
}

var vColor = Color.blue;
var vLoaded = false;
var barH = null;
var barL = null;
var vNum = 150;
var BarCntr = 0;

function main(nTickiHigh, nTickiLow,  nNumOfBars) {
    if (nTickiHigh == null) nTickiHigh = 24;
    if (nTickiLow == null) nTickiLow = -24;
    if (vLoaded == false) {
        if (nNumOfBars != null) vNum = Math.abs(Math.round(nNumOfBars));
        addBand(nTickiHigh, PS_SOLID, 1, Color.yellow, "top");
        addBand(0, PS_SOLID, 1, Color.grey, "zero");
        addBand(nTickiLow, PS_SOLID, 1, Color.yellow, "bottom");
        vLoaded = true;
    }
    
    var c = close(0, 1, "$ticki")*1;
    if (c == null) return;

    if (getBarState() == BARSTATE_NEWBAR) {
        if (BarCntr < vNum) {
            BarCntr += 1;
        } else {
            BarCntr = 0;
        }
        vColor = Color.blue;
        barH = c;
        barL = c;
    }
    
    var h = high(0, 1, "$ticki")*1;
    if (h == null) return;
    var l = low(0, 1, "$ticki")*1;
    if (l == null) return;
    
    barH = Math.max(barH, h, c);
    barL = Math.min(barL, l, c);
    
    if (barH > nTickiHigh) {
        vColor = Color.red;
    }
    if (barL < nTickiLow) {
        vColor = Color.red;
    }

    
    setBarFgColor(vColor, 0);
    setBarFgColor(vColor, 1);

    drawLineRelative(0, barL, 0, barH, PS_SOLID, 3, vColor, "bar" + BarCntr);
    
    return new Array(barH, barL, c);
}