![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhN3zFfW8rGnVgPbbWN3fr8r0yYebscCGJ03GkEBreVNYLHwEv3w0GirivQh-g1I1F3YUqjQ7Pm6-KMe-TKKx0gNDfMxoSYHYPCrzjDeomy7k_xMynzyPw71KKxd5XTY_Mry9_1fAflILF/s400/email1.jpg)
A reader wrote in and asked a question. I'm not sure if I understood exactly what my reader wanted to do but here is one example of leveraging TOS studies.
Reference SimpleMovingAvg(length=21). That would return the SMA value for that bar. If the SMA(21) was less than the close of that bar it would print a point at the specified value.
insideBar.setHiding( if(close > reference SimpleMovingAvg(length=21),1,0));
So if(close > reference SimpleMovingAvg(length=21),1,0)) says that if close > SMA(21) then return true, else return false. Return value true activates the Hide function, return value 0 does not activate it.
(Thanks for the email. I hope you don't mind me sharing a portion of it so all can learn. Best regards, Freethinkscript).
input offset = 1 ;
plot InsideBar = if close < close[1] then high + offset else double.NaN;
insideBar.SetPaintingStrategy(paintingStrategy.POINTS);
InsideBar.SetDefaultColor(color.LIGHT_GREEN);
insideBar.SetLineWeight(5);
insideBar.setHiding( if(close > reference SimpleMovingAvg(length=21),1,0));