Jumbalika BandsBollinger Bands:
Color: You can set the color of the upper and lower Bollinger Bands (bbColor).
Line Width: You can set the thickness of the Bollinger Bands lines (bbLineWidth).
Exponential Moving Averages (EMA):
9 EMA: Custom color (ema9Color) and line width (ema9LineWidth).
20 EMA on Close: Custom color (ema20CloseColor) and line width (ema20CloseLineWidth).
20 EMA on High: Custom color (ema20HighColor) and line width (ema20HighLineWidth).
20 EMA on Low: Custom color (ema20LowColor) and line width (ema20LowLineWidth).
Parabolic SAR:
Indicadores e estratégias
Auto Fibonacci Retracement- MSDThis Auto Fibonacci Retracement script automatically detects the most recent swing high and swing low and plots Fibonacci levels for better trading decisions. It helps traders identify support and resistance levels based on Fibonacci ratios.
BTC Strategy v6Claude
these are btc/usdt ccharts in different time frames, analyse these and create pine code indicator without any error for tradingview in v6, which can analyse the chart of cryptocurrency and show trend, support-resistance level, buy and sell signal if buy then chart background colour changes to green and if sell then red, risk to reward should 1:8-10, avoid false signals, these should show in a box above in the chart corner, entry and exit prediction.
remove halucination, improve error handling, create a better strategy based upon delta exchange for option trading in crypto,
ask if I have missed anything and suggest best improvements and how can I enhance and make it better for more efficiency
Gold Trading RSI//@version=6
strategy("Gold Trading RSI", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Cấu hình tham số đầu vào
rsi_length = input.int(14, title="RSI Period") // Độ dài RSI
rsi_overbought = input.int(70, title="RSI Overbought Level") // Mức quá mua
rsi_oversold = input.int(30, title="RSI Oversold Level") // Mức quá bán
sl_percent = input.float(1.0, title="Stop Loss (%)") / 100 // Cắt lỗ theo %
tp_percent = input.float(2.0, title="Take Profit (%)") / 100 // Chốt lời theo %
capital = strategy.equity // Vốn hiện tại
// Tính RSI trên khung M5
rsi_m5 = ta.rsi(close, rsi_length)
// Lấy giờ hiện tại theo múi giờ của biểu đồ
current_hour = hour(time)
// Giới hạn giao dịch trong khung giờ 6h - 17h
is_trading_time = current_hour >= 6 and current_hour < 17
// Điều kiện vào lệnh
long_condition = is_trading_time and rsi_m5 < rsi_oversold
short_condition = is_trading_time and rsi_m5 > rsi_overbought
// Tính toán SL/TP
sl_long = close * (1 - sl_percent)
tp_long = close * (1 + tp_percent)
sl_short = close * (1 + sl_percent)
tp_short = close * (1 - tp_percent)
// Vào lệnh
if (long_condition)
strategy.entry("Buy", strategy.long)
strategy.exit("Exit Buy", from_entry="Buy", stop=sl_long, limit=tp_long)
if (short_condition)
strategy.entry("Sell", strategy.short)
strategy.exit("Exit Sell", from_entry="Sell", stop=sl_short, limit=tp_short)
Bollinger Band Reentry StrategyAriels BB strat just follow the signals! Bollinger bands are the key to this strat take profit levels ! make sure you are fast
RSI-Based Buy/Sell Signals (15m)//@version=5
indicator("RSI-Based Buy/Sell Signals (15m)", overlay=false)
// Set the timeframe to 15 minutes
fifteenMinClose = request.security(syminfo.tickerid, "15", close)
// RSI Calculation
rsi = ta.rsi(fifteenMinClose, 14)
// Buy/Sell Conditions
buySignal = ta.crossover(rsi, 30) // Buy when RSI crosses above 30
sellSignal = ta.crossunder(rsi, 70) // Sell when RSI crosses below 70
// Plot Buy/Sell Signals in RSI pane
plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 80), size=size.tiny, text="BUY")
plotshape(sellSignal, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 80), size=size.tiny, text="SELL")
// Plot RSI in a separate pane
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
plot(rsi, color=color.blue, title="RSI")
Bollinger Bands cross %The BB strategy (Bollinger Bands strategy) on TradingView utilizes the Bollinger Bands indicator to help traders identify market volatility and potential entry points. The Bollinger Bands indicator consists of three main components:
Middle Band: This is the simple moving average (SMA), usually calculated over a 20-period. It represents the average price over a specific period.
Upper Band and Lower Band: These bands are created by adding and subtracting a multiple of the standard deviation (typically 2) from the middle band. The upper and lower bands help determine the level of price volatility.
How the BB Strategy Works:
Break above the Upper Band: When the price moves above the upper band, it might signal that the market is in an "overbought" condition. This could be a sign to consider selling, but it could also continue if the trend is strong.
Break below the Lower Band: When the price moves below the lower band, it might signal that the market is in an "oversold" condition, which could be a signal to buy if the trend is reversing.
Squeeze (Coiling): When the Bollinger Bands contract, often referred to as a "squeeze," it indicates that the market may be preparing for a strong price move. This is a critical signal in the BB strategy because the narrowing bands signify low volatility and a potential breakout in price.
Specific Strategy:
Buy when price touches the lower band and shows signs of reversal (bullish reversal): If the price touches the lower band, you might wait for a reversal signal, such as a bullish candlestick pattern or confirmation from other indicators like RSI or MACD, indicating oversold conditions.
Sell when price touches the upper band and shows signs of reversal (bearish reversal): Similarly, when the price touches the upper band, you could wait for a bearish reversal signal, such as a bearish candlestick pattern or confirmation from other indicators, and then sell.
Trend-following when bands are expanding: If the Bollinger Bands are expanding and the price continues in the same direction, it could signal a trend-following opportunity.
RSI & MFI Combined With better divergences -100 to 100A modified RSI and MFI in one indicator.
Modifications:
Adjusted the range from 0 to 100 to -100 to 100
Modified divergence detection logic to plot using 2 different lookback periods
Added divergence detection to MFI
Added oversold/overbought gradient to MFI
Added combined oversold/overbought indication
Midnight and 7:30 AM Open with ResetExtreme Discount and Extreme Premium Indicator
This custom indicator identifies the relationship between the current price and key discount and premium levels on the chart. It helps determine whether the price is in an "extreme discount" or "extreme premium" zone, which can be important for making trading decisions based on market structure.
Extreme Discount Zone: The indicator identifies the "extreme discount" zone when the price is below both its extreme discount levels, indicating that the market is in a potential buying area, which could signal a reversal or a good entry point to buy.
Extreme Premium Zone: The indicator marks the "extreme premium" zone when the price is above both its extreme premium levels, suggesting that the market is in a potential selling area, signaling a possible price reversal or a good entry point to sell.
The indicator dynamically adjusts and highlights these zones based on price movement, allowing traders to visualize when the price is reaching extreme levels relative to historical price action.
Key Features:
Detects when the current price is below both extreme discount levels.
Detects when the current price is above both extreme premium levels.
Highlights these extreme areas visually to help traders make informed decisions on buying or selling.
Quarterly Theory IndicatorThe Quarterly Theory Indicator that we built is based on Jevaunie Daye's Quarterly Theory, which segments time into specific quarters to analyze market cycles more effectively. This indicator helps traders track price movements across different timeframes, identify key entry and exit points, and anticipate liquidity events using Accumulation, Manipulation, and Distribution (AMDX) cycles.
Morning Star Candlestick patternMorning star candlestick pattern with gap up opening- Bullish reversal entry indicator
It is more valid at support levels for reversal entry
Volume Spike BoxThis indicator highlights the highest volume candlestick in a specified number of bars. It extends for the same length in the future as the specified number of bars for identifying potential support and resistance
Dynamic Range Finder [The_lurker]هو أداة تهدف إلى تحديد نطاق السعر الديناميكي بناءً على التقلبات ومتوسط الأسعار . حيث يتم التعرف على مناطق التوحيد السعري (Consolidation) ويعطي إشارات شراء وبيع عند اختراق أو كسر هذا النطاق .
// يفضل استخدام المؤشر على اطار 4 ساعات واكثر //
مميزات المؤشر :
1- اكتشاف النطاق السعري الديناميكي
- يقوم المؤشر بحساب متوسط السعر خلال فترة محددة ومقارنة الإغلاقات الحديثة بمدى تقلب الأسعار (ATR) لمعرفة ما إذا كان السعر يتحرك داخل نطاق معين.
2- تحديد الاختراقات Breakout Signals
- عند اختراق السعر الحد العلوي للنطاق، يظهر المؤشر إشارة شراء (BUY).
- عند كسر السعر الحد السفلي للنطاق، يظهر المؤشر إشارة بيع (SELL).
3- دعم أنماط متعددة للمتوسطات المتحركة
- يسمح للمستخدمين باختيار نوع المتوسط المتحرك (SMA، EMA، WMA) المستخدم في حساب متوسط السعر.
4- إعدادات مخصصة للفلترة بحجم التداول (اختياري)
- فلترة حجم التداول هي ميزة اختيارية في المؤشر تسمح بتصفية إشارات الشراء والبيع بناءً على قوة الحجم المتداول مما يعزز دقة الإشارات عن طريق التأكد من أن الاختراقات السعرية مدعومة بحجم تداول قوي
5- تصميم مرن مع تخصيص للألوان والأنماط
- يمكن للمستخدمين تغيير ألوان النطاق وإشارات البيع والشراء حسب رغبتهم.
6- تنبيهات آلية عند حدوث كسر أو اختراق
- يتضمن تنبيهات (Alerts) عند حدوث إشارة بيع أو شراء.
كيف يعمل المؤشر؟
* يتم حساب متوسط السعر خلال الفترة المحددة (rangePeriod).
* يتم حساب التقلب السعري (ATR) ومضاعفته بمعامل النطاق (rangeMultiplier).
* يتم رسم مستطيل يعبر عن النطاق السعري بين (متوسط السعر ± التقلب).
* إذا تجاوز السعر الحد العلوي → إشارة شراء (BUY).
* إذا كسر السعر الحد السفلي → إشارة بيع (SELL).
* يمكن تصفية الإشارات باستخدام حجم التداول (اختياري).
1.0 → الحجم الحالي يجب أن يكون على الأقل مساويًا للمتوسط.
1.2 → الحجم الحالي يجب أن يكون أعلى من المتوسط بنسبة 20%.
1.5 → الحجم الحالي يجب أن يكون أعلى من المتوسط بنسبة 50%.
تنويه:
المؤشر هو أداة مساعدة فقط ويجب استخدامه مع التحليل الفني والأساسي لتحقيق أفضل النتائج.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView.
It is a tool that aims to determine the dynamic price range based on fluctuations and average prices. Consolidation areas are identified and buy and sell signals are given when this range is breached or broken.
// It is preferable to use the indicator on a 4-hour frame or more //
Features of the indicator:
1- Detecting the dynamic price range
- The indicator calculates the average price over a specific period and compares recent closings with the price volatility range (ATR) to see if the price is moving within a specific range.
2- Identifying Breakout Signals
- When the price breaks the upper limit of the range, the indicator shows a buy signal (BUY).
- When the price breaks the lower limit of the range, the indicator shows a sell signal (SELL).
3- Support for multiple moving average patterns
- Allows users to choose the type of moving average (SMA, EMA, WMA) used to calculate the average price.
4- Custom settings for filtering by trading volume (optional)
- Trading volume filtering is an optional feature in the indicator that allows filtering buy and sell signals based on the strength of the trading volume, which enhances the accuracy of the signals by ensuring that price breakouts are supported by strong trading volume
5- Flexible design with customization of colors and patterns
- Users can change the colors of the range and buy and sell signals as they wish.
6- Automatic alerts when a breakout or breakout occurs
- Includes alerts when a buy or sell signal occurs.
How does the indicator work?
* The average price is calculated over the specified period (rangePeriod).
* The price volatility (ATR) is calculated and multiplied by the range factor (rangeMultiplier).
* A rectangle is drawn that represents the price range between (average price ± volatility).
* If the price exceeds the upper bound → a buy signal (BUY).
* If the price breaks the lower bound → a sell signal (SELL).
* Signals can be filtered using trading volume (optional).
1.0 → Current volume should be at least equal to the average.
1.2 → Current volume should be 20% above the average.
1.5 → Current volume should be 50% above the average.
Disclaimer:
The indicator is an auxiliary tool only and should be used in conjunction with technical and fundamental analysis to achieve the best results.
Disclaimer
The information and posts are not intended to be, or constitute, any financial, investment, trading or other types of advice or recommendations provided or endorsed by TradingView.
Major Bar Engulfing StrategyBelow is a concise overview and step-by-step guide on how to interpret and use the **Major Bar Engulfing Strategy** indicator.
---
## 1. Description
The **Major Bar Engulfing Strategy** indicator is designed to identify key turning points (“Major Bars”) and potential trade continuation signals based on higher-timeframe (HTF) and lower-timeframe (LTF) engulfing logic. It helps you see when price has significantly shifted structure at a higher timeframe, and then pinpoints bullish or bearish “engulfing” candles that align with the current trend direction.
### Key Components
1. **Major Bar Detection (HTF)**
- The script tracks a *higher timeframe* high and low (labeled “Major Bar High” & “Major Bar Low” on your chart).
- When the HTF close breaks above the previous Major Bar High, it signals a *new bullish major bar*.
- When the HTF close breaks below the previous Major Bar Low, it signals a *new bearish major bar*.
2. **Trend Direction**
- If a new major bar forms by breaking above the old high, the trend is flagged as “bullish.” Breaking below the old low flags the trend as “bearish.”
- A large triangle (`▲` or `▼`) appears on the bar where the trend flips from bullish to bearish or vice versa.
3. **Bar Coloring**
- **Bullish Major Bar**: Fully bright green (`#00ff72`).
- **Bearish Major Bar**: Fully red.
- **Subsequent Bars After Bullish Major Bar**: Green (`#00ff72`) at 50% transparency.
- **Subsequent Bars After Bearish Major Bar**: Red at 50% transparency.
- This coloring remains until a new major bar changes the trend.
4. **Engulfing Candle Diamonds**
- **Higher Timeframe Engulfing** (HTF) – Green diamond above the candle if bullish engulfing; red diamond below if bearish engulfing.
- **Lower Timeframe Engulfing** (LTF) – Green diamond above the candle if bullish engulfing; red diamond below if bearish engulfing.
- These diamonds help you see when a candle at either timeframe engulfs the previous one in a trend-aligned direction.
5. **Pullback Logic**
- A simple pullback is detected if multiple consecutive bars move against the current trend on the HTF or LTF. Once pullback criteria are met, the next engulfing bar in trend direction is flagged as a signal.
6. **Advanced Retouch Logic** (Optional)
- When enabled, the script checks if the engulfing bar significantly exceeds the previous 2 bar highs/lows and if price “retouches” a certain zone before confirming a final entry signal. This logic is mostly “under the hood” but adds nuance to when final signals appear.
---
## 2. How to Use
1. **Add the Indicator to Your Chart**
- In TradingView, open the **Indicators** menu and add the **Major Bar Engulfing Strategy** indicator to any symbol/timeframe chart.
2. **Select Appropriate Timeframes**
- Open the “Settings” of the indicator (gear icon), and specify the **Higher Timeframe** (e.g., 4H) and the **Lower Timeframe** (e.g., 1H).
- Ideally, your **chart timeframe** should be equal to or lower than the Higher Timeframe you set, so the higher-timeframe logic can unfold properly.
3. **Interpret the Major Bar Lines**
- You’ll see two lines on your chart (by default, bright green for “Major Bar High” and red for “Major Bar Low”). These lines represent the *current* HTF structure boundaries.
4. **Look for a Change in Major Bar**
- If the higher-timeframe close goes beyond the Major Bar High or Low, a **new major bar** is declared, and the **bar color** on your chart will fully switch to bright green (bullish) or full red (bearish).
- The indicator also draws a **triangle** (up for bullish, down for bearish) on the exact bar where the overall *trend flips* from up to down or down to up.
5. **Note the Candle Colors**
- The exact bar that changes the major bar to bullish → *fully bright green*.
- The exact bar that changes the major bar to bearish → *fully red*.
- Follow-up bars stay the same color but at 50% transparency, indicating the prevailing trend until a new major bar triggers.
6. **Engulfing Candle Diamonds**
- Diamonds *above* the bar = bullish engulf.
- Diamonds *below* the bar = bearish engulf.
- **HTF Engulf** uses separate conditions from **LTF Engulf** but both display as diamonds (different titles in the input/Style panel).
- When a pullback is detected and then an engulfing candle occurs in the trend direction, you may see these diamonds as potential re-entry or continuation signals.
7. **Advanced Retouch Logic (Optional)**
- If “Use Advanced Retouch Entry Logic?” is enabled in the settings, the script adds stricter engulfing and “retouch zone” checks. While these conditions are not visually distinct except for internal signals, it can influence when final signals are counted as valid. You might see the “Advanced Entry Signal” marker (●) appear on your chart’s lower region.
8. **Customize in the Style Tab**
- Adjust colors, shape sizes, line thickness, and visibility from the **Style** tab in the indicator’s settings. This includes the Major Bar High/Low lines, triangle flip icons, diamond engulf icons, and debug signal markers.
---
## 3. Practical Tips
- **Timeframe Alignment**:
- If you set the higher timeframe too large compared to your chart, changes might be infrequent. Consider a ratio like 4:1 or 6:1 (e.g., HTF = 4H, chart timeframe = 1H).
- **Pullback & Engulf Settings**:
- Lower the `Pullback Bar Count Threshold` (e.g., from 3 to 2) or the `Minimum Body % for Engulfing` if you want more frequent detection of signals.
- **Multiple Confirmation**:
- Major Bar color changes, trend-flip triangles, and engulfing diamonds can all combine to give you a sense of structure shifts and potential continuation moves.
- **No Automated Orders**:
- This is an **indicator**, not a strategy; it will not place trades automatically. You can use it for discretionary guidance or integrate the logic into your own trading approach.
---
## 4. Disclaimer
This indicator is for **educational** and **informational** purposes only. It does **not** guarantee profitability or success in trading. Always perform your own analysis and risk management. Use at your own discretion.
---
**Enjoy monitoring higher-timeframe structure, trend flips, and engulfing setups with the Major Bar Engulfing Strategy indicator!**
MA200 Dynamic Trend strategy / BTC;BNB;ETH
Title:
MA200 Dynamic Trend Strategy 🚀 | BTC, BNB, ETH
Description:
ENGLISH 🇬🇧:
This strategy is designed for trend-following using the 200-period Simple Moving Average (MA200) combined with RSI, ADX, and ATR indicators.
✅ Buy Signals: Triggered when the price crosses above the MA200 with RSI > 40 and ADX > 20.
❌ Sell Signals: Triggered when the price crosses below the MA200 with RSI < 60 and ADX > 20.
🎯 Dynamic Stop Loss & Take Profit based on ATR for better risk management.
Tested on BTC, BNB, and ETH with outstanding results:
BTC: 90.91% success rate (22 trades)
BNB: 86.67% success rate (15 trades)
ETH: 73.77% success rate (15 trades)
Feel free to test it on other assets and timeframes. Feedback is welcome! 🚀
ESPAÑOL 🇪🇸:
Estrategia diseñada para seguir tendencias utilizando la Media Móvil Simple de 200 periodos (MA200) combinada con los indicadores RSI, ADX y ATR.
✅ Señales de Compra: Cuando el precio cruza por encima de la MA200 con RSI > 40 y ADX > 20.
❌ Señales de Venta: Cuando el precio cruza por debajo de la MA200 con RSI < 60 y ADX > 20.
🎯 Stop Loss y Take Profit Dinámicos basados en ATR para una mejor gestión del riesgo.
Probada en BTC, BNB y ETH con resultados destacados:
BTC: 90.91% de éxito (22 operaciones)
BNB: 86.67% de éxito (15 operaciones)
ETH: 73.77% de éxito (15 operaciones)
¡Pruébala en otros activos y marcos temporales! Se agradecen comentarios. 🚀
Walk Forward PatternsINTRO
In Euclidean geometry, every mathematical output has a planar projection. 'Walk Forward Patterns' can be considered a practical example of this concept. On the other hand, this indicator might also be viewed as an experiment in 'how playing with Lego as a child contributes to time series analysis' :)
OVERVIEW
This script dynamically generates the necessary optimization and testing ranges for Walk Forward Analysis based on user-defined bar count and length inputs. It performs automatic calculations for each step, offers 8 different window options depending on the inputs, and visualizes the results dynamically. I should also note that most of the window models consist of original patterns I have created.
ADDITIONAL INFO : WHAT IS WALK FORWARD ANALYSIS?
Although it is not the main focus of this indicator, providing a brief definition of Walk Forward Analysis can be helpful in correctly interpreting the results it generates. Walk Forward Analysis (WFA) is a systematic method for optimizing parameters and validating trading strategies. It involves dividing historical data into variable segments, where a strategy is first optimized on an in-sample period and then tested on an out-of-sample period. This process repeats by shifting the windows forward, ensuring that each test evaluates the strategy on unseen data, helping to assess its robustness and adaptability in real market conditions.
ORIGINALITY
There are very few studies on Walk Forward Analysis in TradingView. Even worse, there are no any open-source studies available. Someone has to start somewhere, I suppose. And in my personal opinion, determining the optimization and backtest intervals is the most challenging part of WFA. These intervals serve as a prerequisite for automated parameter optimization. I felt the need to publish this pattern module, which I use in my own WFA models, partly due to this gap on community scripts.
INDICATOR MECHANICS
To use the indicator effectively, you only need to perform four simple tasks:
Specify the total number of bars in your chart in the 'Bar Index' parameter.
Define the optimization (In-Sample Test) length.
Define the testing (Out-Of-Sample Test) length.
Finally, select the window type.
The indicator automatically models everything else (including the number of steps) based on your inputs. And the result; you now have a clear idea of which bars to use for your Walk Forward tests!
A COMMONLY USED WINDOW SELECTION METHOD: ROLLING
A more concrete definition of Walk Forward Analysis, specifically for the widely used Rolling method, can be described as follows:
Parameters that have performed well over a certain period are identified (Optimization: In-Sample).
These parameters are then tested on a shorter, subsequent period (Backtest: Out-of-Sample).
The process is repeated forward in time (At each step, the optimization and backtest periods are shifted by the backtest length).
If the cumulative percentage profit obtained from the backtest results is greater than half of the historical optimization profit, the strategy is considered "successful."
If the strategy is successful, the most recent (untested) optimization values are used for live trading.
OTHER WINDOW OPTIONS
ANCHORED: That's a pattern based on progressively expanding optimization ranges at each step. Backtest ranges move forward in a staircase-like manner.
STATIC: Optimization ranges remain fixed, while backtest ranges are shifted forward.
BLOCKED: Optimization ranges are shifted forward in groups of three blocks. Backtest ranges are also shifted in a staircase manner, even at the cost of creating gaps from the optimization end bars.
TRIANGULAR: Optimization ranges are shifted forward in triangular regions, while backtest ranges move in a staircase pattern.
RATIO: The optimization length increases by 25% of the initial step’s fixed length at each step. In other words, the length grows by 25% of the first step's length incrementally. Backtest ranges always start from the bar where the optimization ends.
FIBONACCI: A variation of the Ratio method, where the optimization shift factor is set to 0.618
RANDOM WALK
Unlike the window models explained above, we can also generate optimization and backtest ranges completely randomly—offering almost unlimited variations! When you select the "Random" option in the "Window" parameter on the indicator interface, random intervals are generated based on various trigonometric calculations. By changing the numerical value in the '🐒' parameter, you can create entirely unique patterns.
WHY THE 🐒 EMOJI?
Two reasons.
First, I think that as humanity, we are a species of tailless primates who become happy when we understand things :). At least evolutionarily. The entire history of civilization is built on the effort to express the universe in a scale we can comprehend. 'Knowledge' is an invention born from this effort, which is why we feel happiness when we 'understand'. Second, I can't think of a better metaphor for randomness than a monkey sitting at a keyboard. See: Monkey Test.
Anyway, I’m rambling :)
NOTES
The indicator generates results for up to 100 steps. As the number of steps increases, the table may extend beyond the screen—don’t forget to zoom out!
FINAL WORDS
I haven’t published a Walk Forward script yet . However, there seem to be examples that can perform parameter optimization in the true sense of the word, producing more realistic results without falling into overfitting in my library. Hopefully, I’ll have the chance to publish one in the coming weeks. Sincerely thanks to Kıvanç Özbilgiç, Robert Pardo, Kevin Davey, Ernest P. Chan for their inspiring publishments.
DISCLAIMER
That's just a script, nothing more. I hope it helps everyone. Do not forget to manage your risk. And trade as safely as possible. Best of luck!
© dg_factor
True Strength Index with Zones & AlertsKey Features:
True Strength Index (TSI) Calculation
Uses double-smoothed exponential moving averages (EMA) to calculate TSI.
A signal line (EMA of TSI) helps confirm trends.
Dynamic Color Coding for TSI Line
Green: TSI is above the signal line (Bullish).
Red: TSI is below the signal line (Bearish).
Crossover & Crossunder Signals
Bullish Crossover (TSI crosses above Signal Line) → Green Circle.
Bearish Crossunder (TSI crosses below Signal Line) → Red Circle.
Alerts for Trading Signals
Buy Alert: TSI crosses above the signal line.
Sell Alert: TSI crosses below the signal line.
Overbought & Oversold Zones
Overbought: Between 40 and 50 (Red Zone).
Oversold: Between -40 and -50 (Green Zone).
Highlighted Background when TSI enters these zones.
Neutral Line at 0
Helps determine trend direction and momentum shifts.
How to Use These Values:
• TSI Crosses Above Signal Line → Bullish entry.
• TSI Crosses Below Signal Line → Bearish entry.
• Overbought (+40 to +50) & Oversold (-40 to -50) zones → Watch for trend reversals.
• Divergence Signals → If price makes a new high/low but TSI doesn’t, momentum is weakening.
AMD421This is a simple yet efficient indicator based on my personal trading strategy. I created it to keep myself grounded and aligned with my approach to trading.
Let me know if you'd like it then give it a like.
PaddingThe Padding library is a comprehensive and flexible toolkit designed to extend time series data within TradingView, making it an indispensable resource for advanced signal processing tasks such as FFT, filtering, convolution, and wavelet analysis. At its core, the library addresses the common challenge of edge effects by "padding" your data—that is, by appending additional data points beyond the natural boundaries of your original dataset. This extension not only mitigates the distortions that can occur at the endpoints but also helps to maintain the integrity of various transformations and calculations performed on the series. The library accomplishes this while preserving the ordering of your data, ensuring that the most recent point always resides at index 0.
Central to the functionality of this library are two key enumerations: Direction and PaddingType. The Direction enum determines where the padding will be applied. You can choose to extend the data in the forward direction (ahead of the current values), in the backward direction (behind the current values), or in both directions simultaneously. The PaddingType enum defines the specific method used for extending the data. The library supports several methods—including symmetric, reflect, periodic, antisymmetric, antireflect, smooth, constant, and zero padding—each of which has been implemented to suit different analytical scenarios. For instance, symmetric padding mirrors the original data across its boundaries, while reflect padding continues the trend by reflecting around endpoint values. Periodic padding repeats the data, and antisymmetric padding mirrors the data with alternating signs to counterbalance it. The antireflect and smooth methods take into account the derivatives of your data, thereby extending the series in a way that preserves or smoothly continues these derivative values. Constant and zero padding simply extend the series using fixed endpoint values or zeros. Together, these enums allow you to fine-tune how your data is extended, ensuring that the padding method aligns with the specific requirements of your analysis.
The library is designed to work with both single variable inputs and array inputs. When using array-based methods—particularly with the antireflect and smooth padding types—please note that the implementation intentionally discards the last data point as a result of the delta computation process. This behavior is an important consideration when integrating the library into your TradingView studies, as it affects the overall data length of the padded series. Despite this, the library’s structure and documentation make it straightforward to incorporate into your existing scripts. You simply provide your data source, define the length of your data window, and select the desired padding type and direction, along with any optional parameters to control the extent of the padding (using both_period, forward_period, or backward_period).
In practical application, the Padding library enables you to extend historical data beyond its original range in a controlled and predictable manner. This is particularly useful when preparing datasets for further signal processing, as it helps to reduce artifacts that can otherwise compromise the results of your analytical routines. Whether you are an experienced Pine Script developer or a trader exploring advanced data analysis techniques, this library offers a robust solution that enhances the reliability and accuracy of your studies by ensuring your algorithms operate on a more complete and well-prepared dataset.
Library "Padding"
A comprehensive library for padding time series data with various methods. Supports both single variable and array inputs, with flexible padding directions and periods. Designed for signal processing applications including FFT, filtering, convolution, and wavelets. All methods maintain data ordering with most recent point at index 0.
symmetric(source, series_length, direction, both_period, forward_period, backward_period)
Applies symmetric padding by mirroring the input data across boundaries
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with symmetric padding applied
method symmetric(source, direction, both_period, forward_period, backward_period)
Applies symmetric padding to an array by mirroring the data across boundaries
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with symmetric padding applied
reflect(source, series_length, direction, both_period, forward_period, backward_period)
Applies reflect padding by continuing trends through reflection around endpoint values
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with reflect padding applied
method reflect(source, direction, both_period, forward_period, backward_period)
Applies reflect padding to an array by continuing trends through reflection around endpoint values
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with reflect padding applied
periodic(source, series_length, direction, both_period, forward_period, backward_period)
Applies periodic padding by repeating the input data
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with periodic padding applied
method periodic(source, direction, both_period, forward_period, backward_period)
Applies periodic padding to an array by repeating the data
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with periodic padding applied
antisymmetric(source, series_length, direction, both_period, forward_period, backward_period)
Applies antisymmetric padding by mirroring data and alternating signs
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antisymmetric padding applied
method antisymmetric(source, direction, both_period, forward_period, backward_period)
Applies antisymmetric padding to an array by mirroring data and alternating signs
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antisymmetric padding applied
antireflect(source, series_length, direction, both_period, forward_period, backward_period)
Applies antireflect padding by reflecting around endpoints while preserving derivatives
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antireflect padding applied
method antireflect(source, direction, both_period, forward_period, backward_period)
Applies antireflect padding to an array by reflecting around endpoints while preserving derivatives
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antireflect padding applied. Note: Last data point is lost when using array input
smooth(source, series_length, direction, both_period, forward_period, backward_period)
Applies smooth padding by extending with constant derivatives from endpoints
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with smooth padding applied
method smooth(source, direction, both_period, forward_period, backward_period)
Applies smooth padding to an array by extending with constant derivatives from endpoints
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with smooth padding applied. Note: Last data point is lost when using array input
constant(source, series_length, direction, both_period, forward_period, backward_period)
Applies constant padding by extending endpoint values
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with constant padding applied
method constant(source, direction, both_period, forward_period, backward_period)
Applies constant padding to an array by extending endpoint values
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with constant padding applied
zero(source, series_length, direction, both_period, forward_period, backward_period)
Applies zero padding by extending with zeros
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with zero padding applied
method zero(source, direction, both_period, forward_period, backward_period)
Applies zero padding to an array by extending with zeros
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with zero padding applied
pad_data(source, series_length, padding_type, direction, both_period, forward_period, backward_period)
Generic padding function that applies specified padding type to input data
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
padding_type (series PaddingType) : Type of padding to apply (see PaddingType enum)
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with specified padding applied
method pad_data(source, padding_type, direction, both_period, forward_period, backward_period)
Generic padding function that applies specified padding type to array input
Namespace types: array
Parameters:
source (array) : Array of values to pad
padding_type (series PaddingType) : Type of padding to apply (see PaddingType enum)
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with specified padding applied. Note: Last data point is lost when using antireflect or smooth padding types
make_padded_data(source, series_length, padding_type, direction, both_period, forward_period, backward_period)
Creates a window-based padded data series that updates with each new value. WARNING: Function must be called on every bar for consistency. Do not use in scopes where it may not execute on every bar.
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
padding_type (series PaddingType) : Type of padding to apply (see PaddingType enum)
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing windowed data with specified padding applied
Major moving AveragesA combination of major moving averages both simple and exponential with cross signals on 2 of the SMAs and EMAs, great for assessing trend direction and strength at a glance.
Entering a position for continuation from a retracement to one of the longer period averages can offer a great R:R and win rate, using this in combination with a traditional oscillator such as RSI or MFI can further increase the effectiveness.
Best for use on higher timeframes (4H and above)
Default settings:
Period:
200 SMA, 50 SMA 20SMA (Bollinger band center), 7SMA
200 EMA, 50 EMA, 21EMA, 10EMA
Visual:
Lighter = larger period Darker = smaller period
7 SMA = thin white 10 EMA = thin yellow
Thick = SMA Thin = EMA