OPEN-SOURCE SCRIPT
CISD with fib/range extensions and stats

Overview
The "CISD with range/fib extensions and stats" indicator is a powerful and versatile tool designed for traders seeking to identify and capitalise on market structure shifts across various asset classes, including stocks, forex, cryptocurrencies, and commodities. Built for TradingView using Pine Script v6, this indicator detects Changes in the State of Delivery (CISD), which are pivotal price levels indicating potential trend reversals or continuations. It enhances trading decisions by plotting these levels on the chart, offering optional Fibonacci or Range Multiple extensions, and providing a statistical table to track the reliability of these levels. With customisable alerts and filters, the indicator is suitable for both novice and experienced traders looking to integrate market structure analysis into their strategies.
What the Indicator Does
The indicator identifies two types of CISD levels:
Bullish CISD (+CISD): A key support level formed after a bullish pullback, indicating potential buying opportunities when price holds above this level.
Bearish CISD (-CISD): A key resistance level formed after a bearish pullback, suggesting potential selling opportunities when price remains below this level.
These levels are dynamically plotted as horizontal lines on the chart, labelled as "+CISD" or "-CISD" by default, with user-defined colours and styles for clarity. The indicator tracks market structure by detecting significant pullbacks followed by price breaks, ensuring that only robust levels are highlighted.
Key features include:
Extension Levels: Users can enable Fibonacci extensions (e.g., 1.618, 2.618, 4.236) or Range Multiples (e.g., 1x, 2x, 3x) to project potential price targets above and below CISD levels. These extensions remain static once drawn, updating only when a new CISD level is formed, providing reliable reference points for profit targets or reversal zones.
Statistical Table: A customisable table displays the number of times each extension level has been hit (first hits only) and the percentage of CISD sessions where these hits occurred. It also shows the total number of CISD sessions and the current market state (bullish or bearish), offering insights into the historical reliability of these levels.
Volume and ATR Filters: Optional filters ensure that CISD levels are formed only during significant pullbacks, based on volume spikes or price movements relative to the Average True Range (ATR). This reduces noise and enhances the quality of signals.
Alerts: Traders can set alerts to be notified when price crosses above a bearish CISD or below a bullish CISD, enabling timely trade execution without constant chart monitoring.
Customisation: Extensive settings allow users to adjust line styles, colours, extension lengths, and filter parameters to suit their trading style and market conditions.
How to Use the Indicator in Trading
The "CISD with Alerts" indicator is designed to assist traders in identifying high-probability trading opportunities based on market structure. Here’s how to effectively incorporate it into your trading strategy:
Setup and Configuration:
Add to Chart: Apply the indicator to your TradingView chart by searching for "CISD with Alerts" in the Indicators menu.
Customise Settings:
CISD Levels: Adjust the "Bull CISD" and "Bear CISD" colours for visibility (default: black). Modify the label text (e.g., "+CISD" or "-CISD") to suit your preferences.
Line Style: Choose from solid, dotted, or dashed lines and set the line width (1–5) and extension length (default: 5 bars) for clarity.
Extension Type: Select "Fibonacci" for Fibonacci-based targets, "Range Multiples" for range-based targets, or "None" to focus solely on CISD levels. Customise levels (e.g., "0.786, 1.618" for Fibonacci or "0.5, 1, 1.5" for Range Multiples) to match your market’s volatility.
Filters: Enable volume or ATR filters to ensure CISD levels form during significant price movements. Adjust the volume lookback period (default: 20), threshold (default: 1.5x), ATR length (default: 14), and multiplier (default: 1.0) based on your asset and timeframe.
Table Display: Enable the statistical table (default: on) and choose its position (e.g., Top Right, Bottom Center) to avoid chart clutter.
Alerts: Enable bullish and bearish alerts to receive notifications when price crosses CISD levels. Set up alerts in Trading View’s alert system with the messages "Bullish CISD Formed" or "Bearish CISD Formed."
Keep Levels: Decide whether to retain old CISD levels (default: off) or clear them to focus on the latest levels.
Trading Strategies:
Trend Continuation:
Bullish CISD (+CISD): When price holds above a +CISD level, consider entering long positions, as this indicates strong bullish momentum. Use Fibonacci or Range Multiple extensions above the level (e.g., Fib 1.618) as profit targets.
Bearish CISD (-CISD): When price stays below a -CISD level, consider short positions, targeting extensions below the level (e.g., Range 1x).
Reversal Trading:
Monitor price action near CISD levels for reversal signals, such as candlestick patterns (e.g., pin bars, engulfing patterns) or divergence on oscillators like RSI.
If price rejects a +CISD level and falls below it, consider shorting towards the next -CISD or extension level. Conversely, if price breaks above a -CISD, look for long opportunities.
Breakout Trading:
Set alerts to capture breakouts when price crosses above a -CISD (bullish breakout) or below a +CISD (bearish breakout). Enter trades in the direction of the breakout, targeting the nearest extension level.
Risk Management:
Place stop-loss orders below +CISD levels for long trades or above -CISD levels for short trades to limit risk.
Use the statistical table to assess the reliability of extension levels. For example, if Fib 1.618 has a high hit percentage (e.g., 66.67%), it may be a reliable target, but lower-percentage levels (e.g., Fib 4.236) may require tighter risk management.
Interpreting the Statistical Table:
The table provides valuable data to refine your trading:
Total CISD Sessions: Indicates the number of CISD level sets formed, giving context to the sample size.
Hits and Percentages: Shows how many times each extension level (upside and downside) was hit and the percentage of sessions where these hits occurred. For instance, a Fib 2.618 level with 3 hits and a 75% hit rate suggests it’s a frequent target.
Current State: Displays whether the market is in a bullish or bearish phase, helping you align trades with the broader trend.
Use this data to prioritise high-probability targets. For example, focus on levels with hit rates above 50% for conservative trades or explore lower-probability levels for higher-reward setups with strict risk controls.
Optimising for Different Markets and Timeframes:
Stocks and Forex: Use Fibonacci extensions (e.g., 0.786, 1.618) on daily or 4-hour charts for swing trading. Enable volume filters to capture significant pullbacks during earnings or economic events.
Cryptocurrencies: Opt for Range Multiples (e.g., 0.5, 1, 1.5) on 1-hour or 15-minute charts to navigate high volatility. Adjust the hit tolerance (default: 0.5 ATR) to 0.3–0.7 to account for rapid price swings.
Commodities: Combine ATR filters (e.g., ATR multiplier 1.5) with Fibonacci levels on weekly charts for position trading, targeting longer-term trends.
Backtest settings on your chosen asset and timeframe to optimise volume threshold (e.g., 1.2–2.0), ATR multiplier (e.g., 0.5–1.5), and extension levels for your market’s characteristics.
Best Practices:
Combine with Other Tools: Use the indicator alongside support/resistance zones, moving averages, or momentum indicators to confirm signals. For example, a +CISD level aligning with a 200-period moving average strengthens its significance.
Backtest Thoroughly: Test the indicator on historical data to evaluate the effectiveness of CISD levels and extensions in your market. Adjust hit tolerance and filter settings to balance signal frequency and accuracy.
Monitor Alerts: Set up alerts to stay informed of CISD breakouts, especially for active trading on lower timeframes.
Clear Chart Clutter: Disable old CISD levels (set "Keep old CISD levels" to false) and limit extension levels (e.g., "1.618, 2.618") to maintain a clean chart.
Regular Review: Periodically review the statistical table to identify which extension levels are most reliable, adapting your strategy as market conditions evolve.
Practical Example
Suppose you’re trading BTC/USD on a 1-hour chart:
A +CISD forms at 60,000, and a -CISD forms at 58,000, with a range of 2,000 points.
You enable Fibonacci extensions (1.618, 2.618), plotting levels at 63,236 (upside) and 54,764 (downside) for 1.618, and 65,236 (upside) and 52,764 (downside) for 2.618.
The statistical table shows the 1.618 level (upside) has been hit in 4 out of 5 CISD sessions (80%), suggesting a high-probability target.
Price holds above 60,000, and you enter a long position, targeting 63,236 with a stop-loss below 60,000. An alert notifies you when price breaks above the -CISD at 58,000, confirming bullish momentum.
You monitor the table to see if the 2.618 level (65,236) becomes a viable secondary target based on its 40% hit rate.
Limitations and Considerations
Market Conditions: The indicator performs best in trending or range-bound markets with clear pullbacks. In choppy or low-volatility conditions, CISD levels may generate false signals, so use filters to enhance reliability.
Timeframe Sensitivity: Lower timeframes (e.g., 5-minute) may produce more frequent but noisier signals, while higher timeframes (e.g., daily) offer fewer but more robust levels. Test your preferred timeframe.
Not a Standalone Tool: While powerful, the indicator should be used in conjunction with other technical or fundamental analysis to validate trades.
Backtesting Required: The effectiveness of extension levels varies by market and timeframe. Backtest extensively to determine optimal settings and avoid over-optimisation.
Conclusion
The "CISD with Alerts" indicator is a comprehensive tool for traders aiming to leverage market structure for informed decision-making. By identifying key CISD levels, projecting potential price targets with Fibonacci or Range Multiples, and providing statistical insights, it empowers traders to anticipate reversals, breakouts, and trend continuations with confidence. Its customisable settings, robust filters, and alert system make it adaptable to various trading styles and markets. Whether you’re a day trader scalping cryptocurrencies or a swing trader analysing stocks, this indicator offers a structured approach to navigating price action. Apply it to your charts, fine-tune the settings, and combine it with your existing strategy to enhance your trading edge.
The "CISD with range/fib extensions and stats" indicator is a powerful and versatile tool designed for traders seeking to identify and capitalise on market structure shifts across various asset classes, including stocks, forex, cryptocurrencies, and commodities. Built for TradingView using Pine Script v6, this indicator detects Changes in the State of Delivery (CISD), which are pivotal price levels indicating potential trend reversals or continuations. It enhances trading decisions by plotting these levels on the chart, offering optional Fibonacci or Range Multiple extensions, and providing a statistical table to track the reliability of these levels. With customisable alerts and filters, the indicator is suitable for both novice and experienced traders looking to integrate market structure analysis into their strategies.
What the Indicator Does
The indicator identifies two types of CISD levels:
Bullish CISD (+CISD): A key support level formed after a bullish pullback, indicating potential buying opportunities when price holds above this level.
Bearish CISD (-CISD): A key resistance level formed after a bearish pullback, suggesting potential selling opportunities when price remains below this level.
These levels are dynamically plotted as horizontal lines on the chart, labelled as "+CISD" or "-CISD" by default, with user-defined colours and styles for clarity. The indicator tracks market structure by detecting significant pullbacks followed by price breaks, ensuring that only robust levels are highlighted.
Key features include:
Extension Levels: Users can enable Fibonacci extensions (e.g., 1.618, 2.618, 4.236) or Range Multiples (e.g., 1x, 2x, 3x) to project potential price targets above and below CISD levels. These extensions remain static once drawn, updating only when a new CISD level is formed, providing reliable reference points for profit targets or reversal zones.
Statistical Table: A customisable table displays the number of times each extension level has been hit (first hits only) and the percentage of CISD sessions where these hits occurred. It also shows the total number of CISD sessions and the current market state (bullish or bearish), offering insights into the historical reliability of these levels.
Volume and ATR Filters: Optional filters ensure that CISD levels are formed only during significant pullbacks, based on volume spikes or price movements relative to the Average True Range (ATR). This reduces noise and enhances the quality of signals.
Alerts: Traders can set alerts to be notified when price crosses above a bearish CISD or below a bullish CISD, enabling timely trade execution without constant chart monitoring.
Customisation: Extensive settings allow users to adjust line styles, colours, extension lengths, and filter parameters to suit their trading style and market conditions.
How to Use the Indicator in Trading
The "CISD with Alerts" indicator is designed to assist traders in identifying high-probability trading opportunities based on market structure. Here’s how to effectively incorporate it into your trading strategy:
Setup and Configuration:
Add to Chart: Apply the indicator to your TradingView chart by searching for "CISD with Alerts" in the Indicators menu.
Customise Settings:
CISD Levels: Adjust the "Bull CISD" and "Bear CISD" colours for visibility (default: black). Modify the label text (e.g., "+CISD" or "-CISD") to suit your preferences.
Line Style: Choose from solid, dotted, or dashed lines and set the line width (1–5) and extension length (default: 5 bars) for clarity.
Extension Type: Select "Fibonacci" for Fibonacci-based targets, "Range Multiples" for range-based targets, or "None" to focus solely on CISD levels. Customise levels (e.g., "0.786, 1.618" for Fibonacci or "0.5, 1, 1.5" for Range Multiples) to match your market’s volatility.
Filters: Enable volume or ATR filters to ensure CISD levels form during significant price movements. Adjust the volume lookback period (default: 20), threshold (default: 1.5x), ATR length (default: 14), and multiplier (default: 1.0) based on your asset and timeframe.
Table Display: Enable the statistical table (default: on) and choose its position (e.g., Top Right, Bottom Center) to avoid chart clutter.
Alerts: Enable bullish and bearish alerts to receive notifications when price crosses CISD levels. Set up alerts in Trading View’s alert system with the messages "Bullish CISD Formed" or "Bearish CISD Formed."
Keep Levels: Decide whether to retain old CISD levels (default: off) or clear them to focus on the latest levels.
Trading Strategies:
Trend Continuation:
Bullish CISD (+CISD): When price holds above a +CISD level, consider entering long positions, as this indicates strong bullish momentum. Use Fibonacci or Range Multiple extensions above the level (e.g., Fib 1.618) as profit targets.
Bearish CISD (-CISD): When price stays below a -CISD level, consider short positions, targeting extensions below the level (e.g., Range 1x).
Reversal Trading:
Monitor price action near CISD levels for reversal signals, such as candlestick patterns (e.g., pin bars, engulfing patterns) or divergence on oscillators like RSI.
If price rejects a +CISD level and falls below it, consider shorting towards the next -CISD or extension level. Conversely, if price breaks above a -CISD, look for long opportunities.
Breakout Trading:
Set alerts to capture breakouts when price crosses above a -CISD (bullish breakout) or below a +CISD (bearish breakout). Enter trades in the direction of the breakout, targeting the nearest extension level.
Risk Management:
Place stop-loss orders below +CISD levels for long trades or above -CISD levels for short trades to limit risk.
Use the statistical table to assess the reliability of extension levels. For example, if Fib 1.618 has a high hit percentage (e.g., 66.67%), it may be a reliable target, but lower-percentage levels (e.g., Fib 4.236) may require tighter risk management.
Interpreting the Statistical Table:
The table provides valuable data to refine your trading:
Total CISD Sessions: Indicates the number of CISD level sets formed, giving context to the sample size.
Hits and Percentages: Shows how many times each extension level (upside and downside) was hit and the percentage of sessions where these hits occurred. For instance, a Fib 2.618 level with 3 hits and a 75% hit rate suggests it’s a frequent target.
Current State: Displays whether the market is in a bullish or bearish phase, helping you align trades with the broader trend.
Use this data to prioritise high-probability targets. For example, focus on levels with hit rates above 50% for conservative trades or explore lower-probability levels for higher-reward setups with strict risk controls.
Optimising for Different Markets and Timeframes:
Stocks and Forex: Use Fibonacci extensions (e.g., 0.786, 1.618) on daily or 4-hour charts for swing trading. Enable volume filters to capture significant pullbacks during earnings or economic events.
Cryptocurrencies: Opt for Range Multiples (e.g., 0.5, 1, 1.5) on 1-hour or 15-minute charts to navigate high volatility. Adjust the hit tolerance (default: 0.5 ATR) to 0.3–0.7 to account for rapid price swings.
Commodities: Combine ATR filters (e.g., ATR multiplier 1.5) with Fibonacci levels on weekly charts for position trading, targeting longer-term trends.
Backtest settings on your chosen asset and timeframe to optimise volume threshold (e.g., 1.2–2.0), ATR multiplier (e.g., 0.5–1.5), and extension levels for your market’s characteristics.
Best Practices:
Combine with Other Tools: Use the indicator alongside support/resistance zones, moving averages, or momentum indicators to confirm signals. For example, a +CISD level aligning with a 200-period moving average strengthens its significance.
Backtest Thoroughly: Test the indicator on historical data to evaluate the effectiveness of CISD levels and extensions in your market. Adjust hit tolerance and filter settings to balance signal frequency and accuracy.
Monitor Alerts: Set up alerts to stay informed of CISD breakouts, especially for active trading on lower timeframes.
Clear Chart Clutter: Disable old CISD levels (set "Keep old CISD levels" to false) and limit extension levels (e.g., "1.618, 2.618") to maintain a clean chart.
Regular Review: Periodically review the statistical table to identify which extension levels are most reliable, adapting your strategy as market conditions evolve.
Practical Example
Suppose you’re trading BTC/USD on a 1-hour chart:
A +CISD forms at 60,000, and a -CISD forms at 58,000, with a range of 2,000 points.
You enable Fibonacci extensions (1.618, 2.618), plotting levels at 63,236 (upside) and 54,764 (downside) for 1.618, and 65,236 (upside) and 52,764 (downside) for 2.618.
The statistical table shows the 1.618 level (upside) has been hit in 4 out of 5 CISD sessions (80%), suggesting a high-probability target.
Price holds above 60,000, and you enter a long position, targeting 63,236 with a stop-loss below 60,000. An alert notifies you when price breaks above the -CISD at 58,000, confirming bullish momentum.
You monitor the table to see if the 2.618 level (65,236) becomes a viable secondary target based on its 40% hit rate.
Limitations and Considerations
Market Conditions: The indicator performs best in trending or range-bound markets with clear pullbacks. In choppy or low-volatility conditions, CISD levels may generate false signals, so use filters to enhance reliability.
Timeframe Sensitivity: Lower timeframes (e.g., 5-minute) may produce more frequent but noisier signals, while higher timeframes (e.g., daily) offer fewer but more robust levels. Test your preferred timeframe.
Not a Standalone Tool: While powerful, the indicator should be used in conjunction with other technical or fundamental analysis to validate trades.
Backtesting Required: The effectiveness of extension levels varies by market and timeframe. Backtest extensively to determine optimal settings and avoid over-optimisation.
Conclusion
The "CISD with Alerts" indicator is a comprehensive tool for traders aiming to leverage market structure for informed decision-making. By identifying key CISD levels, projecting potential price targets with Fibonacci or Range Multiples, and providing statistical insights, it empowers traders to anticipate reversals, breakouts, and trend continuations with confidence. Its customisable settings, robust filters, and alert system make it adaptable to various trading styles and markets. Whether you’re a day trader scalping cryptocurrencies or a swing trader analysing stocks, this indicator offers a structured approach to navigating price action. Apply it to your charts, fine-tune the settings, and combine it with your existing strategy to enhance your trading edge.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน