ok, thankyou, I see that the code as posted works. I need the daily close returned every bar so I tried the following code, (I just removed the isLastBarOnChart() && section and changed the getValue to (0))
However, Today's close is being returned all the way back to midnight last night, even though the close of the market which the current close price refers to occured at 15:30 Japan time, which was only about 5 hours ago.
Is there a simple fix to have the daily close price change at the daily close time of 15:30?
Thank you again
var xClose = null;
var bDone = false;
function preMain() {
setPriceStudy(false);
setStudyTitle("DailyClose");
setCursorLabelName("THU", 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(2, 0);
setPlotType(PLOTTYPE_LINE, 0);
addBand( 0, PS_DASH, 1, Color.white,"line");
}
function main(){
if(getBarState()==BARSTATE_ALLBARS){
xClose = close(sym("THU N2-TCM,D"));
}
if(bDone==false){
return( xClose.getValue(0));
bDone=true;
}
However, Today's close is being returned all the way back to midnight last night, even though the close of the market which the current close price refers to occured at 15:30 Japan time, which was only about 5 hours ago.
Is there a simple fix to have the daily close price change at the daily close time of 15:30?
Thank you again
var xClose = null;
var bDone = false;
function preMain() {
setPriceStudy(false);
setStudyTitle("DailyClose");
setCursorLabelName("THU", 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(2, 0);
setPlotType(PLOTTYPE_LINE, 0);
addBand( 0, PS_DASH, 1, Color.white,"line");
}
function main(){
if(getBarState()==BARSTATE_ALLBARS){
xClose = close(sym("THU N2-TCM,D"));
}
if(bDone==false){
return( xClose.getValue(0));
bDone=true;
}
Comment