Troubleshooting a problem with plots
Posted: Sat Jun 16, 2018 12:11 am
I'm hoping someone (Earik?) can help me understand what's going wrong here. The following example script results in a line plotted only after barnumber = 9000. Nothing gets plotted before that bar. That doesn't seem right. Why does the calculation of vRSI (which is never plotted) affect whether a different variable gets plotted?
if (barnum == barsback) {
vPlot = 10;
vPlot_color = white;
vRSI = 50;
}
if (barnum < 9000) {
vRSI = 55;
} else {
vRSI = rsi(c, 20);
}
plot1 = vPlot; color1 = vPlot_color;
plot2 = 0; color2 = gray;
plot3 = 100; color3 = gray;
if (barnum == barsback) {
vPlot = 10;
vPlot_color = white;
vRSI = 50;
}
if (barnum < 9000) {
vRSI = 55;
} else {
vRSI = rsi(c, 20);
}
plot1 = vPlot; color1 = vPlot_color;
plot2 = 0; color2 = gray;
plot3 = 100; color3 = gray;