I would want to see a shape every time the symbol called with the function request.security is updated. This symbol is updated monthly and I would want to use this indicator on weekly or daily charts. So far, I've only been able to plot one shape per period...
If that's not possible, I'd be happy to see a shape every time the indicator value changes.
//@version=5
indicator(title="OECD Leading indicators", overlay=false, timeframe = "1M", timeframe_gaps = false)
plt = request.security("FRED:USALOLITONOSTSAM", timeframe="1M", expression=close)
plot(plt, color=color.blue, linewidth=2)
// Didn't work with if or using plt2 or plt3 instead of plt
plt2 = plt != plt[1]
plt3 = ta.change (plt) != 0
plotshape(plt, style=shape.circle, location = location.absolute, size=size.tiny, color=color.rgb(54, 58, 69, 40))
It is not clear why you use the timeframe argument in the indicator function; it is needed to calculate your indicator on the current symbol, but on a different timeframe. Because of this, your conditions plt2 and plt3 are not valid, because compare the data of the current and previous month, that is, the values will always differ, because every month you get a new value. You are already requesting data through security with a timeframe of 1 month for the instrument you need, so these parameters are not needed.
Everything else is correct, you just need to spruce it up a little
//@version=5
indicator(title="OECD Leading indicators", overlay=false)
plt = request.security("FRED:USALOLITONOSTSAM", timeframe="1M", expression=close)
plot(plt, color=color.blue, linewidth=2)
plt2 = plt != plt[1] ? plt : na
plotshape(plt2, style=shape.circle, location = location.absolute, size=size.tiny, color=color.rgb(54, 58, 69, 40))