I need help analyzing Intraday values (Such as minutes Last for ex.) while the chart is on Day time scale or weeks, and maybe 5 minutes
Anybody tried that?
Anybody tried that?
var vLastIndex = null;
var vFirstIndex = null;
function main(Interval) {
if (Interval == null) Interval = 10;
if (getBarState() == BARSTATE_NEWBAR) {
var vBarTime = getValue("time"); // daily bar
if(vBarTime != null) {
vFirstIndex = getFirstBarIndexOfDay(vBarTime, "IBM,"+Interval); // of intraday chart
if (getCurrentBarIndex() < 0) {
vLastIndex = -1 + getFirstBarIndexOfDay(getValue("time", 1), "IBM,"+Interval); // of intraday chart
} else {
var vDate = new Date();
vLastIndex = -1 + getFirstBarIndexOfDay(vDate, "IBM,"+Interval); // of intraday chart
}
if(vFirstIndex != null && vLastIndex != null) {
debugPrintln(getCurrentBarIndex() + " First :" + vFirstIndex + " Last: " + vLastIndex);
if (getCurrentBarIndex() == 0) {
// first bar of day at aData[0]
//var aData = getValue("Close", vFirstIndex, (vLastIndex-vFirstIndex), "IBM,"+Interval);
// last bar of day at aData[0]
var aData = getValue("Close", vLastIndex, -(vLastIndex-vFirstIndex), "IBM,"+Interval);
debugPrintln(aData);
}
}
}
}
}
Comment