Posts

Showing posts with the label Multi-Timeframe

Pine Script Learning Roadmap: From First Indicator to Advanced Strategy Backtesting

Image
Learning Pine Script efficiently requires a structured progression — jumping directly into complex strategies without mastering the execution model and type system leads to subtle bugs that are difficult to diagnose. This roadmap organizes the learning path into five discrete stages, each building on verified language mechanics, so every concept introduced is grounded in the official Pine Script v6 Reference Manual. 🗺️ Overview: The Five-Stage Learning Path graph TD S1["Stage 1 Language Foundations & Execution Model"] --> S2["Stage 2 Type System & Built-in Series"] S2 --> S3["Stage 3 TA Functions & Plotting"] S3 --> S4["Stage 4 Arrays, UDTs & Drawing Objects"] S4 --> S5["Stage 5 Strategy Backtesting & request.security()"] style S1 fill:#4a90d9,color:#fff,stroke:#2c6fad style S2 fill:#5ba85a,color:#fff,stroke:#3d7a3c style S3 fill:#e8a838,col...

Pine Script v6: How to Use request.security to Fetch Higher-Timeframe Data

Image
When building multi-timeframe indicators in TradingView, one of the most common needs is to overlay a higher-timeframe signal — such as a daily moving average — onto a lower-timeframe chart like a 15-minute view. The request.security() function is the primary tool for this task in Pine Script v6, and understanding its parameters precisely is essential for writing accurate, non-repainting indicators and strategies. 1. What Is request.security() ? request.security() allows a Pine Script to fetch the value of any expression as it would be calculated on a different symbol or timeframe. The result is then mapped back onto the current chart's bar timeline. This is the foundation of multi-timeframe (MTF) analysis in Pine Script. For the full official signature, refer to the Reference Manual: request.security() — Pine Script v6 Reference . 2. Core Parameters Explained The following table describes the most critical parameters you will u...