Before you run your script live or backtest it, you might decide to hide all of your plots.
This will lead to improved performance since the script processing engine will not need to plot every backtest.
What is commenting out your plots?
Simply put, commenting out your plots is putting "//" in front of the line of code, so it doesn't get read by the script processing engine.
This line is NOT commented
plot(close, "close", "#ff0000")
This line IS commented
// plot(close, "close", "#ff0000")
How can I hide the plots with a single variable?
By adding the section of code that has been given below, all you will need to do is turn the input to true or false. If its true, then all of your plots will be shown, If it is false, then the plots will be hidden.
enable_plotting = boolInput("Show plots?", false)
// Wrap all plot() inside the if statement
if (enable_plotting) {
plot(close, "close", "#ff0000")
plot(open, "open", "#00ff00")
plot(high, "high", "#0000ff")
}
Comments
0 comments
Article is closed for comments.