I'm hoping someone can help me with the following efs.
The calculations for Net Change and Net % Change don't work properly for Australian Indices.
During trading hours the values are calculated from 2 days ago rather than the previous day.
Strangely I don't seem to have this problem with U.S. Indices.
Any help would be greatly appreciated.
Eric
function preMain() {
setPriceStudy(true);
setStudyTitle("XJO Price")
setShowCursorLabel(false);
}
function main() {
var vSymbol = close(0, -3, "$XJO-ASX,D");
var vChange = vSymbol[0]-vSymbol[1];
var vChngPct = ((vSymbol[0]-vSymbol[1])/vSymbol[1])*100
if(vChange>=0){
drawTextRelative(2,375,"$XJO-ASX: "+vSymbol[0].toFixed(2)+" Net: "+vChange.toFixed(2)+" Net%: "+vChngPct.toFixed(2),
Color.blue,null,Text.RELATIVETOLEFT|Text.BOLD|Text .RELATIVETOBOTTOM,"MS Sans Serif",12,1);
}
if(vChange<0){
drawTextRelative(2,375,"$XJO-ASX: "+vSymbol[0].toFixed(2)+" Net: "+vChange.toFixed(2)+" Net%: "+vChngPct.toFixed(2),
Color.red,null,Text.RELATIVETOLEFT|Text.BOLD|Text. RELATIVETOBOTTOM,"MS Sans Serif",12,1);
}
return ;
}
The calculations for Net Change and Net % Change don't work properly for Australian Indices.
During trading hours the values are calculated from 2 days ago rather than the previous day.
Strangely I don't seem to have this problem with U.S. Indices.
Any help would be greatly appreciated.
Eric
function preMain() {
setPriceStudy(true);
setStudyTitle("XJO Price")
setShowCursorLabel(false);
}
function main() {
var vSymbol = close(0, -3, "$XJO-ASX,D");
var vChange = vSymbol[0]-vSymbol[1];
var vChngPct = ((vSymbol[0]-vSymbol[1])/vSymbol[1])*100
if(vChange>=0){
drawTextRelative(2,375,"$XJO-ASX: "+vSymbol[0].toFixed(2)+" Net: "+vChange.toFixed(2)+" Net%: "+vChngPct.toFixed(2),
Color.blue,null,Text.RELATIVETOLEFT|Text.BOLD|Text .RELATIVETOBOTTOM,"MS Sans Serif",12,1);
}
if(vChange<0){
drawTextRelative(2,375,"$XJO-ASX: "+vSymbol[0].toFixed(2)+" Net: "+vChange.toFixed(2)+" Net%: "+vChngPct.toFixed(2),
Color.red,null,Text.RELATIVETOLEFT|Text.BOLD|Text. RELATIVETOBOTTOM,"MS Sans Serif",12,1);
}
return ;
}
Comment