Supply and Demand RebalancingPlease do not use this rudimentary script to lose money. As far as I can tell it has ZERO EDGE on its own.
Supply and Demand Pattern Detection Script
Overview
This script identifies potential supply and demand zones by detecting a specific double-wick pattern formation. It's designed as an educational tool and research aid for traders interested in price action and supply/demand concepts.
Pattern Detection
Looks for consecutive candles with long wicks (tails) that align with each other
The wicks must be larger than a specified percentile of recent wick lengths
The candle bodies must be relatively small compared to their wicks
Volume and volatility filters can be optionally applied
Higher timeframe trend confirmation is available as an optional filter
Visual Aids
Green triangles appear when a long setup is detected
Red triangles appear when a short setup is detected
Boxes show the risk zone (red) and reward zone (green)
Boxes extend until the trade reaches either its target or stop loss
A performance table shows win rate and profit factor statistics
Key Settings
1. Pattern Detection:
Wick Alignment Tolerance: How closely the wicks need to align
Min Wick Length Percentile: Minimum size requirement for wicks
Max Body/Wick Ratio: Controls maximum candle body size relative to wick
2. Additional Filters:
Volume Filter: Optional volume confirmation
ATR Filter: Optional volatility confirmation
Higher Timeframe Confirmation: Optional trend alignment
3. Trade Parameters:
Risk/Reward Ratio: Default 2:1
Bars to Wait for Outcome: How long to track trade results
Important Disclaimers
This is an educational tool and should NOT be used to trade real money without extensive testing and modification. Please do not use this rudimentary script to lose money. As far as I can tell it has zero edge on its own.
Historical backtesting results are not indicative of future performance. The script may miss some valid setups or generate false signals. Trade outcomes are simplified and don't account for:
Slippage
Trading fees
Market liquidity
Gap risk
Real-world execution challenges
Recommended Usage
Use as a learning tool to understand supply/demand concepts
Practice identifying these patterns manually
Paper trade the setups first
Combine with other forms of analysis and risk management
Consider it one tool among many, not a complete trading system
Best Practices
Always use proper risk management
Test thoroughly on demo accounts first
Keep detailed trading logs
Understand why each pattern forms
Study both winning and losing trades to improve pattern recognition
Remember: No trading script can guarantee profits. This tool is meant for educational purposes and should be part of a broader trading education and development process.
Educational
Simple Average Price & Target ProfitThis script is designed to help users calculate and visualize the weighted average price of an asset based on multiple entry points, along with the target price and the potential profit. The user can input specific prices for three different entries, along with the percentage of total investment allocated to each price point. The script then calculates the weighted average price based on these entries and displays it on the chart. Additionally, it calculates the potential profit at a given target price, which is plotted on the chart.
mr.crypto731Description:
📊 Enhanced MACD with Strong Buy/Sell Signals 🚀
This script is designed to enhance the standard MACD indicator by adding clear, strong buy and sell signals. It includes:
MACD Line: A fast-moving average that reacts quickly to price changes.
Signal Line: A slower-moving average that smooths out price fluctuations.
MACD Histogram: The difference between the MACD Line and Signal Line, helping to identify trend strength and direction.
Key Features:
Strong Buy/Sell Signals: Uses crossovers of the MACD Line and Signal Line to generate strong buy/sell signals.
Color-Coded Background: Provides visual cues with background colors to highlight strong signals.
User-Friendly Interface: Customizable settings for MACD Fast Length, Slow Length, and Signal Smoothing.
Spent Output Profit Ratio | JeffreyTimmermansSOPR
The "Spent Output Profit Ratio" , aka SOPR indicator is a valuable tool designed to analyze the profitability of spent Bitcoin outputs. SOPR is derived by dividing the selling price of Bitcoin by its purchase price, offering insights into market participants' profit-taking or loss-cutting behavior.
This script features two selectable SOPR metrics:
SOPR 30D: A 30-day Exponential Moving Average (EMA) for short-term trend analysis.
SOPR 365D: A 365-day EMA for assessing long-term profitability trends.
How It Works
Key Levels: The horizontal reference line at 1.0 acts as a critical threshold:
Above 1.0: Market participants are generally in profit, indicating bullish sentiment.
Below 1.0: Market participants are selling at a loss, often signaling bearish sentiment.
Background Colors
Green: Indicates bullish conditions when the selected SOPR value is above 1.
Red: Highlights bearish conditions when the value is below 1.
Dynamic Selection
Easily switch between SOPR 30D and SOPR 365D in the settings for tailored analysis.
Features
Customizable SOPR Selection: Toggle between 30-day and 365-day SOPR views based on your trading preferences.
Dynamic Label: A floating label displays the current SOPR value in real-time, along with the selected SOPR metric for easy monitoring.
Background Highlights: Visual cues for bullish and bearish conditions simplify chart interpretation.
Real-Time Alerts
Bullish Alerts: Triggered when the selected SOPR crosses above 1.
Bearish Alerts: Triggered when the selected SOPR crosses below 1.
Clean Visualization
The indicator includes a horizontal reference line and clear color schemes for easy trend identification.
The SOPR Indicator is an essential tool for traders and analysts seeking to understand Bitcoin market sentiment and profitability trends. Whether used for short-term trades or long-term market analysis, this script provides actionable insights to refine your decision-making process.
-Jeffrey
Market Regime DetectorMarket Regime Detector
The Market Regime Detector is a tool designed to help traders identify and adapt to the prevailing market environment by analyzing price action in relation to key macro timeframe levels. This indicator categorizes the market into distinct regimes—Bullish, Bearish, or Reverting—providing actionable insights to set trading expectations, manage volatility, and align strategies with broader market conditions.
What is a Market Regime?
A market regime refers to the overarching state or condition of the market at a given time. Understanding the market regime is critical for traders as it determines the most effective trading approach. The three main regimes are:
Bullish Regime:
Characterized by upward momentum where prices are consistently trending higher.
Trading strategies often focus on buying opportunities and trend-following setups.
Bearish Regime:
Defined by downward price pressure and declining trends.
Traders typically look for selling opportunities or adopt risk-off strategies.
Reverting Regime:
Represents a consolidation phase where prices move within a defined range.
Ideal for mean-reversion strategies or range-bound trading setups.
Key Features of the Market Regime Detector:
Dynamic Market Regime Detection:
Identifies the market regime based on macro timeframe high and low levels (e.g., weekly or monthly).
Provides clear and actionable insights for each regime to align trading strategies.
Visual Context for Price Levels:
Plots the macro high and low levels on the chart, allowing traders to visualize critical support and resistance zones.
Enhances understanding of volatility and trend boundaries.
Regime Transition Alerts:
Sends alerts only when the market transitions into a new regime, ensuring traders are notified of meaningful changes without redundant signals.
Alert messages include clear regime descriptions, such as "Market entered a Bullish Regime: Price is above the macro high."
Customizable Visualization:
Background colors dynamically adjust to the current regime:
Blue for Reverting.
Aqua for Bullish.
Fuchsia for Bearish.
Option to toggle high/low line plotting and background highlights for a tailored experience.
Volatility and Expectation Management:
Offers insights into market volatility by showing when price action approaches, exceeds, or reverts within macro timeframe levels.
Helps traders set realistic expectations and adjust their strategies accordingly.
Use Cases:
Trend Traders: Identify bullish or bearish regimes to capture sustained price movements.
Range Traders: Leverage reverting regimes to trade between defined support and resistance zones.
Risk Managers: Use macro high and low levels as dynamic stop-loss or take-profit zones to optimize trade management.
The Market Regime Detector equips traders with a deeper understanding of the market environment, making it an essential tool for informed decision-making and strategic planning. Whether you're trading trends, ranges, or managing risk, this indicator provides the clarity and insights needed to navigate any market condition.
Simple COT ReportCOT Net Positions Indicator
Author: © Munkhtur
This indicator provides a comprehensive visualization of the Commitment of Traders (COT) report data, enabling traders to analyze market sentiment and positioning for key market participants.
Key Features:
Dashboard Display: Shows the net positions of Commercial, Noncommercial, and Nonreportable (Retail) traders.
Dynamic Position Tracking: Highlights significant changes in long and short positions for all trader categories based on customizable percentage thresholds.
COT Data Integration: Utilizes Legacy COT report data with clear segregation of long, short, and net positions.
Visual Signals:
Bullish and bearish trends are indicated with customizable colors for better chart visualization.
Displays "open" and "close" position changes directly on the price candles for easier tracking.
Flexible Configuration: Adjustable settings for dashboard location, text size, percentage thresholds, and color schemes.
How to Use:
Load the Script: Add the indicator to your Futures chart only by navigating to the TradingView indicators menu and selecting it from your saved scripts.
Customize Settings:
Dashboard: Enable or disable the dashboard, and set its position (Top Left, Top Right, etc.).
Data on Candle: Turn on/off the visualization of COT data changes on price candles and define the percentage change threshold to focus on significant moves.
Style Options: Customize bullish and bearish colors for better visual differentiation.
Select Trader Group: Choose from Commercial, Noncommercial, or Nonreportable positions in the settings menu to analyze the specific group of market participants.
Interpret Signals:
Green bars indicate opening long positions or bullish sentiment.
Red bars highlight opening short positions or bearish sentiment.
Yellow and purple bars signify the closure of long and short positions, respectively.
Use Cases:
Identify market sentiment shifts by observing net position changes among different trader groups.
Spot potential trend reversals based on COT data dynamics.
Use as a complementary tool to confirm your existing trading strategies.
Disclaimer:
This indicator is a tool for educational and informational purposes only. Always combine it with your own analysis and risk management strategy when trading.
Renko Chart EmulationRenko charts are a popular tool in technical analysis, known for their ability to filter out market noise and focus purely on price movements. Unlike traditional candlestick or bar charts, Renko charts are not time-based but are constructed using bricks that represent a fixed price movement. This makes them particularly useful for identifying trends and key levels of support and resistance. While Renko charts are commonly found on platforms with specialized charting capabilities, they can also be emulated in Pine Script as a line indicator.
The Renko emulation indicator in Pine Script calculates the movement of price based on a user-defined brick size. Whenever the price moves up or down by an amount equal to or greater than the brick size, a new level is plotted, indicating a shift in price direction. This approach helps traders visualize significant price moves without the distractions of smaller fluctuations. By plotting the Renko levels as a continuous line and coloring it based on direction, this indicator provides a clean and straightforward representation of market trends.
Traders can use this Renko emulation line to identify potential entry and exit points, as well as to confirm ongoing trends. The simplicity of Renko charts makes them a favorite among those who prefer a minimalist approach to technical analysis. However, it is essential to choose an appropriate brick size that aligns with the volatility of the trading instrument. A smaller brick size may result in frequent signals, while a larger one can smooth out the chart, focusing only on the most substantial price movements. This script offers a flexible solution for incorporating Renko-style analysis into any trading strategy.
Correlation Coefficient Master TableThe Correlation Coefficient Master Table is a comprehensive tool designed to calculate and visualize the correlation coefficient between a selected base asset and multiple other assets over various time periods. It provides traders and analysts with a clear understanding of the relationships between assets, enabling them to analyze trends, diversification opportunities, and market dynamics. You can define key parameters such as the base asset’s data source (e.g., close price), the assets to compare against (up to six symbols), and multiple lookback periods for granular analysis.
The indicator calculates the covariance and normalizes it by the product of the standard deviations. The correlation coefficient ranges from -1 to +1, with +1 indicating a perfect positive relationship, -1 a perfect negative relationship, and 0 no relationship.
You can specify the lookback periods (e.g., 15, 30, 90, or 120 bars) to tailor the calculation to their analysis needs. The results are visualized as both a line plot and a table. The line plot shows the correlation over the primary lookback period (the Chart Length), which can be used to inspect a certain length close up, or could be used in conjunction with the table to provide you with five lookback periods at once for the same base asset. The dynamically created table provides a detailed breakdown of correlation values for up to six target assets across the four user-defined lengths. The table’s cells are formatted with rounded values and color-coded for easy interpretation.
This indicator is ideal for traders, portfolio managers, and market researchers who need an in-depth understanding of asset interdependencies. By providing both the numerical correlation coefficients and their visual representation, users can easily identify patterns, assess diversification strategies, and monitor correlations across multiple timeframes, making it a valuable tool for decision-making.
Center of Candle Trendline### **Center of Candle Trendline**
This script dynamically plots a trendline through the center of each candlestick's body. The "center" is calculated as the average of the open and close prices for each candle. The trendline updates in real-time as new candles form, providing a clean and straightforward way to track the market's midline movement.
#### **Features:**
1. **Dynamic Trendline:** The trendline connects the center points of consecutive candlestick bodies, giving a clear visual representation of price movements.
2. **Accurate Center Calculation:** The center is determined as `(open + close) / 2`, ensuring the trendline reflects the true midpoint of each candlestick body.
3. **Real-Time Updates:** The trendline updates automatically as new bars form, keeping your chart up to date with the latest price action.
4. **Customization-Ready:** Adjust the line’s color, width, or style easily to fit your chart preferences.
#### **How to Use:**
- Add this script to your chart to monitor the price movement relative to the center of candlestick bodies.
- Use the trendline to identify trends, reversals, or price consolidation zones.
#### **Applications:**
- **Trend Analysis:** Visualize how the market trends around the center of candlesticks.
- **Reversal Identification:** Detect potential reversal zones when the price deviates significantly from the trendline.
- **Support and Resistance Zones:** Use the trendline as a dynamic support or resistance reference.
This tool is perfect for traders who want a clean and minimalistic approach to tracking price action. Whether you're a beginner or an experienced trader, this script provides valuable insights without overwhelming your chart.
#### **Note:**
This is not a standalone trading strategy but a visual aid to complement your analysis. Always combine it with other tools and techniques for better trading decisions.
---
Feel free to tweak this description based on your preferences or style!
Position sizerPosition Sizer Indicator
The "Position Sizer" indicator is a practical tool for traders who need to quickly and accurately calculate position sizes based on their account balance, risk tolerance, and stop-loss level. It ensures real-time updates and supports multiple asset classes like Forex, Indexes, Metals, and Crypto.
Key Features
Dynamic Position Sizing: Automatically calculates position sizes based on the current market price and stop-loss level.
Stop-Loss Adjustment: Allows users to drag the stop-loss level directly on the chart, dynamically updating the position size.
Interactive Table: A single click on the table activates the draggable stop-loss level for easy adjustments.
Multi-Asset Compatibility: Fully supports Forex, Indexes, Metals, and Crypto trading pairs.
How to Use
Deactivate the Indicator:
Turn off the indicator to make it inactive.
Set the Stop-Loss Price:
Copy the stop-loss price or use a price near the current market price.
Reactivate the indicator after inserting the stop-loss price.
Adjust the Stop-Loss Level if needed:
Click once on the table to enable the stop-loss level for dragging.
Move the stop-loss line as needed—position sizes will automatically recalculate.
Important Disclaimer
Verification Required: Always verify the calculated position size before executing trades.
Broker Confirmation: Double-check the point size for your trading symbol with your broker to avoid errors in calculations.
User Responsibility: The creator assumes no responsibility for any trading decisions made based on this indicator.
This tool helps streamline position management, ensuring you can focus on executing your trades with accuracy and speed. Always confirm your calculations before trading.
Enhanced Renko Channel with Emulation and SMA by Dr DevendraThis indicator combines a dynamic Renko-based channel with emulated Renko bricks and a customizable Simple Moving Average (SMA). It provides traders with a powerful tool for identifying trends, visualizing price movement within a Renko framework, and overlaying critical moving average signals.
Features:
Renko Channel:
A Gaussian-based midline with adjustable poles and sampling periods.
True Range-based dynamic channel boundaries.
Visual trend identification with color-coded channel fills.
Renko Emulation:
Emulated Renko brick levels with adjustable brick sizes.
Dynamic brick plotting based on price action.
Simple Moving Average (SMA):
Configurable length and source (e.g., close, hlc3, etc.).
Dynamic color changes based on SMA slope (uptrend or downtrend).
Customizable Inputs:
Adjustable parameters for the channel, Renko emulation, and SMA settings.
Options for reduced lag and fast response modes in the Renko channel.
Improved RSI Trend Sniper | JeffreyTimmermansImproved RSI Trend Sniper
This indicator, the "Improved RSI Trend Sniper" is a sophisticated tool designed to enhance market trend analysis by integrating customizable RSI thresholds with advanced moving average options and refined visual enhancements.
Key Features
Advanced Moving Average Options:
The indicator now supports multiple moving average types: SMA, EMA, SMMA, WMA, VWMA, LSMA, HMA, and ALMA, offering greater flexibility in trend analysis.
Users can customize the moving average length for precise momentum detection.
Enhanced Momentum Detection:
Upgraded to allow dynamic calculation of momentum based on user-selected moving averages.
Conditions for bullish or bearish momentum now consider changes in the chosen moving average rather than a fixed EMA, improving accuracy.
Visual Upgrades:
A gradient-based trend fill with multiple opacity layers provides a visually appealing representation of bullish and bearish trends.
New dashboard integration displays key market information, including the ticker, timeframe, and current trend (bullish or bearish).
Improved Signal Customization:
Customizable colors and labels for bullish and bearish signals ensure easy identification on the chart.
Enhanced settings for showing or hiding labels and trend fills
Refined Alerts System:
Alerts are now generated for bullish and bearish conditions with customized messages for better responsiveness.
Alerts can be triggered once per bar close, making them more reliable.
What's New:
RSI and MA Customization: Users can define thresholds and moving average settings, providing more control over trend analysis.
Dashboard Integration: Displays real-time updates directly on the chart for improved situational awareness.
Visual Enhancements: Introduced gradient fills for trend regions, making trends more distinct.
Expanded Moving Average Options: Allows for tailored strategies using various MA calculation methods.
Alert Messaging: Streamlined notifications for actionable insights.
How It Works
Momentum Analysis:
Bullish momentum is detected when the RSI crosses above the bullish threshold and the moving average is increasing.
Bearish momentum is flagged when the RSI falls below the bearish threshold, and the moving average is decreasing.
Trend Visualization:
Bullish trends are highlighted with gradient shades of green, while bearish trends use shades of red.
Labels appear on the chart to mark key turning points.
Tailored for Different Trading Styles
The Improved RSI Trend Sniper is versatile and adaptable, catering to traders with various time horizons:
Long-Term Adjustments: For traders focusing on long-term trends, increasing the RSI length and moving average period allows the indicator to smooth out minor price fluctuations and highlight sustained momentum. Selecting slower-moving averages like the SMA or LSMA further filters out short-term noise, ensuring signals align with broader market trends.
Medium-Term Adjustments: Swing traders can use a balanced RSI length (e.g., 14–20) and a medium moving average period (e.g., 20–50) to capture actionable signals within the mid-range market cycles. The inclusion of options like EMA or SMMA ensures quicker reactions to price changes while maintaining moderate sensitivity to reversals.
Short-Term Adjustments: For day traders or scalpers, using a shorter RSI period (e.g., 7–10) alongside faster moving averages such as the HMA or ALMA can provide quicker signals for high-frequency trading. These adjustments enhance the ability to react swiftly to immediate market shifts, ideal for fast-paced trading environments.
By customizing the indicator’s settings to align with your trading timeframe, the Improved RSI Trend Sniper ensures accurate and relevant insights, empowering traders to optimize their strategies across any market condition.
Dashboard Details
Provides an at-a-glance view of market data for the current ticker and timeframe.
The Improved RSI Trend Sniper takes the original tool to the next level, offering a more comprehensive, customizable, and visually intuitive approach to market trend analysis. Perfect for traders looking to refine their strategies with actionable insights.
-Jeffrey
Relative Performance Indicator by ComLucro - 2025_V01The "Relative Performance Indicator by ComLucro - 2025_V01" is a powerful tool designed to analyze an asset's performance relative to a benchmark index over multiple timeframes. This indicator provides traders with a clear view of how their chosen asset compares to a market index in short, medium, and long-term periods.
Key Features:
Customizable Lookback Periods: Analyze performance across three adjustable periods (default: 20, 50, and 200 bars).
Relative Performance Analysis: Calculate and visualize the difference in percentage performance between the asset and the benchmark index.
Dynamic Summary Label: Displays a detailed breakdown of the asset's and index's performance for the latest bar.
User-Friendly Interface: Includes customizable colors and display options for clear visualization.
How It Works:
The script fetches closing prices of both the asset and a benchmark index.
It calculates percentage changes over the selected lookback periods.
The indicator then computes the relative performance difference between the asset and the index, plotting it on the chart for easy trend analysis.
Who Is This For?:
Traders and investors who want to compare an asset’s performance against a benchmark index.
Those looking to identify trends and deviations between an asset and the broader market.
Disclaimer:
This tool is for educational purposes only and does not constitute financial or trading advice. Always use it alongside proper risk management strategies and backtest thoroughly before applying it to live trading.
Chart Recommendation:
Use this script on clean charts for better clarity. Combine it with other technical indicators like moving averages or trendlines to enhance your analysis. Ensure you adjust the lookback periods to match your trading style and the timeframe of your analysis.
Additional Notes:
For optimal performance, ensure the benchmark index's data is available on your TradingView subscription. The script uses fallback mechanisms to avoid interruptions when index data is unavailable. Always validate the settings and test them to suit your trading strategy.
Crypto Market Caps / Global GDP %This indicator compares the total market capitalization of various crypto sectors to the global Gross Domestic Product (GDP), expressed as a percentage. The purpose of this indicator is to provide a visual representation of the relative size of the crypto market compared to the global economy, allowing traders and analysts to understand how the market is growing in relation to the overall economy.
Key Features
Crypto Market Caps -
TOTAL: Represents the total market capitalization of all cryptocurrencies.
TOTAL3: Represents the market capitalization of all cryptocurrencies, excluding Bitcoin and Ethereum.
OTHERS: Represents the market capitalization of all cryptocurrencies excluding the top 10.
Global GDP -
The indicator uses a combination of GDP data from multiple regions across the world, including:
GDP from the EU, North America (NA), and other regions.
GDP data from Asia, Latin America (LATAM), and the Middle East & North Africa (MENA).
Percentage Representation -
The market caps (TOTAL, TOTAL3, OTHERS) are compared to the global GDP, and the result is expressed as a percentage. This allows you to easily see how the size of the cryptocurrency market compares to the entire global economy at any given time.
Plotting and Visualization
The indicator plots the market cap to global GDP ratio for each category (TOTAL, TOTAL3, OTHERS) on the chart.
You can choose which plots to display through user inputs.
The percentage scale makes it easy to compare how much of the global GDP is represented by different parts of the crypto market.
Labels can be added for additional clarity, showing the exact percentage value on the chart.
How to Use
The indicator provides a clear view of the cryptocurrency market's relative size compared to the global economy.
Higher values indicate that the crypto market (or a segment of it) is becoming a larger portion of the global economy.
Lower values suggest the crypto market is still a smaller segment of the global economic activity.
User Inputs
TOTAL/GlobalGDP: Toggle visibility for the total market capitalization of all cryptocurrencies.
TOTAL3/GlobalGDP: Toggle visibility for the market cap of cryptocurrencies excluding Bitcoin and Ethereum.
OTHERS/GlobalGDP: Toggle visibility for the market cap of cryptocurrencies excluding the top 10.
Labels: Enable or disable the display of labels showing the exact percentage values.
Practical Use Cases
Market Sentiment: Gauge the overall market sentiment and potential growth relative to global economic conditions.
Investment Decisions: Help identify when the crypto market is becoming more or less significant in the context of the global economy.
Macro Analysis: Combine this indicator with other macroeconomic indicators to gain deeper insights into the broader economic landscape.
By providing an easy-to-understand percentage representation, this indicator offers valuable insights for anyone interested in tracking the relationship between cryptocurrency market cap and global economic activity.
GL_Prev Week HighThe GL_Prev Week High Indicator is a powerful tool designed to enhance your trading analysis by displaying the previous week's high price directly on your chart. With clear and customizable visuals, this indicator helps traders quickly identify critical price levels, enabling more informed decision-making.
Key Features:
Previous Week's High Line:
Displays the previous week's high as a red line on your chart for easy reference.
Customizable Horizontal Line:
Includes a white horizontal line for enhanced clarity, with adjustable length, color, and width settings.
All-Time High Tracking:
Automatically tracks the all-time high from the chart's history and places a dynamic label above it.
Real-Time Updates:
The indicator updates in real-time to ensure accuracy as new bars are added.
User Inputs for Personalization:
Adjust the left and right span of the horizontal line.
Customize line width and color to suit your preferences.
Use Case:
This indicator is ideal for traders looking to integrate the previous week's high as a key support or resistance level in their trading strategy. Whether you are analyzing trends, identifying breakout zones, or planning entry/exit points, this tool provides valuable insights directly on the chart.
How to Use:
Add the indicator to your chart.
Customize the settings (line length, width, and color) through the input panel to match your preferences.
Use the red line to track the previous week's high and the label to monitor all-time highs effortlessly.
License:
This script is shared under the Mozilla Public License 2.0. Feel free to use and adapt the script as per the license terms.
Improved Target Oscillator | JeffreyTimmermansImproved Target Oscillator
The Improved Target Oscillator is a versatile technical indicator that identifies trends, reversals, and market momentum. Designed to work effectively across various markets, this oscillator excels at capturing longer-term market trends, making it ideal for traders focused on sustained price movements. By using advanced mathematical techniques and dynamic visualization, the oscillator provides actionable insights, helping traders navigate complex market environments with confidence.
Key features include:
A dynamic oscillator line to reflect market momentum and reversals.
Clear gradient-based coloring to distinguish between bullish and bearish conditions.
Signal highlights for potential entry and exit points based on trend shifts.
This tool is particularly useful for identifying extended trends and provides a clean, intuitive interface for assessing market dynamics.
Improvements in the Improved Target Oscillator
Smoothing Feature:
Added an optional smoothing toggle, allowing the use of SMA or EMA for reducing noise.
Provides flexibility through adjustable smoothing length, enhancing clarity in choppy markets.
Alerts for Trade Opportunities:
Built-in alert conditions for bullish and bearish signals.
Allows traders to receive notifications when critical trend changes occur, ensuring they never miss an opportunity.
Customizable to integrate seamlessly into trading workflows.
Enhanced Visualization:
Introduced dynamic gradients for bullish and bearish conditions with improved customization options.
Provides clearer differentiation of momentum changes, improving interpretability.
Signal Highlights:
Improved visual cues for bullish and bearish signals with precise dot indicators.
Offers better alignment with oscillator momentum shifts, ensuring actionable insights.
Adaptability:
Tuned for use in capturing longer-term market trends, emphasizing its effectiveness in identifying sustained movements.
Adjusted oscillator sensitivity with a levels multiplier for better scalability across various market conditions.
Level Markers:
Clearer delineation of key oscillator levels, including half and full normalized levels for improved context.
A neutral line explicitly plotted for easier trend and momentum identification.
Summary
The Improved Target Oscillator combines a sophisticated mathematical foundation with practical visualization enhancements to deliver a more intuitive and precise tool for market analysis. With added flexibility, improved signals, and tailored features for longer-term trends, this oscillator is an essential resource for traders looking to refine their strategies.
-Jeffrey
Candle Counter by ComLucro - Multi-Timefram - 2025_V01Candle Counter by ComLucro - Multi-Timeframe - 2025_V01
The Candle Counter by ComLucro - Multi-Timeframe is a highly customizable tool designed to help traders monitor the number of candles across various timeframes directly on their charts. Whether you're analyzing trends or tracking specific market behaviors, this indicator provides a seamless and efficient way to enhance your technical analysis.
Key Features:
Flexible Timeframe Selection: Track candle counts on yearly, monthly, weekly, daily, or hourly intervals to suit your trading style.
Dynamic Label Positioning: Choose to display labels above or below candles, offering greater control over your chart layout.
Customizable Colors: Adjust label text colors to match your chart's aesthetics and improve visibility.
Clean and Organized Visualization: Automatically generates labels for each candle without overcrowding your chart.
How It Works:
Select a Timeframe: Choose from yearly, monthly, weekly, daily, or hourly intervals based on your analysis needs.
Automatic Counting: The indicator calculates and displays the number of candles for the selected period directly on your chart.
Label Customization: Adjust the position (above or below the candles) and color of the labels to align with your preferences.
Why Use This Indicator?
This script is perfect for traders who need a clear and visual representation of candle counts in specific timeframes. Whether you're monitoring trends, evaluating price action, or developing strategies, the Candle Counter by ComLucro adapts to your needs and helps you make informed decisions.
Disclaimer:
This script is intended for educational and informational purposes only. It does not constitute financial advice. Always practice responsible trading and ensure this tool aligns with your strategies and risk management practices.
About ComLucro:
ComLucro is dedicated to providing traders with practical tools and educational resources to improve decision-making in the financial markets. Discover other scripts and strategies developed to enhance your trading experience.
Nen Star Harmonic Pattern [TradingFinder] NenStar Reversal Auto🔵 Introduction
The Nen-Star Harmonic Pattern is an advanced reversal pattern in technical analysis, designed to identify market trend changes and predict key price reversal points. This pattern is defined by a combination of Fibonacci ratios and critical concepts such as Potential Reversal Zones (PRZ), market structure, and corrective waves.
The key points of this pattern include X, A, B, C, and D, and it appears in both bullish and bearish forms. In its bullish form, the pattern resembles the letter M, while in its bearish form, it takes the shape of W. The critical Fibonacci ratios for this pattern are 0.382 to 0.786 for the XA wave, 1.13 to 1.414 for the AB wave, and 1.272 to 2.618 for the BC wave.
The Nen-Star Harmonic Pattern is one of the most precise tools for identifying market reversals and executing reversal trades. Traders can use it to pinpoint optimal entry and exit points and benefit from high risk-to-reward ratios.
By emphasizing Fibonacci retracement levels, XABCD waves, the formation of bullish and bearish patterns, and precise trade entry points, this pattern has become a practical tool in advanced technical analysis.
Bullish Nen-Star Pattern :
Bearish Nen-Star Pattern :
🔵 How to Use
The Nen-Star Harmonic Pattern indicator allows traders to automatically identify the bullish and bearish structures of this pattern and locate optimal entry and exit points. By accurately analyzing Fibonacci ratios and determining points X, A, B, C, and D, the indicator highlights Potential Reversal Zones (PRZ) on the chart. Traders can rely on the generated signals to manage their trades with greater precision.
🟣 Bullish Nen-Star Pattern
The bullish Nen-Star pattern begins with a price increase from point X to point A, followed by a retracement to point B, which lies between 0.382 and 0.786 of the XA wave.
After this retracement, the price moves to point C, located between 1.13 and 1.414 of the AB wave. The final movement is a price decline to point D, which is between 1.272 and 2.618 of the BC wave and 1.13 to 1.272 of the XA wave.
Point D : Serves as the key Potential Reversal Zone (PRZ).
Entry : A buy trade is initiated at point D, signaling the end of the corrective movement and the beginning of a price increase.
Price Targets :
61.8% retracement of the CD wave
Point A
Point C
1.272 and 1.618 extensions of the CD wave if resistance at point C is broken
Stop Loss : Placed slightly below point D.
🟣 Bearish Nen-Star Pattern
The bearish Nen-Star pattern starts with a price decrease from point X to point A, followed by a retracement to point B, which lies between 0.382 and 0.786 of the XA wave.
After this retracement, the price moves to point C, located between 1.13 and 1.414 of the AB wave. The final movement is a price increase to point D, which is between 1.272 and 2.618 of the BC wave and 1.13 to 1.272 of the XA wave.
Point D : Serves as the key Potential Reversal Zone (PRZ).
Entry : A sell trade is initiated at point D, signaling the end of the corrective movement and the beginning of a price decline.
Price Targets :
61.8% retracement of the CD wave
Point A
Point C
1.272 and 1.618 extensions of the CD wave if support at point C is broken
Stop Loss : Placed slightly above point D.
🔵 Setting
🟣 Logical Setting
ZigZag Pivot Period : You can adjust the period so that the harmonic patterns are adjusted according to the pivot period you want. This factor is the most important parameter in pattern recognition.
Show Valid Forma t: If this parameter is on "On" mode, only patterns will be displayed that they have exact format and no noise can be seen in them. If "Off" is, the patterns displayed that maybe are noisy and do not exactly correspond to the original pattern.
Show Formation Last Pivot Confirm : if Turned on, you can see this ability of patterns when their last pivot is formed. If this feature is off, it will see the patterns as soon as they are formed. The advantage of this option being clear is less formation of fielded patterns, and it is accompanied by the latest pattern seeing and a sharp reduction in reward to risk.
Period of Formation Last Pivot : Using this parameter you can determine that the last pivot is based on Pivot period.
🟣 Genaral Setting
Show : Enter "On" to display the template and "Off" to not display the template.
Color : Enter the desired color to draw the pattern in this parameter.
LineWidth : You can enter the number 1 or numbers higher than one to adjust the thickness of the drawing lines. This number must be an integer and increases with increasing thickness.
LabelSize : You can adjust the size of the labels by using the "size.auto", "size.tiny", "size.smal", "size.normal", "size.large" or "size.huge" entries.
🟣 Alert Setting
Alert : On / Off
Message Frequency : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
Show Alert Time by Time Zone : The date, hour, and minute you receive in alert messages can be based on any time zone you choose. For example, if you want New York time, you should enter "UTC-4". This input is set to the time zone "UTC" by default.
🔵 Conclusion
The Nen-Star Harmonic Pattern is a highly effective analytical tool in global financial markets, playing a crucial role in identifying reversal points and market trend changes. By leveraging Fibonacci principles and price structure, this pattern enables precise analysis across various assets, including stocks, cryptocurrencies, forex, and commodities.
Traders operating in global markets can use this pattern to identify high risk-to-reward trading opportunities. Its clear entry and exit points, defined Potential Reversal Zones (PRZ), and accurate price targets make it an excellent tool for risk management and profitability enhancement.
In the global context, the Nen-Star pattern is widely used by professional analysts in both advanced and emerging markets due to its versatility in analyzing long-term and short-term charts. Beyond trend prediction, it enhances trading strategies and optimizes investment decisions.
Combining this pattern with complementary tools such as volume analysis, technical indicators, and macroeconomic conditions can provide traders with deeper market insights, helping them capitalize on global opportunities.
Improved Trend Reconnaissance | JeffreyTimmermansImproved Trend Reconnaissance
The Improved Trend Reconnaissance indicator is a robust tool designed to help traders identify and follow trends while avoiding market noise. It is especially effective for capturing longer-term trends and sustained price movements over extended time periods. By leveraging smoothed trend analysis and volatility-based consolidation detection, this indicator provides clear and actionable insights for traders focusing on significant market trends.
What Does This Indicator Do?
At its core, this indicator calculates a Half Trend value and applies advanced smoothing techniques to emphasize longer-term trends. Additionally, it incorporates volatility analysis using the Average True Range (ATR) to detect periods of consolidation, where trend signals are muted to prevent false signals.
Key Components Explained
Half Trend Calculation:
This indicator determines a Half Trend value based on the relationship between the Exponential Moving Average (EMA) of closing prices and the highest highs and lowest lows over a specified range.
The trend is further smoothed to minimize short-term fluctuations, ensuring the focus remains on sustained price movements.
ATR-Based Consolidation Detection:
By comparing the range of price highs and lows to a multiple of ATR, the indicator detects consolidation zones where the market is range-bound. During these periods, trend signals are suppressed to avoid false positives.
Trend Visualization:
Bullish Trends: Highlighted in green with upward markers and optional trend-colored candles.
Bearish Trends: Highlighted in red with downward markers and optional trend-colored candles.
Designed for Longer-Term Trends:
The default settings are optimized to capture longer-term trends, making this indicator particularly valuable for traders looking to identify and follow substantial market movements over extended periods.
Key Features
Optimized for Capturing Longer Trends:
With the default settings, the indicator is tailored to identify and follow longer-term price trends, reducing noise from minor fluctuations. This makes it ideal for traders focused on significant trends and extended price movements.
Customizable Inputs:
Parameters such as trend range, smoothing length, ATR calculation period, and consolidation threshold are fully customizable.
Visual settings, including trend colors and signal sizes, can be adjusted for personalized trading needs.
Dynamic Signal Generation:
Bullish Signals: Generated when the smoothed Half Trend crosses upward and the market is trending.
Bearish Signals: Generated when the smoothed Half Trend crosses downward and the market is trending.
Alerts can notify traders in real time when these conditions occur.
Enhanced Visualization:
Candle coloring based on trend direction provides an immediate visual representation of market momentum.
Plotted trend lines and filled regions between them emphasize the current trend's strength and direction.
Real-Time Dashboard:
Displays essential information, including the current ticker, trend direction, and status (bullish or bearish), directly on the chart.
How to Use This Indicator
Identify Longer-Term Trends:
Use the smoothed Half Trend line and trend-colored candles to identify and follow significant price trends.
The default settings are specifically designed to focus on extended trends, making it easier to spot major market moves.
Avoid Noise in Consolidation:
Pay attention to the consolidation detection feature, which suppresses signals during range-bound market conditions, aka mean-reverting markets.
This ensures that signals generated are more reliable and actionable.
Confirm Trend Signals:
Use the visual markers (flags) and dashboard status to validate bullish or bearish trends before making trading decisions.
Set Alerts:
Set alerts for bullish or bearish signals to stay informed about key market movements without constantly monitoring the charts.
Adapt for Your Strategy:
While optimized for longer-term trends, the customizable settings allow you to adapt the indicator for shorter-term strategies if needed.
What Makes This Indicator Unique?
Focus on Longer-Term Trends:
Unlike many indicators that respond to short-term fluctuations, this tool is tailored for longer-term trend-following systems, ensuring that traders capture the most meaningful price movements.
Noise Reduction:
By combining smoothing techniques and ATR-based consolidation detection, the indicator reduces market noise and focuses on actionable insights.
Clear Visual Representation:
The combination of trend-colored candles, plotted lines, and dashboard information simplifies the analysis of complex market trends.
Customizability:
Fully adjustable parameters ensure the indicator meets the specific needs of a wide range of trading styles.
Real-Time Feedback:
Alerts and dashboard integration keep traders informed, enabling timely and well-informed decision-making.
The Improved Trend Reconnaissance indicator is an essential tool for traders looking to focus on longer-term trends and sustained market movements. With its default settings optimized for capturing significant trends over extended periods, it offers clarity, precision, and actionable insights for successful trend-following trading.
-Jeffrey
Machine Learning RSI Bands V3The Machine Learning RSI Bands V3 is a cutting-edge trading tool designed to provide actionable insights by combining the strength of machine learning with a traditional RSI framework. It adapts dynamically to changing market conditions, offering traders a robust, data-driven approach to identifying opportunities.
Let’s break down its functionality and the logic behind each input to give you a clear understanding of how it works and how you can use it effectively.
RSI Parameters RSI Source (rsisrc): Choose the data source for RSI calculation, such as the closing price. This allows you to focus on the specific price data that aligns with your trading strategy. RSI Length (rsilen): Set the number of periods used for RSI calculation. A shorter length makes the RSI more reactive to price changes, while a longer length smooths out volatility. These inputs allow you to customize the foundational RSI calculations, ensuring the indicator fits your style of trading.
Band Limits Lower Band Limit (lb): Defines the RSI value below which the market is considered oversold. Upper Band Limit (ub): Defines the RSI value above which the market is considered overbought. These settings give you control over the thresholds for market conditions. By adjusting the band limits, you can tailor the indicator to be more or less sensitive to market movements.
Sampling and Reaction Settings Target Reaction Size (l): Determines the number of bars used to define pivot points. Smaller values react to shorter-term price movements, while larger values focus on broader trends. Backtesting Reaction Size (btw): Sets the number of bars used to validate signal performance. This ensures signals are only considered valid if they perform consistently within the specified range. Data Format (version): Choose between Absolute (ignoring direction) and Directional (incorporating directional price changes). Sampling Method (sm): Select how the data is analyzed—options include Price Movement, Volume Movement, RSI Movement, Trend Movement, or a Hybrid approach. These settings empower you to refine how the indicator processes and interprets data, whether focusing on short-term price shifts or broader market trends.
Signal Settings Signal Confidence Method (cm): Choose between: Threshold: Signals must meet a confidence limit before being generated. Voting: Requires a majority of 5 signal components to confirm a trade. Confidence Limit (cl): Defines the confidence threshold for generating signals when using the Threshold method. Votes Needed (vn): Sets the number of votes required to confirm a trade when using the Voting method. Use All Outputs (fm): If enabled, signals are generated without filtering, providing an unfiltered view of potential opportunities. This section offers a balance between precision and flexibility, enabling you to control the rigor applied to signal generation.
How It Works
The script uses machine learning models to adaptively calculate dynamic RSI bands. These bands adjust based on market conditions, providing a more responsive and nuanced interpretation of overbought and oversold levels.
Dynamic Bands: The lower and upper RSI bands are recalibrated using machine learning to reflect current market conditions. Signals: Long and short signals are generated when RSI crosses these bands, with additional filters applied based on your chosen confidence method and sampling settings. Transparency: Real-time success rates and profit factors are displayed on the chart, giving you clear feedback on the indicator's performance.
Why Use Machine Learning RSI Bands V3?
This indicator is built for traders who want more than static thresholds and generic signals. It offers:
Adaptability: Machine learning dynamically adjusts the indicator to market conditions. Customizability: Each input serves a specific purpose, giving you full control over its behavior. Accountability: With built-in performance metrics, you always know how the tool is performing.
This is a tool designed for those who value precision and adaptability in trading.
Fibonacci Trading Strategy (Auto Levels)How It Works
Swing Highs and Lows Detection:
The script identifies the highest high and lowest low over a specified lookback period (default: 50 candles). These points are used as the basis for Fibonacci calculations.
Fibonacci Levels:
Fibonacci retracement levels: 0%, 38.2%, 50%, 61.8%, 78.6%, and 100%.
Fibonacci extension levels: 127.2%, 161.8%, 200%, 261.8%, and 361.8%.
Each level is plotted on the chart with a specific color and labeled with the corresponding price.
Entry Zones:
Pullback Area: Between the 50% and 61.8% retracement levels. This area is highlighted in green, indicating a potential entry for conservative traders.
Full Margin Area: Between the 61.8% and 78.6% retracement levels. This area is highlighted in red, suggesting a higher-risk entry for aggressive traders.
Stop Loss (SL):
The Stop Loss is placed at the 78.6% Fibonacci retracement level. A dotted red line is drawn at this level to provide a visual reference for risk management.
Entry labels include the Stop Loss price for clarity.
Take Profit (TP) Levels:
Multiple take-profit targets are identified using Fibonacci extension levels (127.2%, 161.8%, 200%, 261.8%, and 361.8%).
Each level is labeled with the price and target percentage.
Visual Aids:
The script dynamically labels each Fibonacci level with its corresponding price.
Entry points (Pullback and Full Margin) are marked with clear labels, including the recommended Stop Loss.
Background highlights help distinguish the Pullback and Full Margin areas.
Strategy Highlights
Risk Management:
Incorporates a well-defined Stop Loss at the 78.6% level to limit downside risk.
Multiple take-profit levels help traders scale out of positions gradually.
Automation:
Automatically recalculates levels when new swing highs or lows are detected, ensuring accuracy in dynamic markets.
Customizability:
Users can adjust the lookback period to suit different timeframes or trading styles.
Clarity:
Clean visuals and detailed labels ensure the strategy is easy to interpret and apply.
When to Use
The strategy is suitable for trend-following traders looking to enter during pullbacks in an established trend.
It works best in trending markets where Fibonacci levels often act as strong support or resistance.
Example Scenario
Bullish Setup:
Price retraces to the 50%-61.8% area (Pullback Area) after a swing high.
A buy order is placed in this zone, with the Stop Loss at the 78.6% level.
Profit targets are set at the 127.2%, 161.8%, and higher Fibonacci extensions.
Bearish Setup:
In a downtrend, price retraces upward to the 50%-61.8% zone.
A sell order is placed, with the Stop Loss at the 78.6% level and take-profit levels below.
STH MVRV + Double MA | JeffreyTimmermansSTH MVRV + Double MA
This indicator combines blockchain analytics and technical analysis to provide traders with insights into market trends and cycles. At its core, it utilizes the Short-Term Holder (STH) Market Value to Realized Value (MVRV) ratio, a powerful metric in blockchain analysis, alongside Moving Averages (MA's) to offer a comprehensive view of market dynamics.
What Is the STH-MVRV Ratio?
The STH-MVRV ratio is a blockchain-based metric that compares the market value of Bitcoin held by short-term holders to its realized value.
Market Value: The current price of Bitcoin multiplied by the number of coins held by short-term holders.
Realized Value : The average price at which short-term holders acquired their Bitcoin, based on blockchain transaction data.
This ratio provides a unique perspective on market sentiment:
Above 1: Short-term holders, on average, are in profit. This often signals a bullish market.
Below 1: Short-term holders are, on average, at a loss, which can indicate bearish sentiment.
The STH-MVRV is particularly useful for identifying potential market tops or bottoms, as short-term holder behavior often reflects broader market trends.
How Does This Indicator Work?
The STH MVRV + Double MA indicator builds on the STH-MVRV ratio by integrating it with additional data and tools to enhance its practical use:
STH-MVRV Variations:
STH-MVRV (MVRV): The traditional ratio as described above.
Price-Based MVRV: A variation using Bitcoin price to measure similar dynamics.
Average MVRV: A hybrid metric combining the two for balanced insights.
Dynamic Moving Averages (MA's):
Primary SMA (STH-MVRV): Smooths out fluctuations in the STH-MVRV ratio over a default period of 155 days.
Extra MA: A faster-moving average for shorter-term trends (default: 50 days).
Second MA: A slower-moving average for longer-term trends (default: 200 days).
Visual and Alert Features:
Color-coded plots to highlight bullish or bearish conditions.
Alerts for key crossover events, such as when STH-MVRV crosses above/below critical levels or Moving Averages.
Key Features
STH-MVRV as a Sentiment Gauge:
Use the ratio to determine whether short-term holders are profiting (bullish) or losing (bearish).
Moving Average Integration:
Identify trends and reversals with customizable Moving Averages.
Crossovers between MA's and the STH-MVRV indicate actionable trading signals.
Customizable Parameters:
Tailor SMA and MA settings to align with your strategy.
Adjust colors and labels for clearer insights.
Real-Time Updates:
Dynamic labels display the current values of STH-MVRV, Price-based MVRV, or the Average, providing instant clarity.
How to Use This Indicator
Gauge Market Sentiment:
Use the STH-MVRV to understand whether the market is overvalued or undervalued based on short-term holder behavior.
Trend Identification with MA's:
Monitor crossovers between STH-MVRV and Moving Averages for potential buy or sell signals.
Analyze Market Cycles:
Use the Average MVRV to gain a broader view of market conditions, balancing short-term and long-term insights.
What Makes This Indicator Unique?
In-Depth Blockchain Metric: Builds directly on the STH-MVRV ratio, a key metric in blockchain analysis.
Integrated Analysis: Combines the STH-MVRV with Moving Averages for enhanced functionality.
Customizability and Practicality: Users can adapt the settings to fit their unique trading style, ensuring the tool is both flexible and powerful.
This combination of blockchain insights and technical tools makes the STH MVRV + Double MA indicator an essential addition to any trader’s arsenal. Use it to stay ahead of market trends and make informed decisions with confidence.
-Jeffrey
Strategy Development Environment [BerlinCode42]Happy Trade,
Intro
What is New
Algebraic/Boolean Equation
Instruction Set for The Algebraic/Boolean Equation
Example
Usage
Settings Menu
Declaration for Tradingview House Rules on Script Publishing
Disclaimer
Conclusion
1. Intro
This is a rich equipped fork of my previous "Backtest any Indicator v5". And serves as the fitting backtester and trade strategy creation tool for my upcoming ANN Indicators (artificial neural network).
As the previous version this script has no trade signal generating code. The trade signals comes in by the five user settable input slots where the user plug-in external indicators. The final trade siganls go long etc are defined by a algebraic/boolean equation typed in as text in 4 terminals as shown in Image 0 . With this algebraic/boolean equations input the user can setup any trade logic as complex and fast and easy as never seen before here on TradingView.
Image 0
2. What is new
Input algebraic/boolean equations in text-form for go long, go short, exit long & exit short
Five input slots for external indicator signals
Equation tester
User settable signal delay for enter and exit trades
User selectable alternating trades filter
User settable exit long = enter short
Intrabar or trade only on bar closing
Time filter with duration input
User settable UTC Adjustment
Long and short trades possible
Two Take Profits with quantity setting
Trailing Stop
Webhook connection
3. Algebraic/Boolean Equation
This is where the magic happens. Unlike other backtesters that rely on drop-down menus to define trade signal equations—thus limiting the number of input signals and the complexity of logic—this script uses a string interpreter to solve equations. With this, you can develop your trade logic equations and add signals or conditions simply by writing them down in algebraic/boolean form.
The instruction set for this interpreter includes not only external input signals but also several internal values. These include BarTime, BarIndex, Open, High, Low, Close, True Range, Minimal Tick, Volume, and a signal that indicates whether there is an open trade (long, short, or none). You can also reference the values of past bars for all these inputs and, of course, use constant values in your equations. There is a sad limitation: Only one past bar value per equation is practicable. If you use more, errors can occur. It seems to be caused by the pipe line architecture of the parallel computing. In any attempt to solve this issue an older function call result was hand over.
The implemented functions cover a wide range of algebraic and boolean operations. A boolean "true" is represented by all values greater than zero, while "false" is represented by zero or values less than zero.
4. Instruction set for the Algebraic/Boolean Equation
There are functions that accept either two input values or one input value. The general form is (XandY) or (notX), where X and Y can be any input slot, predefined value, constant, or another sub-equation. Functions are always written in lowercase, while input slots and predefined values use uppercase letters.
Each sub-equation must be enclosed in parentheses, e.g., (A+B). Without proper use of parentheses, the interpreter cannot determine which function to calculate first. Negative constants must be expressed by subtracting from zero (e.g., (0-3.14)), so careful attention is required.
Here are some examples that demonstrate both incorrect and correct notations:
incorrect correct
(A+B*C) (A+(B*C))
(A+B+D+E) (A+(B+(D+E)))
(-20>A) ((0-20)>A)
(A*-B) (A*(0-B))
(AnotB) (Aand(notB))
ABS(a-b) (abs(A-B))
The correct usage ensures the interpreter calculates in the intended order.
And here comes the complete Instruction Set:
Addition: (A+B)
Subtraction: (A-B)
Multiplication: (A*B)
Division: (A/B)
Absolut value: (absA)
Power of: (A^B)
Natural Logarithm: (logA)
Lowest value of Low of last x bars: (lotx)
Highest value of High of last x bars: (hotx)
Modulo, Remainder of a Division: (A%B)
Round: (rndA)
round to ceil: (ceiA)
Round to floor: (floA)
Round to next minimal tick: (mitA)
EMA of A of last 3 bars: (e03A)
EMA of A of last 7 bars: (e07A)
EMA of A of last 10 bars: (e10A)
EMA of A of last 20 bars: (e20A)
EMA of A of last 50 bars: (e50A)
Smaller then: (AB)
Equal to: (A==B)
Unequal to: (A!=B)
And: (AandB)
Or: (AorB)
Exclusive Or: (AxorB)
Not: (notA)
Past bar value: (A ) ,whereby x can be 1,2,3,...,barIndex-1
Bar time: (T)
Bar index: (I)
Opening Price of Bar: (O)
Highest Price of Bar: (H)
Lowest Price of Bar: (L)
Closing Price of Bar: (C)
Min tick value for the current symbol: (K)
Trade Volume: (V)
True Range: (R)
Is Money invested: (M) ,Long position: M=1,
Short position: M=-1,
No position: M=0
Reminder: if you wanna replace A or B above don't forget the parentheses. So if you have (logA) and wanna replace A with D+F so the correct replacement would be (log(D+F)).
In the following there are some examples of popular bar patterns and useful filters:
Doji: ((abs(O-C))<(10*K))and((H-L)>(100*K))
green Hammer: (((H-C)<(5000*K))and(((O-L)/2)>(abs(O-C)))
Up trend: (C>(e10H))
Down trend: (C<(e10L))
cool down 7 bars: (( any buy condition )and((e07(absM))==0))
possible Pivot High: (H==(hot30))and((CC))
possible Pivot Low: (L==(lot30))and((C>H )or(O0)), goShort ((A>0)and((A )<0)), Enter Signal delay=0, Exit Signal delay=0, Alternate Trades=true
take profit 1 =0.4% (30%), take profit 2 =0.7%, trailing stop loss=0.2%, intrabar, start capital=1000$, qty=5%, fee=0.05%, no Session Filter
Image 1
6. Usage
First you need to attach some signals from external Indicators. In the example above we use the Stochastic RSI indicator from TradingView. Load the Stochastic RSI indicator to the chart. Then you go to the settings menu of this script, choose in the drop-down menu of Input A the signal .
In case you wanna use a signal which is not in the drop-down menu of Input A do the following:
1) You need to know the name of the boolean (or integer) variable of your indicator which hold the desired signal. Lets say that this boolean variable is called BUY. If this BUY variable is not plotted on the chart you simply add the following code line at the end of your pine script.
For boolean (true/false) BUY variables use this:
plot(BUY ? 1:0,'Your buy condition hold in that variable BUY',display = display.data_window)
And in case your script's BUY variable is an integer or float then use instate the following code line:
plot(BUY ,'Your buy condition hold in that variable BUY',display = display.data_window)
2) Probably the name of this BUY variable in your indicator is not BUY. Simply replace in the code line above the BUY with the name of your script's trade condition variable.
3) Do the same procedure for your SELL variable. Then save your changed Indicator script.
4) Then add the changed Indicator script from step before and this backtester script to the chart ...
5) and go to the settings of it. Choose under "Settings -> Input A " your Indicator. So in the example above choose .
The form is usually: ' : BUY'. Then you see something like Image 1
6) Decide about each trade logic for Go Long and Go Short . In this Example we use for GoLong if "Stoch RSI: K" is smaller then 20. The "Stoch RSI: K" we already loaded it in input A. So we set under Go Long (A<20) and set Enter Signal Delay to 0.
Now we setup Go Short if "Stoch RSI: K" is bigger then 80. So we set under Go Short A>80. Enter Signal Delay is already set.
7) For the Exit conditions you can choose (trailing) Stop loss or Take Profit or Exit by Indicator Signal. What ever comes first triggers the exit. If you like to use an EMA Indicator for the Exit by Indicator just load it in a free input slot B, D, E, F or use the inbuild EMA. For this example we use the inbuild EMA of the last 7 values of close. It is called by the following equation: (e07C). So to exit a long trade when the close price crossunder this EMA you have to type in Exit Long ((e07C)>C). For exit a short trade enter in Exit Short ((e07C)<C).
You can choose detailed time- and session filters. You can setup two take profit levels with quantity and stop loss, trailing, initial capital, quantity per trade and set the exchange fees. You get an overall result table and even a detailed, scroll-able table with all trades.
Image 2
In the Image 2 you see the provided info tables about all Trades and the Result Summary. Further more every trade is marked by a background color, labels and levels. An opening Label with the trade direction and trade number. A closing Label again with the trade number, the trade profit in %, the trade gain in $ and the total amount of $ after all past trades. A green line for each take profit levels and an orange line for the (trail) stop loss. This summary table down left gives you an insign about how good or not so good the trade strategy is and with the trade list you can find those trade which should be avoided. Found those bad trades on the chart by the time or trade number. By seeing a big number of bad trades you may find a pattern and can formulate conditions to avoid those bad trades. Those new conditions you can easily add to the equations for enter or exit trades.
Now you have a backtest with the oppotunity to develope and envolve your trading strategy more and more. And for any iteration from general to detailed you can do it with this backtester. You can add more and more filter signals or may change the setting of your Indicator to the best results and setup the following strategy settings like Time- and Session Filter, Stop Loss, Take Profit etc. With it you find a profitable strategy and it's settings.
7. Settings Menu
In the settings menu you will find the following high-lighted sections. Most of the settings have a attention mark on their right side. Move over it with the cursor to read specific explanation.
Input Signals: This are five input slots A, B, D, E & F which you can load up with your preferred Indicators.
Algebraic Equation for the Trade Signals: Here you setup the definitions for Go Long , Go Short , Ex Long & Ex Short . As shown in Image 3 you can combine the input slots A, B, D, E, F with predefined Variables O, H, L, C, T, I, V, K, M, R or any constant value with the in-build function in the instruction set.
Image 3
Additionally, you have the option to delay entry and exit signals. This feature is particularly useful when trade signals exhibit noise and require smoothing.
You can also enable the script to perform alternating trading . In this mode, trades alternate sequentially—after a long trade, a short trade follows, and then another long trade, and so on.
Image 4
As shown in Image 4 , you can configure the script so that an "exit by signal" also acts as the next entry in the opposite trade direction. To enable this, check the option Exit = Enter Next and set the exit condition as the opposite of the entry condition. With this setting, only one occurrence of the signal is needed to trigger both the exit and the new entry, making the transition seamless.
Equation Tester: Each equation is assigned a checkmark and a color. Activate one like in Image 5 and the chart will highlight bars with a colored background where the corresponding equation result is greater than zero (interpreted as true). At the last bar, a label is displayed showing each equation’s result value. This feature allows you to build your equations and test sub-equations to ensure their results are correct.
Image 5
Backtest Results: Check mark the List of Trades to see any single trade with their stats. If there are more trades than can fit in the list, you can scroll down by decreasing the Scroll value.
Timezone Adjustment: In case you wanna use an Chart-UTC that differs from the time scale you can activate Timezone Adjustment . Then you have to setup your location UTC correctly! The Exchange UTC will be set in most cases automatically. Known Exchanges include Amsterdam, Chicago, New_York, Los_Angeles, Calcutta, Colombo, Moscow, St_Petersburg, Tokyo, Shanghai, Hongkong, Berlin, London, Paris, Madrid. Only if you have other exchanges you need to setup it by hand.
Time Filter: You can set a Start time or deactivate it by leave it unhooked. The same with End Time and Duration Days . Duration Days can also count from End time in case you deactivate Start time.
Session Filter: Here, you can choose to activate trading on a weekly basis, specifying which days of the week trading is allowed and which are excluded. Additionally, you can configure trading on a daily basis, setting the start and end times for when trades are permitted. If activated, no new trades will be initiated outside the defined times and sessions.
Long & Short: Here you can enable Longs or Shorts or both trades.
TP & SL Settings: Take Profit 1&2 set the target prices of any trade in relation to the entry price. The TP1 exit a part of the position defined by the quantity value. Stop Loss set the price to step out when a trade goes the wrong direction. You can activate also a trailing SL.
Additionally, you can specify whether trades should be executed intrabar or at the bar's closing.
Hedging: The Hedging is basic as shown in the following Image 6 and serves as a catch if price moves fast in the wrong direction.
Image 6
You can activate a hedging mechanism, which opens a trade in the opposite direction if the price moves x% against the entry price. If both the Stop Loss and Hedging are triggered within the same bar, the hedging action will always take precedence.
Invest Settings: Here, you can set the initial amount of cash to start with. The Quantity Percentage determines how much of the available cash is allocated to each trade, while the Fee Percentage specifies the trading fee applied to both opening and closing positions.
Webhooks: Here, you configure the License ID and the Comment. This is particularly useful if you plan to use multiple instances of the script, ensuring the webhooks target the correct positions. The Take Profit and Stop Loss values are displayed as prices.
8. Declaration for Tradingview House Rules on Script Publishing
This Backtester also serves as Strategy Development Tool by offering the user a fast and easy opportunity to test, enhance and manipulate the definitions for enter and exit trades. The unique feature "algebraic/boolean equation input" provides users with a significant edge over other backtest scripts. Unlike any other backtesting tool available with few drop-down menus for enter the equation, this script allows users to define an extensive range of trade equation definitions without setup of numerous specific parameters. This is reached by four terminals where the user type in the equation as text. Those equations in text-form are send intern to a context-depending touring machine that interprets the string. So with this tool, users can implement their trading ideas—even those involving complex definitions for trade entries and exits based on huge number of variables and indicators—without hiring a developer.
This script is closed-source and invite-only to support and compensate for over a year of development work. Unlike traditional backtest scripts, this one does not rely on TradingView's strategy functions. Instead, it is designed as an indicator, utilizing TradingView's "Indicator-on-Indicator" functionality.
9. Disclaimer
Trading is risky, and traders do lose money, eventually all. This script is for informational and educational purposes only. All content should be considered hypothetical, selected post-factum to demonstrate the upcoming ANN scripts and is not to be construed as financial advice. Decisions to buy, sell, hold, or trade in securities, commodities, and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results. Using this script on your own risk. This script may have bugs and I declare don't be responsible for any losses.
10. Conclusion
Now it’s your turn! Connect your promising Artificial Neural Networks (ANN) and standard indicators to this feature-rich Backtest/Strategy script. This tool allows you to quickly evaluate how well your indicators perform in trading scenarios and easily compare different trading logics defined by algebraic/boolean equations. You can refine your trading strategy step by step without needing a coder. Let it incorporate numerous variables and indicators—simply write the algebraic/boolean equations for trade entries and exits directly into the script’s settings.
Additionally, you can utilize the Time Filter to identify the market conditions where your setups perform best—or where they fall short. The Session Filter helps you isolate recurring favorable conditions to optimize your strategy further. Once you find a promising configuration, you can set up alerts to send webhooks directly. Configure all parameters, test and validate them in paper trading, and if results align with your expectations, deploy the script as your trading bit.
Cheers