I've written a script to determine the daily high, low and closing prices as follows:
/*************************
Debug
**************************/
var DebugDone = false;
function preMain() {
setPriceStudy (true);
}
function main() {
var sHigh = null;
var sLow = null;
var sClose = null;
var sDay = null;
var i = 0;
if (DebugDone == false) {
debugClear();
sHigh = high (inv("D"));
sLow = low (inv("D"));
sClose = close (inv("D"));
sDay = day (inv("D"));
debugPrintln ("i ", "Day ", "High ", "Low ", "Close ");
for (i = 0; i >= -2; i--) {
debugPrintln (i+" ", sDay.getValue(i)+" ", sHigh.getValue(i)+" ", sLow.getValue(i)+" ", sClose.getValue(i)+" ");
}
DebugDone = true;
}
return;
}
Using a 24 hour chart, I loaded the formula and determine the high, low and closing prices for the last 3 days. Then I changed the time template for the chart, and visually confirmed that the T+1 session prices were not shown. I reloaded the script again, and the high, low and closing prices for the last 3 days remained the same as for the 24 hour chart.
How can I obtain the high, low and closing prices for a particular trading day, exclusing the T+1 session on the same calendar day?
/*************************
Debug
**************************/
var DebugDone = false;
function preMain() {
setPriceStudy (true);
}
function main() {
var sHigh = null;
var sLow = null;
var sClose = null;
var sDay = null;
var i = 0;
if (DebugDone == false) {
debugClear();
sHigh = high (inv("D"));
sLow = low (inv("D"));
sClose = close (inv("D"));
sDay = day (inv("D"));
debugPrintln ("i ", "Day ", "High ", "Low ", "Close ");
for (i = 0; i >= -2; i--) {
debugPrintln (i+" ", sDay.getValue(i)+" ", sHigh.getValue(i)+" ", sLow.getValue(i)+" ", sClose.getValue(i)+" ");
}
DebugDone = true;
}
return;
}
Using a 24 hour chart, I loaded the formula and determine the high, low and closing prices for the last 3 days. Then I changed the time template for the chart, and visually confirmed that the T+1 session prices were not shown. I reloaded the script again, and the high, low and closing prices for the last 3 days remained the same as for the 24 hour chart.
How can I obtain the high, low and closing prices for a particular trading day, exclusing the T+1 session on the same calendar day?
Comment