Performance Table From OpenThis indicator plots the percentage performance from the open of up to 20 different customizable tickers.
Enjoy!
Поиск скриптов по запросу "Table"
[Nic] Intraday Vix LabelsPrints intraday percent change of VIX9D, VVIX, PCC, and any other arbitrary symbol on a table for quick reference.
BTC Futures BasisShows various basis percentages in a table and plots historical basis. Also has an alert function for backwardation events. Useful for tracking bullish/bearish sentiment in BTC futures markets.
*Currently displays March and June futures for the following exchanges: Bitmex, Binance, Deribit, Okex, and FTX
Also displays CME Continuous Next Contract. All of the symbols are customizable.
-----------
Market-wide backwardation usually occurs during a heavy sell-off (such as a liquidation cascade).
**For getting alerts of backwardation events, I recommend creating an alert on the 1 minute chart with the condition "Any alert() function call". Alert level is customizable as well.
-----------
*NOTE!! : Futures contracts expire (obviously), so the contract symbols will need to be updated periodically. I will try to keep them updated going into the future.
**NOTE2!! : The alert() function does not track the CME contract. This is to avoid false triggers.
SPY Sub-Sector Daily Money Flow TableThis calculates the dollar volume per candlestick (2nd row) and cumulative (3rd row) of the entire trading day for each subsector of the SPY.
The 'Total' column is the total of all the subsectors combined. It is calculated separately from SPY volume.
The money flow is calculated with (open+close)/2 which means different timeframes yield different results and won't be especially accurate day-by-day. This is useful to quickly see rotation and possible divergences.
Enjoy!
PreMarketStatsThe idea is to catch pre market information (or other relevant data), that basically consists of a single number, in a table instead of using a plot that takes up space in the chart. In this example, I added pre market volume and pre market change in %. Where the second one is as well available in the details tab of the stock, it is not available if this tab is closed or during replays.
[CLX][#01] Animation - Price Ticker (Marquee)This indicator displays a classic animated price ticker overlaid on the user’s current chart. It is possible to fully customize it or to select one of the predefined styles.
A detailed description will follow in the next few days.
Used Pinescript technics:
- varip (view/animation)
- tulip instance (config/codestructur)
- table (view/position)
By the way, for me, one of the coolest animated effects is by Duyck
We hope you enjoy it! 🎉
CRYPTOLINX - jango_blockchained 😊👍
Disclaimer:
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely.
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script.
Probability TableThe script is inspired by user NickbarComb, I suggested checking out his Price Convergence script.
Basically, this script plots a table containing the probability of the current candle closing either higher or lower based on user-define past period.
Hope that it will be helpful.
MTF Price/Volume % [Anan]Hello friends,
This is a multi-timeframe table with these features:
Display price change percentage compared with the last timeframe candle close.
Display price change percentage compared with the last timeframe candle close MA.
Displays change percentage compared with the last timeframe candle volume.
Displays change percentage compared with the last timeframe candle volume MA.
Change type/length of MA for Price/Volume.
Full control of Panel position and size.
Full control of displaying any row or column.
Average Daily Range TableThis is the last script to complete Vladimir Poltoratskiy's setup found in his books.
Poltoratskiy argues that you should not take any fractal corridors higher than 50% of the Average Daily Range. To be honest, even 40% is a lot, because then, your target will be 160% ADR away from your entry and one "fracture" just can't be enough to predict moves this big.
I chose a table to visually represent the indicator because it doesn't change its value during the day. It takes far less room on the chart.
There are also two simple moving averages. You may use the as an indicator if the relative volatility as of late is extremely low and in that case, perhaps, expect an increase in the coming days. They are applied to the Average Daily Range, not one day range!
PAC newThis indicator will alert you when a candle goes above or below the price action channel (PAC) but only on the first or second candle after a colour change in candle.
When price is above the price action channel that is a bullish sign, when price is below the PAC that is a bearish sign.
The idea is that a sudden change in price is a cause to investigate further price action moving in that direction so the indicator aims to identify reversal
Scalping strategy that works on 5 min chart and aims to gain 10 pips. Do not act on every signal. Further investigation is required, for example by looking at RSI oversolf and overbought levels. For example, at an oversold area, a buy signal is more valid
Table: Forex Central Bank Interest RatesThis tool shows CB Interest Rates for USD, JPY, CAD, CHF, EUR, GBP, NZD, AUD - basically all the majors.
Use override and input your own value if it is changed and I haven't updated the script yet.
Month/Month Percentage % Change, Historical; Seasonal TendencyTable of monthly % changes in Average Price over the last 10 years (or the 10 yrs prior to input year).
Useful for gauging seasonal tendencies of an asset; backtesting monthly volatility and bullish/bearish tendency.
~~User Inputs~~
Choose measure of average: sma(close), sma(ohlc4), vwap(close), vwma(close).
Show last 10yrs, with 10yr average % change, or to just show single year.
Chose input year; with the indicator auto calculating the prior 10 years.
Choose color for labels and size for labels; choose +Ve value color and -Ve value color.
Set 'Daily bars in month': 21 for Forex/Commodities/Indices; 30 for Crypto.
Set precision: decimal places
~~notes~~
-designed for use on Daily timeframe (tradingview is buggy on monthly timeframe calculations, and less precise on weekly timeframe calculations).
-where Current month of year has not occurred yet, will print 9yr average.
-calculates the average change of displayed month compared to the previous month: i.e. Jan22 value represents whole of Jan22 compared to whole of Dec21.
-table displays on the chart over the input year; so for ES, with 2010 selected; shows values from 2001-2010, displaying across 2010-2011 on the chart.
-plots on seperate right hand side scale, so can be shrunk and dragged vertically.
-thanks to @gabx11 for the suggestion which inspired me to write this
Koalafied Risk ManagementTables and labels/lines showing trade levels and risk/reward. Use to manage trade risk compared to portfolio size.
Initial design optimised for tickers denominated against USD.
Multi-Session High/Low Trackertable that shows rth eth and full weekly range high and low with range difference from high and low
Table ATH and DayQuotes in the middle of a chartJust important things at a glance ..
AlltimeHigh and Daily High/Low
Smart Pro Entry Guideज्यादातर नए और मिड-लेवल ट्रेडर indicator की भीड़ में या जल्दीबाज़ी में ग़लत entry/exit पर फँस जाते हैं, जिससे बार-बार loss होता है या सही trade छूट जाता है।
Smart Pro Entry Guide इसी असली समस्या का सीधा हल है:
यह indicator price action, candle analysis, volume और trend momentum – सबका adaptive combination लगाकर हर स्थिति में साफ शब्दों में (BUY/SELL/WAIT) real-time signal देता है। इसकी सबसे खास बात – higher और current timeframe की sync analysis और auto-adaptive logic, जिससे beginners/experienced – सभी traders किसी भी market structure में बिना confusion सही entry, support/resistance, liquidity और trend direction एक दम साफ देख सकते हैं।
Key Concept & Benefits
No Indicator Clutter: सिर्फ one-glance signals, सारे signals और levels auto-update ताकि screen पर कभी overload ना हो।
Exact Entry Guide: कब सही entry है – system खुद strongest action filter करता है, जिससे FOMO और whipsaw entry से बचा जा सके।
HTF+LTF Logic: Multitimeframe sync analysis – हर market mood (bullish, bearish, sideways) को पकड़े और जल्द signal ना बदले।
Auto S/R & Liquidity Zones: Important support/resistance और liquidity levels auto-plot, जिससे price action traders को ready reference मिले।
Clear Action/Direction: हर बार realtime table/dashboard में plain words में “market क्या चाहता है” दिखे – चाहे bull trap हो, sudden volume spike, wick reversal या trend exhaustion.
For Everyone: Trader चाहे newbie हो या pro – सिर्फ chart add करें और real market psychology का live simplified signal instantly पायें।
Ideal Usage
Instant decision support: जब भी confused हों entry/exit को लेकर – इस indicator की सिफारिश चेक करें।
Entry learning: Beginners को best real-time practice playground – हर entry/exit reason भी दिखता है।
Screen time & Stress कम: Chart पर clear, relevant info – no noise, no extra marks!
Smart Entry Guide – Pro Dashboard HTF/Action Split ट्रेडिंग को आसान, साफ और आत्मविश्वासी बनाता है – ताकि आप market signal miss ना करें, जल्दीबाज़ी में trap ना हों और हर बड़े move का सही हिस्सा बन सकें।
Input Setting:
Enable Wick Analysis (useWickAnalysis)
क्या है?
यह एक बूलियन (true/false) सेटिंग है जिससे यूज़र यह decide कर सकता है कि indicator में "wick analysis" को एक्टिव करना है या नहीं.
क्यों है?
"Wick analysis" ट्रेडिंग में कैंडलस्टिक के shadows (wick/tail) को analyze करता है — यानी किसी भी कैंडल का जो हिस्सा खुलने/बंद होने के दाम से उपर या नीचे जाता है, लेकिन वहीं टिकता नहीं।
यह analysis दर्शाता है कि प्राइस पर seller या buyer ने strength दिखाई, पर वो momentum टिक नहीं पाया— यानी rejection या sudden buying/selling pressure।
Intent (भावना/लक्ष्य)
मार्केट की psychology को और गहराई से पकड़ना।
Beginner को live chart पर वही logic समझाना जो manual price action expert traders ढूंढ़ते हैं।
False signals/whipsaws को avoid करना, खासकर wicks के कारण आने वाले traps से बचाव करना।
User के लिए फायदा
जब यह ON रहेगा, तो indicator extra alert देगा — अगर बहुत बड़ी wick बनी है (जैसे big lower wick यानी नीचे से strong buying या big upper wick यानी strong selling), तो signal जल्दी और सही मिलेगा।
इससे ट्रेडर को पता चलेगा कि market एक तरफ rejection दिखा चुका है — जिससे खास entry/exit का decision और strong हो जाता है।
FOMO या panic में गलती से entry/exit लेने से बचाव, क्यूंकि wick पहचानना often pro trader का काम था — indicator उसे भी automatically दिखा देता है।
Real market reversal या fake breakout points को early पहचानने में मदद।
संक्षेप में:
Enable Wick Analysis चालू करने पर indicator manual pro price action reading जैसा एक smart filter जोड़ लेता है — जिससे signals ज़्यादा powerful, और market के traps से बचने में मदद मिलती है।
Enable Absorption (useAbsorption)
क्या है?
यह एक बूल विकल्प (On/Off) है। जब आप इसे true/active करते हैं, तो indicator "absorption candle" का logic अपने analysis में शामिल करता है।
क्यों है?
Absorption trading में एक ऐसी स्थिति को दर्शाता है जहाँ एक तरफ से ज़बरदस्त buying या selling pressure आता है—लेकिन उसके सामने दूसरी ओर से equally strong order flow आकर move को absorb (निगल) लेता है, जिससे price को रोक दिया जाता है। यह market में hidden strength का संकेत होता है—जैसे कोई चलती ट्रेन अचानक दीवार से टकरा जाती है!
Indicator में absorption analysis यह पकड़ता है कि volume अचानक high है, और price एकदम lowest या highest point पर बंद हो गया, पर price बड़ा move नहीं कर पाया—यानी buyers या sellers का दबाव absorb हो गया।
Intent
Pro level price/volume dynamics को automatically पढ़ना, जिससे major reversals या breakout fakeouts का पता लगाया जा सके।
Beginners के लिए complicated manual candle/volume analysis को आसान बनाना।
Market में छुपी हुई liquidity और institutional order zones को पहचानना—जहाँ real move start हो सकता है।
User को क्या फायदा?
On करने पर जब भी absorption signal मिलेगा, indicator entry/exit या directional alert को और मजबूत बना देगा।
Reversal या fake breakout/trap के पहले ही user को advanced warning मिल सकती है—जो अक्सर सिर्फ बड़े price action expert charts से ही पकड़ते हैं।
Beginners के लिए "hidden" market action को सामने लायेगा—panic या FOMO entry से बचाव और patience बढ़ेगा।
खासकर volatile या news-driven market में जहाँ sudden wicks और volume spike निकलते हैं, वहाँ यह बहुत काबिल feature है।
संक्षेप में:
Enable Absorption ON रखने पर indicator market के छुपे हुए pressure zones को automatically detect करता है—traders को entry/reversal/exit points पर pro-level confidence देता है, जिससे major loss या फालतू entries से बचा जा सकता है।
Enable Unusual Breakout (useUnusualBreakout)
क्या है?
यह एक ON/OFF विकल्प है (बूल वैल्यू)। इसे सक्रिय करने पर indicator unusual breakout की प्रबल पहचान करता है — यानी जब candle का बॉडी औसत से बहुत बड़ा और वॉल्यूम ज़्यादा होता है।
क्यों है?
मार्केट में कभी-कभी अचानक बड़े मूव (breakout/breakdown) आते हैं — जिनमें volume भी साथ में surge करता है।
ऐसे unusual moves beginners अक्सर miss कर देते हैं, या उलटी साइड में फँस जाते हैं, क्योंकि वो normal range से बाहर signal होते हैं।
Intent
Sharp momentum और real breakout moves को identify करना।
Beginners को uncommon market situations में, पहले से alert करना, ताकि genuine move miss न हो और trap में भी न फँसे।
Volatility ke time पर traders को confidence और clarity मिल सके।
User फायदा कैसे ले सकता है?
ON रखने पर indicator जैसे ही unusual breakout detect करेगा (big candle + high volume), signal के साथ reason में दिखा देगा।
Scalping/trend ट्रेड या volatile मार्केट में, extraordinary moves को जल्दी पकड़ पाएँगे।
Entry miss या फालतू whipsaw moves में फँसने से बच सकते हैं, क्योंकि indicator unusual move को plain शब्दों में highlight करेगा।
High-probability moves में तेजी से action लेने का मौका मिलेगा।
संक्षेप में:
Unusual Breakout ON रखने पर indicator हर uncommonly strong move को समय पर पकड़ लेता है — जिससे users big and real market move miss नहीं करते और risky sudden traps से बचते हैं!
Enable Range/Expansion (useRangeExpansion)
क्या है?
यह एक boolean setting है (On/Off)। इसे ON करने पर indicator "Range Expansion" logic को activate करता है — यानी जब market में suddenly price range बढ़ जाती है, तब उसको खास तौर पर analyze करता है।
क्यों है?
"Range/Expansion" का मतलब है — जब किसी भी candle या bar का high-low suddenly पिछले average range के मुकाबले बहुत ज्यादा बड़ा/छोटा हो जाए।
यह अक्सर अचानक volatility, नए trend की शुरुआत, या powerful breakouts/breakdowns के वक्त होता है — यानी market stationary/restricted से एकदम dynamic/high-volatility mode में आ गई।
Beginners ये movement कई बार miss कर देते हैं या old range में फँसकर false entry ले लेते हैं।
Intent
Trend shift, volatility burst और range breakout जैसी critical movements को exact time पर पकड़ना।
User को warn करना कि market एक नए phase में आ चुकी है — अब entry/exit approach को accordingly adjust करना चाहिए।
Entry का best time signal करना, जब suddenly real move शुरू हो गया हो।
User को क्या फायदा?
ON करने पर जैसे ही market में unusual range expansion दिखाई देगी, indicator alert कर देगा — जिससे no-trade phase से out-of-box move को catch करना आसान हो जाएगा।
इसमें पुराने (previous) small ranges और sudden large candle के difference को detect किया जाता है — जिससे user sideways/confused market में trap होने से बच सकता है।
Best entry का timing improve करेगा — अगर expansion bullish/positive हो तो BUY या bearish/negative हो तो SELL quickly identify हो जाएगा।
Big trend moves miss नहीं होंगे, क्योंकि system खुद नए phase को instantly पकड़ लेगा।
संक्षेप में:
Enable Range/Expansion ON करने से indicator sudden trend shifts, breakout/breakdown या big volatility phase को तुरंत पकड़ता है — जिससे user entry/exit का फायदे-मंद decision ले सकते हैं, moving/range bound market trap से बच सकते हैं, और trend phase को miss नहीं करते!
Trend Bar Lookback (Rolling) (trendBarCount)
क्या है?
यह एक integer/numeric input है, जिससे आप set करते हैं कि indicator पिछले कितने candles/bars का data लेकर trend की direction और strength calculate (roll करता है) करे।
जैसे: अगर इसका मान 7 है, तो पिछले 7 candles की price movement देखकर trend का हिसाब करेगा।
क्यों है?
हर market/trader का style और time-frame अलग होता है;
Short lookback = तेज़ी से बदलने वाला, ज्यादा sensitive signal → scalping/small moves के लिए।
Long lookback = बड़ा data, ज़्यादा stable trend, कम whipsaw → swing/position trading के लिए।
Indicator को flexible बनाने के लिए यह option रखा गया, ताकि user अपने हिसाब से momentum/trend detection को adjust कर पाए।
Intent
User को control देना कि trend detection में कितना past data consider करना है।
Beginners और pros दोनों को flexibility देना — कोई ultra-fast trend देखना चाहे तो small value रखे, कोई safe/stable trend के लिए बड़ी value रख सकता है।
हर symbol/market के हिसाब से customization—volatile stocks में कम या ज़्यादा lookback set कर सकते हैं।
User के लिए फायदा
अपनी strategy, time-frame, और market के behaviour के हिसाब से best trend sensitivity set कर पायेंगे।
Short-term traders quick entries पकड़ सकते हैं; long-term traders noise से बच सकते हैं।
Indicator false signals या whipsaw से बचाने के लिए τtrendBarCount को adjust कर decision clarity पा सकता है।
Multi-timeframe analysis और system tuning ultra easy बन जाता है—user खुद देख सकता है कि कौन सा setting उसके लिए सबसे अच्छा result दे रहा है।
संक्षेप में:
Trend Bar Lookback user को ये control देता है कि trend/momentum calculation कितना “fast” या “slow” हो, जिससे वे अपनी style के हिसाब से indicator को बिलकुल fit बना सकते हैं—यह ट्रेडिंग में एक बहुत बड़ा practical edge देता है!
Bull/Bear Bars for Strong Trend Min (trendScoreMin)
क्या है?
यह setting यह define करती है कि पिछले lookback window (जैसे—Trend Bar Lookback) के अंदर लगातार कितनी bullish (green) या bearish (red) candles minimum चाहिए, ताकि indicator उसे "strong trend" मानकर BUY या SELL signal दे सके।
उदाहरण: अगर इसे 5 set किया है, तो पिछले lookback (माने 7) में कम-से-कम 5 बारें लगातार bullish हों—तभी उसे strong uptrend और vice versa के लिए strong downtrend trigger माना जाएगा।
क्यों है?
बहुत सारे indicators या strategies market में छोटे-छोटे या random price moves में भी trend detect कर लेते हैं, जिससे beginners बार-बार छोटे या झूठे (false) signal पर फंस जाते हैं।
trendScoreMin रखने का logic ही यह है कि सिर्फ तभी entry मिले, जब वहाँ सच्चा momentum, यानी majority candles एक direction में हों—ताकि weak trend, sideways, या whipsaw moves से user बचे।
Intent (मूल भावना)
Signal quality improve करना—सिर्फ “high probability” entries व strong momentum trade मिले।
Market noise और बार-बार signal flip या reversal के chance कम करना।
Beginner/trader discipline रखना—बार-बार entry/exit करके trap होने से रोकना।
User फ़ायदा (User कैसे लाभ उठा सकता है?)
अगर user aggressive है और ज्यादा fast signal चाहिए, तो इस value को कम रखे (जैसे 3-4)—उससे short trend/flips भी मिल जाएंगे।
अगर user को only strong/full-body trends चाहिए, loss से डर है या ज्यादा noise नहीं चाहिए, तो value ज्यादा रखें (6-7)—तभी signal आएगा जब market strongly एक तरफ जा रहा हो।
खासकर beginners जल्दी signal के चक्कर में fake moves पकड़ लेते हैं—यह setting उन्हें patience सिखाएगी और परेशान market moves में unwanted trades से रोकेगी।
Pro trader इसको नए-नए symbol या market reality के हिसाब से tweak कर सकते हैं—जैसे volatile crypto में कम, stable stock में ज्यादा।
Example Practical Use:
Suppose आपने lookback 7 रखा है और trendScoreMin 5, तो पिछले 7 candles में कम से कम 5 green पूरे हों तो ही BUY trigger बनेगा—वरना WAIT ही दिखेगा।
यह logic practically हर time frame, हर market, हर user type के लिए risk control और entry select करने को super easy और disciplined बना देता है।
Volume MA Length (length)
क्या है?
यह setting user से पूछती है कि वॉल्यूम का “moving average” कितने पिछले bars/candles के ऊपर लें।
माने, यह वह अवधि है जिसके आधार पर indicator वॉल्यूम का औसत निकालता है। Default value अक्सर 20 होती है, यानी पिछली 20 candles के volume का average लिया जाता है।
क्यों है?
Market में हर candle का वॉल्यूम अलग होता है—कभी ऊपर, कभी नीचे।
जब sudden volume spike/decline आता है तो वही असली move, trap या breakout का clue होता है।
Normal volume कितनी है ये पता रहे, ताकि unusual वॉल्यूम तुरंत पकड़ में आए।
Intent (लक्ष्य/भावना)
Beginner/pro दोनों trader को अपने हिसाब से volume behavior analyze करने देना।
हर symbol, market type, time frame आदि के लिए अपने हिसाब से logical वॉल्यूम spike/filter tuning देना।
Noise, trap या fake volume moves से alert रखना।
User फ़ायदा (कैसे use करे/benefit)
Short-term/small move के लिए: (e.g., Scalping, fast intraday) – कम value रखें जैसे 10–15। इससे fast volume change जल्दी पकड़ जायेगा।
Long-term/big move के लिए: (e.g., Swing, positional) – बड़ी value रखें जैसे 30–50। Stable average बनेगा, सिर्फ असली strong moves दिखेंगे।
Practical Entry/Exit: Unusual volume candle पर indicator quickly alert करेगा—FOMO, panic या silent entry से user बचेगा।
Beginner कोई भी market (Forex, stock, crypto) इस्तेमाल कर रहा हो, इस length के हिसाब से volume analysis best fit बना सकता है।
अगर volume ज्यादातर flat है, तो MA length बढ़ा लें। अगर हमेशा high change रहता है, तो कम कर सकते हैं।
Example:
अगर length 20 रखा और अगले candle का volume, पिछले 20 का average से 2x हो गया—system उसे impactful move मानेगा और यूजर को real breakout या absorption candle instant बता देगा।
यह setting छोटी है लेकिन trading में “volume traps” और “real participation” को पकड़ने के लिए बहुत काम की है। सही value experiment करके user अपनी strategy के लिए best sweet spot खुद खोज सकता है!
Swing Lookback Bars (swing_look)
क्या है?
यह setting बताती है कि indicator ब्रेकआउट/रिवर्सल या swing को पकड़ने के लिए कितनी पिछली candles (bars) का डेटा देखे।
Simple रूप में, जब system swing high/low (local top/bottom) calculate करता है, तो वह पीछे कितनी bars देखे — यह user decide करता है।
Default value 15 होती है, यानी पिछली 15 candles में सबसे ज़्यादा हाई या सबसे कम low को swing point माना जाएगा।
क्यों है?
हर मार्केट और हर trader का swing/reversal पढ़ने का तरीका अलग होता है — किसी को छोटी moves (scalping/small breakout) पकड़नी है, किसी को big swings (trend shift) चाहिए।
अगर छोटी value रखेंगे तो system जल्दी-जल्दी swings दिखाएगा; बड़ी value से सिर्फ major, मजबूत reversal points दिखेंगे।
Intent (लक्ष्य/भावना)
User को flexibility देना, ताकि वह chart structure अपनी strategy के हिसाब से देख सके।
Pro-level market structure analysis (higher highs/lows, lower lows/highs) को simplify करना।
Beginners को real swing/reversal या trend continuation signal में clarity देना, bar-बार changing signals से बचाना।
User फ़ायदा (कैसे use करें/benefit)
Short-term/Scalping के लिए: small value (जैसे 8-10)—quick swing points, fast choppy market में best है।
Swing/Positional Trading के लिए: larger value (15-30)—major reversal या only big breakouts/breakdowns दिखेंगे, noise कम, reliability ज्यादा।
Entry/exit timing ultra accurate हो जाती है — क्योंकि वही bars (swings) true reversal बन पाते हैं जिनके पीछे enough candles का context होता है।
Beginners भी chart पर local high/low, support/resistance आसानी से identify कर पाते हैं, manual drawing की ज़रूरत नहीं।
Trend-followers छोटे swing के trap से बच सकते हैं; reversal traders major profit capturing कर सकते हैं।
Example:
अगर swing_look = 15, तो indicator हर point पर पिछले 15 bars में highest high और lowest low देखेगा — अगर कोई बार इन values से ज़्यादा/कम है, तो swing high/low बन जाएगा।
इससे आप अपनी strategy को perfectly match करते हुए, strong और weak swings को filter कर सकते हैं—high probability trading, कम confusion, और confident setup!
HTF (Bias Window) (window_tf)
क्या है?
HTF (Higher Time Frame) Bias Window वह setting है जिससे आप यह decide करते हैं कि indicator multisystem logic में कौन सा higher time frame (जैसे—15min, 1H, 4H, 1D आदि) market bias/मूड पढ़ने के लिए इस्तमाल करे।
इसमें time-frame (window) select होता है जिस पर overall market trend, bias, liquidity और reversal zones का हिसाब लगाया जाता है।
क्यों है?
ज़्यादातर beginners या हाल ही के traders सिर्फ current/candle time-frame देखते हैं — जिससे बार-बार छोटे या fake signals आ जाते हैं।
लेकिन real market direction, big moves और trend reversals अक्सर bigger time frame (HTF) से ही decide होते हैं।
HTF bias window रखने का मकसद यह है कि entry/exit decisions हमेशा बड़े context के हिसाब से हों—market की asliyat कभी भी small time-frame में miss न हो!
Intent (मूल भावना)
User को multitimeframe trading की advanced power देना—बिना extra charts के।
हर trade से पहले bigger bias पता रहे—market bullish है, sideways है या bearish है, वो instantly clear हो।
Beginners को frustration, false breakout और whipsaw trap से बचाना—क्योंकि current TF का move अगर HTF के खिलाफ है तो trap होने के chances बहुत ज्यादा हैं।
User फ़ायदा (कैसे benefit लें?)
Scalping/trading में:
Quick trades के लिए छोटी HTF window (जैसे 15-30min) चुनें।
Swing/position trading में:
बड़ी window (1H, 4H, 1D) रखें—overall trend, major reversal & support/resistance zones का सही अंदाजा मिलेगा।
Beginner हो या Pro—HTF bias window के हिसाब से entry लें तो “trend के खिलाफ trade” ना के बराबर होंगे, result consistency बढ़ जाएगी।
HTF हमेशा direction/major move के पीछे की असली ताकत दिखाता है—choppy, sideways या reversal market में perfect filter की तरह काम करता है।
Example Practical Use:
Suppose आपने chart 5min का open किया है, पर HTF bias window 1H set किया—तो हर 5min move की असली दिशा hourly trend बताएगा, जिससे सिर्फ strong, genuine trend पर ही entry मिलेगी।
सारांश:
HTF Bias Window ऐसी setting है जो हर user को beginner से pro तक, market के बड़े structure के हिसाब से decision लेने की ताकत देती है—winning ratio और discipline दोनों full boost हो जाते हैं!
Adaptive Lookback (HTF) (lookback_sup)
क्या है?
Adaptive Lookback (HTF) वो setting है जिसमें user यह तय करता है कि higher time frame (HTF) analysis में सुपर इम्पॉर्टेंट data points—जैसे highest volume, biggest candle body, swing points आदि—calculate करने के लिए कितनी पिछली HTF candles को consider करना चाहिए।
यानी HTF में latest कितनी bars देखनी हैं ताकि extreme/high impact moves, zones, और levels का पता चले।
क्यों है?
बड़े moves या reversal अक्सर पिछले लंबे data history में बनती है — इसलिए adaptive lookback जरूरी है।
Short lookback से फटाफट बदलने वाले (quick, responsive) zones मिलेंगे; long lookback से ultra-reliable, rarely changing, big zones मिलेंगे।
हर symbol, strategy और time-frame के हिसाब से right lookback set करना ultra-important है — beginner के लिए भी और pro के लिए भी।
Intent (भावना/logic)
Market के real key levels, HTF trend strength और liquidity का असली context provide करना।
Trend exhaustion, real support/resistance shift, big volume pockets — सब detect हों, इसलिए adaptive tuning option देना।
Beginner को सिर्फ current देखने की गलती से बचाना और overall bias/history भी use करने का रास्ता मिलना।
User फ़ायदा (कैसे use करें/benefit)
छोटा lookback (10-15):
Fast market/volatile asset या intraday के लिए, ताकि indicator बदलती condition के हिसाब से तेजी से adapt करें।
Beginners जो टाइम-टू-टाइम active entries चाहते हैं, उन्हें short lookback से quick response मिलेगा।
बड़ा lookback (20-50+):
High TF पे, swing/positional users के लिए—ऐसे zones, जो बहुत rare और reliable हों। Real trend/fake out/trap से protection मिलेगी।
Pro traders, long-term portfolios में rarely shift होने वाले buy/sell levels automatic spot कर सकते हैं।
HTF के support/resistance, body high, volume high जैसी values निकालकर indicator हर signal को सिर्फ सच्चे big context में ही पास करेगा — accuracy, discipline और trust दोनों बनेगा।
Example:
मान लीजिए lookback_sup = 20; HTF पर, सबसे बड़े volume और candle body last 20 HTF bars से निकाले जाएँगे। अगर sudden spike/zone आता है, तो नया level बनेगा, वरना reliable old results चलेंगे।
निष्कर्ष:
Adaptive Lookback (HTF) आपको long/short trend context, big reversal, institution zones जैसी बड़ी info “ अपने time-frame/strategy के हिसाब से ही ” देता है—entry/exit के लिए ज्यादा भरोसेमंद और high-impact decision possible होता है!
Show Support/Resistance (showSR)
क्या है?
यह एक ON/OFF (True/False) setting है जिसके जरिए user decide करता है कि indicator chart पर automatically निकाले गए support और resistance levels को display करे या नहीं।
जब यह ON रहता है, तो सिस्टम खुद-ब-खुद सबसे ज़्यादा relevant support और resistance (S/R) levels को price chart पर label कर देता है।
क्यों है?
Beginners या even pro-traders भी कभी-कभी key S/R levels draw करने में गलती कर देते हैं या चीज़ें miss कर जाते हैं।
S/R levels trade entry, exit, stoploss और target decide करने का main scientific base होते हैं।
Manual S/R drawing में time भी लगता है और bias का risk भी रहता है—auto-detection हर trader का काम आसान कर देता है।
Intent (logic/लक्ष्य)
User को key market reversal/continuation zones instantly, chart पर real-time दिखाना।
Entry/exit decision-making को speed और confidence के साथ simple बनाना।
किसी भी strategy (price action, breakout, reversal etc.) में key level visualization on-the-fly मिले।
User फ़ायदा (कैसे use करें/benefit)
जैसे ही showSR ON करेंगे, सिस्टम चुपचाप adaptive logic से latest swing हाई/लो, उम्मीद के reversal/trap/continuation level labels chart पर दिखा देगा।
Entry के लिए—जब price support से bounce या resistance पर फंसे, तो action बहुत reliable होगा।
Stoploss/target planning ultra-simple—कोई भी level exact price पर देख सकते हैं।
Beginners को chart पढ़ना, risk management और candle structure analysis learning practically मिल जाता है—कोई guesswork या over-thinking नहीं।
Advanced user multi-timeframe chart्स पर cross-check के लिए instantly s/r देख सकते हैं।
Example:
Fast trading या market में फँसने वाले trade में, S/R ON कर देने से market की real “boundary” हर वक्त सामने रहेगी—best risk/reward और patience automatic आएगा।
निष्कर्ष:
Show Support/Resistance ON रखना हर trader को आत्मनिर्भर, confident और high-probability decision maker बना देता है—चाहे वह नया हो या प्रो।
Manual drawing, confusion या misplacement का risk एकदम vanish—chart always ready, always clear!Show Support/Resistance (showSR)
Show Liquidity Zones (showLIQ)
क्या है?
यह एक ON/OFF (True/False) टॉगल है—user decide करता है कि indicator chart पर हाई-वॉल्यूम वाले liquidity zones को highlight (दिखाए) करे या नहीं।
ON करने पर indicator intelligent logic से chart पर वही price area label करता है जहाँ सबसे ज़्यादा असली trade (liquidity) होती है—यानि जहाँ institutional, big-player activity या sudden big moves के आसार होते हैं।
क्यों है?
Market के बड़े moves या reversals अक्सर वहीं से शुरू होते हैं जहाँ बहुत high volume या liquidity जमा होती है; यही “trap” और “fake breakout” zone भी होते हैं।
Beginners liquidity zone को पचान नहीं पाते और असली move शुरू होने के समय उलट trade कर लेते हैं।
Automatic liquidity mapping से entry, exit या reversal का decision practical and pro-level हो जाता है।
Intent (logic/लक्ष्य)
User को real market power zones ekदम instantly chart पर दिखाना।
Beginners/pro दोनों को — कहाँ "smart money" छुपा है, कहाँ price trap या sudden reversal संभव है, उसका ready clue मिले।
Trade execution, stoploss placement और breakout management को safe, fast और systematic बनाना।
User फ़ायदा (कैसे use करें/benefit)
ON करने से chart पर वही zone highlight होंगे जहाँ price action सबसे ज्यादा meaning रखता है—entry का probability और risk management दोनों best रहेगा।
Beginners को समझ आएगा कि market में सिर्फ SR नहीं, liquidity zone भी important trend driver है।
Advanced user smart money follow करके trap से बचेगा और reversal या continuation पर strong एग्रेसिव entry ले सकेगा।
Panic moves, fake breakouts, और unusual volatility के समय यह zones maximize protection देते हैं।
Scalping, intraday, swing—हर strategy के लिए; liquidity zone का visualization फौरन available होगा।
Example:
Suppose price suddenly एक liquidity zone (high volume mark) के करीब आया—तो system आपको unconsciously alert करेगा कि या तो यह strong entry है या यहाँ से trend reversal मुमकिन है।
सारांश:
Show Liquidity Zones ON रखने से हर ट्रेडर instantly जान सकता है कि “market को सही मायने में कहाँ interest है”—entry timing sharp, big-player trap पहचानना आसान, और overall trading discipline ultra-confident रहेगा!
Manual guesswork पूरी तरह खत्म!
Show Trendlines (showTrend)
क्या है?
यह एक ON/OFF (True/False) setting है — user तय करता है कि indicator chart पर automatically adaptive trendlines plot करे या नहीं।
ON करने पर indicator current/higher time frame के हिसाब से latest price action trends (uptrend or downtrend) के relevant trendline सीधे chart पर draw कर देता है — साथ ही यह entry, breakout और reversal signal में instantly मदद करता है।
क्यों है?
Trendlines trading में price direction, entry/exit point, breakout या reversal zone, और overall price momentum visualize करने का सबसे बेसिक और सबसे भरोसेमंद तरीका हैं।
Beginners को manually trendline draw करना सीखना या perfect line लगाना बेहद tough लगता है — bias, error या miss होने का खतरा रहता है।
Auto-adaptive trendlines होने से market का असली structure बार-बार देखकर समझ में आता है — और signal confirmation भी आसानी से हो जाती है।
Intent (logic/लक्ष्य)
User को chart पर price action और trend का true angle instantly दिखाना।
Trend-following, breakout और reversal strategies को beginner level पर भी super easy बनाना।
No-bias charting experience — हर बार trendline reliable, adaptive और real-time दिखे।
User फ़ायदा (कैसे use करें/benefit)
Trend continuation/entry planning: जब price trendline के साथ/against react करे तो instant clarity मिलेगी — उपरी या निचली trendline के break होने पर entry/exit signal भी refined रहेगा।
Breakout trap या fake reversal से बचाव: Trendline हमेशा real price mood की side दिखाएगी — beginners कभी भी sideways market या false move में confused नहीं होंगे।
Chart minimal, practical और fast-acting रहेगा; चाहे swing tracing हो, scalping या long-term.
Advanced traders भी multiple timeframes/strategy के हिसाब से instant trendline reference के फायदा ले सकते हैं।
Pro-level visualization instantly बिना manual मेहनत के, confidence और patience अपने आप बढ़ेगी।
Example:
Suppose market uptrend में है, trendline chart पर auto-draw हो जायेगी; price जब भी support पर बने या break करे — system instant alert के साथ real trend जाने देगा।
निष्कर्ष:
Show Trendlines ON रखने से indicator entry/exit या reversal की direction instantly live दिखाता है — chart कभी blank, confusion या bias वाला नहीं रहता — beginners से लेकर expert तक, सभी को super-smooth price action discipline instantly मिल जाता है!
Manual drawing भूल जाएँ — chart हमेशा ready, always trustworthy!
S/R Lookback (Adaptive) (srLook)
क्या है?
यह setting यह डिफाइन करती है कि indicator adaptive support/resistance (S/R) levels निकालने के लिए पिछले कितनी bars (candles) का डेटा चेक करे।
यानी, हर बार जब indicator chart पर नया support या resistance label निकालता है, तो वह कितने पीछे जाकर swing high/low देखे — user खुद srLook से decide करता है।
Default value (जैसे 5 या उससे ऊपर)—पिछली 5 candles के lowest/highest को adaptive SR निकालने में इस्तेमाल करेगा।
क्यों है?
S/R calculation की reliability उस दौरान देखे गए data की width/size पर बहुत depend करती है।
कम lookback = तेजी से बदलने वाला support/resistance (quick trading/scalping)।
ज्यादा lookback = ज़्यादा stable, rarely changing, strong S/R (trend/swing position trading)।
हर strategy/trader और market structure के लिए सही lookback choose करना edge देता है।
Intent (लक्ष्य/logic)
User को control देना कि S/R detection कितना “responsive” हो या कितना “stable/reliable” हो।
Beginners को adaptive calculation logic और pro-traders को customizable S/R depth, दोनों देना।
Ultra clutter-free chart; chart भी साफ, levels भी logical।
User फ़ायदा (कैसे use करें/benefit)
Intraday/scalping के लिए:
कम srLook (5-7) — frequent, fast-reacting S/R; rapid moves के लिए बढ़िया।
Swing/positional trading के लिए:
ज्यादा srLook (10-20) — strong, rarely shifting S/R; false breakouts और noisy zones का risk बेहद कम।
Beginners खुद instantly देख सकते हैं कि chart पर कौन-सा level सबसे ज्यादा touch या respect हो रहा है — entry, stoploss, target super easy।
वैसे strategies में जहां price बहुत sideways है, srLook बढ़ाकर only real reversal zones को auto-pick कर सकते हैं।
Strategy-setup के हिसाब से experiment कर सकते हैं—result live देखेंगे।
Example:
अगर srLook = 7 है, तो indicator last 7 candles में सबसे lowest low को support और सबसे highest high को resistance मानकर chart पर adaptive डॉट या label लगा देगा — जैसे ही market S/R के पास आएगा system alert होगा।
निष्कर्ष:
S/R Lookback (Adaptive) user को अपने chart और trading style के हिसाब से best-fit support/resistance levels निकालने का फ्रीडम देता है—noise, guesswork और manual जानकारी की ज़रूरत खत्म, chart हमेशा practically trade-ready रहता है!
Liquidity Lookback (Adaptive) (liqLook)
क्या है?
Liquidity Lookback एक numerical setting है, जिससे user define करता है कि indicator liquidity (यानी unusual/high volume वाले zones) detect करने के लिए कितनी पिछली candles (bars) को average करें।
Default value (जैसे 20) - इसका मतलब है कि पिछले 20 bars का volume average लेकर ही liquidity zone set होगा।
क्यों है?
Liquidity trap, big volume breakout या absorption जैसे pro-level analysis सही तरीके से तभी identify होते हैं जब सही history देखी जाए।
कम lookback (छोटी window) से liquidity detection इतना fast हो जाता है कि हर छोटी volume spike भी ज़ोन बन जाती है (scalper/faster traders के लिए)।
बड़ी lookback (ज्यादा bars) से सिर्फ वे ही liquidity zones बनते हैं जो वास्तव में बहुत बार repeat हुए हों—ज्यादा reliable for swing/positional trading।
Intent (उद्देश्य/logic)
Chart पर liquidity detection को user strategy, asset type, और market behavior के हिसाब से customize करना।
Beginners को too many, irrelevant, या weak liquidity zones से बचाना और pro-users को rare yet powerful zone देने का विकल्प रखना।
System को practical, less noisy और adaptive बनाना।
User फ़ायदा (कैसे benefit लें?)
Fast/Scalping के लिए:
कम value रखें (5-10)—market में हर unusual volume पर liquidity zone दिखेगा, quick moves पकड़ पाएँगे।
Swing/Positional के लिए:
ज्यादा value रखें (20-30+)—सिर्फ high-impact, rarely changing, very important zone ही बनेगा, less noise!
Beginners simply experiment करके देख सकते हैं कि कौन सा value उसके chart और time-frame के लिए सबसे उपयोगी है।
Liquidity trap, fake breakout या panic entry का खतरा/liquidity drying zones आसानी से spot।
Pro-traders advanced tuning से ultra-specific zones बना सकते हैं।
Example:
अगर liqLook = 20, तो indicator पिछले 20 bars का volume average करेगा — और जब current volume उससे कहीं ऊपर जाएगा, तभी liquidity zone बनेगा।
छोटा देखना है तो कम value, बड़ी swing trade या safe zone चाहिए तो ज्यादा value।
निष्कर्ष:
Liquidity Lookback (Adaptive) हर user को अपने chart, trading style और strategy की जरूरत के अनुसार adaptive liquidity zones दिखाने का 100% control देता है — जिससे market trap, fake moves से बचना बहुत आसान हो जाता है और हर real move instantly identify होता है!
Liquidity Vol Multiplier (liqFactor)
क्या है?
यह एक float (जैसे—0.9, 1.2, 1.5 etc.) parameter है, जिससे user यह define करता है कि liquidity zone तब ही बनाना है जब current candle का volume, average liquidity volume (past liqLook bars का average) के कितने गुना से ज़्यादा हो।
यानी—market में unusual, real liquidity तभी highlight करनी है जब वो ordinary से काफी ऊपर हो।
क्यों है?
हर price action, reversal या breakout real volume पर ही बनता है—but, अगर हर छोटी volume spike को भी liquidity मान लें तो chart useless/overcrowded लगने लगेगा।
यह multiplier control देता है कि सिर्फ genuinely big money movement या rare event पर ही liquidity zone बने—regular/fake volume moves filter हो जाएँ।
Intent (logic/लक्ष्य)
System को noise-free, only big/true liquidity detect करना सिखाना, ताकि beginners बार-बार irrelevant signals से परेशान न हों।
Pro-users को smart-money वाली entries और true institutional action जल्दी और भरोसेमंद तरीके से दिखाना।
All-purpose—हर strategy, time-frame, asset type के हिसाब से practical tuning option देना।
User फ़ायदा (कैसे use करें/benefit)
Aggressive/Fast trades:
Liquidity vol multiplier कम रखें (0.8—1.0)—system छोटी-छोटी unusual moves को भी zones मानेगा (quick scalp या volatile moves के लिए)।
Conservative/Swing trades:
High value (1.2—2.0)—liquidity zone तभी बनेगा जब market में वाकई बड़ा order या participants move करें; गलती से fake zones आ ही नहीं सकते।
Beginners—अगर chart पर बहुत ज़्यादा liquidity zones दिख रहे हो तो value बढ़ा दें, कम दिख रहे हैं तो घटा दें।
Real power/trap zones हमेशा instantly मिलेंगे—entry, stoploss, या reversal सब safe, reliable और high-probability बन जाएगा।
Helps to avoid “false liquidity”—यानी normal या weak volume को ignore करके सिर्फ real/big action point दिखाएगा।
Example:
अगर liqFactor = 0.9 है, और avg liquidity 1L volume है—तो current volume 90,000 या उससे ज़्यादा होने पर ही liquidity zone बनेगा।
अगर liqFactor = 1.5 है—तो 1.5L से ऊपर volume हो तो ही zone बनेगा—system simply ignore कर देगा सब ordinary or dull market move।
निष्कर्ष:
Liquidity Vol Multiplier से liquidity detection real और practical रहता है—market के हर user के लिए chart साफ, entry high quality, और real risk management full control में।
Manual tuning करके ultra-personalized trading edge लेना super easy!
बिल्कुल! अब हम Dashboard के हर section को detailing में लेंगे—
हर parameter/intent की theory (ट्रेडर के लिए क्या फायदा?) और उसके नीचे LIVE code में logic कैसे काम कर रहा है दोनों बताएँगे, ताकि beginner और pro-trader दोनों को pure practical clarity मिले।
Dashboard Section: Intent HTF (dashboardIntent)
User Parameter / Intent क्या है?
Intent HTF बताता है कि higher time frame (HTF)—जैसे 1H, 4H, daily, जो भी आपने select किया—उस पर market का असली, पक्का bias क्या है:
BULLISH INTENT (HTF) — buyers overall control में हैं: उपर जाने की संभावना strongest है।
BEARISH INTENT (HTF) — sellers control में हैं: नीचे जाने/गिरावट की संभावना ज्यादा।
NO CLEAR INTENT — market sideways, indecisive या trend/fluctuation साफ नहीं है…entry करना risky हो सकता है।
यह Indicator कैसे Decide करता है? (आसान practical भाषा में)
बड़े Time Frame की Candle को Observe करना:
Indicator selected HTF पर candle का open, close, high, low, और volume देखता है (main chart time-frame से अलग window_tf setting के हिसाब से).
Biggest Volume & Move Compare करना:
पीछे lookback_sup जितनी candles में से, biggest candle body, biggest volume और percentage body निकालता है।
फिर percentile logic (जैसे top 80% percentile) देखता है—मतलब क्या current move उस historical data के comparison में वाकई unusual है?
Strict Signal Check:
अगर:
Candle का close उसके open से ऊपर है (for Bullish) और वह पिछले swing/high को भी cross कर रही है,
और volume/body/apni percentile threshold को beat कर रही है
…तभी intent बनेगा “HTF BULLISH”।
Vice versa अगर close नीचे, swing low से भी नीचे, और बाकी signals pass हो—तो “HTF BEARISH”।
अगर कोई भी strict condition fulfill नहीं होती, intent रहेगा “NO CLEAR INTENT”—यानि sideways/chop.
Persistent logic:
Intent बार-बार तड़ातड़ बदलता नहीं—एक बार बनी bias सिर्फ तभी change होगी, जब साफ-साफ opposite पक्का signal मिले।
इससे chart bar-bar flip नहीं करता—trader discipline और confidence में रहता है।
Trader को क्या Practical Benefit है?
Beginner — अब confuse नहीं होगा क्योंकी “market का real trend क्या है” सीधे dashboard पर लिखकर मिलेगा; कोई guess-work नहीं।
Pro-trader — directional bias के खिलाफ trade नहीं करेगा, risk-reward हमेशा optimal बनेगा।
Market sideways हो तो NO CLEAR INTENT दिखेगा, यानि extra discipline—trade avoid या wait करना easy लगेगा।
Example:
आपने 1H window चुनी। पिछली बार trend strong buyers वाला था, आज candle open से ऊपर, unusual volume, previous high breakout—system बोलेगा: BULLISH INTENT (HTF)
Market टेढ़ी, unclear—system NO CLEAR INTENT बोलेगा: avoid करो, या छोटी quantity में patience रखो।
नोट:
Intent HTF आपको winning side पर बने रहने, trap से बचने और हर big move के पहले reliable confirmation लेने की power देता है—कोई भी loss, overtrading और panic यहां से control में आ जाता है!
HTF Bias (persistentBiasMsg, htfBiasMsg)
क्या है - User की भाषा में:
“HTF Bias” ये बताता है कि बड़े time-frame (जैसे 1 घंटे, 4 घंटे, 1 दिन) पर market का असली माहौल क्या है — buyers के favor में (Bullish), sellers के favor में (Bearish), या market undecided/sideways (Chop) है।
Dashboard के बॉक्स में हमेशा updated रहता है — जिससे कोई भी trader instantly पहचान ले कि बड़े players का mood किस तरफ है।
Indicator इसका bias कैसे निकालता है—आसान भाषा में Logic:
HTF की Big Candle और Volume देखना:
Indicator main chart से ऊपर, एक और बड़े time-frame (जैसे 1H, 4H, 1D) पर market की बड़ी candle (उसका open, close, high, low) और उसका volume बहार ले आता है.
Historical Data से सबसे तेज़, शार्प move पकड़ना:
अब वह पीछे कुछ चुनी हुई बड़ी candles देखता है (user की lookback setting जितनी), और उनमें से सबसे बड़ी candle body, सबसे बड़ी volume, और सबसे बड़ा percentage body (size/length) निकालता है.
फिर इन values का percentile अप्लाई करता है (जैसे top 80% वाली candles).
Decision Point बनाना:
अब Indicator ये judge करता है:
क्या current HTF candle का close ज्यादा है open से?
क्या उसने पिछले swing/high को break किया?
क्या volume और candle का size उस बाकी historical data में सबसे बड़ा (या percentile के हिसाब से high) है?
अगर हां — तो यह मालूम होता है कि buyers/sellers ने बड़े time-frame पर सच्चा control दिखाया!
Bias assign करना (Bullish/Bearish/Chop):
अगर सब signal मिल जाएं और price ऊपर बंद हो, volume/body पुरानों से बड़ा हो तो — “HTF: Bullish”
अगर सब signal, पर price नीचे बंद हो, volume/body बड़े हों तो — “HTF: Bearish”
अगर signal clear नहीं है (कोई strong move या unusual volume/size नहीं) — “HTF: Chop” (मतलब न खरीदो न बेचो)
Bias Stable रखने का System:
Indicator bias को बार-बार flashy तरीके से नहीं बदलता!
जब तक clear और पक्की opposite signal ना मिले, bias पुराने वाले पर ही रहता है — जिससे हर बार का mood trustworthy और panic-free feel होता है.
Trader के लिए Practical Result:
आपको chart देखते ही जल्दी पता चल जायेगा — आज, इस time-frame पर market का बाप कौन है: buyers, sellers, या कोई भी नहीं!
आप बिना किसी doubt या panic के entry/exit plan कर सकते हैं — बस bias check करें और उसी direction की trade पर ज़ोर दें.
Beginners मार्केट के छोटे trap/fake-out से बच सकते हैं, Pro-trader कई time-frame strategies safe बना सकते हैं.
Simple Example:
मान लीजिए आप 15min chart देख रहे हैं, पर dashboard में “HTF Bias: Bullish” दिख रहा है (window_tf = 1H):
इसका मतलब hourly chart पर buyers की पकड़ है.
आप शांत mind से shorter chart पर buy setup में ही focus करेंगे!
जब तक bias flip न हो — only buy-side priority. Market sideways हो तो trade बचें.
Dashboard Section: Chart Action (chartAction)
User Parameter / Intent क्या है?
Chart Action यह डिसाइड करता है कि अभी main chart time-frame पर user को क्या action लेना चाहिए—BUY (खरीदें), SELL (बेचें), या WAIT (रुकें, कोई trade मत लें).
यह signal पूरा system के सारे rules, filters, trend strengths और user-selected options के साथ निकलता है—ताकि हर trade disciplined, practical और प्रूफ वाला हो.
Logic – Chart Action कैसे निकाला जाता है? (आसान words में)
System दो तरफ के इशारे देखता है:
Strong Trend:
System चेक करता है कि recent candles में majority bars एक ही साइड हैं (जैसे ज्यादातर green/bullish या red/bearish), और price moving average (trendBarCount वाली SMA) के ऊपर (long) या नीचे (short) है।
User Intent (Special Price Action Signals):
खास events जैसे wick analysis, absorption, unusual breakout, range expansion—इनमें से कोई strong signal active है या नहीं।
Rules – Signal किस logic से मिलते हैं:
BUY:
अगर strong trend long active हो (कई candles लगातार आगे),
या कोई भी user-intent वाली bullish signal ON हो (जैसे wick reversal, unusual breakout आदि)
=> तब “BUY”
SELL:
अगर strong trend short active हो (कई candles लगातार नीचे),
या bearish price action signal मिले
=> तब “SELL”
WAIT:
ऊपर में से कोई condition पूरी नहीं हो रही
=> कोई trade नहीं—“WAIT”
Why so strict?
System में दोनों—Trend & User Intent logics लें—ताकि fake move, sideways/trap से बचाव हो।
Signal तभी मिले जब सच्चा momentum या clear signal हो—false entry से बचाव!
Trader को Practical Result क्या मिलेगा?
Dashboard पर एकदम clear दिखेगा—“BUY” (green), “SELL” (red), या “WAIT” (yellow)
Beginners को कभी overtrade या बिना logic entry नहीं मिलेगी; chart action सिर्फ real, filters पास करने वाले मौके पर ही देगा।
Pro-Trader को signal-triggering full transparency और quick action—सिर्फ actionable मौके, कोई guess, कोई overconfidence नहीं।
WAIT की हालत में trader खुद-ब-खुद discipline में रहेगा और नो-ट्रेड का मज़ा समझेगा (best protection!)।
यह Logic background में कैसे चलता है? (सरल शब्दों में)
Indicator हर candle पर पूरी logic चेक करता है—trend score, price SMA, user enabled filters और price action triggers।
जैसे ही कोई strong buy या sell signal confidencely बनेगा—dashboard में action update हो जाएगा।
System कभी force entry नहीं देगा—अपने आप “WAIT” if कोई condition ना मिले.
Simple Example:
लगातार कई green bar, price average से ऊपर—system तरह का एक strong trend देखता है—फिर sudden unusual breakout candle (with big volume) आ गई—chart action: BUY।
Market अजीब/sideways—ना trend score पूरा, ना कोई action trigger—chart action: WAIT।
Strong red trend चला और sudden downside expansion candle—chart action: SELL।
Dashboard Section: TrendScore Long/Short
User Parameter / Intent क्या है?
यह cell आपको एक ही नजर में दिखाता है कि पिछली X candles (जितना “Trend Bar Lookback” set किया है) में कितनी candles बिना किसी confusion एकदम bullish direction में हैं—और कितनी bearish.
Format हमेशा — LongCount / ShortCount
जैसे: 5/2 का मतलब: 5 bullish, 2 bearish bar (trendBarCount=7).
Logic – यह TrendScore कैसे निकलता है?
Recent Candle Analysis:
Indicator अपनी selected window (e.g. पिछले 7 candles) में हर bar check करता है:
अगर bar का close, open से ज्यादा है: उसे bullish मानता है (LongCount +1)
अगर bar का close, open से कम है: उसे bearish मानता है (ShortCount +1)
Neutral candles (close = open) को ignore किया जा सकता है.
Count Store करा जाता है:
LongCount और ShortCount दोनों अलग-अलग number में store होते हैं.
Result Dashboard पर Show होता है:
यानि जैसे जैसे market direction बदलती है, trendScore dynamicaly update होता है.
Table cell में यह pair — “LongCount/ShortCount” — दिखता है.
Trader को Practical Benefit:
Quick Read:
एक हिस्से में कितने bars buyers ने control किया, कितने sellers ने—instantly दिख जाता है.
Market Mood:
अगर Long/Short count बराबर या ज्यादा short है तो समझ जाएं कि trend weak है—WAIT, no trade!
अगर Long बहुत ज्यादा है, short कम—Strong bullish momentum, safe entry; vice-versa bearish.
Beginner Friendly:
खुद manually candle गिनने की जरूरत नहीं—trendScore से हर beginner/confused trader direction clarity पा सकता है.
Strategy Tuning:
Swing, scalping या positional—हर setup के लिए lookback adjust कर सकते हैं, trendScore से फुर्तीला या slow trend देख सकते हैं.
Example:
Suppose आपने trendBarCount = 7,
पिछले 7 bars में 6 bullish, 1 bearish — TrendScore: 6/1 (Strong uptrend!)
अगर 2 long, 5 short — 2/5 (Strong downtrend!)
अगर 3/4, 4/3 — मतलब trend बराबर/sideways — Avoid rash trading.
Dashboard Section: Reason (WHY)
User Parameter / Intent क्या है?
Reason (WHY) user को बिलकुल साफ-साफ बताता है कि अभी dashboard जो trade action बता रहा है (BUY/SELL/WAIT), उसका सबसे बड़ा, सबसे मजबूत कारण क्या है।
यानी — system मुझे entry क्यों दे रहा है? किस filter या logic से ये action निकला?
Logic – Reason कैसे निकलता है? (Simple, Practical Explanation)
सब Active Price Action और Trend दाखिल पढ़ना:
Indicator हर candle पर यह देखता है कि कौन सा signal या filter सबसे ज्यादा powerful काम कर रहा है।
जैसे: unusual breakout (बड़ा range + volume), wick reversal (lower/upper wick extra बड़ा signal), absorption (high vol + special close), strong trend, या expansion candle आदि।
Priority/Order of Reasons:
Code एक-एक करके सबसे potent (ज्यादा weight वाला) reason को check करता है—
सबसे पहले unusual breakout है? तो वही reason।
नहीं, तो wick analysis—वह है तो वही।
ऐसे ही absorption, expansion, strong trend—जैसे जैसे logic pass करता है, first one को ही reason दिखा देता है।
अगर कोई भी खास signal active नहीं, ना trend-score, ना price-action —
Reason: “Wait/No Clear Signal”
Live Reason in Dashboard:
जैसे ही कोई नई candle बनेगी, reason bar/bar auto-update होता है, ताकि हर trade से पहले user को एक line में solid justification मिले।
Trader को Practical Benefit:
Complete Clarity:
आपको instantly पता चल जाएगा —entry मिली तो वह किस price action या trend signal से मिली।
No Blind Trust:
FAITH से नहीं—logic समझ के entry/exit लें।
Beginner या advanced trader—reason भटकेगा नहीं!
System Debug & Learn:
अगर बार-बार रीजन "Wait/No Clear Signal" दिखाए — patience रखें!
और जो भी signal आता है, उसकी price pattern instant chart पर match कर सकते हैं—pattern पहचानना आसान।
Transparency:
System कभी भी hidden logic पे trade फँसाएगा नहीं—सामने reason मिलेगा।
नोट:
Reason (WHY) cell हर trader को ultra-confidence देता है—signal का base, reasoning, और validation हर entry से पहले always ready!
Dashboard के बाकी logic भी चाहिए हों तो बताइए!Dashboard Section: Reason (WHY)
User Parameter / Intent क्या है?
“Reason (WHY)” dashboard cell आपको live बताता है:
इस candle पर trade का जो सिग्नल मिला (BUY/SELL/WAIT), उसका सबसे बड़ा कारण क्या था?
आपको पता चलता है, सिग्नल trend से आया, unusual breakout से, wick analysis से, दबाव या absorption से — या कोई reason ही नहीं, इसलिए WAIT signal।
Logic – कैसे Decide होता है? (आम भाषा में):
सारी Filters और Signals को Check करना:
हर बार system सारे price action filters एक-एक करके देखता है, जैसे:
क्या unusual breakout हुआ? (बहुत बड़ा range और volume)
क्या wick analysis से बार reversal signal मिला?
क्या volumetric absorption signal दिखी?
क्या expansion candle बना?
क्या strong trend pattern मिला?
इन सब signals में जिसे सबसे strong priority मिली है, वही as main reason चुनी जाएगी।
Order of Importance (Priority):
सबसे पहले unusual breakout trigger है? — तो वही.
फिर wick analysis — signal है तो वही.
ऐसे ही absorption, expansion, trend—जिसको पहले logic trigger हुआ उसे reason बना देंगे।
अगर कोई खास signal नहीं तो — “Wait/No Clear Signal”.
Reason Dashboard पर instant update होता है:
जैसे ही candle बनेगी, reason field auto-update — जिससे entry से पहले पता चले “सिग्नल का असली आधार क्या है?”।
Trader को फायदा:
कभी भी “blind trust” या confusion नहीं—हर action का open मनाव “सबूत” मिलता है।
सीखने के लिए — हर signal पर उस price pattern/logic को खुद तुरंत सीख सकेंगे।
प्रो और beginner दोनों — reason देख कर समझ सकते हैं कि कितना weighty/trusted signal मिला है।
अगर बार-बार “Wait/No Clear Signal” दिखे—entry से बचें, patience रखें।
Dashboard Section: TrendScore Long/Short
User Parameter / Intent क्या है?
यह section सीधा-सीधा आपको बताता है कि पिछली X candles (जितनी आपने “Trend Bar Lookback” सेट की है, जैसे 7) में से कितनी bullish बनीं (Long score), और कितनी bearish (Short score)।
फॉर्मैट: LongCount / ShortCount
जैसे: 5 / 2
मतलब: 7 में से 5 bars buyers के हाथ में, 2 bars sellers के।
Logic—कैसे निकलता है? (आसान भाषा में)
Candle-by-Candle Count:
Indicator, कहिए की एक छोटा सा loop चलाता है — पिछली जितनी candles आपने “trendBarCount” में select की उतनी।
हर candle की direction check करता है:
अगर close > open (green) → Long score +1
अगर close < open (red) → Short score +1
Result Store:
जितनी bullish bars मिलीं, उतना “Long”; bearish bars, उतना “Short”।
Table में यह pair साथ में show होता है — जैसे 5/2 या 3/4।
Live Auto-Update:
जैसी नई candle बनेगी, TrendScore update हो जाएगा — market का latest mood instantly दिख जाएगा।
Trader को Practical Benefit:
Instant Trend Strength:
Momentum देखना easy—buyers का domination है या sellers का, या बराबरी।
Trap/Fake Trend से Protection:
अगर Long और Short score करीब-करीब बराबर—market sideways या uncertain, entry avoid कर सकते हैं।
अगर Long बहुत ज्यादा—strong bullish trend (buying signal रिजि्ड बना रहेगा), vice versa short के लिए।
No Manual Count:
Beginner को बिना count किए candles का trend पता चलेगा—झंझट खत्म।
Strategy Tuning:
Aggressive trader small lookback/fast trend tune करें; conservative बड़ा lookback सेट करें—पूरा control!
Examples:
6/1: यानी पिछले 7 bars में 6 बार buyers ने win किया—momentum बहुत strong है!
3/4: दोनों almost same—trend weak या reversal zone, caution रखो।
0/7: केवल sellers, अतिवादी bearish—discipline maintain।
Summary:
TrendScore आपको instantly market के side का “real” हाल बताता है—entry से पहले intuition नहीं, clear number देखकर disciplined decision लो!
क्या है?
ये आपको दिखाता है कि “पिछली जितनी candles आप सेट करोगे” (जैसे 7), उनमें से कितनी bars bullish थीं (long score), कितनी bearish (short score)।
Logic कैसे चलता है?
Indicator हर बार पिछली X candles को देखता है।
अगर कोई bar की closing ऊपर (open से ऊपर) है — उसे bullish मानेगा (long score +1)
अगर नीचे — bearish (short score +1)
सबकी गिनती हो गई —
तो Dashboard में दिख जाएगा,
Example:
6/1 → 6 bullish, 1 bearish (strong uptrend)
2/5 → 2 bullish, 5 bearish (downtrend)
3/4 → बराबर – trend कमजोर है
जैसे-जैसे नई candle बनेगी, यह score भी auto-update रहेगा।
Trader को क्या फायदा?
बिना manually गिने, trend का सही हाल instantly पता लगेगा।
अगर दोनों तरफ का score नज़दीक है (3/4 या 4/3), तो समझो market चक्कर में है—cautious रहो, फंसने का chance।
एक साइड बहुत ज्यादा है (6/1, 7/0)—तो confidence से उसी तरफ entry/की planning करो।
निष्कर्ष:
TrendScore आपका सबसे तेज़, simplest “market mood thermometer” है—trend strong है, weak है या confusing—बस एक cell में दिख जाएगा!
Dashboard Section: Strong Trend (Long/Short)
User Parameter / Intent क्या है?
यह cell आपको तुरंत बताता है कि “अभी market में trend कितना पक्का, मजबूत और reliable है”—
YES (long) /
YES (short)
एक या दोनों side में।
यानी—क्या अभी buyers/sellers का जोर इतना है कि system उसे strong trend माने?
Logic—कैसे Decide होता है? (आसान/practical explaination)
TrendScore Threshold Check:
System सबसे पहले देखता है:
आपके चुने गए window (जैसे trendBarCount = 7) में, bullish या bearish bars का total score trendScoreMin से ज्यादा है या नहीं?
(जैसे min = 5, तो 7 में कम से कम 5 बार एक ही साइड हों।)
Price Position:
सिर्फ count काफी नहीं — check करता है कि अभी price अपनी average से ऊपर (long) या नीचे (short) भी है या नहीं।
Bulls के लिए: closing average से ऊपर
Bears के लिए: closing average से नीचे
Result Assign:
अगर दोनों conditions pass हों (count + average)—
तो “Strong Trend Long” (YES)
या “Strong Trend Short” (YES)
बाकी case में blank/empty यानी कोई strong trend नहीं।
Dashboard Cell:
Display:
अगर दोनों side strong हों: YES/YES
बस long: YES/
बस short: /YES
दोनों empty: /
Trader को Practical Benefit:
Fake move/trap से बचाव:
अगर strong trend नहीं दिखता है तो avoid करें—सिर्फ real momentum पर ही trade करो!
Entry confirmation:
Pro trader इस cell के YES आने पर ही aggressive setup लेता है—otherwise patience/avoid.
Quick Crosscheck:
Beginner को instantly समझ आ जाएगा—buy-side entry only तब लूँ जब YES (long), sell-side तब जब YES (short)
No guess, only discipline:
Trend कमजोर है—धैर्य रखो, system खुद बताएगा कब confident हो!
Examples:
**YES/ ** (Long side full strong trend, short weak)
** /YES** (Short side strong trend, long weak)
YES/YES (Very rare, usually trend reversal moment)
** /** (No strong trend, high risk, wait!)
निष्कर्ष:
Strong Trend cell सिर्फ high-probability, high-momentum setups के लिए GREEN/SIGNAL देता है—बाकी time patience सिखाता है। Trade हमेशा safest, trap से दूर!
Dashboard Section: HTF Vol/Body
User Parameter / Intent क्या है?
यह cell आपको higher time frame (HTF) पे दो चीजें real-time में दिखाता है:
V: (Volume) बड़ी candle पर आया actual volume कितना है
B: (Body %) उस HTF की candle का body percentage कितना है
यानी—market के बड़े trend या reversal के समय unusual volume और candle body size देखकर आप instantly समझ सकते हैं कि कितना मजबूत momentum या move आया।
Logic—कैसे Calculate होता है? (आसान/practical language)
HTF का डेटा उठाओ:
Indicator आपकी chosen विंडो (जैसे 1H, 4H) की candle को देखता है—उसका volume (V), open, close, high, low values।
Volume Calculation (V):
V: सिर्फ current HTF candle का volume ही नहीं दिखाता,
बल्कि पताि लेता है percentile logic के हिसाब से unusual/highest volume का adaptive average क्या है।
Compare भी करता है: क्या अभी volume “normal से बहुत बड़ा” है (यानी big move possible)?
Body Percentage (B):
B: Candle body (open-close) को पूरे candle ke range (high-low) से percentage में निकालता है:
जितना यह % ज्यादा, उतना momentum मांगा जाता है!
यानी, छोटी body = indecisive, बड़ी body = strong trend bar.
Dashboard Cell:
Show करता है:
“V: actual-vol / B: actual-body%”
Live auto-update होता है हर नई candle पे।
Trader को Practical Benefit:
Big Players का Action Quickly देखना:
अगर किसी HTF candle पे असामान्य volume या बड़ी body% दिखे, आप तुरंत समझ सकते हैं—market में institutions, big money एक्टिव है, breakout/trend reversal का chance ज्यादा है।
Trap & Fakeout Avoidance:
Low volume or low body% = sideways या fake move, entry avoid करें।
बहुत high volume + big body% = real break, momentum, safe entry!
Strategy Adaptation:
Swing, positional, or multiday trades के लिए, high volume/body% वाले candle का इंतजार ही आपके setup को next-level safe बना देगा।
Examples:
V: 152000 / B: 85.4 → HTF पे high unusual volume और body भी strong (great signal for big move)
V: 34000 / B: 12 → Volume low, body% छोटा (avoid, sideways/trap move possible)
V: 90000 / B: 35 → Normal volume, average trend; no urgent action
Summary:
HTF Vol/Body आपको instantly बताता है कि market में real action हो रहा है या noise; entry, exit या wait—all decision one glance में तय!
Universal Ratio Trend Matrix [InvestorUnknown]The Universal Ratio Trend Matrix is designed for trend analysis on asset/asset ratios, supporting up to 40 different assets. Its primary purpose is to help identify which assets are outperforming others within a selection, providing a broad overview of market trends through a matrix of ratios. The indicator automatically expands the matrix based on the number of assets chosen, simplifying the process of comparing multiple assets in terms of performance.
Key features include the ability to choose from a narrow selection of indicators to perform the ratio trend analysis, allowing users to apply well-defined metrics to their comparison.
Drawback: Due to the computational intensity involved in calculating ratios across many assets, the indicator has a limitation related to loading speed. TradingView has time limits for calculations, and for users on the basic (free) plan, this could result in frequent errors due to exceeded time limits. To use the indicator effectively, users with any paid plans should run it on timeframes higher than 8h (the lowest timeframe on which it managed to load with 40 assets), as lower timeframes may not reliably load.
Indicators:
RSI_raw: Simple function to calculate the Relative Strength Index (RSI) of a source (asset price).
RSI_sma: Calculates RSI followed by a Simple Moving Average (SMA).
RSI_ema: Calculates RSI followed by an Exponential Moving Average (EMA).
CCI: Calculates the Commodity Channel Index (CCI).
Fisher: Implements the Fisher Transform to normalize prices.
Utility Functions:
f_remove_exchange_name: Strips the exchange name from asset tickers (e.g., "INDEX:BTCUSD" to "BTCUSD").
f_remove_exchange_name(simple string name) =>
string parts = str.split(name, ":")
string result = array.size(parts) > 1 ? array.get(parts, 1) : name
result
f_get_price: Retrieves the closing price of a given asset ticker using request.security().
f_constant_src: Checks if the source data is constant by comparing multiple consecutive values.
Inputs:
General settings allow users to select the number of tickers for analysis (used_assets) and choose the trend indicator (RSI, CCI, Fisher, etc.).
Table settings customize how trend scores are displayed in terms of text size, header visibility, highlighting options, and top-performing asset identification.
The script includes inputs for up to 40 assets, allowing the user to select various cryptocurrencies (e.g., BTCUSD, ETHUSD, SOLUSD) or other assets for trend analysis.
Price Arrays:
Price values for each asset are stored in variables (price_a1 to price_a40) initialized as na. These prices are updated only for the number of assets specified by the user (used_assets).
Trend scores for each asset are stored in separate arrays
// declare price variables as "na"
var float price_a1 = na, var float price_a2 = na, var float price_a3 = na, var float price_a4 = na, var float price_a5 = na
var float price_a6 = na, var float price_a7 = na, var float price_a8 = na, var float price_a9 = na, var float price_a10 = na
var float price_a11 = na, var float price_a12 = na, var float price_a13 = na, var float price_a14 = na, var float price_a15 = na
var float price_a16 = na, var float price_a17 = na, var float price_a18 = na, var float price_a19 = na, var float price_a20 = na
var float price_a21 = na, var float price_a22 = na, var float price_a23 = na, var float price_a24 = na, var float price_a25 = na
var float price_a26 = na, var float price_a27 = na, var float price_a28 = na, var float price_a29 = na, var float price_a30 = na
var float price_a31 = na, var float price_a32 = na, var float price_a33 = na, var float price_a34 = na, var float price_a35 = na
var float price_a36 = na, var float price_a37 = na, var float price_a38 = na, var float price_a39 = na, var float price_a40 = na
// create "empty" arrays to store trend scores
var a1_array = array.new_int(40, 0), var a2_array = array.new_int(40, 0), var a3_array = array.new_int(40, 0), var a4_array = array.new_int(40, 0)
var a5_array = array.new_int(40, 0), var a6_array = array.new_int(40, 0), var a7_array = array.new_int(40, 0), var a8_array = array.new_int(40, 0)
var a9_array = array.new_int(40, 0), var a10_array = array.new_int(40, 0), var a11_array = array.new_int(40, 0), var a12_array = array.new_int(40, 0)
var a13_array = array.new_int(40, 0), var a14_array = array.new_int(40, 0), var a15_array = array.new_int(40, 0), var a16_array = array.new_int(40, 0)
var a17_array = array.new_int(40, 0), var a18_array = array.new_int(40, 0), var a19_array = array.new_int(40, 0), var a20_array = array.new_int(40, 0)
var a21_array = array.new_int(40, 0), var a22_array = array.new_int(40, 0), var a23_array = array.new_int(40, 0), var a24_array = array.new_int(40, 0)
var a25_array = array.new_int(40, 0), var a26_array = array.new_int(40, 0), var a27_array = array.new_int(40, 0), var a28_array = array.new_int(40, 0)
var a29_array = array.new_int(40, 0), var a30_array = array.new_int(40, 0), var a31_array = array.new_int(40, 0), var a32_array = array.new_int(40, 0)
var a33_array = array.new_int(40, 0), var a34_array = array.new_int(40, 0), var a35_array = array.new_int(40, 0), var a36_array = array.new_int(40, 0)
var a37_array = array.new_int(40, 0), var a38_array = array.new_int(40, 0), var a39_array = array.new_int(40, 0), var a40_array = array.new_int(40, 0)
f_get_price(simple string ticker) =>
request.security(ticker, "", close)
// Prices for each USED asset
f_get_asset_price(asset_number, ticker) =>
if (used_assets >= asset_number)
f_get_price(ticker)
else
na
// overwrite empty variables with the prices if "used_assets" is greater or equal to the asset number
if barstate.isconfirmed // use barstate.isconfirmed to avoid "na prices" and calculation errors that result in empty cells in the table
price_a1 := f_get_asset_price(1, asset1), price_a2 := f_get_asset_price(2, asset2), price_a3 := f_get_asset_price(3, asset3), price_a4 := f_get_asset_price(4, asset4)
price_a5 := f_get_asset_price(5, asset5), price_a6 := f_get_asset_price(6, asset6), price_a7 := f_get_asset_price(7, asset7), price_a8 := f_get_asset_price(8, asset8)
price_a9 := f_get_asset_price(9, asset9), price_a10 := f_get_asset_price(10, asset10), price_a11 := f_get_asset_price(11, asset11), price_a12 := f_get_asset_price(12, asset12)
price_a13 := f_get_asset_price(13, asset13), price_a14 := f_get_asset_price(14, asset14), price_a15 := f_get_asset_price(15, asset15), price_a16 := f_get_asset_price(16, asset16)
price_a17 := f_get_asset_price(17, asset17), price_a18 := f_get_asset_price(18, asset18), price_a19 := f_get_asset_price(19, asset19), price_a20 := f_get_asset_price(20, asset20)
price_a21 := f_get_asset_price(21, asset21), price_a22 := f_get_asset_price(22, asset22), price_a23 := f_get_asset_price(23, asset23), price_a24 := f_get_asset_price(24, asset24)
price_a25 := f_get_asset_price(25, asset25), price_a26 := f_get_asset_price(26, asset26), price_a27 := f_get_asset_price(27, asset27), price_a28 := f_get_asset_price(28, asset28)
price_a29 := f_get_asset_price(29, asset29), price_a30 := f_get_asset_price(30, asset30), price_a31 := f_get_asset_price(31, asset31), price_a32 := f_get_asset_price(32, asset32)
price_a33 := f_get_asset_price(33, asset33), price_a34 := f_get_asset_price(34, asset34), price_a35 := f_get_asset_price(35, asset35), price_a36 := f_get_asset_price(36, asset36)
price_a37 := f_get_asset_price(37, asset37), price_a38 := f_get_asset_price(38, asset38), price_a39 := f_get_asset_price(39, asset39), price_a40 := f_get_asset_price(40, asset40)
Universal Indicator Calculation (f_calc_score):
This function allows switching between different trend indicators (RSI, CCI, Fisher) for flexibility.
It uses a switch-case structure to calculate the indicator score, where a positive trend is denoted by 1 and a negative trend by 0. Each indicator has its own logic to determine whether the asset is trending up or down.
// use switch to allow "universality" in indicator selection
f_calc_score(source, trend_indicator, int_1, int_2) =>
int score = na
if (not f_constant_src(source)) and source > 0.0 // Skip if you are using the same assets for ratio (for example BTC/BTC)
x = switch trend_indicator
"RSI (Raw)" => RSI_raw(source, int_1)
"RSI (SMA)" => RSI_sma(source, int_1, int_2)
"RSI (EMA)" => RSI_ema(source, int_1, int_2)
"CCI" => CCI(source, int_1)
"Fisher" => Fisher(source, int_1)
y = switch trend_indicator
"RSI (Raw)" => x > 50 ? 1 : 0
"RSI (SMA)" => x > 50 ? 1 : 0
"RSI (EMA)" => x > 50 ? 1 : 0
"CCI" => x > 0 ? 1 : 0
"Fisher" => x > x ? 1 : 0
score := y
else
score := 0
score
Array Setting Function (f_array_set):
This function populates an array with scores calculated for each asset based on a base price (p_base) divided by the prices of the individual assets.
It processes multiple assets (up to 40), calling the f_calc_score function for each.
// function to set values into the arrays
f_array_set(a_array, p_base) =>
array.set(a_array, 0, f_calc_score(p_base / price_a1, trend_indicator, int_1, int_2))
array.set(a_array, 1, f_calc_score(p_base / price_a2, trend_indicator, int_1, int_2))
array.set(a_array, 2, f_calc_score(p_base / price_a3, trend_indicator, int_1, int_2))
array.set(a_array, 3, f_calc_score(p_base / price_a4, trend_indicator, int_1, int_2))
array.set(a_array, 4, f_calc_score(p_base / price_a5, trend_indicator, int_1, int_2))
array.set(a_array, 5, f_calc_score(p_base / price_a6, trend_indicator, int_1, int_2))
array.set(a_array, 6, f_calc_score(p_base / price_a7, trend_indicator, int_1, int_2))
array.set(a_array, 7, f_calc_score(p_base / price_a8, trend_indicator, int_1, int_2))
array.set(a_array, 8, f_calc_score(p_base / price_a9, trend_indicator, int_1, int_2))
array.set(a_array, 9, f_calc_score(p_base / price_a10, trend_indicator, int_1, int_2))
array.set(a_array, 10, f_calc_score(p_base / price_a11, trend_indicator, int_1, int_2))
array.set(a_array, 11, f_calc_score(p_base / price_a12, trend_indicator, int_1, int_2))
array.set(a_array, 12, f_calc_score(p_base / price_a13, trend_indicator, int_1, int_2))
array.set(a_array, 13, f_calc_score(p_base / price_a14, trend_indicator, int_1, int_2))
array.set(a_array, 14, f_calc_score(p_base / price_a15, trend_indicator, int_1, int_2))
array.set(a_array, 15, f_calc_score(p_base / price_a16, trend_indicator, int_1, int_2))
array.set(a_array, 16, f_calc_score(p_base / price_a17, trend_indicator, int_1, int_2))
array.set(a_array, 17, f_calc_score(p_base / price_a18, trend_indicator, int_1, int_2))
array.set(a_array, 18, f_calc_score(p_base / price_a19, trend_indicator, int_1, int_2))
array.set(a_array, 19, f_calc_score(p_base / price_a20, trend_indicator, int_1, int_2))
array.set(a_array, 20, f_calc_score(p_base / price_a21, trend_indicator, int_1, int_2))
array.set(a_array, 21, f_calc_score(p_base / price_a22, trend_indicator, int_1, int_2))
array.set(a_array, 22, f_calc_score(p_base / price_a23, trend_indicator, int_1, int_2))
array.set(a_array, 23, f_calc_score(p_base / price_a24, trend_indicator, int_1, int_2))
array.set(a_array, 24, f_calc_score(p_base / price_a25, trend_indicator, int_1, int_2))
array.set(a_array, 25, f_calc_score(p_base / price_a26, trend_indicator, int_1, int_2))
array.set(a_array, 26, f_calc_score(p_base / price_a27, trend_indicator, int_1, int_2))
array.set(a_array, 27, f_calc_score(p_base / price_a28, trend_indicator, int_1, int_2))
array.set(a_array, 28, f_calc_score(p_base / price_a29, trend_indicator, int_1, int_2))
array.set(a_array, 29, f_calc_score(p_base / price_a30, trend_indicator, int_1, int_2))
array.set(a_array, 30, f_calc_score(p_base / price_a31, trend_indicator, int_1, int_2))
array.set(a_array, 31, f_calc_score(p_base / price_a32, trend_indicator, int_1, int_2))
array.set(a_array, 32, f_calc_score(p_base / price_a33, trend_indicator, int_1, int_2))
array.set(a_array, 33, f_calc_score(p_base / price_a34, trend_indicator, int_1, int_2))
array.set(a_array, 34, f_calc_score(p_base / price_a35, trend_indicator, int_1, int_2))
array.set(a_array, 35, f_calc_score(p_base / price_a36, trend_indicator, int_1, int_2))
array.set(a_array, 36, f_calc_score(p_base / price_a37, trend_indicator, int_1, int_2))
array.set(a_array, 37, f_calc_score(p_base / price_a38, trend_indicator, int_1, int_2))
array.set(a_array, 38, f_calc_score(p_base / price_a39, trend_indicator, int_1, int_2))
array.set(a_array, 39, f_calc_score(p_base / price_a40, trend_indicator, int_1, int_2))
a_array
Conditional Array Setting (f_arrayset):
This function checks if the number of used assets is greater than or equal to a specified number before populating the arrays.
// only set values into arrays for USED assets
f_arrayset(asset_number, a_array, p_base) =>
if (used_assets >= asset_number)
f_array_set(a_array, p_base)
else
na
Main Logic
The main logic initializes arrays to store scores for each asset. Each array corresponds to one asset's performance score.
Setting Trend Values: The code calls f_arrayset for each asset, populating the respective arrays with calculated scores based on the asset prices.
Combining Arrays: A combined_array is created to hold all the scores from individual asset arrays. This array facilitates further analysis, allowing for an overview of the performance scores of all assets at once.
// create a combined array (work-around since pinescript doesn't support having array of arrays)
var combined_array = array.new_int(40 * 40, 0)
if barstate.islast
for i = 0 to 39
array.set(combined_array, i, array.get(a1_array, i))
array.set(combined_array, i + (40 * 1), array.get(a2_array, i))
array.set(combined_array, i + (40 * 2), array.get(a3_array, i))
array.set(combined_array, i + (40 * 3), array.get(a4_array, i))
array.set(combined_array, i + (40 * 4), array.get(a5_array, i))
array.set(combined_array, i + (40 * 5), array.get(a6_array, i))
array.set(combined_array, i + (40 * 6), array.get(a7_array, i))
array.set(combined_array, i + (40 * 7), array.get(a8_array, i))
array.set(combined_array, i + (40 * 8), array.get(a9_array, i))
array.set(combined_array, i + (40 * 9), array.get(a10_array, i))
array.set(combined_array, i + (40 * 10), array.get(a11_array, i))
array.set(combined_array, i + (40 * 11), array.get(a12_array, i))
array.set(combined_array, i + (40 * 12), array.get(a13_array, i))
array.set(combined_array, i + (40 * 13), array.get(a14_array, i))
array.set(combined_array, i + (40 * 14), array.get(a15_array, i))
array.set(combined_array, i + (40 * 15), array.get(a16_array, i))
array.set(combined_array, i + (40 * 16), array.get(a17_array, i))
array.set(combined_array, i + (40 * 17), array.get(a18_array, i))
array.set(combined_array, i + (40 * 18), array.get(a19_array, i))
array.set(combined_array, i + (40 * 19), array.get(a20_array, i))
array.set(combined_array, i + (40 * 20), array.get(a21_array, i))
array.set(combined_array, i + (40 * 21), array.get(a22_array, i))
array.set(combined_array, i + (40 * 22), array.get(a23_array, i))
array.set(combined_array, i + (40 * 23), array.get(a24_array, i))
array.set(combined_array, i + (40 * 24), array.get(a25_array, i))
array.set(combined_array, i + (40 * 25), array.get(a26_array, i))
array.set(combined_array, i + (40 * 26), array.get(a27_array, i))
array.set(combined_array, i + (40 * 27), array.get(a28_array, i))
array.set(combined_array, i + (40 * 28), array.get(a29_array, i))
array.set(combined_array, i + (40 * 29), array.get(a30_array, i))
array.set(combined_array, i + (40 * 30), array.get(a31_array, i))
array.set(combined_array, i + (40 * 31), array.get(a32_array, i))
array.set(combined_array, i + (40 * 32), array.get(a33_array, i))
array.set(combined_array, i + (40 * 33), array.get(a34_array, i))
array.set(combined_array, i + (40 * 34), array.get(a35_array, i))
array.set(combined_array, i + (40 * 35), array.get(a36_array, i))
array.set(combined_array, i + (40 * 36), array.get(a37_array, i))
array.set(combined_array, i + (40 * 37), array.get(a38_array, i))
array.set(combined_array, i + (40 * 38), array.get(a39_array, i))
array.set(combined_array, i + (40 * 39), array.get(a40_array, i))
Calculating Sums: A separate array_sums is created to store the total score for each asset by summing the values of their respective score arrays. This allows for easy comparison of overall performance.
Ranking Assets: The final part of the code ranks the assets based on their total scores stored in array_sums. It assigns a rank to each asset, where the asset with the highest score receives the highest rank.
// create array for asset RANK based on array.sum
var ranks = array.new_int(used_assets, 0)
// for loop that calculates the rank of each asset
if barstate.islast
for i = 0 to (used_assets - 1)
int rank = 1
for x = 0 to (used_assets - 1)
if i != x
if array.get(array_sums, i) < array.get(array_sums, x)
rank := rank + 1
array.set(ranks, i, rank)
Dynamic Table Creation
Initialization: The table is initialized with a base structure that includes headers for asset names, scores, and ranks. The headers are set to remain constant, ensuring clarity for users as they interpret the displayed data.
Data Population: As scores are calculated for each asset, the corresponding values are dynamically inserted into the table. This is achieved through a loop that iterates over the scores and ranks stored in the combined_array and array_sums, respectively.
Automatic Extending Mechanism
Variable Asset Count: The code checks the number of assets defined by the user. Instead of hardcoding the number of rows in the table, it uses a variable to determine the extent of the data that needs to be displayed. This allows the table to expand or contract based on the number of assets being analyzed.
Dynamic Row Generation: Within the loop that populates the table, the code appends new rows for each asset based on the current asset count. The structure of each row includes the asset name, its score, and its rank, ensuring that the table remains consistent regardless of how many assets are involved.
// Automatically extending table based on the number of used assets
var table table = table.new(position.bottom_center, 50, 50, color.new(color.black, 100), color.white, 3, color.white, 1)
if barstate.islast
if not hide_head
table.cell(table, 0, 0, "Universal Ratio Trend Matrix", text_color = color.white, bgcolor = #010c3b, text_size = fontSize)
table.merge_cells(table, 0, 0, used_assets + 3, 0)
if not hide_inps
table.cell(table, 0, 1,
text = "Inputs: You are using " + str.tostring(trend_indicator) + ", which takes: " + str.tostring(f_get_input(trend_indicator)),
text_color = color.white, text_size = fontSize), table.merge_cells(table, 0, 1, used_assets + 3, 1)
table.cell(table, 0, 2, "Assets", text_color = color.white, text_size = fontSize, bgcolor = #010c3b)
for x = 0 to (used_assets - 1)
table.cell(table, x + 1, 2, text = str.tostring(array.get(assets, x)), text_color = color.white, bgcolor = #010c3b, text_size = fontSize)
table.cell(table, 0, x + 3, text = str.tostring(array.get(assets, x)), text_color = color.white, bgcolor = f_asset_col(array.get(ranks, x)), text_size = fontSize)
for r = 0 to (used_assets - 1)
for c = 0 to (used_assets - 1)
table.cell(table, c + 1, r + 3, text = str.tostring(array.get(combined_array, c + (r * 40))),
text_color = hl_type == "Text" ? f_get_col(array.get(combined_array, c + (r * 40))) : color.white, text_size = fontSize,
bgcolor = hl_type == "Background" ? f_get_col(array.get(combined_array, c + (r * 40))) : na)
for x = 0 to (used_assets - 1)
table.cell(table, x + 1, x + 3, "", bgcolor = #010c3b)
table.cell(table, used_assets + 1, 2, "", bgcolor = #010c3b)
for x = 0 to (used_assets - 1)
table.cell(table, used_assets + 1, x + 3, "==>", text_color = color.white)
table.cell(table, used_assets + 2, 2, "SUM", text_color = color.white, text_size = fontSize, bgcolor = #010c3b)
table.cell(table, used_assets + 3, 2, "RANK", text_color = color.white, text_size = fontSize, bgcolor = #010c3b)
for x = 0 to (used_assets - 1)
table.cell(table, used_assets + 2, x + 3,
text = str.tostring(array.get(array_sums, x)),
text_color = color.white, text_size = fontSize,
bgcolor = f_highlight_sum(array.get(array_sums, x), array.get(ranks, x)))
table.cell(table, used_assets + 3, x + 3,
text = str.tostring(array.get(ranks, x)),
text_color = color.white, text_size = fontSize,
bgcolor = f_highlight_rank(array.get(ranks, x)))
Markov Chain [3D] | FractalystWhat exactly is a Markov Chain?
This indicator uses a Markov Chain model to analyze, quantify, and visualize the transitions between market regimes (Bull, Bear, Neutral) on your chart. It dynamically detects these regimes in real-time, calculates transition probabilities, and displays them as animated 3D spheres and arrows, giving traders intuitive insight into current and future market conditions.
How does a Markov Chain work, and how should I read this spheres-and-arrows diagram?
Think of three weather modes: Sunny, Rainy, Cloudy.
Each sphere is one mode. The loop on a sphere means “stay the same next step” (e.g., Sunny again tomorrow).
The arrows leaving a sphere show where things usually go next if they change (e.g., Sunny moving to Cloudy).
Some paths matter more than others. A more prominent loop means the current mode tends to persist. A more prominent outgoing arrow means a change to that destination is the usual next step.
Direction isn’t symmetric: moving Sunny→Cloudy can behave differently than Cloudy→Sunny.
Now relabel the spheres to markets: Bull, Bear, Neutral.
Spheres: market regimes (uptrend, downtrend, range).
Self‑loop: tendency for the current regime to continue on the next bar.
Arrows: the most common next regime if a switch happens.
How to read: Start at the sphere that matches current bar state. If the loop stands out, expect continuation. If one outgoing path stands out, that switch is the typical next step. Opposite directions can differ (Bear→Neutral doesn’t have to match Neutral→Bear).
What states and transitions are shown?
The three market states visualized are:
Bullish (Bull): Upward or strong-market regime.
Bearish (Bear): Downward or weak-market regime.
Neutral: Sideways or range-bound regime.
Bidirectional animated arrows and probability labels show how likely the market is to move from one regime to another (e.g., Bull → Bear or Neutral → Bull).
How does the regime detection system work?
You can use either built-in price returns (based on adaptive Z-score normalization) or supply three custom indicators (such as volume, oscillators, etc.).
Values are statistically normalized (Z-scored) over a configurable lookback period.
The normalized outputs are classified into Bull, Bear, or Neutral zones.
If using three indicators, their regime signals are averaged and smoothed for robustness.
How are transition probabilities calculated?
On every confirmed bar, the algorithm tracks the sequence of detected market states, then builds a rolling window of transitions.
The code maintains a transition count matrix for all regime pairs (e.g., Bull → Bear).
Transition probabilities are extracted for each possible state change using Laplace smoothing for numerical stability, and frequently updated in real-time.
What is unique about the visualization?
3D animated spheres represent each regime and change visually when active.
Animated, bidirectional arrows reveal transition probabilities and allow you to see both dominant and less likely regime flows.
Particles (moving dots) animate along the arrows, enhancing the perception of regime flow direction and speed.
All elements dynamically update with each new price bar, providing a live market map in an intuitive, engaging format.
Can I use custom indicators for regime classification?
Yes! Enable the "Custom Indicators" switch and select any three chart series as inputs. These will be normalized and combined (each with equal weight), broadening the regime classification beyond just price-based movement.
What does the “Lookback Period” control?
Lookback Period (default: 100) sets how much historical data builds the probability matrix. Shorter periods adapt faster to regime changes but may be noisier. Longer periods are more stable but slower to adapt.
How is this different from a Hidden Markov Model (HMM)?
It sets the window for both regime detection and probability calculations. Lower values make the system more reactive, but potentially noisier. Higher values smooth estimates and make the system more robust.
How is this Markov Chain different from a Hidden Markov Model (HMM)?
Markov Chain (as here): All market regimes (Bull, Bear, Neutral) are directly observable on the chart. The transition matrix is built from actual detected regimes, keeping the model simple and interpretable.
Hidden Markov Model: The actual regimes are unobservable ("hidden") and must be inferred from market output or indicator "emissions" using statistical learning algorithms. HMMs are more complex, can capture more subtle structure, but are harder to visualize and require additional machine learning steps for training.
A standard Markov Chain models transitions between observable states using a simple transition matrix, while a Hidden Markov Model assumes the true states are hidden (latent) and must be inferred from observable “emissions” like price or volume data. In practical terms, a Markov Chain is transparent and easier to implement and interpret; an HMM is more expressive but requires statistical inference to estimate hidden states from data.
Markov Chain: states are observable; you directly count or estimate transition probabilities between visible states. This makes it simpler, faster, and easier to validate and tune.
HMM: states are hidden; you only observe emissions generated by those latent states. Learning involves machine learning/statistical algorithms (commonly Baum–Welch/EM for training and Viterbi for decoding) to infer both the transition dynamics and the most likely hidden state sequence from data.
How does the indicator avoid “repainting” or look-ahead bias?
All regime changes and matrix updates happen only on confirmed (closed) bars, so no future data is leaked, ensuring reliable real-time operation.
Are there practical tuning tips?
Tune the Lookback Period for your asset/timeframe: shorter for fast markets, longer for stability.
Use custom indicators if your asset has unique regime drivers.
Watch for rapid changes in transition probabilities as early warning of a possible regime shift.
Who is this indicator for?
Quants and quantitative researchers exploring probabilistic market modeling, especially those interested in regime-switching dynamics and Markov models.
Programmers and system developers who need a probabilistic regime filter for systematic and algorithmic backtesting:
The Markov Chain indicator is ideally suited for programmatic integration via its bias output (1 = Bull, 0 = Neutral, -1 = Bear).
Although the visualization is engaging, the core output is designed for automated, rules-based workflows—not for discretionary/manual trading decisions.
Developers can connect the indicator’s output directly to their Pine Script logic (using input.source()), allowing rapid and robust backtesting of regime-based strategies.
It acts as a plug-and-play regime filter: simply plug the bias output into your entry/exit logic, and you have a scientifically robust, probabilistically-derived signal for filtering, timing, position sizing, or risk regimes.
The MC's output is intentionally "trinary" (1/0/-1), focusing on clear regime states for unambiguous decision-making in code. If you require nuanced, multi-probability or soft-label state vectors, consider expanding the indicator or stacking it with a probability-weighted logic layer in your scripting.
Because it avoids subjectivity, this approach is optimal for systematic quants, algo developers building backtested, repeatable strategies based on probabilistic regime analysis.
What's the mathematical foundation behind this?
The mathematical foundation behind this Markov Chain indicator—and probabilistic regime detection in finance—draws from two principal models: the (standard) Markov Chain and the Hidden Markov Model (HMM).
How to use this indicator programmatically?
The Markov Chain indicator automatically exports a bias value (+1 for Bullish, -1 for Bearish, 0 for Neutral) as a plot visible in the Data Window. This allows you to integrate its regime signal into your own scripts and strategies for backtesting, automation, or live trading.
Step-by-Step Integration with Pine Script (input.source)
Add the Markov Chain indicator to your chart.
This must be done first, since your custom script will "pull" the bias signal from the indicator's plot.
In your strategy, create an input using input.source()
Example:
//@version=5
strategy("MC Bias Strategy Example")
mcBias = input.source(close, "MC Bias Source")
After saving, go to your script’s settings. For the “MC Bias Source” input, select the plot/output of the Markov Chain indicator (typically its bias plot).
Use the bias in your trading logic
Example (long only on Bull, flat otherwise):
if mcBias == 1
strategy.entry("Long", strategy.long)
else
strategy.close("Long")
For more advanced workflows, combine mcBias with additional filters or trailing stops.
How does this work behind-the-scenes?
TradingView’s input.source() lets you use any plot from another indicator as a real-time, “live” data feed in your own script (source).
The selected bias signal is available to your Pine code as a variable, enabling logical decisions based on regime (trend-following, mean-reversion, etc.).
This enables powerful strategy modularity : decouple regime detection from entry/exit logic, allowing fast experimentation without rewriting core signal code.
Integrating 45+ Indicators with Your Markov Chain — How & Why
The Enhanced Custom Indicators Export script exports a massive suite of over 45 technical indicators—ranging from classic momentum (RSI, MACD, Stochastic, etc.) to trend, volume, volatility, and oscillator tools—all pre-calculated, centered/scaled, and available as plots.
// Enhanced Custom Indicators Export - 45 Technical Indicators
// Comprehensive technical analysis suite for advanced market regime detection
//@version=6
indicator('Enhanced Custom Indicators Export | Fractalyst', shorttitle='Enhanced CI Export', overlay=false, scale=scale.right, max_labels_count=500, max_lines_count=500)
// |----- Input Parameters -----| //
momentum_group = "Momentum Indicators"
trend_group = "Trend Indicators"
volume_group = "Volume Indicators"
volatility_group = "Volatility Indicators"
oscillator_group = "Oscillator Indicators"
display_group = "Display Settings"
// Common lengths
length_14 = input.int(14, "Standard Length (14)", minval=1, maxval=100, group=momentum_group)
length_20 = input.int(20, "Medium Length (20)", minval=1, maxval=200, group=trend_group)
length_50 = input.int(50, "Long Length (50)", minval=1, maxval=200, group=trend_group)
// Display options
show_table = input.bool(true, "Show Values Table", group=display_group)
table_size = input.string("Small", "Table Size", options= , group=display_group)
// |----- MOMENTUM INDICATORS (15 indicators) -----| //
// 1. RSI (Relative Strength Index)
rsi_14 = ta.rsi(close, length_14)
rsi_centered = rsi_14 - 50
// 2. Stochastic Oscillator
stoch_k = ta.stoch(close, high, low, length_14)
stoch_d = ta.sma(stoch_k, 3)
stoch_centered = stoch_k - 50
// 3. Williams %R
williams_r = ta.stoch(close, high, low, length_14) - 100
// 4. MACD (Moving Average Convergence Divergence)
= ta.macd(close, 12, 26, 9)
// 5. Momentum (Rate of Change)
momentum = ta.mom(close, length_14)
momentum_pct = (momentum / close ) * 100
// 6. Rate of Change (ROC)
roc = ta.roc(close, length_14)
// 7. Commodity Channel Index (CCI)
cci = ta.cci(close, length_20)
// 8. Money Flow Index (MFI)
mfi = ta.mfi(close, length_14)
mfi_centered = mfi - 50
// 9. Awesome Oscillator (AO)
ao = ta.sma(hl2, 5) - ta.sma(hl2, 34)
// 10. Accelerator Oscillator (AC)
ac = ao - ta.sma(ao, 5)
// 11. Chande Momentum Oscillator (CMO)
cmo = ta.cmo(close, length_14)
// 12. Detrended Price Oscillator (DPO)
dpo = close - ta.sma(close, length_20)
// 13. Price Oscillator (PPO)
ppo = ta.sma(close, 12) - ta.sma(close, 26)
ppo_pct = (ppo / ta.sma(close, 26)) * 100
// 14. TRIX
trix_ema1 = ta.ema(close, length_14)
trix_ema2 = ta.ema(trix_ema1, length_14)
trix_ema3 = ta.ema(trix_ema2, length_14)
trix = ta.roc(trix_ema3, 1) * 10000
// 15. Klinger Oscillator
klinger = ta.ema(volume * (high + low + close) / 3, 34) - ta.ema(volume * (high + low + close) / 3, 55)
// 16. Fisher Transform
fisher_hl2 = 0.5 * (hl2 - ta.lowest(hl2, 10)) / (ta.highest(hl2, 10) - ta.lowest(hl2, 10)) - 0.25
fisher = 0.5 * math.log((1 + fisher_hl2) / (1 - fisher_hl2))
// 17. Stochastic RSI
stoch_rsi = ta.stoch(rsi_14, rsi_14, rsi_14, length_14)
stoch_rsi_centered = stoch_rsi - 50
// 18. Relative Vigor Index (RVI)
rvi_num = ta.swma(close - open)
rvi_den = ta.swma(high - low)
rvi = rvi_den != 0 ? rvi_num / rvi_den : 0
// 19. Balance of Power (BOP)
bop = (close - open) / (high - low)
// |----- TREND INDICATORS (10 indicators) -----| //
// 20. Simple Moving Average Momentum
sma_20 = ta.sma(close, length_20)
sma_momentum = ((close - sma_20) / sma_20) * 100
// 21. Exponential Moving Average Momentum
ema_20 = ta.ema(close, length_20)
ema_momentum = ((close - ema_20) / ema_20) * 100
// 22. Parabolic SAR
sar = ta.sar(0.02, 0.02, 0.2)
sar_trend = close > sar ? 1 : -1
// 23. Linear Regression Slope
lr_slope = ta.linreg(close, length_20, 0) - ta.linreg(close, length_20, 1)
// 24. Moving Average Convergence (MAC)
mac = ta.sma(close, 10) - ta.sma(close, 30)
// 25. Trend Intensity Index (TII)
tii_sum = 0.0
for i = 1 to length_20
tii_sum += close > close ? 1 : 0
tii = (tii_sum / length_20) * 100
// 26. Ichimoku Cloud Components
ichimoku_tenkan = (ta.highest(high, 9) + ta.lowest(low, 9)) / 2
ichimoku_kijun = (ta.highest(high, 26) + ta.lowest(low, 26)) / 2
ichimoku_signal = ichimoku_tenkan > ichimoku_kijun ? 1 : -1
// 27. MESA Adaptive Moving Average (MAMA)
mama_alpha = 2.0 / (length_20 + 1)
mama = ta.ema(close, length_20)
mama_momentum = ((close - mama) / mama) * 100
// 28. Zero Lag Exponential Moving Average (ZLEMA)
zlema_lag = math.round((length_20 - 1) / 2)
zlema_data = close + (close - close )
zlema = ta.ema(zlema_data, length_20)
zlema_momentum = ((close - zlema) / zlema) * 100
// |----- VOLUME INDICATORS (6 indicators) -----| //
// 29. On-Balance Volume (OBV)
obv = ta.obv
// 30. Volume Rate of Change (VROC)
vroc = ta.roc(volume, length_14)
// 31. Price Volume Trend (PVT)
pvt = ta.pvt
// 32. Negative Volume Index (NVI)
nvi = 0.0
nvi := volume < volume ? nvi + ((close - close ) / close ) * nvi : nvi
// 33. Positive Volume Index (PVI)
pvi = 0.0
pvi := volume > volume ? pvi + ((close - close ) / close ) * pvi : pvi
// 34. Volume Oscillator
vol_osc = ta.sma(volume, 5) - ta.sma(volume, 10)
// 35. Ease of Movement (EOM)
eom_distance = high - low
eom_box_height = volume / 1000000
eom = eom_box_height != 0 ? eom_distance / eom_box_height : 0
eom_sma = ta.sma(eom, length_14)
// 36. Force Index
force_index = volume * (close - close )
force_index_sma = ta.sma(force_index, length_14)
// |----- VOLATILITY INDICATORS (10 indicators) -----| //
// 37. Average True Range (ATR)
atr = ta.atr(length_14)
atr_pct = (atr / close) * 100
// 38. Bollinger Bands Position
bb_basis = ta.sma(close, length_20)
bb_dev = 2.0 * ta.stdev(close, length_20)
bb_upper = bb_basis + bb_dev
bb_lower = bb_basis - bb_dev
bb_position = bb_dev != 0 ? (close - bb_basis) / bb_dev : 0
bb_width = bb_dev != 0 ? (bb_upper - bb_lower) / bb_basis * 100 : 0
// 39. Keltner Channels Position
kc_basis = ta.ema(close, length_20)
kc_range = ta.ema(ta.tr, length_20)
kc_upper = kc_basis + (2.0 * kc_range)
kc_lower = kc_basis - (2.0 * kc_range)
kc_position = kc_range != 0 ? (close - kc_basis) / kc_range : 0
// 40. Donchian Channels Position
dc_upper = ta.highest(high, length_20)
dc_lower = ta.lowest(low, length_20)
dc_basis = (dc_upper + dc_lower) / 2
dc_position = (dc_upper - dc_lower) != 0 ? (close - dc_basis) / (dc_upper - dc_lower) : 0
// 41. Standard Deviation
std_dev = ta.stdev(close, length_20)
std_dev_pct = (std_dev / close) * 100
// 42. Relative Volatility Index (RVI)
rvi_up = ta.stdev(close > close ? close : 0, length_14)
rvi_down = ta.stdev(close < close ? close : 0, length_14)
rvi_total = rvi_up + rvi_down
rvi_volatility = rvi_total != 0 ? (rvi_up / rvi_total) * 100 : 50
// 43. Historical Volatility
hv_returns = math.log(close / close )
hv = ta.stdev(hv_returns, length_20) * math.sqrt(252) * 100
// 44. Garman-Klass Volatility
gk_vol = math.log(high/low) * math.log(high/low) - (2*math.log(2)-1) * math.log(close/open) * math.log(close/open)
gk_volatility = math.sqrt(ta.sma(gk_vol, length_20)) * 100
// 45. Parkinson Volatility
park_vol = math.log(high/low) * math.log(high/low)
parkinson = math.sqrt(ta.sma(park_vol, length_20) / (4 * math.log(2))) * 100
// 46. Rogers-Satchell Volatility
rs_vol = math.log(high/close) * math.log(high/open) + math.log(low/close) * math.log(low/open)
rogers_satchell = math.sqrt(ta.sma(rs_vol, length_20)) * 100
// |----- OSCILLATOR INDICATORS (5 indicators) -----| //
// 47. Elder Ray Index
elder_bull = high - ta.ema(close, 13)
elder_bear = low - ta.ema(close, 13)
elder_power = elder_bull + elder_bear
// 48. Schaff Trend Cycle (STC)
stc_macd = ta.ema(close, 23) - ta.ema(close, 50)
stc_k = ta.stoch(stc_macd, stc_macd, stc_macd, 10)
stc_d = ta.ema(stc_k, 3)
stc = ta.stoch(stc_d, stc_d, stc_d, 10)
// 49. Coppock Curve
coppock_roc1 = ta.roc(close, 14)
coppock_roc2 = ta.roc(close, 11)
coppock = ta.wma(coppock_roc1 + coppock_roc2, 10)
// 50. Know Sure Thing (KST)
kst_roc1 = ta.roc(close, 10)
kst_roc2 = ta.roc(close, 15)
kst_roc3 = ta.roc(close, 20)
kst_roc4 = ta.roc(close, 30)
kst = ta.sma(kst_roc1, 10) + 2*ta.sma(kst_roc2, 10) + 3*ta.sma(kst_roc3, 10) + 4*ta.sma(kst_roc4, 15)
// 51. Percentage Price Oscillator (PPO)
ppo_line = ((ta.ema(close, 12) - ta.ema(close, 26)) / ta.ema(close, 26)) * 100
ppo_signal = ta.ema(ppo_line, 9)
ppo_histogram = ppo_line - ppo_signal
// |----- PLOT MAIN INDICATORS -----| //
// Plot key momentum indicators
plot(rsi_centered, title="01_RSI_Centered", color=color.purple, linewidth=1)
plot(stoch_centered, title="02_Stoch_Centered", color=color.blue, linewidth=1)
plot(williams_r, title="03_Williams_R", color=color.red, linewidth=1)
plot(macd_histogram, title="04_MACD_Histogram", color=color.orange, linewidth=1)
plot(cci, title="05_CCI", color=color.green, linewidth=1)
// Plot trend indicators
plot(sma_momentum, title="06_SMA_Momentum", color=color.navy, linewidth=1)
plot(ema_momentum, title="07_EMA_Momentum", color=color.maroon, linewidth=1)
plot(sar_trend, title="08_SAR_Trend", color=color.teal, linewidth=1)
plot(lr_slope, title="09_LR_Slope", color=color.lime, linewidth=1)
plot(mac, title="10_MAC", color=color.fuchsia, linewidth=1)
// Plot volatility indicators
plot(atr_pct, title="11_ATR_Pct", color=color.yellow, linewidth=1)
plot(bb_position, title="12_BB_Position", color=color.aqua, linewidth=1)
plot(kc_position, title="13_KC_Position", color=color.olive, linewidth=1)
plot(std_dev_pct, title="14_StdDev_Pct", color=color.silver, linewidth=1)
plot(bb_width, title="15_BB_Width", color=color.gray, linewidth=1)
// Plot volume indicators
plot(vroc, title="16_VROC", color=color.blue, linewidth=1)
plot(eom_sma, title="17_EOM", color=color.red, linewidth=1)
plot(vol_osc, title="18_Vol_Osc", color=color.green, linewidth=1)
plot(force_index_sma, title="19_Force_Index", color=color.orange, linewidth=1)
plot(obv, title="20_OBV", color=color.purple, linewidth=1)
// Plot additional oscillators
plot(ao, title="21_Awesome_Osc", color=color.navy, linewidth=1)
plot(cmo, title="22_CMO", color=color.maroon, linewidth=1)
plot(dpo, title="23_DPO", color=color.teal, linewidth=1)
plot(trix, title="24_TRIX", color=color.lime, linewidth=1)
plot(fisher, title="25_Fisher", color=color.fuchsia, linewidth=1)
// Plot more momentum indicators
plot(mfi_centered, title="26_MFI_Centered", color=color.yellow, linewidth=1)
plot(ac, title="27_AC", color=color.aqua, linewidth=1)
plot(ppo_pct, title="28_PPO_Pct", color=color.olive, linewidth=1)
plot(stoch_rsi_centered, title="29_StochRSI_Centered", color=color.silver, linewidth=1)
plot(klinger, title="30_Klinger", color=color.gray, linewidth=1)
// Plot trend continuation
plot(tii, title="31_TII", color=color.blue, linewidth=1)
plot(ichimoku_signal, title="32_Ichimoku_Signal", color=color.red, linewidth=1)
plot(mama_momentum, title="33_MAMA_Momentum", color=color.green, linewidth=1)
plot(zlema_momentum, title="34_ZLEMA_Momentum", color=color.orange, linewidth=1)
plot(bop, title="35_BOP", color=color.purple, linewidth=1)
// Plot volume continuation
plot(nvi, title="36_NVI", color=color.navy, linewidth=1)
plot(pvi, title="37_PVI", color=color.maroon, linewidth=1)
plot(momentum_pct, title="38_Momentum_Pct", color=color.teal, linewidth=1)
plot(roc, title="39_ROC", color=color.lime, linewidth=1)
plot(rvi, title="40_RVI", color=color.fuchsia, linewidth=1)
// Plot volatility continuation
plot(dc_position, title="41_DC_Position", color=color.yellow, linewidth=1)
plot(rvi_volatility, title="42_RVI_Volatility", color=color.aqua, linewidth=1)
plot(hv, title="43_Historical_Vol", color=color.olive, linewidth=1)
plot(gk_volatility, title="44_GK_Volatility", color=color.silver, linewidth=1)
plot(parkinson, title="45_Parkinson_Vol", color=color.gray, linewidth=1)
// Plot final oscillators
plot(rogers_satchell, title="46_RS_Volatility", color=color.blue, linewidth=1)
plot(elder_power, title="47_Elder_Power", color=color.red, linewidth=1)
plot(stc, title="48_STC", color=color.green, linewidth=1)
plot(coppock, title="49_Coppock", color=color.orange, linewidth=1)
plot(kst, title="50_KST", color=color.purple, linewidth=1)
// Plot final indicators
plot(ppo_histogram, title="51_PPO_Histogram", color=color.navy, linewidth=1)
plot(pvt, title="52_PVT", color=color.maroon, linewidth=1)
// |----- Reference Lines -----| //
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dashed, linewidth=1)
hline(50, "Midline", color=color.gray, linestyle=hline.style_dotted, linewidth=1)
hline(-50, "Lower Midline", color=color.gray, linestyle=hline.style_dotted, linewidth=1)
hline(25, "Upper Threshold", color=color.gray, linestyle=hline.style_dotted, linewidth=1)
hline(-25, "Lower Threshold", color=color.gray, linestyle=hline.style_dotted, linewidth=1)
// |----- Enhanced Information Table -----| //
if show_table and barstate.islast
table_position = position.top_right
table_text_size = table_size == "Tiny" ? size.tiny : table_size == "Small" ? size.small : size.normal
var table info_table = table.new(table_position, 3, 18, bgcolor=color.new(color.white, 85), border_width=1, border_color=color.gray)
// Headers
table.cell(info_table, 0, 0, 'Category', text_color=color.black, text_size=table_text_size, bgcolor=color.new(color.blue, 70))
table.cell(info_table, 1, 0, 'Indicator', text_color=color.black, text_size=table_text_size, bgcolor=color.new(color.blue, 70))
table.cell(info_table, 2, 0, 'Value', text_color=color.black, text_size=table_text_size, bgcolor=color.new(color.blue, 70))
// Key Momentum Indicators
table.cell(info_table, 0, 1, 'MOMENTUM', text_color=color.purple, text_size=table_text_size, bgcolor=color.new(color.purple, 90))
table.cell(info_table, 1, 1, 'RSI Centered', text_color=color.purple, text_size=table_text_size)
table.cell(info_table, 2, 1, str.tostring(rsi_centered, '0.00'), text_color=color.purple, text_size=table_text_size)
table.cell(info_table, 0, 2, '', text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 1, 2, 'Stoch Centered', text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 2, 2, str.tostring(stoch_centered, '0.00'), text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 0, 3, '', text_color=color.red, text_size=table_text_size)
table.cell(info_table, 1, 3, 'Williams %R', text_color=color.red, text_size=table_text_size)
table.cell(info_table, 2, 3, str.tostring(williams_r, '0.00'), text_color=color.red, text_size=table_text_size)
table.cell(info_table, 0, 4, '', text_color=color.orange, text_size=table_text_size)
table.cell(info_table, 1, 4, 'MACD Histogram', text_color=color.orange, text_size=table_text_size)
table.cell(info_table, 2, 4, str.tostring(macd_histogram, '0.000'), text_color=color.orange, text_size=table_text_size)
table.cell(info_table, 0, 5, '', text_color=color.green, text_size=table_text_size)
table.cell(info_table, 1, 5, 'CCI', text_color=color.green, text_size=table_text_size)
table.cell(info_table, 2, 5, str.tostring(cci, '0.00'), text_color=color.green, text_size=table_text_size)
// Key Trend Indicators
table.cell(info_table, 0, 6, 'TREND', text_color=color.navy, text_size=table_text_size, bgcolor=color.new(color.navy, 90))
table.cell(info_table, 1, 6, 'SMA Momentum %', text_color=color.navy, text_size=table_text_size)
table.cell(info_table, 2, 6, str.tostring(sma_momentum, '0.00'), text_color=color.navy, text_size=table_text_size)
table.cell(info_table, 0, 7, '', text_color=color.maroon, text_size=table_text_size)
table.cell(info_table, 1, 7, 'EMA Momentum %', text_color=color.maroon, text_size=table_text_size)
table.cell(info_table, 2, 7, str.tostring(ema_momentum, '0.00'), text_color=color.maroon, text_size=table_text_size)
table.cell(info_table, 0, 8, '', text_color=color.teal, text_size=table_text_size)
table.cell(info_table, 1, 8, 'SAR Trend', text_color=color.teal, text_size=table_text_size)
table.cell(info_table, 2, 8, str.tostring(sar_trend, '0'), text_color=color.teal, text_size=table_text_size)
table.cell(info_table, 0, 9, '', text_color=color.lime, text_size=table_text_size)
table.cell(info_table, 1, 9, 'Linear Regression', text_color=color.lime, text_size=table_text_size)
table.cell(info_table, 2, 9, str.tostring(lr_slope, '0.000'), text_color=color.lime, text_size=table_text_size)
// Key Volatility Indicators
table.cell(info_table, 0, 10, 'VOLATILITY', text_color=color.yellow, text_size=table_text_size, bgcolor=color.new(color.yellow, 90))
table.cell(info_table, 1, 10, 'ATR %', text_color=color.yellow, text_size=table_text_size)
table.cell(info_table, 2, 10, str.tostring(atr_pct, '0.00'), text_color=color.yellow, text_size=table_text_size)
table.cell(info_table, 0, 11, '', text_color=color.aqua, text_size=table_text_size)
table.cell(info_table, 1, 11, 'BB Position', text_color=color.aqua, text_size=table_text_size)
table.cell(info_table, 2, 11, str.tostring(bb_position, '0.00'), text_color=color.aqua, text_size=table_text_size)
table.cell(info_table, 0, 12, '', text_color=color.olive, text_size=table_text_size)
table.cell(info_table, 1, 12, 'KC Position', text_color=color.olive, text_size=table_text_size)
table.cell(info_table, 2, 12, str.tostring(kc_position, '0.00'), text_color=color.olive, text_size=table_text_size)
// Key Volume Indicators
table.cell(info_table, 0, 13, 'VOLUME', text_color=color.blue, text_size=table_text_size, bgcolor=color.new(color.blue, 90))
table.cell(info_table, 1, 13, 'Volume ROC', text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 2, 13, str.tostring(vroc, '0.00'), text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 0, 14, '', text_color=color.red, text_size=table_text_size)
table.cell(info_table, 1, 14, 'EOM', text_color=color.red, text_size=table_text_size)
table.cell(info_table, 2, 14, str.tostring(eom_sma, '0.000'), text_color=color.red, text_size=table_text_size)
// Key Oscillators
table.cell(info_table, 0, 15, 'OSCILLATORS', text_color=color.purple, text_size=table_text_size, bgcolor=color.new(color.purple, 90))
table.cell(info_table, 1, 15, 'Awesome Osc', text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 2, 15, str.tostring(ao, '0.000'), text_color=color.blue, text_size=table_text_size)
table.cell(info_table, 0, 16, '', text_color=color.red, text_size=table_text_size)
table.cell(info_table, 1, 16, 'Fisher Transform', text_color=color.red, text_size=table_text_size)
table.cell(info_table, 2, 16, str.tostring(fisher, '0.000'), text_color=color.red, text_size=table_text_size)
// Summary Statistics
table.cell(info_table, 0, 17, 'SUMMARY', text_color=color.black, text_size=table_text_size, bgcolor=color.new(color.gray, 70))
table.cell(info_table, 1, 17, 'Total Indicators: 52', text_color=color.black, text_size=table_text_size)
regime_color = rsi_centered > 10 ? color.green : rsi_centered < -10 ? color.red : color.gray
regime_text = rsi_centered > 10 ? "BULLISH" : rsi_centered < -10 ? "BEARISH" : "NEUTRAL"
table.cell(info_table, 2, 17, regime_text, text_color=regime_color, text_size=table_text_size)
This makes it the perfect “indicator backbone” for quantitative and systematic traders who want to prototype, combine, and test new regime detection models—especially in combination with the Markov Chain indicator.
How to use this script with the Markov Chain for research and backtesting:
Add the Enhanced Indicator Export to your chart.
Every calculated indicator is available as an individual data stream.
Connect the indicator(s) you want as custom input(s) to the Markov Chain’s “Custom Indicators” option.
In the Markov Chain indicator’s settings, turn ON the custom indicator mode.
For each of the three custom indicator inputs, select the exported plot from the Enhanced Export script—the menu lists all 45+ signals by name.
This creates a powerful, modular regime-detection engine where you can mix-and-match momentum, trend, volume, or custom combinations for advanced filtering.
Backtest regime logic directly.
Once you’ve connected your chosen indicators, the Markov Chain script performs regime detection (Bull/Neutral/Bear) based on your selected features—not just price returns.
The regime detection is robust, automatically normalized (using Z-score), and outputs bias (1, -1, 0) for plug-and-play integration.
Export the regime bias for programmatic use.
As described above, use input.source() in your Pine Script strategy or system and link the bias output.
You can now filter signals, control trade direction/size, or design pairs-trading that respect true, indicator-driven market regimes.
With this framework, you’re not limited to static or simplistic regime filters. You can rigorously define, test, and refine what “market regime” means for your strategies—using the technical features that matter most to you.
Optimize your signal generation by backtesting across a universe of meaningful indicator blends.
Enhance risk management with objective, real-time regime boundaries.
Accelerate your research: iterate quickly, swap indicator components, and see results with minimal code changes.
Automate multi-asset or pairs-trading by integrating regime context directly into strategy logic.
Add both scripts to your chart, connect your preferred features, and start investigating your best regime-based trades—entirely within the TradingView ecosystem.
References & Further Reading
Ang, A., & Bekaert, G. (2002). “Regime Switches in Interest Rates.” Journal of Business & Economic Statistics, 20(2), 163–182.
Hamilton, J. D. (1989). “A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle.” Econometrica, 57(2), 357–384.
Markov, A. A. (1906). "Extension of the Limit Theorems of Probability Theory to a Sum of Variables Connected in a Chain." The Notes of the Imperial Academy of Sciences of St. Petersburg.
Guidolin, M., & Timmermann, A. (2007). “Asset Allocation under Multivariate Regime Switching.” Journal of Economic Dynamics and Control, 31(11), 3503–3544.
Murphy, J. J. (1999). Technical Analysis of the Financial Markets. New York Institute of Finance.
Brock, W., Lakonishok, J., & LeBaron, B. (1992). “Simple Technical Trading Rules and the Stochastic Properties of Stock Returns.” Journal of Finance, 47(5), 1731–1764.
Zucchini, W., MacDonald, I. L., & Langrock, R. (2017). Hidden Markov Models for Time Series: An Introduction Using R (2nd ed.). Chapman and Hall/CRC.
On Quantitative Finance and Markov Models:
Lo, A. W., & Hasanhodzic, J. (2009). The Heretics of Finance: Conversations with Leading Practitioners of Technical Analysis. Bloomberg Press.
Patterson, S. (2016). The Man Who Solved the Market: How Jim Simons Launched the Quant Revolution. Penguin Press.
TradingView Pine Script Documentation: www.tradingview.com
TradingView Blog: “Use an Input From Another Indicator With Your Strategy” www.tradingview.com
GeeksforGeeks: “What is the Difference Between Markov Chains and Hidden Markov Models?” www.geeksforgeeks.org
What makes this indicator original and unique?
- On‑chart, real‑time Markov. The chain is drawn directly on your chart. You see the current regime, its tendency to stay (self‑loop), and the usual next step (arrows) as bars confirm.
- Source‑agnostic by design. The engine runs on any series you select via input.source() — price, your own oscillator, a composite score, anything you compute in the script.
- Automatic normalization + regime mapping. Different inputs live on different scales. The script standardizes your chosen source and maps it into clear regimes (e.g., Bull / Bear / Neutral) without you micromanaging thresholds each time.
- Rolling, bar‑by‑bar learning. Transition tendencies are computed from a rolling window of confirmed bars. What you see is exactly what the market did in that window.
- Fast experimentation. Switch the source, adjust the window, and the Markov view updates instantly. It’s a rapid way to test ideas and feel regime persistence/switch behavior.
Integrate your own signals (using input.source())
- In settings, choose the Source . This is powered by input.source() .
- Feed it price, an indicator you compute inside the script, or a custom composite series.
- The script will automatically normalize that series and process it through the Markov engine, mapping it to regimes and updating the on‑chart spheres/arrows in real time.
Credits:
Deep gratitude to @RicardoSantos for both the foundational Markov chain processing engine and inspiring open-source contributions, which made advanced probabilistic market modeling accessible to the TradingView community.
Special thanks to @Alien_Algorithms for the innovative and visually stunning 3D sphere logic that powers the indicator’s animated, regime-based visualization.
Disclaimer
This tool summarizes recent behavior. It is not financial advice and not a guarantee of future results.
Nifty Dashboard//@version=5
//Author @GODvMarkets
indicator("GOD NSE Nifty Dashboard", "Nifty Dashboard")
i_timeframe = input.timeframe("D", "Timeframe")
// if not timeframe.isdaily
// runtime.error("Please switch timeframe to Daily")
i_text_size = input.string(size.auto, "Text Size", )
//-----------------------Functions-----------------------------------------------------
f_oi_buildup(price_chg_, oi_chg_) =>
switch
price_chg_ > 0 and oi_chg_ > 0 =>
price_chg_ > 0 and oi_chg_ < 0 =>
price_chg_ < 0 and oi_chg_ > 0 =>
price_chg_ < 0 and oi_chg_ < 0 =>
=>
f_color(val_) => val_ > 0 ? color.green : val_ < 0 ? color.red : color.gray
f_bg_color(val_) => val_ > 0 ? color.new(color.green,80) : val_ < 0 ? color.new(color.red,80) : color.new(color.black,80)
f_bg_color_price(val_) =>
fg_color_ = f_color(val_)
abs_val_ = math.abs(val_)
transp_ = switch
abs_val_ > .03 => 40
abs_val_ > .02 => 50
abs_val_ > .01 => 60
=> 80
color.new(fg_color_, transp_)
f_bg_color_oi(val_) =>
fg_color_ = f_color(val_)
abs_val_ = math.abs(val_)
transp_ = switch
abs_val_ > .10 => 40
abs_val_ > .05 => 50
abs_val_ > .025 => 60
=> 80
color.new(fg_color_, transp_)
f_day_of_week(time_=time) =>
switch dayofweek(time_)
1 => "Sun"
2 => "Mon"
3 => "Tue"
4 => "Wed"
5 => "Thu"
6 => "Fri"
7 => "Sat"
//-------------------------------------------------------------------------------------
var table table_ = table.new(position.middle_center, 22, 20, border_width = 1)
var cols_ = 0
var text_color_ = color.white
var bg_color_ = color.rgb(1, 5, 19)
f_symbol(idx_, symbol_) =>
symbol_nse_ = "NSE" + ":" + symbol_
fut_cur_ = "NSE" + ":" + symbol_ + "1!"
fut_next_ = "NSE" + ":" + symbol_ + "2!"
= request.security(symbol_nse_, i_timeframe, [close, close-close , close/close -1, volume], ignore_invalid_symbol = true, lookahead = barmerge.lookahead_on)
= request.security(fut_cur_, i_timeframe, , ignore_invalid_symbol = true, lookahead = barmerge.lookahead_on)
= request.security(fut_next_, i_timeframe, , ignore_invalid_symbol = true, lookahead = barmerge.lookahead_on)
= request.security(fut_cur_ + "_OI", i_timeframe, [close, close-close ], ignore_invalid_symbol = true, lookahead = barmerge.lookahead_on)
= request.security(fut_next_ + "_OI", i_timeframe, [close, close-close ], ignore_invalid_symbol = true, lookahead = barmerge.lookahead_on)
stk_vol_ = stk_vol_nse_
fut_vol_ = fut_cur_vol_ + fut_next_vol_
fut_oi_ = fut_cur_oi_ + fut_next_oi_
fut_oi_chg_ = fut_cur_oi_chg_ + fut_next_oi_chg_
fut_oi_chg_pct_ = fut_oi_chg_ / fut_oi_
fut_stk_vol_x_ = fut_vol_ / stk_vol_
fut_vol_oi_action_ = fut_vol_ / math.abs(fut_oi_chg_)
= f_oi_buildup(chg_pct_, fut_oi_chg_pct_)
close_color_ = fut_cur_close_ > fut_vwap_ ? color.green : fut_cur_close_ < fut_vwap_ ? color.red : text_color_
if barstate.isfirst
row_ = 0, col_ = 0
table.cell(table_, col_, row_, "Symbol", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Close", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "VWAP", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Pts", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Stk Vol", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Fut Vol", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Fut/Stk Vol", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "OI Cur", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "OI Next", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "OI Cur Chg", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "OI Next Chg", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "COI ", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "COI Chg", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Vol/OI Chg", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "COI Chg%", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "Pr.Chg%", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
table.cell(table_, col_, row_, "OI Buildup", text_color = text_color_, bgcolor = bg_color_, text_size = i_text_size), col_ += 1
cell_color_ = color.white
cell_bg_color_ = color.rgb(1, 7, 24)
if barstate.islast
row_ = idx_, col_ = 0
table.cell(table_, col_, row_, str.format("{0}", symbol_), text_color = f_color(chg_pct_), bgcolor = f_bg_color_price(chg_pct_), text_size = i_text_size, text_halign = text.align_left), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#.00}", fut_cur_close_), text_color = close_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#.00}", fut_vwap_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,0.00}", chg_pts_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", stk_vol_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_vol_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,0.00}", fut_stk_vol_x_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_cur_oi_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_next_oi_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_cur_oi_chg_), text_color = f_color(fut_cur_oi_chg_), bgcolor = f_bg_color(fut_cur_oi_chg_), text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_next_oi_chg_), text_color = f_color(fut_next_oi_chg_), bgcolor = f_bg_color(fut_next_oi_chg_), text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_oi_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,#,###}", fut_oi_chg_), text_color = f_color(fut_oi_chg_), bgcolor = f_bg_color(fut_oi_chg_), text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,0.00}", fut_vol_oi_action_), text_color = cell_color_, bgcolor = cell_bg_color_, text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,0.00%}", fut_oi_chg_pct_), text_color = f_color(fut_oi_chg_pct_), bgcolor = f_bg_color_oi(fut_oi_chg_pct_), text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0,number,0.00%}", chg_pct_), text_color = f_color(chg_pct_), bgcolor = f_bg_color_price(chg_pct_), text_size = i_text_size, text_halign = text.align_right), col_ += 1
table.cell(table_, col_, row_, str.format("{0}", oi_buildup_), text_color = oi_buildup_color_, bgcolor = color.new(oi_buildup_color_,80), text_size = i_text_size, text_halign = text.align_left), col_ += 1
idx_ = 1
f_symbol(idx_, "BANKNIFTY"), idx_ += 1
f_symbol(idx_, "NIFTY"), idx_ += 1
f_symbol(idx_, "CNXFINANCE"), idx_ += 1
f_symbol(idx_, "RELIANCE"), idx_ += 1
f_symbol(idx_, "HDFC"), idx_ += 1
f_symbol(idx_, "ITC"), idx_ += 1
f_symbol(idx_, "HINDUNILVR"), idx_ += 1
f_symbol(idx_, "INFY"), idx_ += 1
Intrabar Efficiency Ratio█ OVERVIEW
This indicator displays a directional variant of Perry Kaufman's Efficiency Ratio, designed to gauge the "efficiency" of intrabar price movement by comparing the sum of movements of the lower timeframe bars composing a chart bar with the respective bar's movement on an average basis.
█ CONCEPTS
Efficiency Ratio (ER)
Efficiency Ratio was first introduced by Perry Kaufman in his 1995 book, titled "Smarter Trading". It is the ratio of absolute price change to the sum of absolute changes on each bar over a period. This tells us how strong the period's trend is relative to the underlying noise. Simply put, it's a measure of price movement efficiency. This ratio is the modulator utilized in Kaufman's Adaptive Moving Average (KAMA), which is essentially an Exponential Moving Average (EMA) that adapts its responsiveness to movement efficiency.
ER's output is bounded between 0 and 1. A value of 0 indicates that the starting price equals the ending price for the period, which suggests that price movement was maximally inefficient. A value of 1 indicates that price had travelled no more than the distance between the starting price and the ending price for the period, which suggests that price movement was maximally efficient. A value between 0 and 1 indicates that price had travelled a distance greater than the distance between the starting price and the ending price for the period. In other words, some degree of noise was present which resulted in reduced efficiency over the period.
As an example, let's say that the price of an asset had moved from $15 to $14 by the end of a period, but the sum of absolute changes for each bar of data was $4. ER would be calculated like so:
ER = abs(14 - 15)/4 = 0.25
This suggests that the trend was only 25% efficient over the period, as the total distanced travelled by price was four times what was required to achieve the change over the period.
Intrabars
Intrabars are chart bars at a lower timeframe than the chart's. Each 1H chart bar of a 24x7 market will, for example, usually contain 60 intrabars at the LTF of 1min, provided there was market activity during each minute of the hour. Mining information from intrabars can be useful in that it offers traders visibility on the activity inside a chart bar.
Lower timeframes (LTFs)
A lower timeframe is a timeframe that is smaller than the chart's timeframe. This script determines which LTF to use by examining the chart's timeframe. The LTF determines how many intrabars are examined for each chart bar; the lower the timeframe, the more intrabars are analyzed, but fewer chart bars can display indicator information because there is a limit to the total number of intrabars that can be analyzed.
Intrabar precision
The precision of calculations increases with the number of intrabars analyzed for each chart bar. As there is a 100K limit to the number of intrabars that can be analyzed by a script, a trade-off occurs between the number of intrabars analyzed per chart bar and the chart bars for which calculations are possible.
Intrabar Efficiency Ratio (IER)
Intrabar Efficiency Ratio applies the concept of ER on an intrabar level. Rather than comparing the overall change to the sum of bar changes for the current chart's timeframe over a period, IER compares single bar changes for the current chart's timeframe to the sum of absolute intrabar changes, then applies smoothing to the result. This gives an indication of how efficient changes are on the current chart's timeframe for each bar of data relative to LTF bar changes on an average basis. Unlike the standard ER calculation, we've opted to preserve directional information by not taking the absolute value of overall change, thus allowing it to be utilized as a momentum oscillator. However, by taking the absolute value of this oscillator, it could potentially serve as a replacement for ER in the design of adaptive moving averages.
Since this indicator preserves directional information, IER can be regarded as similar to the Chande Momentum Oscillator (CMO) , which was presented in 1994 by Tushar Chande in "The New Technical Trader". Both CMO and ER essentially measure the same relationship between trend and noise. CMO simply differs in scale, and considers the direction of overall changes.
█ FEATURES
Display
Three different display types are included within the script:
• Line : Displays the middle length MA of the IER as a line .
Color for this display can be customized via the "Line" portion of the "Visuals" section in the script settings.
• Candles : Displays the non-smooth IER and two moving averages of different lengths as candles .
The `open` and `close` of the candle are the longest and shortest length MAs of the IER respectively.
The `high` and `low` of the candle are the max and min of the IER, longest length MA of the IER, and shortest length MA of the IER respectively.
Colors for this display can be customized via the "Candles" portion of the "Visuals" section in the script settings.
• Circles : Displays three MAs of the IER as circles .
The color of each plot depends on the percent rank of the respective MA over the previous 100 bars.
Different colors are triggered when ranks are below 10%, between 10% and 50%, between 50% and 90%, and above 90%.
Colors for this display can be customized via the "Circles" portion of the "Visuals" section in the script settings.
With either display type, an optional information box can be displayed. This box shows the LTF that the script is using, the average number of lower timeframe bars per chart bar, and the number of chart bars that contain LTF data.
Specifying intrabar precision
Ten options are included in the script to control the number of intrabars used per chart bar for calculations. The greater the number of intrabars per chart bar, the fewer chart bars can be analyzed.
The first five options allow users to specify the approximate amount of chart bars to be covered:
• Least Precise (Most chart bars) : Covers all chart bars by dividing the current timeframe by four.
This ensures the highest level of intrabar precision while achieving complete coverage for the dataset.
• Less Precise (Some chart bars) & More Precise (Less chart bars) : These options calculate a stepped LTF in relation to the current chart's timeframe.
• Very precise (2min intrabars) : Uses the second highest quantity of intrabars possible with the 2min LTF.
• Most precise (1min intrabars) : Uses the maximum quantity of intrabars possible with the 1min LTF.
The stepped lower timeframe for "Less Precise" and "More Precise" options is calculated from the current chart's timeframe as follows:
Chart Timeframe Lower Timeframe
Less Precise More Precise
< 1hr 1min 1min
< 1D 15min 1min
< 1W 2hr 30min
> 1W 1D 60min
The last five options allow users to specify an approximate fixed number of intrabars to analyze per chart bar. The available choices are 12, 24, 50, 100, and 250. The script will calculate the LTF which most closely approximates the specified number of intrabars per chart bar. Keep in mind that due to factors such as the length of a ticker's sessions and rounding of the LTF, it is not always possible to produce the exact number specified. However, the script will do its best to get as close to the value as possible.
Specifying MA type
Seven MA types are included in the script for different averaging effects:
• Simple
• Exponential
• Wilder (RMA)
• Weighted
• Volume-Weighted
• Arnaud Legoux with `offset` and `sigma` set to 0.85 and 6 respectively.
• Hull
Weighting
This script includes the option to weight IER values based on the percent rank of absolute price changes on the current chart's timeframe over a specified period, which can be enabled by checking the "Weigh using relative close changes" option in the script settings. This places reduced emphasis on IER values from smaller changes, which may help to reduce noise in the output.
█ FOR Pine Script™ CODERS
• This script imports the recently published lower_ltf library for calculating intrabar statistics and the optimal lower timeframe in relation to the current chart's timeframe.
• This script uses the recently released request.security_lower_tf() Pine Script™ function discussed in this blog post .
It works differently from the usual request.security() in that it can only be used on LTFs, and it returns an array containing one value per intrabar.
This makes it much easier for programmers to access intrabar information.
• This script implements a new recommended best practice for tables which works faster and reduces memory consumption.
Using this new method, tables are declared only once with var , as usual. Then, on the first bar only, we use table.cell() to populate the table.
Finally, table.set_*() functions are used to update attributes of table cells on the last bar of the dataset.
This greatly reduces the resources required to render tables.
Look first. Then leap.
lower_tf█ OVERVIEW
This library is a Pine programmer’s tool containing functions to help those who use the request.security_lower_tf() function. Its `ltf()` function helps translate user inputs into a lower timeframe string usable with request.security_lower_tf() . Another function, `ltfStats()`, accumulates statistics on processed chart bars and intrabars.
█ CONCEPTS
Chart bars
Chart bars , as referred to in our publications, are bars that occur at the current chart timeframe, as opposed to those that occur at a timeframe that is higher or lower than that of the chart view.
Intrabars
Intrabars are chart bars at a lower timeframe than the chart's. Each 1H chart bar of a 24x7 market will, for example, usually contain 60 intrabars at the LTF of 1min, provided there was market activity during each minute of the hour. Mining information from intrabars can be useful in that it offers traders visibility on the activity inside a chart bar.
Lower timeframes (LTFs)
A lower timeframe is a timeframe that is smaller than the chart's timeframe. This framework exemplifies how authors can determine which LTF to use by examining the chart's timeframe. The LTF determines how many intrabars are examined for each chart bar; the lower the timeframe, the more intrabars are analyzed.
Intrabar precision
The precision of calculations increases with the number of intrabars analyzed for each chart bar. As there is a 100K limit to the number of intrabars that can be analyzed by a script, a trade-off occurs between the number of intrabars analyzed per chart bar and the chart bars for which calculations are possible.
█ `ltf()`
This function returns a timeframe string usable with request.security_lower_tf() . It calculates the returned timeframe by taking into account a user selection between eight different calculation modes and the chart's timeframe. You send it the user's selection, along with the text corresponding to the eight choices from which the user has chosen, and the function returns a corresponding LTF string.
Because the function processes strings and doesn't require recalculation on each bar, using var to declare the variable to which its result is assigned will execute the function only once on bar zero and speed up your script:
var string ltfString = ltf(ltfModeInput, LTF1, LTF2, LTF3, LTF4, LTF5, LTF6, LTF7, LTF8)
The eight choices users can select from are of two types: the first four allow a selection from the desired amount of chart bars to be covered, the last four are choices of a fixed number of intrabars to be analyzed per chart bar. Our example code shows how to structure your input call and then make the call to `ltf()`. By changing the text associated with the `LTF1` to `LTF8` constants, you can tailor it to your preferences while preserving the functionality of `ltf()` because you will be sending those string constants as the function's arguments so it can determine the user's selection. The association between each `LTFx` constant and its calculation mode is fixed, so the order of the arguments is important when you call `ltf()`.
These are the first four modes and the `LTFx` constants corresponding to each:
Covering most chart bars (least precise) — LTF1
Covers all chart bars. This is accomplished by dividing the current timeframe in seconds by 4 and converting that number back to a string in timeframe.period format using secondsToTfString() . Due to the fact that, on premium subscriptions, the typical historical bar count is between 20-25k bars, dividing the timeframe by 4 ensures the highest level of intrabar precision possible while achieving complete coverage for the entire dataset with the maximum allowed 100K intrabars.
Covering some chart bars (less precise) — LTF2
Covering less chart bars (more precise) — LTF3
These levels offer a stepped LTF in relation to the chart timeframe with slightly more, or slightly less precision. The stepped lower timeframe tiers are calculated from the chart timeframe as follows:
Chart Timeframe Lower Timeframe
Less Precise More Precise
< 1hr 1min 1min
< 1D 15min 1min
< 1W 2hr 30min
> 1W 1D 60min
Covering the least chart bars (most precise) — LTF4
Analyzes the maximum quantity of intrabars possible by using the 1min LTF, which also allows the least amount of chart bars to be covered.
The last four modes allow the user to specify a fixed number of intrabars to analyze per chart bar. Users can choose from 12, 24, 50 or 100 intrabars, respectively corresponding to the `LTF5`, `LTF6`, `LTF7` and `LTF8` constants. The value is a target; the function will do its best to come up with a LTF producing the required number of intrabars. Because of considerations such as the length of a ticker's session, rounding of the LTF to the closest allowable timeframe, or the lowest allowable timeframe of 1min intrabars, it is often impossible for the function to find a LTF producing the exact number of intrabars. Requesting 100 intrabars on a 60min chart, for example, can only produce 60 1min intrabars. Higher chart timeframes, tickers with high liquidity or 24x7 markets will produce optimal results.
█ `ltfStats()`
`ltfStats()` returns statistics that will be useful to programmers using intrabar inspection. By analyzing the arrays returned by request.security_lower_tf() in can determine:
• intrabarsInChartBar : The number of intrabars analyzed for each chart bar.
• chartBarsCovered : The number of chart bars where intrabar information is available.
• avgIntrabars : The average number of intrabars analyzed per chart bar. Events like holidays, market activity, or reduced hours sessions can cause the number of intrabars to vary, bar to bar.
The function must be called on each bar to produce reliable results.
█ DEMONSTRATION CODE
Our example code shows how to provide users with an input from which they can select a LTF calculation mode. If you use this library's functions, feel free to reuse our input setup code, including the tooltip providing users with explanations on how it works for them.
We make a simple call to request.security_lower_tf() to fetch the close values of intrabars, but we do not use those values. We simply send the returned array to `ltfStats()` and then plot in the indicator's pane the number of intrabars examined on each bar and its average. We also display an information box showing the user's selection of the LTF calculation mode, the resulting LTF calculated by `ltf()` and some statistics.
█ NOTES
• As in several of our recent publications, this script uses secondsToTfString() to produce a timeframe string in timeframe.period format from a timeframe expressed in seconds.
• The script utilizes display.data_window and display.status_line to restrict the display of certain plots.
These new built-ins allow coders to fine-tune where a script’s plot values are displayed.
• We implement a new recommended best practice for tables which works faster and reduces memory consumption.
Using this new method, tables are declared only once with var , as usual. Then, on bar zero only, we use table.cell() calls to populate the table.
Finally, table.set_*() functions are used to update attributes of table cells on the last bar of the dataset.
This greatly reduces the resources required to render tables. We encourage all Pine Script™ programmers to do the same.
Look first. Then leap.
█ FUNCTIONS
The library contains the following functions:
ltf(userSelection, choice1, choice2, choice3, choice4, choice5, choice6, choice7, choice8)
Selects a LTF from the chart's TF, depending on the `userSelection` input string.
Parameters:
userSelection : (simple string) User-selected input string which must be one of the `choicex` arguments.
choice1 : (simple string) Input selection corresponding to "Least precise, covering most chart bars".
choice2 : (simple string) Input selection corresponding to "Less precise, covering some chart bars".
choice3 : (simple string) Input selection corresponding to "More precise, covering less chart bars".
choice4 : (simple string) Input selection corresponding to "Most precise, 1min intrabars".
choice5 : (simple string) Input selection corresponding to "~12 intrabars per chart bar".
choice6 : (simple string) Input selection corresponding to "~24 intrabars per chart bar".
choice7 : (simple string) Input selection corresponding to "~50 intrabars per chart bar".
choice8 : (simple string) Input selection corresponding to "~100 intrabars per chart bar".
Returns: (simple string) A timeframe string to be used with `request.security_lower_tf()`.
ltfStats()
Returns statistics about analyzed intrabars and chart bars covered by calls to `request.security_lower_tf()`.
Parameters:
intrabarValues : (float [ ]) The ID of a float array containing values fetched by a call to `request.security_lower_tf()`.
Returns: A 3-element tuple: [ (series int) intrabarsInChartBar, (series int) chartBarsCovered, (series float) avgIntrabars ].
Super PerformanceThe "Super Performance" script is a custom indicator written in Pine Script (version 6) for use on the TradingView platform. Its main purpose is to visually compare the performance of a selected stock or index against a benchmark index (default: NIFTYMIDSML400) over various timeframes, and to display sector-wise performance rankings in a clear, tabular format.
Key Features:
Customizable Display:
Users can toggle between dark and light color themes, enable or disable extended data columns, and choose between a compact "Mini Mode" or a full-featured table view. Table positions and sizes are also configurable for both stock and sector tables.
Performance Calculation:
The script calculates percentage price changes for the selected stock and the benchmark index over multiple periods: 1, 5, 10, 20, 50, and 200 days. It then checks if the stock is outperforming the index for each period.
Conviction Score:
For each period where the stock outperforms the index, a "conviction score" is incremented. This score is mapped to qualitative labels such as "Super solid," "Solid," "Good," etc., and is color-coded for quick visual interpretation.
Sector Performance Table:
The script tracks 19 sector indices (e.g., REALTY, IT, PHARMA, AUTO, ENERGY) and calculates their performance over 1, 5, 10, 20, and 60-day periods. It then ranks the top 5 performing sectors for each timeframe and displays them in a sector performance table.
Visual Output:
Two tables are constructed:
Stock Performance Table: Shows the stock's returns, index returns, outperformance markers (✔/✖), and the difference for each period, along with the overall conviction score.
Sector Performance Table: Ranks and displays the top 5 sectors for each timeframe, with color-coded performance values for easy comparison.
Seasonality DOW CombinedOverall Purpose
This script analyzes historical daily returns based on two specific criteria:
Month of the year (January through December)
Day of the week (Sunday through Saturday)
It summarizes and visually displays the average historical performance of the selected asset by these criteria over multiple years.
Step-by-Step Breakdown
1. Initial Settings:
Defines minimum year (i_year_start) from which data analysis will start.
Ensures the user is using a daily timeframe, otherwise prompts an error.
Sets basic display preferences like text size and color schemes.
2. Data Collection and Variables:
Initializes matrices to store and aggregate returns data:
month_data_ and month_agg_: store monthly performance.
dow_data_ and dow_agg_: store day-of-week performance.
COUNT tracks total number of occurrences, and COUNT_POSITIVE tracks positive-return occurrences.
3. Return Calculation:
Calculates daily percentage change (chg_pct_) in price:
chg_pct_ = close / close - 1
Ensures it captures this data only for the specified years (year >= i_year_start).
4. Monthly Performance Calculation:
Each daily return is grouped by month:
matrix.set updates total returns per month.
The script tracks:
Monthly cumulative returns
Number of occurrences (how many days recorded per month)
Positive occurrences (days with positive returns)
5. Day-of-Week Performance Calculation:
Similarly, daily returns are also grouped by day-of-the-week (Sunday to Saturday):
Daily return values are summed per weekday.
The script tracks:
Cumulative returns per weekday
Number of occurrences per weekday
Positive occurrences per weekday
6. Visual Display (Tables):
The script creates two visual tables:
Left Table: Monthly Performance.
Right Table: Day-of-the-Week Performance.
For each table, it shows:
Yearly data for each month/day.
Summaries at the bottom:
SUM row: Shows total accumulated returns over all selected years for each month/day.
+ive row: Shows percentage (%) of times the month/day had positive returns, along with a tooltip displaying positive occurrences vs total occurrences.
Cells are color-coded:
Green for positive returns.
Red for negative returns.
Gray for neutral/no change.
7. Interpreting the Tables:
Monthly Table (left side):
Helps identify seasonal patterns (e.g., historically bullish/bearish months).
Day-of-Week Table (right side):
Helps detect recurring weekday patterns (e.g., historically bullish Mondays or bearish Fridays).
Practical Use:
Traders use this to:
Identify patterns based on historical data.
Inform trading strategies, e.g., avoiding historically bearish days/months or leveraging historically bullish periods.
Example Interpretation:
If the table shows consistently green (positive) for March and April, historically the asset tends to perform well during spring. Similarly, if the "Friday" column is often red, historically Fridays are bearish for this asset.