WeeklyMidpointOnIntraday.efs

ICE Data Services -

WeeklyMidpointOnIntraday.efs  

File Name: WeeklyMidpointOnIntraday.efs

Description:
Draws the previous week's midpoint on intra-day charts.

Formula Parameters:

NA

Notes:
NA

Download File:
WeeklyMidpointOnIntraday.efs



EFS Code:

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


function preMain() {
    setPriceStudy(true);
    setStudyTitle("Weekly Midpoint ");
    setDefaultBarFgColor(Color.lime);
    setCursorLabelName("Wk Midpoint");
}

var vMid = null;
var vMid1 = null;

function main() {    
    var vI = getInterval();
    if (vI == "M" || vI == "W" || vI == "D") return;

    var vSymbol = getSymbol() + ",W";

    var vDay0 = getDay();
    var vDay1 = getDay(-1);
    if (vDay0 != vDay1) {
        vMid1 = vMid;
        var vBarTime = getValue("time");
        if(vBarTime != null) {
            vIndex = getFirstBarIndexOfDay(vBarTime, vSymbol);
            if(vIndex != null) {
                vH = getValueAbsolute("High", vIndex, vSymbol);
                vL = getValueAbsolute("Low",  vIndex, vSymbol);
                if(vH != null && vL != null) {
                    vMid = (vH + vL) / 2;
                    return vMid1;
                }
            } 
        }
    }

    return vMid1;
}