Templates
CodeLab includes built-in templates to get you started quickly. Each template is a complete, working indicator that you can use as-is or modify.
Available Templates
| Template | Category | Description |
|---|---|---|
| Blank Script | Starter | Empty starter with basic structure |
| Simple Moving Average | Trend | SMA of selected source over a period |
| Bollinger Bands | Trend | SMA with standard deviation bands |
| RSI | Momentum | Relative Strength Index with colored zones |
| EMA Crossover | Trend | Fast/slow EMA crossover signal |
| MACD | Momentum | MACD with signal line and histogram |
| ATR Bands | Trend | Price bands based on ATR volatility |
| SuperTrend | Trend | ATR-based trend follower with dynamic coloring |
| MACD Enhanced | Momentum | MACD with 4-color histogram showing momentum direction |
| Stochastic | Momentum | Stochastic %K/%D with overbought/oversold zones |
| Hull MA | Trend | Low-lag Hull Moving Average with trend coloring |
| VWMA with Bands | Trend | Volume-weighted MA with standard deviation envelope |
| EMA Crossover Strategy | Strategy | Buy/sell strategy based on EMA crossover signals |
| RSI Mean Reversion Strategy | Strategy | Buy oversold / sell overbought using RSI |
Using a Template
- Open CodeLab from the navigation bar
- Click the New button in the toolbar
- Select a template from the dropdown
- The code loads into the Monaco editor
- Modify inputs, logic, or colors to fit your needs
- Click Run (or press
Ctrl+Enter) to preview - Click Add to Chart to apply to your live chart
Template Categories
Trend Templates
Best for identifying and following market direction. These typically use overlay: true to draw on the price chart.
Momentum Templates
Best for gauging the speed and strength of price movements. These plot in a separate sub-pane below the chart.
Strategy Templates
Include entry/exit logic with position tracking. Can be backtested using the Backtest button.
Customizing Templates
Every template is meant to be a starting point. Common modifications:
- Change periods: Adjust
input.number()defaults for different timeframes - Add sources: Let users pick the data source with
input.source() - Change colors: Swap
color.bluefor any color constant or hex string - Add signals: Use
plotShape()to mark buy/sell points - Combine indicators: Import functions from multiple categories

