Interactive Code Examples Guide¶
This page demonstrates the interactive code features available in our documentation. Use these patterns when contributing or reading technical content.
✨ Features Available¶
1. Tabbed Code Examples¶
Show multiple scenarios or languages side-by-side:
2. Highlighted Lines¶
Draw attention to specific lines:
- Parse incoming JSON from TradingView
- Check confidence level before processing
- Execute trade logic if validation passes
3. Line Numbers & Linking¶
Click line numbers to link directly:
4. Inline Code Highlighting¶
Use def calculate(): for inline syntax highlighting, or emphasize with const value = 42 inline.
Examples:
- Alert condition: ta.crossover(close, sma)
- JSON key: "message": "{{ close }}"
- Python check: if signal == 'BUY':
5. Interactive Checklists¶
Track your progress:
Alert Setup Checklist¶
- TradingView Premium account (required for webhooks)
- Signal Pilot indicator installed
- Alert created with "Once Per Bar Close" setting
- Webhook URL configured (if using automation)
- Test alert sent successfully
- Notification delivery confirmed
Webhook Integration¶
- Webhook endpoint created
- SSL certificate installed (https required)
- JSON parsing implemented
- Error handling added
- Logs monitoring setup
- Production testing completed
6. Code Annotations¶
Add numbered explanations:
- TD Length: Number of bars to look back for TD Sequential
- Show Labels: Toggle label display on/off
- tdCount: Persistent variable tracks consecutive TD signals
- TD Buy Condition: Price must close below close 4 bars ago
- Display Logic: Only show label when count reaches 9 and labels enabled
7. Multi-Language Tabs¶
Show same concept in different languages:
💡 Best Practices¶
When to Use Each Feature
- Tabs: Multiple approaches or languages
- Highlighting: Draw attention to critical lines
- Annotations: Explain complex logic step-by-step
- Checklists: Setup guides and prerequisites
- Inline highlighting: Quick syntax references
Real-World Usage
See these features in action: - How to Set Alerts - Tabbed examples - Pentarch v1.0 - Code annotations - Prerequisites - Interactive checklists
🎨 Syntax Support¶
Supported languages for syntax highlighting:
| Language | Code | Example |
|---|---|---|
| PineScript | pinescript |
TradingView indicators |
| Python | python |
Webhook receivers |
| JavaScript | javascript, js |
Node.js automations |
| JSON | json |
API payloads |
| Bash | bash, sh |
Shell scripts |
| YAML | yaml |
Configuration files |
Need help? Check the MkDocs Material documentation for more advanced features.