BITCOIN BTC Machine Learning Approximation Strategy by NHBPRODHey everyone, here's a new trading strategy script for Bitcoin, and I’m super excited to share it with you. It’s called the "BITCOIN BTC Machine Learning Approximation Strategy by NHBPROD." It employs a simplified machine learning technique referred to as K-means clustering approximation. It plots the mean price, upper cluster, and lower cluster, and prints a green and yellow background to visually cue you when to buy and when to sell. This is the strategy script, but I also have the indicator script which can be used to automate buy and sell signals directly to your phone, email, or your bot.
What It Does
The script calculates a dynamic mean price using linear regression and defines upper and lower zones based on standard deviation. These zones help identify potential support, resistance, or trend reversal areas on a chart. It visualizes the mean and clusters with plots and highlights significant areas where price moves above or below the clusters. Alerts are triggered when the price crosses these critical levels, enabling traders to stay informed about key market movements.
Backtest Results
Some notables:
Seemingly consistent profits on BTC 1 day chart.
I included slippage & I included commission.
100+, and covers the maximum amount of time allowed in tradingview.
The script is ready for BITCOIN and I deploy it on the 1 day timeframe because I feel like 1 day bars get enough data to make solid judgements for this type of indicator.
How to Use It
Look at the background—it’s color-coded and easy to spot.
green background = buy
red background = sell
This strategy (and the pairing indicator script) is able to be used to trade long only.
Göstergeler ve stratejiler
Gold Strategy - MACD, RSI, Bollinger BandsGold Strategy: MACD, RSI, Bollinger Bands Combo
This indicator combines MACD, RSI, and Bollinger Bands on a single chart for gold and forex trading. Features:
• Normalized MACD and RSI plotted with price
• Bollinger Bands for volatility
• Overbought/oversold zones visible
• Long/short signals based on all three indicators
• Customizable parameters
Ideal for spotting potential entries/exits using trend, momentum, and volatility in one view. Streamlines analysis for both new and experienced traders.
XU100 Yükseliş FiltrelemeRSI ve Hacim: Sadece RSI ve hacim kriterlerini kullanarak alım sinyali oluşturulmuştur. Bu, "en fazla 3 kategori seçin" hatasını önleyecektir.
Yükseliş Sinyali: Aşırı satım durumu ve yüksek hacim koşullarını bir araya getirerek alım sinyali oluşturulur.
Squeeze Pro - Directional Arrows ONLYThis script is designed to work hand-in-hand with Beardy Fred's TTM Squeeze Pro script. He is the original maker of the base code that was used for this indicator. I take no credit for that. Arrows were merely added based on his script.
BTC Perp/Spot Ratio & RSCalculates the ratio between futures (PERP) and spot (SPOT) prices, revealing market imbalances.
Integrates an RSI to detect potential overbought or oversold points.
Displays the annualized Funding Rate, helping to identify bullish or bearish biases in the futures market.
Generates buy/sell signals based on specific funding rate thresholds, the short-term trader, and the interaction of price with the EMAs.
Fibonacci Trend - Aynet1. Inputs
lookbackPeriod: Defines the number of bars to consider for calculating swing highs and lows. Default is 20.
fibLevel1 to fibLevel5: Fibonacci retracement levels to calculate price levels (23.6%, 38.2%, 50%, 61.8%, 78.6%).
useTime: Enables or disables time-based Fibonacci projections.
riskPercent: Defines the percentage of risk for trading purposes (currently not used in calculations).
2. Functions
isSwingHigh(index): Identifies a swing high at the given index, where the high of that candle is higher than both its previous and subsequent candles.
isSwingLow(index): Identifies a swing low at the given index, where the low of that candle is lower than both its previous and subsequent candles.
3. Variables
swingHigh and swingLow: Store the most recent swing high and swing low prices.
swingHighTime and swingLowTime: Store the timestamps of the swing high and swing low.
fib1 to fib5: Fibonacci levels based on the difference between swingHigh and swingLow.
4. Swing Point Detection
The script checks if the last bar is a swing high or swing low using the isSwingHigh() and isSwingLow() functions.
If a swing high is detected:
The high price is stored in swingHigh.
The timestamp of the swing high is stored in swingHighTime.
If a swing low is detected:
The low price is stored in swingLow.
The timestamp of the swing low is stored in swingLowTime.
5. Fibonacci Levels Calculation
If both swingHigh and swingLow are defined, the script calculates the Fibonacci retracement levels (fib1 to fib5) based on the price difference (priceDiff = swingHigh - swingLow).
6. Plotting Fibonacci Levels
Fibonacci levels (fib1 to fib5) are plotted as horizontal lines using the line.new() function.
Labels (e.g., "23.6%") are added near the lines to indicate the level.
Lines and labels are color-coded:
23.6% → Blue
38.2% → Green
50.0% → Yellow
61.8% → Orange
78.6% → Red
7. Filling Between Fibonacci Levels
The plot() function creates lines for each Fibonacci level.
The fill() function is used to fill the space between two levels with semi-transparent colors:
Blue → Between fib1 and fib2
Green → Between fib2 and fib3
Yellow → Between fib3 and fib4
Orange → Between fib4 and fib5
8. Time-Based Fibonacci Projections
If useTime is enabled:
The time difference (timeDiff) between the swing high and swing low is calculated.
Fibonacci time projections are added based on multiples of 23.6%.
If the current time reaches a projected time, a label (e.g., "T1", "T2") is displayed near the high price.
9. Trading Logic
Two placeholder variables are defined for trading logic:
longCondition: Tracks whether a condition for a long trade is met (currently not implemented).
shortCondition: Tracks whether a condition for a short trade is met (currently not implemented).
These variables can be extended to define entry/exit signals based on Fibonacci levels.
How It Works
Detect Swing Points: It identifies recent swing high and swing low points on the chart.
Calculate Fibonacci Levels: Based on the swing points, it computes retracement levels.
Visualize Levels: Plots the levels on the chart with labels and fills between them.
Time Projections: Optionally calculates time-based projections for future price movements.
Trading Opportunities: The framework provides tools for detecting potential reversal or breakout zones using Fibonacci levels.
AI - Bull Market Support BandChatGPT Bull Market Support Band based on the weekly sma Length = 20 emaLength = 21
Breakout off ConsolidationBreakout detection indicator that identifies high-probability trading opportunities when price breaks out of tight consolidation patterns.
The script combines volume analysis, price action, and momentum to filter out low-quality setups.
The optional performance table tracks breakout outcomes based on MACD crossovers to provide a rough estimate of setup quality for the specific instrument. While past performance doesn't guarantee future results, these setups aim to provide favorable risk/reward opportunities when properly selected.
Key features:
Smart consolidation detection that differentiates between tight, okay, and loose consolidation patterns
Volume-based confirmation using multiple metrics including volume multiples and volume spikes
Special "Golden Candle" breakouts (🥇) highlighting exceptional setups with ideal volume and price characteristics (from deep backtests)
Risk management features with automatic stop loss placement based on consolidation structure
Momentum Confirmation
The weekly time-frame typically provides the highest quality setups due to stronger institutional volume patterns and clearer consolidation structures.
This indicator can be used with Pine Script™ Screener to scan for breakout opportunities across your watchlists.
Median MACD - MattesThe Median Based MACD is a new-generation indicator created from old statistical Concepts. It combines a Median Calculation with a MACD to create a smoother signal with less noise and increased robustness.
In this case, the original calculation source of the MACD is replaced with a Median which can be calculated over user set X time.
- Why its good:
This "Phoenix" of sorts brings old concepts together to create a strong, new indicator which can frontrun & see trends from miles up front.
- How it can be used:
While this indicator can be used to follow trends, it can also be used to detect where a trend has weakened and is unlikely to continue. Please keep in mind that its unlikely but the chance is never 0.
In my personal opinion, i think that this indicator should NOT be used as a standalone indicator but rather as a compliment to analysis.
Enjoy!
6-Month VWAPTESTING TESTING!!!
This script calculates a 6-month rolling Volume Weighted Average Price (VWAP), offering traders a dynamic view of price trends based on recent market activity. The indicator updates continuously, recalculating VWAP using data from the past 6 months, providing an adaptable perspective as time progresses.
Key Features:
Time Range Setting: The script calculates the starting point for VWAP as 6 months before the current time.
Cumulative Calculation: It progressively accumulates volume and volume-weighted prices within the 6-month window.
Conditional Handling: If there is insufficient volume data, the VWAP will return na to prevent errors.
Chart Display: The final VWAP is displayed on the price chart as a blue line.
Bollinger Bands Breakout Strategy by Finesseking27Bollinger Bands Breakout Strategy by Finesseking27
Bollinger Bands Breakout Strategy by Finesseking27Bollinger Bands Breakout Strategy by Finesseking27
SMT Divergence + IFVG Strategy with Buy/Sell Signals//@version=6
indicator("SMT Divergence + IFVG Strategy with Buy/Sell Signals", overlay=true)
// Input parameters
higherTimeframe = input.timeframe("60", "Higher Timeframe") // Corrected timeframe to "60" for hourly
defaultStopLossPct = input.float(15.0, "Stop Loss %", step=0.1) // Updated to 15% stop loss
defaultTakeProfitPct = input.float(30.0, "Take Profit %", step=0.1) // Added 30% take profit percentage
// Retrieve higher timeframe trend
htfClose = request.security(syminfo.tickerid, higherTimeframe, close)
higherTrend = ta.ema(htfClose, 50) > ta.ema(htfClose, 200) // Higher timeframe bias: bullish if EMA50 > EMA200
// Custom Divergence Detection
rsiPeriod = input.int(14, "RSI Period")
rsi = ta.rsi(close, rsiPeriod)
lookback = input.int(5, "Divergence Lookback")
// Detect bullish divergence: Price makes a lower low, RSI makes a higher low
priceLow = ta.lowest(close, lookback)
pricePrevLow = ta.lowest(close , lookback)
rsiLow = ta.lowest(rsi, lookback)
rsiPrevLow = ta.lowest(rsi , lookback)
bullishDivergence = (priceLow < pricePrevLow) and (rsiLow > rsiPrevLow)
// Detect bearish divergence: Price makes a higher high, RSI makes a lower high
priceHigh = ta.highest(close, lookback)
pricePrevHigh = ta.highest(close , lookback)
rsiHigh = ta.highest(rsi, lookback)
rsiPrevHigh = ta.highest(rsi , lookback)
bearishDivergence = (priceHigh > pricePrevHigh) and (rsiHigh < rsiPrevHigh)
smtDiv = bullishDivergence or bearishDivergence
// Inverse Fair Value Gap (IFVG)
gapThreshold = input.float(0.5, "IFVG Threshold (%)", step=0.1)
priceChange = math.abs(close - close )
previousHigh = ta.valuewhen(priceChange > gapThreshold * close , high, 1)
previousLow = ta.valuewhen(priceChange > gapThreshold * close , low, 1)
ifvgZone = not na(previousHigh) and not na(previousLow) and (close > previousHigh or close < previousLow)
// Entry Signal
entryConditionBuy = higherTrend and bullishDivergence and ifvgZone
entryConditionSell = not higherTrend and bearishDivergence and ifvgZone
// Plotting Buy and Sell Signals
if entryConditionBuy
label.new(bar_index, high, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
stopLossLevel = close * (1 - defaultStopLossPct / 100)
takeProfitLevel = close * (1 + defaultTakeProfitPct / 100)
line.new(bar_index, stopLossLevel, bar_index + 1, stopLossLevel, color=color.red, width=1, extend=extend.right)
line.new(bar_index, takeProfitLevel, bar_index + 1, takeProfitLevel, color=color.green, width=1, extend=extend.right)
if entryConditionSell
label.new(bar_index, low, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
stopLossLevel = close * (1 + defaultStopLossPct / 100)
takeProfitLevel = close * (1 - defaultTakeProfitPct / 100)
line.new(bar_index, stopLossLevel, bar_index + 1, stopLossLevel, color=color.red, width=1, extend=extend.right)
line.new(bar_index, takeProfitLevel, bar_index + 1, takeProfitLevel, color=color.green, width=1, extend=extend.right)
// Alerts
alertcondition(entryConditionBuy, title="Buy Signal", message="Buy signal detected. Target 30%, Stop Loss 15%.")
alertcondition(entryConditionSell, title="Sell Signal", message="Sell signal detected. Target 30%, Stop Loss 15%.")
P/L CalculatorDescription of the P/L Calculator Indicator
The P/L Calculator is a dynamic TradingView indicator designed to provide traders with real-time insights into profit and loss metrics for their trades. It visualizes key levels such as entry price, profit target, and stop-loss, while also calculating percentage differences and net profit or loss, factoring in fees.
Features:
Customizable Input Parameters:
Entry Price: Define the starting price of the trade.
Profit and Stop-Loss Levels (%): Set percentage thresholds for targets and risk levels.
USDT Amount: Specify the trade size for precise calculations.
Trade Type: Choose between "Long" or "Short" positions.
Visual Representation:
Entry Price, Profit Target, and Stop-Loss levels are plotted as horizontal lines on the chart.
Line styles, colors, and thicknesses are fully customizable for better visibility.
Real-Time Metrics:
Percentage difference between the live price and the entry price is calculated dynamically.
Profit/Loss (P/L) and fees are computed in real time to display net profit or loss.
Alerts:
Alerts are triggered when:
The live price hits the profit target.
The live price crosses the stop-loss level.
The price reaches the specified entry level.
A user-defined percentage difference is reached.
Labels and Annotations:
Displays percentage difference, P/L, and fee information in a clear label near the live price.
Custom Fee Integration:
Allows input of trading fees (%), enabling accurate net profit or loss calculations.
Price Scale Visualization:
Displays the percentage difference on the price scale for enhanced context.
Use Case:
The P/L Calculator is ideal for traders who want to monitor their trades' performance and make informed decisions without manually calculating metrics. Its visual cues and alerts ensure you stay updated on critical levels and price movements.
This indicator supports a wide range of trading styles, including swing trading, scalping, and position trading, making it a versatile tool for anyone in the market.
Sentiment Proxy (Enhanced Version)"Sentiment Proxy" indicator is designed to enhance your trading decisions by combining the power of an Adaptive EMA with a momentum-based Sentiment Proxy. This dual-layer approach ensures you are well-informed about market conditions and can act decisively.
Key Features:
Adaptive EMA (RSI-based):
Dynamically adjusts to market conditions using RSI-based smoothing.
Helps identify short-term trends and turning points.
Sentiment Proxy (Momentum Analysis):
Calculates momentum and its moving average to evaluate market sentiment.
Divides the market into three zones:
Bullish Zone: Positive momentum (green background).
Bearish Zone: Negative momentum (red background).
Neutral Zone: No clear sentiment (yellow background).
Filtered Buy & Sell Signals:
Buy signals occur when the Adaptive EMA crosses above the comparison EMA during bullish momentum.
Sell signals occur when the Adaptive EMA crosses below the comparison EMA during bearish momentum.
How to Use:
Add the Indicator to Your Chart:
Apply the indicator to any timeframe and asset class.
Interpret the Zones:
Look at the background color for a quick sentiment overview:
Green: Market is bullish.
Red: Market is bearish.
Yellow: Market is neutral.
Monitor the Buy & Sell Signals:
Buy signals appear as green "B" labels below candles.
Sell signals appear as red "S" labels above candles.
Adjust Parameters:
Modify RSI Length, Smoothing Factor, Momentum Length, or Momentum SMA Length to fit your strategy.
Example Strategy:
Bullish Setup:
Wait for a buy signal with a green background.
Confirm the trend by ensuring the price is above the comparison EMA.
Bearish Setup:
Look for a sell signal with a red background.
Ensure the price is below the comparison EMA for confirmation.
SMT Divergence + IFVG StrategyTrading Schedule: They trade when the New York stock market session begins (a major time for activity in trading).
Determine a Direction (Bias): They start by looking at higher timeframes (like daily or 4-hour charts) to decide if the price is likely to go up (bullish) or down (bearish).
Zoom In for Details: Once they have a general idea of the market’s direction, they switch to lower timeframes (like 5-minute or 15-minute charts) to look for specific trading opportunities.
Look for Patterns:
SMT Divergence: This likely means they compare price movements across similar assets (or indices) to spot inconsistencies that suggest a potential reversal or continuation of trends.
Inverse Fair Value Gap: They identify gaps in price (on the chart) where the market may want to return or "fill in" before continuing in a certain direction.
Set an Entry Point: They wait for the price to "tap" into their identified level (like a support or resistance zone) before entering a trade.
Set a Target: Their goal is to target "resting liquidity," which means areas where other traders are likely placing stop-losses or take-profits, and use those as price movement goals.
Risk-to-Reward Ratio: For every trade, they aim to make 2 to 3 times the amount they’re risking (a 1:2 or 1:3 risk-to-reward ratio).
Win Rate: They win about 70% of their trades, which means most of their trades are profitable.
In short, they have a systematic approach where they identify a market trend, spot good entry opportunities based on patterns, and stick to a strategy with good risk management. Their success comes from consistency and discipline.
1h apertura de New_Yorkprobando apertura de new york ., miramos vela horaria anterior a la apertura y entramos en sentido contrario a esa vela.,
gestionamos stop loss y take proffit en % ., modificandolos en caso d eser necesario por activo
Adaptive Fibonacci ClusterThe Adaptive Fibonacci Cluster dynamically adjusts Fibonacci levels based on historical price ranges, identifying key support and resistance zones. It helps traders spot potential reversal points and strengthen their market analysis.
How to Use:
Support Levels: Look for price interactions near the lower Fibonacci clusters.
Resistance Levels: Watch for rejections around the upper Fibonacci clusters.
Dynamic Updates: The clusters adjust automatically to the latest price data, ensuring relevance in all market conditions.
Integrate this tool into your trading strategy to uncover hidden opportunities and boost confidence in decision-making.
PremiumDiscountLibraryLibrary "PremiumDiscountLibrary"
isInZone(currentTime, price, trend, tz)
Vérifie si le prix est en zone premium ou discount
Parameters:
currentTime (int) : L'heure actuelle (timestamp)
price (float) : Le prix actuel
trend (string) : La tendance ("bullish" ou "bearish")
tz (string) : Le fuseau horaire pour calculer les sessions (par défaut : "GMT+1")
Returns: true si le prix est dans la zone correcte, sinon false
Pivot Points Fibonacci and StandardTraditional and Fibonacci Pivot Points Formula:
Pivot Point (P) is calculated as the average of the previous period's High, Low, and Close prices:
P=(High+Low+Close)/3
Where:
High = High price of the previous period
Low = Low price of the previous period
Close = Close price of the previous period
Bollinger Bands color candlesThis Pine Script indicator applies Bollinger Bands to the price chart and visually highlights candles based on their proximity to the upper and lower bands. The script plots colored candles as follows:
Bullish Close Above Upper Band: Candles are colored green when the closing price is above the upper Bollinger Band, indicating strong bullish momentum.
Bearish Close Below Lower Band: Candles are colored red when the closing price is below the lower Bollinger Band, signaling strong bearish momentum.
Neutral Candles: Candles that close within the bands remain their default color.
This visual aid helps traders quickly identify potential breakout or breakdown points based on Bollinger Band dynamics.
Autonomous 5-Minute RobotKey Components of the Strategy:
Trend Detection:
A 50-period simple moving average (SMA) is used to define the market trend. If the current close is above the SMA, the market is considered to be in an uptrend (bullish), and if it's below, it's considered a downtrend (bearish).
The strategy also looks at the trend over the last 30 minutes (6 candles in a 5-minute chart). The strategy compares the previous close with the current close to detect an uptrend or downtrend.
Volume Analysis:
The strategy calculates buyVolume and sellVolume based on price movement within each candle.
The condition for entering a long position is when the market is in an uptrend, and the buy volume is greater than the sell volume.
The condition for entering a short position is when the market is in a downtrend, and the sell volume is greater than the buy volume.
Trade Execution:
The strategy enters a long position when the trend is up and the buy volume is higher than the sell volume.
The strategy enters a short position when the trend is down and the sell volume is higher than the buy volume.
Positions are closed based on stop-loss and take-profit conditions.
Stop-loss is set at 3% below the entry price.
Take-profit is set at 29% above the entry price.
Exit Conditions:
Long trades will be closed if the price falls 3% below the entry price or rises 29% above the entry price.
Short trades will be closed if the price rises 3% above the entry price or falls 29% below the entry price.
Visuals:
The SMA (50-period) is plotted on the chart to show the trend.
Buy and sell signals are marked with labels on the chart for easy identification.
With this being said this algo is still being worked on to be autonomous
Analyze the Market Direction: Determine whether the market is in an uptrend or downtrend over the past 30 minutes (using the last 6 candles in a 5-minute chart).
Use Trend Indicators and Volume: Implement trend-following indicators like moving averages or the SMA/EMA crossover and consider volume to decide when to enter or exit a trade.
Enter and Exit Trades: The robot will enter long positions when the trend is up and short positions when the trend is down. Additionally, it will close positions based on volume signals and price action (e.g., volume spikes, price reversals).
Pamplona Enhanced TP/SL ToggleableName: Pamplona Enhanced TP/SL Toggleable
Type: Strategy
Description:
This strategy introduces flexibility and innovation in managing Take Profit (TP) and Stop Loss (SL) levels, making it a valuable tool for traders. It offers three configurable modes: Tick-Based, Dollar-Based, and Risk-Reward Ratio-Based, allowing users to toggle between them based on trading preferences. The strategy combines robust technical indicators to identify optimal trade opportunities and improves reliability by entering trades only on the second signal.
Key Features:
TP/SL Modes:
Tick-Based: Uses a fixed number of ticks to calculate TP/SL.
Dollar-Based: Uses fixed dollar amounts for TP/SL.
Risk-Reward Ratio-Based: Calculates TP/SL based on a user-defined ratio.
The user can toggle one mode at a time for precise control.
Trade Logic:
Long Trades: Triggered when price trends above the 200 EMA, the Madrid Ribbon turns bullish, and price exceeds the Donchian Channel high. The trade is confirmed only after the second valid signal.
Short Trades: Triggered when price trends below the 200 EMA, the Madrid Ribbon turns bearish, and price breaks the Donchian Channel low. The trade is confirmed only after the second valid signal.
Dynamic Configuration:
Adjustable ticks, dollar amounts, and risk-reward ratios in the settings.
Allows users to define contract size and Donchian Channel length.
Originality and Usefulness:
This strategy enhances common trading methodologies by:
Offering a configurable multi-mode TP/SL system that adapts to diverse trading styles.
Using a confirmation-based entry system, which reduces false signals and increases reliability.
Combining widely used indicators (EMA, Madrid Ribbon, Donchian Channel) into a practical framework for trend-following strategies.
How to Use:
Set TP/SL Mode:
In the settings, enable only one mode (Tick-Based, Dollar-Based, or Risk-Reward).
Adjust relevant parameters for the selected mode (e.g., ticks, dollar values, or risk-reward ratio).
Customize Trade Settings:
Define the contract size and Donchian Channel period.
The default configuration is suited for swing trading but can be adapted to other timeframes.
Understand Trade Logic:
The background highlights potential long (green) and short (red) zones.
Long entries occur when all conditions align bullishly, confirmed on the second signal.
Short entries occur when all conditions align bearishly, confirmed on the second signal.
Review Backtesting Results:
Use realistic commission, slippage, and risk values.
Ensure settings align with your trading style and risk management rules.
Notes:
No repainting: The script operates entirely on historical and current data without lookahead bias.
Backtesting: Test the strategy across multiple assets and timeframes to ensure robustness.
Customizability: The toggling system and configurable parameters make this strategy highly adaptable.
🚀