Skip to content

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

TemplateCategoryDescription
Blank ScriptStarterEmpty starter with basic structure
Simple Moving AverageTrendSMA of selected source over a period
Bollinger BandsTrendSMA with standard deviation bands
RSIMomentumRelative Strength Index with colored zones
EMA CrossoverTrendFast/slow EMA crossover signal
MACDMomentumMACD with signal line and histogram
ATR BandsTrendPrice bands based on ATR volatility
SuperTrendTrendATR-based trend follower with dynamic coloring
MACD EnhancedMomentumMACD with 4-color histogram showing momentum direction
StochasticMomentumStochastic %K/%D with overbought/oversold zones
Hull MATrendLow-lag Hull Moving Average with trend coloring
VWMA with BandsTrendVolume-weighted MA with standard deviation envelope
EMA Crossover StrategyStrategyBuy/sell strategy based on EMA crossover signals
RSI Mean Reversion StrategyStrategyBuy oversold / sell overbought using RSI

Using a Template

  1. Open CodeLab from the navigation bar
  2. Click the New button in the toolbar
  3. Select a template from the dropdown
  4. The code loads into the Monaco editor
  5. Modify inputs, logic, or colors to fit your needs
  6. Click Run (or press Ctrl+Enter) to preview
  7. 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.blue for any color constant or hex string
  • Add signals: Use plotShape() to mark buy/sell points
  • Combine indicators: Import functions from multiple categories

ChartLabs Documentation