Indicator · Pine Script v6 · On the chart

Cycles Analysis

by regalouisei

This indicator segments market history into bull and bear cycle periods based on user-defined percentage movements or elapsed time duration.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code544
Settings30inputs
LicenceNone stated
Last update8 months ago25 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Cycles Analysis overlays cycle stages directly on the price chart using colored background highlights, peak and trough labels, and detection markers showing when trend shifts are confirmed. A prediction zone estimates future cycle horizons using customizable statistical percentiles, while an on-chart summary table displays aggregate cycle statistics. Configuration settings allow independent bull and bear percentage thresholds, minimum cycle lengths, and custom date filters.

Details

Published by

regalouisei on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
VersionstringrevisionrevisionInput
Change in Direction, %float30changeInDirectionPercentsInput
Direction Change ModestringDIRECTION_CHANGE_PERCENTAGEchangeInDirectionModeInput
Duration UnitsstringTIME_DURATION_DAYSdurationUnitsInput
Use Separate Value for Bear Percentage ChangeboolfalseuseSeparatePercentageForBearChangeInput
Change in Bear Direction, %float30changeInDirectionPercentsBearInput
Change in Direction, timeint182changeInDirectionUnitsInput
Enforce Minimum Period Duration ForstringDIRECTION_NONEenforceMinimumPeriodDurationModeInput
Minimum Period Duration, timeint90minimumPeriodDurationUnitsInput
First Period DirectionstringDIRECTION_BULLfirstPeriodDirectionInput
Show StagnationsboolfalseshowStagnationInput
Stagnation, timeint182stagnationUnitsInput
Show all 30 settings
SettingTypeDefaultVariable
Show Predictions ZonebooltrueshowPredictionZoneInput
Calculate PercentilebooltruecalculatePercentileInput
Percentileint80percentileInput
Show Aggeragates TablebooltrueshowAggregatesInput
Use Custom Start DateboolfalseuseCustomStartRangeInput
Range Start Datetime0rangeStartDateInput
Use Custom End DateboolfalseuseCustomEndRangeInput
Range End Exittime0rangeEndDateInput
YearsbooltruedurationInYearsInput
MonthbooltruedurationInMonthsInput
DaysbooltruedurationInDaysInput
HoursboolfalsedurationInHoursInput
MinutesboolfalsedurationInMinutesInput
SecondsboolfalsedurationInSecondsInput
Show BackgroundbooltrueshowBackgroundInput
Show LablesbooltrueshowLablesInput
Show New Highs/LowsboolfalseshowNewHighsLowsInput
Show the point when the direction change was detectedbooltrueshowReversalDetectionPointInput
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

257 stars

This indicator overlays an intraday SPX and ES chart with a midnight session range, regular-trading-hours opening levels, and a VWAP projection box. It draws the midnight high, mid, and low, flags edge rejections within an absolute tolerance, and plots optiona

Indicator v6 TrendSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of SPX Midnight Box + Snag Logic
228 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of TradersPost Trading Checklist
92 stars

This indicator classifies the market into gamma regime types (negative gamma trend, positive gamma mean-reversion, or transition) by calculating a composite score based on daily ATR ratios, session VWAP crossover frequencies, and opening range displacement. It

Indicator v5 Volatility & bandsTrend
Updated 2 months ago · Custom licence GitHub repository of Moon Dev GEX Regime & Trap

EMA Ribbon Overlay

by iamrichardD
57 stars

Calculates exponential moving averages for fast, pivot, and slow lengths along with optional 50, 100, and 200 simple moving average context lines. It visualizes bullish and bearish ribbon fills on the main price chart alongside MACD calculations to generate ea

Indicator v6 TrendMoving averages
Updated 1 year ago · Apache-2.0 GitHub repository of EMA Ribbon Overlay
53 stars

Apex Trend & Liquidity Master calculates a trend cloud using customizable moving averages expanded by a volatility multiplier directly on the main price chart. It identifies dynamic support and resistance liquidity zones from swing high and low pivots, extendi

Indicator v6 TrendSupport & resistance
Updated 2 months ago · MPL-2.0 GitHub repository of Apex Trend & Liquidity Master

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers