I am still learning pinescript, and part of this was created using the Pine Script language reference manual. This includes looking at the time series, a fixed length, and the default intraday_loss variables. This also includes the basic fixed lengths for an swma (Symmetrically weighted moving average) and the script to start creating a strategy. All in all this is just a basic sample of pinescript that you can customize for your trading needs. This can work with Cryptocurrency but these moving averages usually work more efficiently for forex.