KernelSwenLibrary "KernelFunctions"
This library provides non-repainting kernel functions for Nadaraya-Watson estimator implementations. This allows for easy substition/comparison of different kernel functions for one another in indicators. Furthermore, kernels can easily be combined with other kernels to create newer, more customized kernels.
rationalQuadratic(_src, _lookback, _relativeWeight, startAtBar)
Rational Quadratic Kernel - An infinite sum of Gaussian Kernels of different length scales.
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
_relativeWeight (simple float) : Relative weighting of time frames. Smaller values resut in a more stretched out curve and larger values will result in a more wiggly curve. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel.
startAtBar (simple int)
Returns: yhat The estimated values according to the Rational Quadratic Kernel.
gaussian(_src, _lookback, startAtBar)
Gaussian Kernel - A weighted average of the source series. The weights are determined by the Radial Basis Function (RBF).
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
startAtBar (simple int)
Returns: yhat The estimated values according to the Gaussian Kernel.
periodic(_src, _lookback, _period, startAtBar)
Periodic Kernel - The periodic kernel (derived by David Mackay) allows one to model functions which repeat themselves exactly.
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
_period (simple int) : The distance between repititions of the function.
startAtBar (simple int)
Returns: yhat The estimated values according to the Periodic Kernel.
locallyPeriodic(_src, _lookback, _period, startAtBar)
Locally Periodic Kernel - The locally periodic kernel is a periodic function that slowly varies with time. It is the product of the Periodic Kernel and the Gaussian Kernel.
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
_period (simple int) : The distance between repititions of the function.
startAtBar (simple int)
Returns: yhat The estimated values according to the Locally Periodic Kernel.
指標和策略
Open and Low Same - TestingFor Devang's test, its a indicator which signals where the candle is formed with same open and low.
Finite Difference - Backward (mcbw_)In calculus there exists a 'derivative', which simply just measures the difference between two points on a curve. For well behaved mathematical functions there are infinitely many points and so there exists a derivative at every point. Where there are infinitely many points in a curve that curve is called 'continuous'. Continuous curves are very nice to deal with since each point on it exists almost exactly where its neighbors are. However, if the curve does not have infinitely many points on it, but instead has a finite number of points on it, that curve is called 'discrete' instead of continuous. Taking the derivative of discrete curves is much trickier business since there are none of the mathematical conveniences that a continuous offers. In the real world everything we measure is a discrete curve, including Price (since we measure it a finite number of times, aka each candlestick)!
The branch of Discrete Mathematics has found an approach to measure the derivative along a discrete curve, that approach is aptly called " Finite Difference ". To get a more accurate approximation of a discrete derivative, the finite difference approach uses weighted combinations of neighboring points. The most common type of finite difference is a 'central' difference, this uses a combination of points before and after the point of interest to approximate the discrete derivative. This is great for historical analysis but is not of much use for trading algorithms since it technically means using future prices to calculate the derivative of the current point. Instead we can use a less common variant called a ' Backwards Difference ' that only uses a combination of points before the current one to help approximate the current derivative.
In this script you can choose the " Order " of your derivative and the " Accuracy " of its approximation. This script is for educational purposes for folks building trading algorithms. Many trading algorithms often have an element of seeing how much Price has changed from the previous candle to the current candle. This approach is the lowest accuracy derivative possible, and using the backwards finite differences, made available for the first time on TradingView (!!), algorithms that use derivatives can now have higher orders of accuracy!
Happy Trading/Developing!
RSI + Bollinger Bands + OBV [blondepanther]This custom indicator combines the power of Relative Strength Index (RSI), Bollinger Bands (BB), and On-Balance Volume (OBV) to help identify undervalued and overbought conditions in any market.
Market Session Highlights- Indicator Function: This indicator highlights the first hour of each major trading session in UTC for better market timing.
- Sessions Covered:
1. Sydney Session – First hour marked.
2. Tokyo Session – First hour marked.
3. London Session – First hour marked.
4. New York Session – First hour marked.
ELHAI INDICES CHECKERDescription
The Major Indices Trend Checker is a powerful TradingView indicator designed to monitor the trend synchronization of the three major U.S. stock indices:
✅ S&P 500 (SPX)
✅ Nasdaq 100 (NDX)
✅ Dow Jones Industrial Average (DJI)
This indicator checks whether all three indices are bullish or bearish during each candle formation. If one of them is out of sync (e.g., two indices are bullish while one is bearish), the indicator triggers an alert and highlights the background in red, helping traders identify potential market indecision or divergence.
Key Features
📌 Live Market Monitoring – Works in real-time, updating dynamically with every tick.
📌 Bullish/Bearish Trend Check – Confirms if all three indices are aligned in the same trend.
📌 Mismatched Trend Detection – Alerts you when at least one index is not following the others.
📌 Custom Alerts – Set up TradingView alerts to notify you when a trend mismatch occurs.
📌 Visual Background Highlight – Red background indicates an out-of-sync market.
How It Works
The script retrieves open and close prices for SPX, NDX, and DJI.
Determines whether each index is bullish (close > open) or bearish (close < open).
If all three indices are bullish or all are bearish, it remains neutral.
If one index is out of sync, an alert is triggered and the background turns red.
How to Use
Apply the indicator to your TradingView chart.
Select any timeframe – it works on all intraday, daily, and higher timeframes.
Enable alerts: Go to Alerts → Create Alert, select "Trend Mismatch", and choose how often you want to be notified.
Use it with other indicators for confirmation, such as moving averages, RSI, or MACD.
Best Use Cases
✔ Day traders & scalpers – Spot market uncertainty early in the session.
✔ Swing traders – Identify moments when markets lack alignment before making a move.
✔ Trend followers – Avoid entering trades when major indices disagree on direction.
Final Notes
This indicator helps you stay ahead of market indecision by highlighting divergence among major indices. Use it as a confirmation tool alongside your strategy to improve your market timing and decision-making.
EMA 20-50 Kesişimleri EMA 20 EMA 50'yi yukarı kestiğinde (Golden Cross) Yeşil AL sinyalini verir
EMA 20 EMA 50'yi aşağı kestiğinde (Death Cross) Kırmızı SAT sinyalini verir
Sadece kesişimleri gösterir gereksiz sinyaller göstermez
Grafikte EMA 20 (MAVİ) İLE EMA 50 (TURUNCU) çizgiler ile gösteriliyor.
Her türlü zaman diliminde çalışır fakat önerim 5 dakikalıkta kesinlikle çalıştırmamanız çünkü çok sahte sinyal verebilir.
En doğru kullanım zaman dilimleri Günlük, 1 Saatlik ve 4 Saatlik zaman dilimlerinde orta uzun vadeli çok doğru sinyaller aldığını grafikte sizlerde görebilirsiniz.
EMA_RSI_VOL_KKSThis indicator combines RSI, volume analysis, and moving average crossovers to generate precise buy and sell signals. It ensures buy signals occur only when RSI crosses above its 14 EMA below the 45 RSI zone, confirming a strong upward momentum. Conversely, sell signals are triggered only when RSI crosses below its 14 EMA above the 55 RSI zone, indicating a potential downturn. Additionally, volume analysis helps validate the strength of these signals, reducing false entries. By integrating moving averages, this script enhances trend confirmation, making it a powerful tool for traders.
Demo GPT - Bollinger Bands Strategy//@version=6
strategy("Demo GPT - Bollinger Bands Strategy", overlay=true, commission_value=0.1, slippage=3)
// User Inputs
length = input.int(20, minval=1, title="BB Length")
maType = input.string("SMA", "Basis MA Type", options= )
src = input(close, title="Source")
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
offset = input.int(0, "Offset", minval=-500, maxval=500, display=display.data_window)
// Date Range Inputs
startDate = input.time(timestamp("2018-01-01 00:00"), title="Start Date")
endDate = input.time(timestamp("2069-12-31 23:59"), title="End Date")
// Moving Average Function
ma(source, length, _type) =>
switch _type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
// Bollinger Bands Calculation
basis = ma(src, length, maType)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Plotting Bollinger Bands
plot(basis, "Basis", color=#FF6D00, offset=offset)
p1 = plot(upper, "Upper", color=#2962FF, offset=offset)
p2 = plot(lower, "Lower", color=#2962FF, offset=offset)
fill(p1, p2, title="Background", color=color.rgb(33, 150, 243, 95))
// Strategy Logic (Only Long Trades)
isTradingPeriod = (time >= startDate and time <= endDate)
longCondition = ta.crossover(src, lower) and isTradingPeriod
exitCondition = ta.crossunder(src, basis) and isTradingPeriod
if longCondition
strategy.entry("Long", strategy.long, qty=100)
if exitCondition
strategy.close("Long")
First 5 Candles RangeI'll explain this indicator which marks the high and low range of the first 5 minutes of the Indian market trading session:
Purpose:
This indicator identifies and marks the highest and lowest prices during the first 5 minutes (9:15 AM - 9:20 AM) of the Indian trading session
It draws two horizontal lines: red for the high and green for the low
These levels are often used by traders to identify potential support/resistance for the day
Buy/Sell Signals (MACD + RSI) 1H CEM123456789signals for gold (XAU/USD) on an hourly basis using TradingView, you can implement a strategy that combines the Moving Average Convergence Divergence (MACD) and the Relative Strength Index (RSI). This method is effective for generating clear entry and exit signals
AI Bollinger Bands Strategy with SL, TP, and Bars Till CloseThis auto trader uses Bollinger Bands (with adjustable length and deviation) and an optional EMA filter to trigger trades. It enters short trades when the prior candle closes above the upper band and then reverses, and long trades when the prior candle is below the lower band and then turns bullish. Risk is managed via:
Trailing stops activated when price crosses the middle band.
Predefined stop loss and take profit levels.
An option to close trades after a set number of bars.
Additionally, you can toggle the visual display of Bollinger Bands and EMA on the chart.
200-Day SMA Slope Oscillator SmoothA smooth oscillator that oscillates between positive and negative values.
The oscillator tracks the change in the 200-day SMA and smooths the transitions to give you a cleaner, more gradual movement.
We use the slope to determine the value of the oscillator. If the slope is positive, the oscillator will show a positive value;If the slope is negative, it'll be a negative value.
RoGr75 - EMA 50/8 Cross With Buy/Sell Signals RoGr75 - EMA 50/8 Cross With Buy/Sell Signals
---
**Overview:**
This script is designed to generate **Buy** and **Sell** signals based on the crossover and crossunder of two Exponential Moving Averages (EMAs): **EMA 8** (green line) and **EMA 50** (blue line). The signals are plotted at a user-defined distance from the candles, ensuring clear visibility and adaptability to market volatility.
---
**Key Features:**
1. **EMA Cross Signals**:
- A **Buy Signal** is generated when the **EMA 8** crosses above the **EMA 50**.
- A **Sell Signal** is generated when the **EMA 8** crosses below the **EMA 50**.
2. **Variable Signal Distance**:
- The distance of the Buy and Sell signals from the candles is controlled by a **user-defined input** (`signal_distance`).
- The distance is calculated using the **Average True Range (ATR)** to adapt to market volatility.
3. **Customizable Parameters**:
- `signal_distance`: Adjust the distance of the signals from the candles (default: 2.0).
- ATR period: Fixed at 14 but can be modified in the script.
4. **Visual Enhancements**:
- Buy signals are displayed as green labels below the candles.
- Sell signals are displayed as red labels above the candles.
- Optional background highlighting for Buy and Sell signals.
---
**How It Works:**
- The script calculates the **EMA 8** and **EMA 50** and plots them on the chart.
- When a crossover or crossunder occurs, a label is placed at a distance determined by the formula:
- **Buy Signal Position**: `low - (signal_distance * ATR(14))`
- **Sell Signal Position**: `high + (signal_distance * ATR(14))`
- The signals are clearly visible and adapt to the volatility of the asset.
---
**Input Parameters:**
- `signal_distance` (type: input float): Controls the distance of the Buy and Sell signals from the candles. Default value is `2.0`.
---
**Usage:**
1. Add the script to your chart in TradingView.
2. Adjust the `signal_distance` input to set the desired distance of the signals from the candles.
3. Monitor the Buy and Sell signals generated by the script for potential trading opportunities.
---
**Example:**
- If `signal_distance` is set to `2.0`, the Buy signal will appear **2x ATR** below the candle's low, and the Sell signal will appear **2x ATR** above the candle's high.
---
**Customization:**
- Modify the ATR period or replace it with a fixed value for static distance.
- Adjust the colors, styles, and sizes of the labels and EMAs to suit your preferences.
---
**Ideal For:**
- Traders looking for a simple and effective EMA crossover strategy.
- Users who want customizable signal placement for better visibility.
- Those who prefer volatility-adjusted signal distances.
---
**Note:**
This script is for educational and informational purposes only. Always backtest and validate strategies before using them in live trading.
High-Volume Bearish EngulfingHow This Script Works
Bearish Engulfing Pattern
The current red candle engulfs the previous green candle.
Open price is higher than the previous close, and the close is lower than the previous open.
High Volume Filter
The current volume must be 1.5x higher than the average volume of the last 5 candles (configurable).
RSI Confirmation (Optional)
If enabled, checks if RSI > 70 (overbought zone), confirming the potential downtrend.
Marks Bearish Engulfing Candles on the Chart
A red downward arrow is plotted when all conditions are met.
Multi-Indicator [ADX, MACD, Stoch, OBV] alamis custom multi-indicator combines several popular technical analysis tools in one view:
- ADX (Average Directional Index): Measures trend strength
- MACD (Moving Average Convergence Divergence): Shows momentum and trend changes
- Stochastic: Identifies overbought/oversold conditions
- OBV (On Balance Volume): Volume-based momentum indicator
Features:
- All indicators are normalized to the same scale for easy comparison
- Color-coded lines for clear visualization
- Reference lines for better readability
- Optimized scaling for each indicator
Settings:
ADX Length: 14
MACD: (12, 26, 9)
Stochastic: (14, 3, 3)
Lines:
Blue: ADX
Green: MACD Line
Red: MACD Signal
Orange: Stochastic K
Purple: Stochastic D
Yellow: Scaled OBV
Version: PineScript™ v6
Relative Strength Index With Range ZoneRSI (Relative Strength Index) with 45-55 Range Zone
1. Introduction and Historical Background
The Relative Strength Index (RSI) is a momentum indicator developed in 1978 by J. Welles Wilder Jr. It measures the speed and magnitude of price changes to assess overbought and oversold conditions of an asset. This widely used oscillator ranges between 0 and 100.
Historically, the RSI was mainly used to detect trend reversals by identifying extreme levels: above 70 (overbought) and below 30 (oversold). However, its application has evolved, and new approaches refine its interpretation, such as adding a 45-55 neutral zone to identify consolidation (range) periods.
2. RSI Calculation
The RSI is calculated using the following formula:
RSI=100−(1001+RS)RSI=100−(1+RS100)
Where:
RS=Average gain over N periodsAverage loss over N periodsRS=Average loss over N periodsAverage gain over N periods
• RS (Relative Strength) is the ratio between the average gains and the average losses over N periods (typically 14 periods).
• Gains and losses are calculated based on daily price variations.
Example calculation with a 14-day period:
1. Compute daily gains and losses.
2. Take an exponential or simple moving average of these values over 14 days.
3. Apply the formula to get the RSI value.
3. Classic RSI Usage
The RSI is typically interpreted as follows:
• RSI > 70: Overbought → Possible correction or bearish reversal.
• RSI < 30: Oversold → Possible rebound or bullish reversal.
• RSI between 50 and 70: Bullish momentum.
• RSI between 30 and 50: Bearish momentum.
4. Adding the 45-55 Zone to Identify Range Phases
Adding a neutral zone between 45 and 55 helps identify consolidation periods, when price moves sideways without a strong trend.
• RSI between 45 and 55: The market is in a range, meaning neither buyers nor sellers dominate.
• RSI breaking out of this zone:
o Above 55: Indicates the start of a bullish trend.
o Below 45: Indicates the start of a bearish trend.
This zone is particularly useful for:
• Avoiding false signals by waiting for trend confirmation.
• Identifying ranging markets, favoring range trading strategies (buying at support, selling at resistance).
• Filtering trend-based entries, waiting for the RSI to exit the 45-55 zone.
5. Trading Strategies Using RSI with the 45-55 Range Zone
1. Range Trading:
• When the RSI oscillates between 45 and 55, it signals a lack of strong trend.
• Strategy:
o Identify a support and resistance level.
o Buy near support when the RSI touches 45.
o Sell near resistance when the RSI touches 55.
2. Breakout Trading:
• If the RSI exits the 45-55 zone:
o Above 55 → Buy (start of a bullish trend).
o Below 45 → Sell (start of a bearish trend).
• This breakout can be used as a confirmed entry signal.
3. Confirmation with Divergences:
• A bullish divergence (price making lower lows while RSI makes higher lows) is more relevant if the RSI moves above 55.
• A bearish divergence (price making higher highs while RSI makes lower highs) is stronger if the RSI drops below 45.
6. Conclusion
The RSI is a powerful tool for analyzing price momentum. Adding a 45-55 zone enhances its usage by clearly distinguishing:
• Consolidation phases (range markets).
• Trend beginnings when RSI breaks out of this range.
This approach improves RSI reliability by filtering out false signals and allowing traders to adapt their strategy based on market conditions.
Custom Watermark by matarMATAR CUSTOM WATERMARK SCRIPT DESCRIPTION Type: TradingView Chart Watermark & Info Panel
Version: 1.0
Compatibility: All TradingView Charts
CORE FEATURES
1️⃣ Customizable Watermark
Add main title and subtitle
Adjust text color, size, and alignment
9 positioning options (Top-Center, Bottom-Right, etc.)
2️⃣ Smart Symbol Info Panel
Real-time symbol display (e.g., BTC/USDT)
Timeframe details (e.g., 15 Minutes, 4 Hours)
Last candle date (DD/MM/YYYY)
Toggle panel visibility
3️⃣ Visual Flexibility
Background color selection (including transparent)
6 font sizes (Tiny > Huge)
Precise positioning with margin controls
USE CASES
✅ Branding
Add company name/logo to screenshots
Credit sources in educational materials
✅ Risk Management
Permanent reminders like "Max 2% Risk"
Position size warnings
✅ Data Tracking
Quick reference for multi-timeframe analysis
Automatic date stamps for backtests
SETTINGS PANEL
📝 Text Customization
Main Title: Default "MATAR TRADING" (editable)
Subtitle: Add your trading motto
🎨 Appearance
16+ color options (HEX code support)
Font scaling for different screen sizes
📍 Positioning
Vertical/horizontal alignment
Margin adjustments for spacing
ℹ Symbol Info
Independent panel positioning
Customizable date format
INSTALLATION & USAGE
Add script to TradingView
Click "Settings" icon (top-right)
Modify parameters in dedicated tabs
Changes apply instantly (no reload needed)
KEY BENEFITS
Non-Intrusive: 90% transparency support
Lightweight: Zero performance impact
Multi-Timeframe: Show D1 data on H1 charts
Universal: Works with stocks, forex, crypto
EXAMPLE SCENARIOS
Intraday Trader:
Title: "Scalping Strategy v2.0"
Subtitle: "15M-1H TF Only"
Symbol Panel: Top-right
Educator:
Title: "Training Demo - Do Not Copy"
Background: Red transparency
Date: Auto watermark for recordings
Portfolio Manager:
Subtitle: "Max 3 Trades Daily"
Symbol Info: Bottom-left
SUPPORTED ASSETS
All TradingView symbols
Custom instruments (any listed asset)
Historical data compatible (backtesting)
This script combines practical trading discipline with brand identity management, helping you maintain professional charts while avoiding distractions. 🚀
Note: Requires basic TradingView navigation skills. No coding knowledge needed.