TV Script - Trading Dashboard Documentation

Comprehensive documentation for TradingView Pine Script indicators and trading strategies

View the Project on GitHub tekram/tv-script

Inside Candle Patterns

Overview

Inside candle patterns identify consolidation periods where one candle is completely contained within the previous candle’s range. These patterns often precede significant price moves and are valuable for identifying potential breakout setups.

Types of Inside Patterns

Inside Week

Condition: Previous week’s high is lower than 2 weeks ago high, AND previous week’s low is higher than 2 weeks ago low

Formula:

isInsideWeekCandle = (prior_week_high < twoPriorWeekHigh and 
                      prior_week_low > twoPriorWeekLow)

Visual: Purple background in top-right table Display: Shows week high/low range when detected

Inside Candle (Configurable Timeframe)

Condition: 2 bars ago high/low contains previous bar’s high/low

Formula:

isInsideCandle = (twoPriorthirtyMinHigh >= prevThirtyMinHigh and 
                  twoPriorthirtyMinLow <= prevThirtyMinLow)

Default Timeframe: 30-min (configurable) Visual: Shows in top-right table with timeframe label

Configuration

Timeframe Selection

Display Options

Visual Display

Inside Week Display

Inside Candle Display

Trading Applications

Breakout Trading

Position Building

Risk Management

Best Practices

  1. Wait for Confirmation: Don’t enter until breakout occurs
  2. Volume Check: Require volume increase on breakout
  3. Structure Alignment: Best when inside pattern aligns with structure
  4. Multiple Timeframes: Check inside patterns on multiple timeframes
  5. Market Context: Inside patterns work best in trending markets

Technical Details

Data Fetching

// Weekly data
[prior_week_high, prior_week_low, twoPriorWeekHigh, twoPriorWeekLow] = 
    request.security(syminfo.tickerid, 'W', 
        [high[1], low[1], high[2], low[2]], 
        lookahead=barmerge.lookahead_on)

// Configurable timeframe data
twoPriorthirtyMinHigh = request.security(syminfo.tickerid, 
                                         insideCandleTimeframe, high[2])
twoPriorthirtyMinLow = request.security(syminfo.tickerid, 
                                        insideCandleTimeframe, low[2])
prevThirtyMinHigh = request.security(syminfo.tickerid, 
                                     insideCandleTimeframe, high[1])
prevThirtyMinLow = request.security(syminfo.tickerid, 
                                    insideCandleTimeframe, low[1])

Display Logic