I know how to get the value at the beginning of a bar using the sample code
if (getBarState() == BARSTATE_NEWBAR) {
vFlag = false;
var vData1 = 5;
var vData2 = 1;
if (vData1 > vData2 && vFlag == false) {
vHistoryFile = (vChartTitle + getInterval() + "--Loaded on " + getMonth(0) + "-" + getDay(0) + " at " + getHour(0) + "." + getMinute(0) + "");
vHistoryFileTitle = ("Loaded on: " + getMonth(0) + "-" + getDay(0) + " at " + getHour(0) + "." + getMinute(0));
vFlag = true;
}
}
But how can you grab the last value of the last bar instead
What I am trying to do is have SETCOMPUTEONCLOSE to false, and check the value of an StochD (which is updating on every tick), against the closing value of the last bar. Using a "-1" parameter, study(-1), will not work because that gives me the value of the last tick, not the last closed bar
if (getBarState() == BARSTATE_NEWBAR) {
vFlag = false;
var vData1 = 5;
var vData2 = 1;
if (vData1 > vData2 && vFlag == false) {
vHistoryFile = (vChartTitle + getInterval() + "--Loaded on " + getMonth(0) + "-" + getDay(0) + " at " + getHour(0) + "." + getMinute(0) + "");
vHistoryFileTitle = ("Loaded on: " + getMonth(0) + "-" + getDay(0) + " at " + getHour(0) + "." + getMinute(0));
vFlag = true;
}
}
But how can you grab the last value of the last bar instead
What I am trying to do is have SETCOMPUTEONCLOSE to false, and check the value of an StochD (which is updating on every tick), against the closing value of the last bar. Using a "-1" parameter, study(-1), will not work because that gives me the value of the last tick, not the last closed bar
Comment