I am a complete noob to coding but I have a script with a lot of indicators in it. Like vwap, ema, sma. Now I can't figure out how to plot the vwap so it's only visible on 1-5 min timeframe and the MA's only visibile on the 30+ min chart. Is this possible?, because I rather have everything in one script then have three different and select the visibility in options.
You can use the below function to get the resolution in minutes. Then plot the things you want to plot based on that.
f_resInMinutes() =>
_resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
res_in_min = f_resInMinutes()
can_plot_ma = res_in_min >= 30