You’ll get line 2: no viable alternative at character '$' // @version=2 study($) Pine Script Tutorial | How To Develop Real Trading Strategies On ... Pine Try opening up the pine editor, adding this in and then clicking “add to chart”. line 103: Cannot use 'strategy.risk.allow_entry_in' in local scope. This code is shorter and will run much faster because it does not use a loop and uses the ta.sma () built-in function to accomplish the task: //@version=5 indicator("The Pine Script™ MA", "", true) thePineMA = ta.sma(close, 10) plot(thePineMA) Pine of version 2 (and higher) is better at explaining errors of this kind. Plots — Pine Script™ v5 User Manual v5 documentation As this ‘cannot use in local scope’ error says, we cannot use the plot () function in a local scope. If the box is not checked do not plot the line. Then we set the function’s style argument to linebr (TradingView, n.d.). Pine Script User Manual 4 documentation - TradingView So when you call the plot (close) function in pine script it draws a line at the close price for each data point. When you change the timeframe on the chart the data changes and the indicator or strategy will change completely. There are 2 ways to go about this, depending on your requirements: either with multiple plotshape () calls or with labels. I have a long list of stuff I want to create – see the Roadmap. In the above example, study () and the if statement are examples of that. On the other hand, since it is possible to refer to any variable or function declared in the global scope from the scope of a function (except for self-referencing recursive calls), one can say that the local scope is embedded into the global scope. You should see two lines printed on your chart for the moving averages. This is half introduction, half cheat sheet to get up to speed as quickly as possible before we go through some more in … If the box is checked, the plot the line. In Pine, nested functions are not allowed, i.e., one cannot declare a function inside another one. If you have comments, bug reports, or ideas for new or improved things I might like to create, get in touch using the Contact Form. Pine Script Tutorial - Overlay and Plot function - ForexBee