OPEN-SOURCE SCRIPT
Step SMA

Step SMA – Block-Based Moving Average
Description:
Step SMA is a simple, block-based moving average that shows price trends in discrete steps. Instead of a continuous moving average, it divides the chart into fixed-length blocks and calculates an SMA within each block. At the start of each new block, the average resets, creating a clear “step” effect.
How it Works:
• Block Length: Set the number of bars per block (Block SMA Length).
• Step SMA Calculation: Computes the average of closes within each block. At the end of a block, the calculation resets for the next one.
• Restart Circles: Optional circles mark the first bar of each block for easy visual reference.
• Visual Defaults: The SMA line defaults to bright cyan (width 3) and restart circles default to orange (max size). All colors, line width, and circle size can be customized in the Style tab.
Key Features:
• Stepwise SMA for clear, block-level trend visualization
• Optional restart circles to highlight block starts
• Fully customizable styling via the Style tab
• Simple block length input to adjust sensitivity
Use Cases:
• Easily see short-term trends within discrete blocks
• Identify points where trend averages reset
• Compare block-level trends to standard SMA or EMA
Description:
Step SMA is a simple, block-based moving average that shows price trends in discrete steps. Instead of a continuous moving average, it divides the chart into fixed-length blocks and calculates an SMA within each block. At the start of each new block, the average resets, creating a clear “step” effect.
How it Works:
• Block Length: Set the number of bars per block (Block SMA Length).
• Step SMA Calculation: Computes the average of closes within each block. At the end of a block, the calculation resets for the next one.
• Restart Circles: Optional circles mark the first bar of each block for easy visual reference.
• Visual Defaults: The SMA line defaults to bright cyan (width 3) and restart circles default to orange (max size). All colors, line width, and circle size can be customized in the Style tab.
Key Features:
• Stepwise SMA for clear, block-level trend visualization
• Optional restart circles to highlight block starts
• Fully customizable styling via the Style tab
• Simple block length input to adjust sensitivity
Use Cases:
• Easily see short-term trends within discrete blocks
• Identify points where trend averages reset
• Compare block-level trends to standard SMA or EMA
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.