When you take a closure look at any pinescript it has following key components.
- Variable definitions
- Logic and calculations
- Graph plotting
- Plotting shapes
- Alerts
This can serves as a guide while writing your own pine-script.
When you take a closure look at any pinescript it has following key components.
This can serves as a guide while writing your own pine-script.
Price-Base line setup
Confirmations
Conversion line – Base line setup
Confirmations
Cloud Penetration setup
Confirmations
TradingView related websites
Tradingview : Main TradingView platform website
Kodify – Tradingview : Excellent site to learn the pine-script language
BigBits Pinescript tutorials
Investment platforms
Zerodha : Main trading platform
Smallcase : Simple & easy way to invest in ready-made stock portfolios
Streak : Zerodha platform to build algo scripts based on various conditions
INDICATOR NAME : SMA Crossover
INDICATOR TYPE : MA – Lagging indicator
MARKETS : Stocks
WORKS BEST IN : Trending / sideways market
THEORY :
This is a simple Moving average crossover strategy using Two Moving averages. I have used 12 day SMA and 26 day SMA for strategy constructions.
This is a long strategy
BUY when Fast MA (12 day SMA) Cross above Slow MA (26 day SMA)
SELL when Fast MA (12 day SMA) Cross Below Slow MA (26 day SMA)
SL with 1% TP with 2%
FORMULA :
ENTRY
BUY 1 share when 12 SMA crosses above 26 SMA. Enter trade between 09:00 to 23:59
EXIT
SELL 1 share when 12 SMA crosses below 26 SMA or at stop loss of 1% or target profit of 2%

OPTIMISATION :
Here is a list of limitations of zerodha strem platform . This list will be updated on a continuous basis.
STRATEGY LIMITATIONS
Strategy creation does not have MATH functions which are otherwise available in Scan creation
Strategy creation does not have Period High / Period Low functions which are otherwise available in Scan creation
OffSet option is not available for indicators like RSI
Comment fields in the “Strategy” definition is required so that we can add comments relating to strategy construction and logic for building up the strategy.
SCAN LIMITATIONS
Copy Scan option should be available so that we can copy the existing scan to create new scan