NY HIGH LOW BREAKNY HIGH LOW BREAK: A New York Session Breakout Strategy
The "NY HIGH LOW BREAK" indicator is a powerful TradingView script designed to identify and capitalize on breakout opportunities during the New York trading session. This strategy focuses on the initial price action of the New York market open, looking for clear breaches of the high or low established within the first 30 minutes. It's particularly suited for intraday traders who seek to capture momentum-driven moves.
Strategy Logic
The core of the "NY HIGH LOW BREAK" strategy revolves around these key components:
New York Session Opening Range Identification:
The script first identifies the opening range of the New York session. This is defined by the high and low prices established during the first 30 minutes of the New York trading session (from 7:01 AM GMT-4 to 7:31 AM GMT-4).
These crucial levels are then extended forward on the chart as horizontal lines, serving as potential support and resistance zones.
Breakout Signal Generation:
Long Signal: A buy signal is generated when the price breaks above the high of the New York opening range. Specifically, it looks for a candle whose open and close are both above the highLinePrice, and importantly, the previous candle's open was below and close was above the highLinePrice. This indicates a strong upward momentum confirming the breakout.
Short Signal: Conversely, a sell signal is generated when the price breaks below the low of the New York opening range. It looks for a candle whose open and close are both below the lowLinePrice, and the previous candle's open was above and close was below the lowLinePrice. This suggests strong downward momentum confirming the breakdown.
Supertrend Filter (Implicit/Future Enhancement):
While the supertrend and direction variables are present in the code, they are not actively used in the current signal generation logic. This suggests a potential future enhancement where the Supertrend indicator could be incorporated as a trend filter to confirm breakout directions, adding an extra layer of confluence to the signals. For example, only taking long breakouts when Supertrend indicates an uptrend, and short breakouts when Supertrend indicates a downtrend.
Second Candle Confirmation (Possible Future Enhancement):
The close_sec_candle function and openSEC, closeSEC variables indicate an attempt to capture the open and close of a "second candle" (30 minutes after the initial New York open). Currently, closeSEC is used in a specific condition for signal_way but not directly in the primary longSignal or shortSignal logic. This also suggests a potential future refinement where the price action of this second candle could be used for further confirmation or specific entry criteria.
Time-Based Filtering:
Signals are only considered valid within a specific trading window from 8:00 AM GMT-4 to 8:00 AM GMT-4 + 16 * 30 minutes (which is 480 minutes, or 8 hours) on 1-minute and 5-minute timeframes. This ensures that trades are taken during the most active and volatile periods of the New York session, avoiding late-session chop.
The script also highlights the New York session and lunch hours using background colors, providing visual context to the trading day.
Key Features
Automated New York Open Range Detection: The script automatically identifies and plots the high and low of the first 30 minutes of the New York trading session.
Clear Breakout Signals: Visually distinct "BUY" and "SELL" labels appear on the chart when a breakout occurs, making it easy to spot trading opportunities.
Timeframe Adaptability: While optimized for 1-minute and 5-minute timeframes for signal generation, the opening range lines can be displayed on various timeframes.
Customizable Risk-to-Reward (RR): The rr input allows users to define their preferred risk-to-reward ratio for potential trades, although it's not directly implemented in the current signal or trade management logic. This could be used by traders for manual trade management.
Visual Session and Lunch Highlights: The script colors the background to clearly delineate the New York trading session and the lunch break, helping traders understand the market context.
How to Use
Apply the Indicator: Add the "NY HIGH LOW BREAK" indicator to your chart on TradingView.
Select a Relevant Timeframe: For optimal signal generation, use 1-minute or 5-minute timeframes.
Observe the Opening Range: The green and red lines represent the high and low of the first 30 minutes of the New York session.
Look for Breakouts: Wait for price to decisively break above the green line (for a buy) or below the red line (for a sell).
Confirm Signals: The "BUY" or "SELL" labels will appear on the chart when the breakout conditions are met within the active trading window.
Implement Your Risk Management: Use your preferred risk management techniques, including stop-loss and take-profit levels, in conjunction with the signals generated. The rr input can guide your manual risk-to-reward calculations.
Potential Enhancements & Considerations
Supertrend Confirmation: Integrating the supertrend variable to filter signals would significantly enhance the strategy's robustness by aligning trades with the prevailing trend.
Stop-Loss and Take-Profit Automation: The rr input currently serves as a manual guide. Future versions could integrate automated stop-loss and take-profit placement based on this ratio, potentially using ATR for dynamic sizing.
Volume Confirmation: Adding a volume filter to confirm breakouts would ensure that only high-conviction moves are traded.
Backtesting and Optimization: Thorough backtesting across various assets and market conditions is crucial to determine the optimal settings and profitability of this strategy.
Session Times: The current session times are hardcoded. Making these user-definable inputs would allow for greater flexibility across different time zones and trading preferences.
The "NY HIGH LOW BREAK" is a straightforward yet effective strategy for capturing initial New York session momentum. By focusing on clear breakout levels, it aims to provide timely and actionable trading signals for intraday traders.
"supertrend"に関するスクリプトを検索
TradingView.To Strategy Template (with Dyanmic Alerts)Hello traders,
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of TradingView.TO alerts, sparing users the time and effort of mastering the TradingView.TO syntax and manually create alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via TradingView.TO bot.
 IMPORTANT NOTES 
TradingView.TO is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, Metatrader 4/5, ...) for automating trading.
Many traders don't know how to create TradingView.TO dynamically-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create TradingView.TO alerts dynamically.
 TRADINGVIEW ALERTS 
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for BTC/USDT on the 5 minutes chart, 1 alert for BTC/USDT on the 15-minute chart (assuming you want your bot to trade the BTC/USDT on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) TradingView.TO uses webhook technology - setting a webhook URL from the alerts notifications tab is required.
 KEY FEATURES 
 I) Modular Indicator Connection 
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
 
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10,    "ATR Length", minval = 1)
factor =    input.float(3.0, "Factor",     minval = 0.01, step = 0.01)
  = ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend =    plot(direction < 0 ? supertrend : na, "Up Trend",   color = color.green, style = plot.style_linebr)
downTrend =  plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red,   style = plot.style_linebr)
fill(bodyMiddle, upTrend,   color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red,   90), fillgaps = false)
buy  = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION //////// 
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION //////// 
 Important Notes 
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
 
 II) BOT Risk Management: 
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
 III) Order Types and Position Sizing 
- Choose between market or limit orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
 IV) Advanced Take-Profit and Stop-Loss Options 
- Choose to set your SL/TP in either USD or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in USD for “risk-free” trades.
V) Miscellaneous:
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
 VI) Logger 
The TradingView.TO commands are logged in the TradingView logger.
You'll find more information about it in this  TradingView blog post .
 WHY YOU MIGHT NEED THIS TEMPLATE 
1) Transform your indicator into a TradingView.TO trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for TradingView.TO.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your TradingView.TO account
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
 BACKTEST RESULTS FROM THIS POST 
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with TradingView.TO.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
ProfitView Strategy TemplateHello traders,
This script took me a full week of coding/testing, sweat, and tears - and I’m too nice as I’m giving it for free to the community.
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of ProfitView alerts, sparing users the time and effort of mastering the ProfitView syntax and manually creating alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via the ProfitView Chrome extension.
 IMPORTANT NOTES 
ProfitView is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, etc.) for automating trading.
Many traders don't know how to dynamically create ProfitView-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create ProfitView alerts dynamically.
 TRADINGVIEW ALERTS 
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) ProfitView doesn't use webhook technology, so setting a webhook URL from the alerts notifications tab is unnecessary.
 KEY FEATURES 
 I) Modular Indicator Connection 
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
 
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10,    "ATR Length", minval = 1)
factor =    input.float(3.0, "Factor",     minval = 0.01, step = 0.01)
  = ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend =    plot(direction < 0 ? supertrend : na, "Up Trend",   color = color.green, style = plot.style_linebr)
downTrend =  plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red,   style = plot.style_linebr)
fill(bodyMiddle, upTrend,   color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red,   90), fillgaps = false)
buy  = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION //////// 
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION //////// 
 Important Notes 
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
 
 II) BOT Risk Management: 
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
- Use Restart Intraday EA: Enable/Disable a feature to restart the bot at the first bar of the next day if it has been stopped with an intraday risk management safeguard.
 III) Order Types and Position Sizing 
- Choose between market, limit, or stop orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
 IV) Advanced Take-Profit and Stop-Loss Options 
- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.
 V) Miscellaneous 
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
 VI) Notifications (Telegram/Discord/Email/IFTTT/Twilio/SMS) 
Customize notifications sent to Telegram, Discord, Email, IFTTT, Twilio, and ProfitView Logger.
 VII) Logger 
The ProfitView commands are logged in the TradingView logger.
You'll find more information about it in this  TradingView blog post .
 WHY YOU MIGHT NEED THIS TEMPLATE 
1) Transform your indicator into a ProfitView trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for ProfitView.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
 REQUIREMENTS 
* Make sure you have your ProfitView account and do the settings correctly in your Chrome extension. If you don't know how to do it, read the documentation + ask for help in the ProfitView Discord support channel.
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
 BACKTEST RESULTS FROM THIS POST 
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with ProfitView.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
Best regards,
Dave
Pineconnector Strategy Template (Connect Any Indicator)Hello traders,
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further. 
This Pine Script v5 strategy template is engineered for maximum customization and risk management. 
Best part? 
It’s optimized for Pineconnector, allowing seamless integration with MetaTrader 4 and 5.
This powerful tool gives a lot of power to those who don't know how to code in Pinescript and are looking to automate their indicators' signals on Metatrader 4/5.
 IMPORTANT NOTES 
Pineconnector is a trading bot software that forwards TradingView alerts to your Metatrader 4/5 for automating trading.
Many traders don't know how to dynamically create Pineconnector-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create Pineconnector alerts dynamically.
Pineconnector doesn't support alerts with multiple Take Profits.
As a workaround, for 2 TPs, I had to open two trades.
It's not optimal, as we end up paying more spreads for that extra trade - however, depending on your trading strategy, it may not be a big deal.
 TRADINGVIEW ALERTS 
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) Don't forget to set the Pineconnector webhook URL in the Notifications tab of the TradingView alerts UI.
You’ll find the URL on the Pineconnector documentation website.
 EA CONFIGURATION 
1) The Pyramiding in the EA on Metatrader must be set to 2 if you want to trade with 2 TPs => as it's opening 2 trades.
If you only want 1 TP, set the EA Pyramiding to 1.
Regarding the other EA settings, please refer to the Pineconnector documentation on their website.
2) In the EA, you can set a risk (= position size type) in %/lots/USD, as in the TradingView backtest settings.
 KEY FEATURES 
I) Modular Indicator Connection
    * plug in your existing indicator into the template.
    * Only two lines of code are needed for full compatibility.
 Step 1: Create your connector 
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether it's a MACD , ZigZag , Pivots , higher-highs, lower-lows, or whatever indicator with clear buy and sell conditions.
 
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10,    "ATR Length", minval = 1)
factor =    input.float(3.0, "Factor",     minval = 0.01, step = 0.01)
  = ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend =    plot(direction < 0 ? supertrend : na, "Up Trend",   color = color.green, style = plot.style_linebr)
downTrend =  plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red,   style = plot.style_linebr)
fill(bodyMiddle, upTrend,   color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red,   90), fillgaps = false)
buy  = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION //////// 
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION //////// 
 
 Important Notes 
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
 Step 2: Connect the connector 
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
 II) Customizable Risk Management 
- Choose between percentage or USD modes for maximum drawdown.
- Set max consecutive losing days and max losing streak length.
		
- I used the code from my friend @JosKodify for the maximum losing streak. :) 
Will halt the EA and backtest orders fill whenever either of the safeguards above are “broken”
 III) Intraday Risk Management 
- Limit the maximum intraday losses both in percentage or USD.
- Option to set a maximum number of intraday trades.
- If your EA gets halted on an intraday chart, auto-restart it the next day.
 IV) Spread and Account Filters 
- Trade only if the spread is below a certain pip value.
- Set requirements based on account balance or equity.
 V) Order Types and Position Sizing 
- Choose between market, limit, or stop orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
 Reason : The template sends the order on the same candle as the entry signals - at those entry signals candles, the position size isn’t computed yet, and the template can’t then send it to Pineconnector.
However, you can use the position size type (USD, contracts, %) from the “Properties” tab for backtesting. 
In the EA, you can define the position size type for your orders in USD or lots or %.
 VI) Advanced Take-Profit and Stop-Loss Options 
- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.
 VII) Logger 
The Pineconnector commands are logged in the TradingView logger.
You'll find more information about it in this  TradingView blog post .
 WHY YOU MIGHT NEED THIS TEMPLATE 
1) Transform your indicator into a Pineconnector trading bot more easily than before
 
  Connect your indicator to the template
  Create your alerts
  Set your EA settings
 
2) Save Time
Auto-generated alert messages for Pineconnector.
I tested them all, and I checked with the support team what could/can’t be done
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
 REQUIREMENTS 
* Make sure you have your Pineconnector license ID.
* Create your alerts with the Pineconnector webhook URL
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
 BACKTEST RESULTS FROM THIS POST 
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with Pineconnector.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :) 
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1 contract
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
 WHAT’S COMING NEXT FOR YOU GUYS? 
I’ll make the same template for ProfitView, then for AutoView, and then for Alertatron.
All of those are free and open-source.
I have no affiliations with any of those companies - I'm publishing those templates as they will be useful to many of you.
Dave
Band-Zigzag Based Trend FollowerWe defined new method to derive zigzag last month - which is called  Channel-Based-Zigzag . This script is an example of one of the use case of this method.
 🎲 Trend Following 
Defining a trend following method is simple. Basic rule of trend following is Buy High and Sell Low (Yes, you heard it right). To explain further - methodology involve finding an established trend which is flying high and join the trend with proper risk and optimal stop. Once you get into the trade, you will not exit unless there is change in the trend. Or in other words, the parameters which you used to define trend has reversed and the trend is not valid anymore.
Few examples are:
 🎯 Using bands 
When price breaks out of upper bands (example, Bollinger Band, Keltener Channel, or Donchian Channel), with a pre determined length and multiplier, we can consider the trend to be bullish and similarly when price breaks down the lower band, we can consider the trend to be bearish.
Here are few examples where I have used bands for identifying trend
 
   Band-Based-Supertrend 
   Donchian-Channel-Trend-Filter 
 
 🎯 Using Pivots 
Simple logic using zigzag or pivot points is that when price starts making higher highs and higher lows, we can consider this as uptrend. And when price starts making lower highs and lower lows, we can consider this as downtrend. There are few supertrend implementations I have published in the past based on zigzags and pivot points.
 
   Adoptive-Supertrend-Pivots 
   Zigzag-Supertrend 
 
 Drawbacks  of both of these methods is that there will be too many fluctuations in both cases unless we increase the reference length. And if we increase the reference length, we will have higher drawdown. 
 🎲 Band Based Zigzag Method 
Band Based Zigzag will help overcome these issues by combining both the methods.
 
  Here we use bands to define our pivot high and pivot low - this makes sure that we are identifying trend only on breakouts as pivots are only formed on breakouts.
  Our method also includes pivot ratio to cross over 1.0 to be able to consider it as trend. This means, we are waiting for price also to make new high high or lower low before making the decision on trend. But, this helps us ignore smaller pivot movements due to the usage of bands.
  I have also implemented few tricks such as sticky bands (Bands will not contract unless there is breakout) and Adaptive Bands (Band will not expand unless price is moving in the direction of band). This makes the trend following method very robust.
  To avoid fakeouts, we also use percentB of high/low in comparison with price retracement to define breakout.
 
 🎲 The indicator 
The output of indicator is simple and intuitive to understand.
 🎯 Trend Criteria 
 
  Uptrend when last confirmed pivot is pivot high and has higher retracement ratio than PercentB of High. Else, considered as downtrend.
  Downtrend when last confirmed pivot is pivot low and has higher retracement ratio than PercentB of High. Else, considered as uptrend.
 
 🎯 Settings 
Settings allow you to select the band type and parameters used for calculating zigzag and then trend. Also has few options to hide the display.
  
saodisengxiaoyu-lianghua-2.1- This indicator is a modular, signal-building framework designed to generate long and short signals by combining a chosen leading indicator with selectable confirmation filters. It runs on Pine Script version 5, overlays directly on price, and is built to be highly configurable so traders can tailor the signal logic to their market, timeframe, and trading style. It includes a dashboard to visualize which conditions are active and whether they validate a signal, and it outputs clear buy/sell labels and alert conditions so you can automate or monitor trades with confidence.
Core Design
- Leading Indicator: You choose one primary signal generator from a broad list (for example, Range Filter, Supertrend, MACD, RSI, Ichimoku, and many others). This serves as the anchor of the system and determines when a preliminary long or short setup exists.
- Confirmation Filters: You can enable additional filters that validate the leading signal before it becomes actionable. Each “respect…” input toggles a filter on or off. These filters include popular tools like EMA, 2/3 EMA crosses, RQK (Nadaraya Watson), ADX/DMI, Bollinger-based oscillators, MACD variations, QQE, Hull, VWAP, Choppiness Index, Damiani Volatility, and more.
- Signal Expiry: To avoid waiting indefinitely for confirmations, the indicator counts how many consecutive bars the leading condition holds. If confirmations do not align within a defined number of bars, the setup expires. This controls latency and helps reduce late or stale entries.
- Alternating Signals: An optional mode enforces alternation (long must follow short and vice versa), helping avoid repeated entries in the same direction without a meaningful reset.
- Aggregation Logic: The final long/short conditions are formed by combining the leading condition with all selected confirmation filters through logical conjunction. Only if all enabled filters validate the signal (within expiry constraints) does the indicator consider it a confirmed long or short.
- Visualization and Alerts: The script plots buy/sell labels at signal points, provides alert conditions for automation, and displays a compact dashboard summarizing the leading indicator’s status and each confirmation’s pass/fail result using checkmarks.
Leading Indicator Options
- The indicator includes a very large menu of leading tools, each with its own logic to determine uptrend or downtrend impulses. Highlights include:
  - Range Filter: Uses a dynamic centerline and bands computed via conditional EMA/SMA and range sizing to define directional movement. It can operate in a default mode or an alternative “DW” mode.
  - Rational Quadratic Kernel (RQK): Applies a kernel smoothing model (Nadaraya Watson) to detect uptrends and downtrends with a focus on noise reduction.
  - Supertrend, Half Trend, SSL Channel: Classic trend-following tools that derive direction from ATR-based bands or moving average channels.
  - Ichimoku Cloud and SuperIchi: Multi-component systems validating trend via cloud position, conversion/base line relationships, projected cloud, and lagging span.
  - TSI (True Strength Index), DPO (Detrended Price Oscillator), AO (Awesome Oscillator), MACD, STC (Schaff Trend Cycle), QQE Mod: Momentum and cycle tools that parse direction from crossovers, zero-line behavior, and momentum shifts.
  - Donchian Trend Ribbon, Chandelier Exit: Trend and exit tools that can validate breakouts or sustained trend strength.
  - ADX/DMI: Measures trend strength and directional movement via +DI/-DI relationships and minimum ADX thresholds.
  - RSI and Stochastic: Use crossovers, level exits, or threshold filters to gate entries based on overbought/oversold dynamics or relative strength trends.
  - Vortex, Chaikin Money Flow, VWAP, Bull Bear Power, ROC, Wolfpack Id, Hull Suite: A diverse set of directional, momentum, and volume-based indicators to suit different markets and styles.
  - Trendline Breakout and Range Detector: Price-behavior filters that confirm signals during breakouts or within defined ranges.
Confirmation Filters
- Each filter is optional. When enabled, it must validate the leading condition for a signal to pass. Examples:
  - EMA Filter: Requires price to be above a specified EMA for longs and below for shorts, filtering signals that contradict broader trend or baseline levels.
  - 2 EMA Cross and 3 EMA Cross: Enforce moving average cross conditions (fast above slow for long, the reverse for short) or a three-line stacking logic for more stringent trend alignment.
  - RQK, Supertrend, Half Trend, Donchian, QQE, Hull, MACD (crossover vs. zero-line), AO (zero line or AC momentum variants), SSL: Each adds its characteristic validation pattern.
  - RSI family (MA cross, exits OB/OS zones, threshold levels) plus RSI MA direction and RSI/RSI MA limits: Multiple ways to constrain signals via relative strength behavior and trajectories.
  - Choppiness Index and Damiani Volatility: Prevent entries during ranging conditions or insufficient volatility; choppiness thresholds and volatility states gate the trade.
  - VWAP, Volume modes (above MA, simple up/down, delta), Chaikin Money Flow: Volume and flow conditions that ensure signals happen in supportive liquidity or accumulation/distribution contexts.
  - ADX/DMI thresholds: Demand a minimum trend strength and directional DI alignment to reduce whipsaw trades.
  - Trendline Breakout and Range Detector: Confirm that the price is breaking structure or remains within active range consistent with the leading setup.
- By combining several filters you can create strict, conservative entries or looser setups depending on your goals.
Range Filter Engine
- A core building block, the Range Filter uses conditional EMA and SMA functions to compute adaptive bands around a dynamic centerline. It supports two types:
  - Type 1: The centerline updates when price exceeds the band thresholds; bands define acceptable drift ranges.
  - Type 2: Uses quantized steps (via floor operations) relative to the previous centerline to handle larger moves in discrete increments.
- The engine offers smoothing for range values using a secondary EMA and can switch between raw and averaged outputs. Its hi/lo bands and centerline compose a corridor that defines directional movement and potential breakout confirmation.
Signal Construction
- The script computes:
  - leadinglongcond and leadingshortcond : The primary directional signals from the chosen leading indicator.
  - longCond and shortCond : Final signals formed by combining the leading conditions with all enabled confirmations. Each confirmation contributes a boolean gate. If a filter is disabled, it contributes a neutral pass-through, keeping the logic intact without enforcing that condition.
  - Expiry Logic: The code counts consecutive bars where the leading condition remains true. If confirmations do not line up within the user-defined “Signal Expiry Candle Count,” the setup is abandoned and the signal does not trigger.
  - Alternation: An optional state ensures that long and short signals alternate. This can reduce repeated entries in the same direction without a clear reset.
- Finally, longCondition and shortCondition represent the actionable signals after expiry and alternation logic. These drive the label plotting and alert conditions.
Visualization
- Buy and Sell Labels: When longCondition or shortCondition confirm, the script plots annotated labels directly on the chart, making entries easy to see at a glance. The labels use color coding and clear text tags (“long” vs. “short”).
- Dashboard: A table summarizes the status of the leading indicator and all confirmations. Each row shows the indicator label and whether it passed (✔️) or failed (❌) on the current bar. This intensely practical UI helps you diagnose why a signal did or did not trigger, empowering faster strategy iteration and parameter tuning.
- Failed Confirmation Markers: If a setup expires (count exceeds the limit) and confirmations failed to align, the script can mark the chart with a small label and provide a tooltip listing which confirmations did not pass. It’s a helpful audit trail to understand missed trades or prevent “chasing” invalid signals.
- Data Window Values: The script outputs signal states to the data window, which can be useful for debugging or building composite conditions in multi-indicator templates.
Inputs and Parameters
- You control the indicator from a comprehensive input panel:
  - Setup: Signal expiry count, whether to enforce alternating signals, and whether to display labels and the dashboard (including position and size).
  - Leading Indicator: Choose the primary signal generator from the large list.
  - Per-Filter Toggles: For each confirmation, a respect... toggle enables or disables it. Many include sub-options (like MACD type, Stochastic mode, RSI mode, ADX variants, thresholds for choppiness/volatility, etc.) to fine-tune behavior.
  - Range Filter Settings: Choose type and behavior; select default vs. DW mode and smoothing. The underlying functions adjust band sizes using ATR, average change, standard deviation, or user-defined scales.
- Because everything is customizable, you can adapt the indicator to different assets, volatility regimes, and timeframes.
Alerts and Automation
- The script defines alert conditions tied to longCondition and shortCondition . You can set these alerts in your chart to trigger notifications or webhook calls for automated execution in external bots. The alert text is simple, and you can configure your own message template when creating alerts in the chart, including JSON payloads for algorithmic integration.
Typical Workflow
- Select a Leading Indicator aligned with your style. For trend following, Supertrend or SSL may be appropriate; for momentum, MACD or TSI; for range/trend-change detection, Range Filter, RQK, or Donchian.
- Add a few key Confirmation Filters that complement the leading signal. For example:
  - Pair Supertrend with EMA Filter and RSI MA Direction to ensure trend alignment and positive momentum.
  - Combine MACD Crossover with ADX/DMI and Volume Above MA to avoid signals in low-trend or low-liquidity conditions.
  - Use RQK with Choppiness Index and Damiani Volatility to only act when the market is trending and volatile enough.
- Set a sensible Signal Expiry Candle Count. Shorter expiry keeps entries timely and reduces lag; longer expiry captures setups that mature slowly.
- Observe the Dashboard during live markets to see which filters pass or fail, then iterate. Tighten or loosen thresholds and filter combinations as needed.
- For automation, turn on alerts for the final conditions and use webhook payloads to notify your trading robot.
Strengths and Practical Notes
- Flexibility: The indicator is a toolkit rather than a single rigid model. It lets you test different combinations rapidly and visualize outcomes immediately.
- Clarity: Labels, dashboard, and failed-confirmation markers make it easy to audit behavior and refine settings without digging into code.
- Robustness: The expiry and alternation options add discipline, avoiding the temptation to enter late or repeatedly in one direction without a reset.
- Modular Design: The logical gates (“respect…”) make the behavior transparent: if a filter is on, it must pass; if it’s off, the signal ignores it. This keeps reasoning clean.
- Avoiding Overfitting: Because you can stack many filters, it’s tempting to over-constrain signals. Start simple (one leading indicator and one or two confirmations). Add complexity only if it demonstrably improves your edge across varied market regimes.
Limitations and Recommendations
- No single configuration is universally optimal. Markets change; tune filters for the instrument and timeframe you trade and revisit settings periodically.
- Trend filters can underperform in choppy markets; likewise, momentum filters can false-trigger in quiet periods. Consider using Choppiness Index or Damiani to gate signals by regime.
- Use expiry wisely. Too short may miss good setups that need a few bars to confirm; too long may cause late entries. Balance responsiveness and accuracy.
- Always consider risk management externally (position sizing, stops, profit targets). The indicator focuses on signal quality; combining it with robust trade management methods will improve results.
Example Configurations
- Trend-Following Setup:
  - Leading: Supertrend uptrend for longs and downtrend for shorts.
  - Confirmations: EMA Filter (price above 200 EMA for long, below for short), ADX/DMI (trend strength above threshold with +DI/-DI alignment), Volume Above MA.
  - Expiry: 3–4 bars to keep entries timely.
  - Result: Strong bias toward sustained moves while avoiding weak trends and thin liquidity.
- Mean-Reversion to Momentum Crossover:
  - Leading: RSI exits from OB/OS zones (e.g., RSI leaves oversold for long and leaves overbought for short).
  - Confirmations: 2 EMA Cross (fast crossing slow in the same direction), MACD zero-line behavior for added momentum validation.
  - Expiry: 2–3 bars for responsive re-entry.
  - Result: Captures momentum transitions after short-term extremes, with extra confirmation to reduce head-fakes.
- Range Breakout Focus:
  - Leading: Range Filter Type 2 or Donchian Trend Ribbon to detect breakouts.
  - Confirmations: Damiani Volatility (avoid low-volatility false breaks), Choppiness Index (prefer trend-ready states), ROC positive/negative threshold.
  - Expiry: 1–3 bars to act on breakout windows.
  - Result: Better alignment to breakout dynamics, gating trades by volatility and regime.
Conclusion
- This indicator is a comprehensive, configurable framework that merges a chosen leading signal with an array of corroborating filters, disciplined expiry handling, and intuitive visualization. It’s designed to help you build high-quality entry signals tailored to your approach, whether that’s trend-following, breakout trading, momentum capturing, or a hybrid. By surfacing pass/fail states in a dashboard and allowing alert-based automation, it bridges the gap between discretionary analysis and systematic execution. With sensible parameter tuning and thoughtful filter selection, it can serve as a robust backbone for signal generation across diverse instruments and timeframes.
Momentum_EMABand📢 Reposting Notice 
I am reposting this script because my earlier submission was hidden due to description requirements under TradingView’s House Rules. This updated version fully explains the originality, the reason for combining these indicators, and how they work together. Follow me for future updates and refinements.
🆕 Momentum EMA Band, Rule-Based System
Momentum EMA Band is not just a mashup — it is a purpose-built trading tool for intraday traders and scalpers that integrates three complementary technical concepts into a single rules-based breakout & retest framework.
Originality comes from the specific sequence and interaction of these three filters:
Supertrend → Sets directional bias.
EMA Band breakout with retest logic → Times precise entries.
ADX filter → Confirms momentum strength and avoids noise.
This system is designed to filter out weak setups and false breakouts that standalone indicators often fail to avoid.
🔧 How the Indicator Works — Combined Logic
1️⃣ EMA Price Band — Dynamic Zone Visualization
Plots upper & lower EMA bands (default: 9-period EMA).
Green Band → Price above upper EMA = bullish momentum
Red Band → Price below lower EMA = bearish pressure
Yellow Band → Price within band = neutral zone
Acts as a consolidation zone and breakout trigger level.
2️⃣ Supertrend Overlay — Reliable Trend Confirmation
ATR-based Supertrend adapts to volatility:
Green Line = Uptrend bias
Red Line = Downtrend bias
Ensures trades align with the prevailing trend.
3️⃣ ADX-Based No-Trade Zone — Choppy Market Filter
Manual ADX calculation (default: length 14).
If ADX < threshold (default: 20) and price is inside EMA Band → gray background marks low-momentum zones.
 🧩 Why This Mashup Works 
 
 Supertrend confirms trend direction.
 EMA Band breakout & retest validates the breakout’s strength.
 ADX ensures the market has enough trend momentum.
 When all align, entries are higher probability and whipsaws are reduced.
 
 
 📈 Example Trade Walkthrough 
Scenario: 5-minute chart, ADX threshold = 20.
 
 Supertrend turns green → trend bias is bullish.
 Price consolidates inside the yellow EMA Band.
 ADX rises above 20 → trend momentum confirmed.
 Price closes above the green EMA Band after retesting the band as support.
 Entry triggered on candle close, stop below band, target based on risk-reward.
 Exit when Supertrend flips red or ADX momentum drops.
 
 
This sequence prevents premature entries, keeps trades aligned with trend, and avoids ranging markets.
🎯 Key Features
✅ Multi-layered confirmation for precision trading
✅ Built-in no-trade zone filter
✅ Fully customizable parameters
✅ Clean visuals for quick decision-making
⚠ Disclaimer: This is Version 1. Educational purposes only. Always use with risk management.
Bober XM v2.0# ₿ober XM v2.0 Trading Bot Documentation
**Developer's Note**: While our previous Bot 1.3.1 was removed due to guideline violations, this setback only fueled our determination to create something even better. Rising from this challenge, Bober XM 2.0 emerges not just as an update, but as a complete reimagining with multi-timeframe analysis, enhanced filters, and superior adaptability. This adversity pushed us to innovate further and deliver a strategy that's smarter, more agile, and more powerful than ever before. Challenges create opportunity - welcome to Cryptobeat's finest work yet.
## !!!!You need to tune it for your own pair and timeframe and retune it periodicaly!!!!!
## Overview
The ₿ober XM v2.0 is an advanced dual-channel trading bot with multi-timeframe analysis capabilities. It integrates multiple technical indicators, customizable risk management, and advanced order execution via webhook for automated trading. The bot's distinctive feature is its separate channel systems for long and short positions, allowing for asymmetric trade strategies that adapt to different market conditions across multiple timeframes.
### Key Features
- **Multi-Timeframe Analysis**: Analyze price data across multiple timeframes simultaneously
- **Dual Channel System**: Separate parameter sets for long and short positions
- **Advanced Entry Filters**: RSI, Volatility, Volume, Bollinger Bands, and KEMAD filters
- **Machine Learning Moving Average**: Adaptive prediction-based channels
- **Multiple Entry Strategies**: Breakout, Pullback, and Mean Reversion modes
- **Risk Management**: Customizable stop-loss, take-profit, and trailing stop settings
- **Webhook Integration**: Compatible with external trading bots and platforms
### Strategy Components
| Component | Description |
|---------|-------------|
| **Dual Channel Trading** | Uses either Keltner Channels or Machine Learning Moving Average (MLMA) with separate settings for long and short positions |
| **MLMA Implementation** | Machine learning algorithm that predicts future price movements and creates adaptive bands |
| **Pivot Point SuperTrend** | Trend identification and confirmation system based on pivot points |
| **Three Entry Strategies** | Choose between Breakout, Pullback, or Mean Reversion approaches |
| **Advanced Filter System** | Multiple customizable filters with multi-timeframe support to avoid false signals |
| **Custom Exit Logic** | Exits based on OBV crossover of its moving average combined with pivot trend changes |
### Note for Novice Users
This is a fully featured real trading bot and can be tweaked for any ticker — SOL is just an example. It follows this structure:
1. **Indicator** – gives the initial signal
2. **Entry strategy** – decides when to open a trade
3. **Exit strategy** – defines when to close it
4. **Trend confirmation** – ensures the trade follows the market direction
5. **Filters** – cuts out noise and avoids weak setups
6. **Risk management** – controls losses and protects your capital
To tune it for a different pair, you'll need to start from scratch:
1. Select the timeframe (candle size)
2. Turn off all filters and trend entry/exit confirmations
3. Choose a channel type, channel source and entry strategy
4. Adjust risk parameters
5. Tune long and short settings for the channel
6. Fine-tune the Pivot Point Supertrend and Main Exit condition OBV
This will generate a lot of signals and activity on the chart. Your next task is to find the right combination of filters and settings to reduce noise and tune it for profitability.
### Default Strategy values
Default values are tuned for: Symbol BITGET:SOLUSDT.P 5min candle
Filters are off by default: Try to play with it to understand how it works
 
## Configuration Guide
### General Settings
| Setting | Description | Default Value |
|---------|-------------|---------------|
| **Long Positions** | Enable or disable long trades | Enabled |
| **Short Positions** | Enable or disable short trades | Enabled |
| **Risk/Reward Area** | Visual display of stop-loss and take-profit zones | Enabled |
| **Long Entry Source** | Price data used for long entry signals | hl2 (High+Low/2) |
| **Short Entry Source** | Price data used for short entry signals | hl2 (High+Low/2) |
The bot allows you to trade long positions, short positions, or both simultaneously. Each direction has its own set of parameters, allowing for fine-tuned strategies that recognize the asymmetric nature of market movements.
### Multi-Timeframe Settings
1. **Enable Multi-Timeframe Analysis**: Toggle 'Enable Multi-Timeframe Analysis' in the Multi-Timeframe Settings section
2. **Configure Timeframes**: Set appropriate higher timeframes based on your trading style:
   - Timeframe 1: Default is now 15 minutes (intraday confirmation)
   - Timeframe 2: Default is 4 hours (trend direction)
3. **Select Sources per Indicator**: For each indicator (RSI, KEMAD, Volume, etc.), choose:
   - The desired timeframe (current, mtf1, or mtf2)
   - The appropriate price type (open, high, low, close, hl2, hlc3, ohlc4)
### Entry Strategies
- **Breakout**: Enter when price breaks above/below the channel
- **Pullback**: Enter when price pulls back to the channel
- **Mean Reversion**: Enter when price is extended from the channel
You can enable different strategies for long and short positions.
### Core Components
### Risk Management
- **Position Size**: Control risk with percentage-based position sizing
- **Stop Loss Options**:
  - Fixed: Set a specific price or percentage from entry
  - ATR-based: Dynamic stop-loss based on market volatility
  - Swing: Uses recent swing high/low points
- **Take Profit**: Multiple targets with percentage allocation
- **Trailing Stop**: Dynamic stop that follows price movement
## Advanced Usage Strategies
### Moving Average Type Selection Guide
- **SMA**: More stable in choppy markets, good for higher timeframes
- **EMA/WMA**: More responsive to recent price changes, better for entry signals
- **VWMA**: Adds volume weighting for stronger trends, use with Volume filter
- **HMA**: Balance between responsiveness and noise reduction, good for volatile markets
### Multi-Timeframe Strategy Approaches
- **Trend Confirmation**: Use higher timeframe RSI (mtf2) for overall trend, current timeframe for entries
- **Entry Precision**: Use KEMAD on current timeframe with volume filter on mtf1 
- **False Signal Reduction**: Apply RSI filter on mtf1 with strict KEMAD settings
### Market Condition Optimization
| Market Condition | Recommended Settings |
|------------------|----------------------|
| **Trending** | Use Breakout strategy with KEMAD filter on higher timeframe |
| **Ranging** | Use Mean Reversion with strict RSI filter (mtf1) |
| **Volatile** | Increase ATR multipliers, use HMA for moving averages |
| **Low Volatility** | Decrease noise parameters, use pullback strategy |
## Webhook Integration 
The strategy features a professional webhook system that allows direct connectivity to your exchange or trading platform of choice through third-party services like 3commas, Alertatron, or Autoview.
The webhook payload includes all necessary parameters for automated execution:
- Entry price and direction
- Stop loss and take profit levels
- Position size
- Custom identifier for webhook routing
## Performance Optimization Tips
1. **Start with Defaults**: Begin with the default settings for your timeframe before customizing
2. **Adjust One Component at a Time**: Make incremental changes and test the impact
3. **Match MA Types to Market Conditions**: Use appropriate moving average types based on the Market Condition Optimization table
4. **Timeframe Synergy**: Create logical relationships between timeframes (e.g., 5min chart with 15min and 4h higher timeframes)
5. **Periodic Retuning**: Markets evolve - regularly review and adjust parameters
## Common Setups
### Crypto Trend-Following
- MLMA with EMA or HMA
- Higher RSI thresholds (75/25)
- KEMAD filter on mtf1
- Breakout entry strategy
### Stock Swing Trading
- MLMA with SMA for stability
- Volume filter with higher threshold
- KEMAD with increased filter order
- Pullback entry strategy
### Forex Scalping
- MLMA with WMA and lower noise parameter
- RSI filter on current timeframe
- Use highest timeframe for trend direction only
- Mean Reversion strategy
## Webhook Configuration
- **Benefits**: 
  - Automated trade execution without manual intervention
  - Immediate response to market conditions
  - Consistent execution of your strategy
  
- **Implementation Notes**:
  - Requires proper webhook configuration on your exchange or platform
  - Test thoroughly with small position sizes before full deployment
  - Consider latency between signal generation and execution
### Backtesting Period
Define a specific historical period to evaluate the bot's performance:
| Setting | Description | Default Value |
|---------|-------------|---------------|
| **Start Date** | Beginning of backtest period | January 1, 2025 |
| **End Date** | End of backtest period | December 31, 2026 |
- **Best Practice**: Test across different market conditions (bull markets, bear markets, sideways markets)
- **Limitation**: Past performance doesn't guarantee future results
## Entry and Exit Strategies
### Dual-Channel System
A key innovation of the Bober XM is its dual-channel approach:
- **Independent Parameters**: Each trade direction has its own channel settings
- **Asymmetric Trading**: Recognizes that markets often behave differently in uptrends versus downtrends
- **Optimized Performance**: Fine-tune settings for both bullish and bearish conditions
This approach allows the bot to adapt to the natural asymmetry of markets, where uptrends often develop gradually while downtrends can be sharp and sudden.
### Channel Types
#### 1. Keltner Channels
Traditional volatility-based channels using EMA and ATR:
| Setting | Long Default | Short Default |
|---------|--------------|---------------|
| **EMA Length** | 37 | 20 |
| **ATR Length** | 13 | 17 |
| **Multiplier** | 1.4 | 1.9 |
| **Source** | low | high |
- **Strengths**: 
  - Reliable in trending markets
  - Less prone to whipsaws than Bollinger Bands
  - Clear visual representation of volatility
  
- **Weaknesses**:
  - Can lag during rapid market changes
  - Less effective in choppy, non-trending markets
#### 2. Machine Learning Moving Average (MLMA)
Advanced predictive model using kernel regression (RBF kernel):
| Setting | Description | Options |
|---------|-------------|--------|
| **Source MA** | Price data used for MA calculations | Any price source (low/high/close/etc.) |
| **Moving Average Type** | Type of MA algorithm for calculations | SMA, EMA, WMA, VWMA, RMA, HMA |
| **Trend Source** | Price data used for trend determination | Any price source (close default) |
| **Window Size** | Historical window for MLMA calculations | 5+ (default: 16) |
| **Forecast Length** | Number of bars to forecast ahead | 1+ (default: 3) |
| **Noise Parameter** | Controls smoothness of prediction | 0.01+ (default: ~0.43) |
| **Band Multiplier** | Multiplier for channel width | 0.1+ (default: 0.5-0.6) |
- **Strengths**:
  - Predictive rather than reactive
  - Adapts quickly to changing market conditions
  - Better at identifying trend reversals early
  
- **Weaknesses**:
  - More computationally intensive
  - Requires careful parameter tuning
  - Can be sensitive to input data quality
### Entry Strategies
| Strategy | Description | Ideal Market Conditions |
|----------|-------------|-------------------------|
| **Breakout** | Enters when price breaks through channel bands, indicating strong momentum | High volatility, emerging trends |
| **Pullback** | Enters when price retraces to the middle band after testing extremes | Established trends with regular pullbacks |
| **Mean Reversion** | Enters at channel extremes, betting on a return to the mean | Range-bound or oscillating markets |
#### Breakout Strategy (Default)
- **Implementation**: Enters long when price crosses above the upper band, short when price crosses below the lower band
- **Strengths**: Captures strong momentum moves, performs well in trending markets
- **Weaknesses**: Can lead to late entries, higher risk of false breakouts
- **Optimization Tips**: 
  - Increase channel multiplier for fewer but more reliable signals
  - Combine with volume confirmation for better accuracy
#### Pullback Strategy
- **Implementation**: Enters long when price pulls back to middle band during uptrend, short during downtrend pullbacks
- **Strengths**: Better entry prices, lower risk, higher probability setups
- **Weaknesses**: Misses some strong moves, requires clear trend identification
- **Optimization Tips**:
  - Use with trend filters to confirm overall direction
  - Adjust middle band calculation for market volatility
#### Mean Reversion Strategy
- **Implementation**: Enters long at lower band, short at upper band, expecting price to revert to the mean
- **Strengths**: Excellent entry prices, works well in ranging markets
- **Weaknesses**: Dangerous in strong trends, can lead to fighting the trend
- **Optimization Tips**:
  - Implement strong trend filters to avoid counter-trend trades
  - Use smaller position sizes due to higher risk nature
### Confirmation Indicators
#### Pivot Point SuperTrend
Combines pivot points with ATR-based SuperTrend for trend confirmation:
| Setting | Default Value |
|---------|---------------|
| **Pivot Period** | 25 |
| **ATR Factor** | 2.2 |
| **ATR Period** | 41 |
- **Function**: Identifies significant market turning points and confirms trend direction
- **Implementation**: Requires price to respect the SuperTrend line for trade confirmation
#### Weighted Moving Average (WMA)
Provides additional confirmation layer for entries:
| Setting | Default Value |
|---------|---------------|
| **Period** | 15 |
| **Source** | ohlc4 (average of Open, High, Low, Close) |
- **Function**: Confirms trend direction and filters out low-quality signals
- **Implementation**: Price must be above WMA for longs, below for shorts
### Exit Strategies
#### On-Balance Volume (OBV) Based Exits
Uses volume flow to identify potential reversals:
| Setting | Default Value |
|---------|---------------|
| **Source** | ohlc4 |
| **MA Type** | HMA (Options: SMA, EMA, WMA, RMA, VWMA, HMA) |
| **Period** | 22 |
- **Function**: Identifies divergences between price and volume to exit before reversals
- **Implementation**: Exits when OBV crosses its moving average in the opposite direction
- **Customizable MA Type**: Different MA types provide varying sensitivity to OBV changes:
  - **SMA**: Traditional simple average, equal weight to all periods
  - **EMA**: More weight to recent data, responds faster to price changes
  - **WMA**: Weighted by recency, smoother than EMA
  - **RMA**: Similar to EMA but smoother, reduces noise
  - **VWMA**: Factors in volume, helpful for OBV confirmation
  - **HMA**: Reduces lag while maintaining smoothness (default)
#### ADX Exit Confirmation
Uses Average Directional Index to confirm trend exhaustion:
| Setting | Default Value |
|---------|---------------|
| **ADX Threshold** | 35 |
| **ADX Smoothing** | 60 |
| **DI Length** | 60 |
- **Function**: Confirms trend weakness before exiting positions
- **Implementation**: Requires ADX to drop below threshold or DI lines to cross
## Filter System
### RSI Filter
- **Function**: Controls entries based on momentum conditions
- **Parameters**:
  - Period: 15 (default)
  - Overbought level: 71
  - Oversold level: 23
  - Multi-timeframe support: Current, MTF1 (15min), or MTF2 (4h)
  - Customizable price source (open, high, low, close, hl2, hlc3, ohlc4)
- **Implementation**: Blocks long entries when RSI > overbought, short entries when RSI < oversold
### Volatility Filter
- **Function**: Prevents trading during excessive market volatility
- **Parameters**:
  - Measure: ATR (Average True Range)
  - Period: Customizable (default varies by timeframe)
  - Threshold: Adjustable multiplier
  - Multi-timeframe support
  - Customizable price source
- **Implementation**: Blocks trades when current volatility exceeds threshold × average volatility
### Volume Filter
- **Function**: Ensures adequate market liquidity for trades
- **Parameters**:
  - Threshold: 0.4× average (default)
  - Measurement period: 5 (default)
  - Moving average type: Customizable (HMA default)
  - Multi-timeframe support
  - Customizable price source
- **Implementation**: Requires current volume to exceed threshold × average volume
### Bollinger Bands Filter
- **Function**: Controls entries based on price relative to statistical boundaries
- **Parameters**:
  - Period: Customizable
  - Standard deviation multiplier: Adjustable
  - Moving average type: Customizable
  - Multi-timeframe support
  - Customizable price source
- **Implementation**: Can require price to be within bands or breaking out of bands depending on strategy
### KEMAD Filter (Kalman EMA Distance)
- **Function**: Advanced trend confirmation using Kalman filter algorithm
- **Parameters**:
  - Process Noise: 0.35 (controls smoothness)
  - Measurement Noise: 24 (controls reactivity)
  - Filter Order: 6 (higher = more smoothing)
  - ATR Length: 8 (for bandwidth calculation)
  - Upper Multiplier: 2.0 (for long signals)
  - Lower Multiplier: 2.7 (for short signals)
  - Multi-timeframe support
  - Customizable visual indicators
- **Implementation**: Generates signals based on price position relative to Kalman-filtered EMA bands
## Risk Management System
### Position Sizing
Automatically calculates position size based on account equity and risk parameters:
| Setting | Default Value |
|---------|---------------|
| **Risk % of Equity** | 50% |
- **Implementation**: 
  - Position size = (Account equity × Risk %) ÷ (Entry price × Stop loss distance)
  - Adjusts automatically based on volatility and stop placement
  
- **Best Practices**:
  - Start with lower risk percentages (1-2%) until strategy is proven
  - Consider reducing risk during high volatility periods
### Stop-Loss Methods
Multiple stop-loss calculation methods with separate configurations for long and short positions:
| Method | Description | Configuration |
|--------|-------------|---------------|
| **ATR-Based** | Dynamic stops based on volatility | ATR Period: 14, Multiplier: 2.0 |
| **Percentage** | Fixed percentage from entry | Long: 1.5%, Short: 1.5% |
| **PIP-Based** | Fixed currency unit distance | 10.0 pips |
- **Implementation Notes**:
  - ATR-based stops adapt to changing market volatility
  - Percentage stops maintain consistent risk exposure
  - PIP-based stops provide precise control in stable markets
### Trailing Stops
Locks in profits by adjusting stop-loss levels as price moves favorably:
| Setting | Default Value |
|---------|---------------|
| **Stop-Loss %** | 1.5% |
| **Activation Threshold** | 2.1% |
| **Trailing Distance** | 1.4% |
- **Implementation**: 
  - Initial stop remains fixed until profit reaches activation threshold
  - Once activated, stop follows price at specified distance
  - Locks in profit while allowing room for normal price fluctuations
### Risk-Reward Parameters
Defines the relationship between risk and potential reward:
| Setting | Default Value |
|---------|---------------|
| **Risk-Reward Ratio** | 1.4 |
| **Take Profit %** | 2.4% |
| **Stop-Loss %** | 1.5% |
- **Implementation**: 
  - Take profit distance = Stop loss distance × Risk-reward ratio
  - Higher ratios require fewer winning trades for profitability
  - Lower ratios increase win rate but reduce average profit
### Filter Combinations
The strategy allows for simultaneous application of multiple filters:
- **Recommended Combinations**:
  - Trending markets: RSI + KEMAD filters
  - Ranging markets: Bollinger Bands + Volatility filters
  - All markets: Volume filter as minimum requirement
- **Performance Impact**:
  - Each additional filter reduces the number of trades
  - Quality of remaining trades typically improves
  - Optimal combination depends on market conditions and timeframe
  
### Multi-Timeframe Filter Applications
| Filter Type | Current Timeframe | MTF1 (15min) | MTF2 (4h) |
|-------------|-------------------|-------------|------------|
| RSI | Quick entries/exits | Intraday trend | Overall trend |
| Volume | Immediate liquidity | Sustained support | Market participation |
| Volatility | Entry timing | Short-term risk | Regime changes |
| KEMAD | Precise signals | Trend confirmation | Major reversals |
## Visual Indicators and Chart Analysis
The bot provides comprehensive visual feedback on the chart:
- **Channel Bands**: Keltner or MLMA bands showing potential support/resistance
- **Pivot SuperTrend**: Colored line showing trend direction and potential reversal points
- **Entry/Exit Markers**: Annotations showing actual trade entries and exits
- **Risk/Reward Zones**: Visual representation of stop-loss and take-profit levels
These visual elements allow for:
- Real-time strategy assessment
- Post-trade analysis and optimization
- Educational understanding of the strategy logic
## Implementation Guide
### TradingView Setup
1. Load the script in TradingView Pine Editor
2. Apply to your preferred chart and timeframe
3. Adjust parameters based on your trading preferences
4. Enable alerts for webhook integration
### Webhook Integration
1. Configure webhook URL in TradingView alerts
2. Set up receiving endpoint on your trading platform
3. Define message format matching the bot's output
4. Test with small position sizes before full deployment
### Optimization Process
1. Backtest across different market conditions
2. Identify parameter sensitivity through multiple tests
3. Focus on risk management parameters first
4. Fine-tune entry/exit conditions based on performance metrics
5. Validate with out-of-sample testing
## Performance Considerations
### Strengths
- Adaptability to different market conditions through dual channels
- Multiple layers of confirmation reducing false signals
- Comprehensive risk management protecting capital
- Machine learning integration for predictive edge
### Limitations
- Complex parameter set requiring careful optimization
- Potential over-optimization risk with so many variables
- Computational intensity of MLMA calculations
- Dependency on proper webhook configuration for execution
### Best Practices
- Start with conservative risk settings (1-2% of equity)
- Test thoroughly in demo environment before live trading
- Monitor performance regularly and adjust parameters
- Consider market regime changes when evaluating results
## Conclusion
The ₿ober XM v2.0 represents a significant evolution in trading strategy design, combining traditional technical analysis with machine learning elements and multi-timeframe analysis. The core strength of this system lies in its adaptability and recognition of market asymmetry.
### Market Asymmetry and Adaptive Approach
The strategy acknowledges a fundamental truth about markets: bullish and bearish phases behave differently and should be treated as distinct environments. The dual-channel system with separate parameters for long and short positions directly addresses this asymmetry, allowing for optimized performance regardless of market direction.
### Targeted Backtesting Philosophy
It's counterproductive to run backtests over excessively long periods. Markets evolve continuously, and strategies that worked in previous market regimes may be ineffective in current conditions. Instead:
- Test specific market phases separately (bull markets, bear markets, range-bound periods)
- Regularly re-optimize parameters as market conditions change
- Focus on recent performance with higher weight than historical results
- Test across multiple timeframes to ensure robustness
### Multi-Timeframe Analysis as a Game-Changer
The integration of multi-timeframe analysis fundamentally transforms the strategy's effectiveness:
- **Increased Safety**: Higher timeframe confirmations reduce false signals and improve trade quality
- **Context Awareness**: Decisions made with awareness of larger trends reduce adverse entries
- **Adaptable Precision**: Apply strict filters on lower timeframes while maintaining awareness of broader conditions
- **Reduced Noise**: Higher timeframe data naturally filters market noise that can trigger poor entries
The ₿ober XM v2.0 provides traders with a framework that acknowledges market complexity while offering practical tools to navigate it. With proper setup, realistic expectations, and attention to changing market conditions, it delivers a sophisticated approach to systematic trading that can be continuously refined and optimized.
ootaLibrary   "oota" 
Collection of all custom and enhanced TA indicators - Object oriented methods implementation
 method tr(c, useTrueRange) 
  returns true range of the candle
  Namespace types: Candle
  Parameters:
     c (Candle) : Candle object containing ohlc data
     useTrueRange (bool) : Use true range for atr calculation instead of just high/low difference
 method ma(maType, length, source) 
  returns custom moving averages
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     source (float) : Moving Average Source
  Returns: moving average for the given type and length
 method atr(maType, length, useTrueRange, c) 
  returns ATR with custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     useTrueRange (bool) : Use true range for atr calculation instead of just high/low difference
     c (Candle) : Candle object containing ohlc
  Returns: ATR for the given moving average type and length
 method atrpercent(maType, length, useTrueRange, c) 
  returns ATR as percentage of close price
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     useTrueRange (bool) : Use true range for atr calculation instead of just high/low difference
     c (Candle) : Candle object containing ohlc
  Returns: ATR as percentage of close price for the given moving average type and length
 method bb(maType, length, multiplier, sticky, c) 
  returns Bollinger band for custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     multiplier (float) : Standard Deviation multiplier
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
     c (Candle) : Candle object containing ohlc
  Returns: Bollinger band with custom moving average for given source, length and multiplier
 method bbw(maType, length, multiplier, sticky, c) 
  returns Bollinger bandwidth for custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     multiplier (float) : Standard Deviation multiplier
     sticky (simple bool) : sticky boundaries which will only change when value is outside boundary.
     c (Candle) : Candle object containing ohlc
  Returns: Bollinger Bandwidth for custom moving average for given source, length and multiplier
 method bpercentb(maType, length, multiplier, sticky, c) 
  returns Bollinger Percent B for custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     multiplier (float) : Standard Deviation multiplier
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
     c (Candle) : Candle object containing ohlc
  Returns: Bollinger Percent B for custom moving average for given source, length and multiplier
 method kc(maType, length, multiplier, useTrueRange, sticky, c) 
  returns Keltner Channel for custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     multiplier (float) : Standard Deviation multiplier
     useTrueRange (simple bool) : - if set to false, uses high-low.
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
     c (Candle) : Candle object containing ohlc
  Returns: Keltner Channel for custom moving average for given souce, length and multiplier
 method kcw(maType, length, multiplier, useTrueRange, sticky, c) 
  returns Keltner Channel Width with custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     multiplier (float) : Standard Deviation multiplier
     useTrueRange (simple bool) : - if set to false, uses high-low.
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
     c (Candle) : Candle object containing ohlc
  Returns: Keltner Channel Width for custom moving average
 method kpercentk(maType, length, multiplier, useTrueRange, sticky, c) 
  returns Keltner Channel Percent K Width with custom moving average
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom series type
     length (simple int) : Moving Average Length
     multiplier (float) : Standard Deviation multiplier
     useTrueRange (simple bool) : - if set to false, uses high-low.
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
     c (Candle) : Candle object containing ohlc
  Returns: Keltner Percent K for given moving average, source, length and multiplier
 method dc(c, length, sticky) 
  returns Custom Donchian Channel
  Namespace types: Candle
  Parameters:
     c (Candle) : Candle object containing ohlc
     length (simple int) : - donchian channel length
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
  Returns: Donchian channel
 method dcw(c, length, sticky) 
  returns Donchian Channel Width
  Namespace types: Candle
  Parameters:
     c (Candle) : Candle object containing ohlc
     length (simple int) : - donchian channel length
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
  Returns: Donchian channel width
 method dpercentd(c, length, sticky) 
  returns Donchian Channel Percent of price
  Namespace types: Candle
  Parameters:
     c (Candle) : Candle object containing ohlc
     length (simple int) : - donchian channel length
     sticky (simple bool) : - sticky boundaries which will only change when value is outside boundary.
  Returns: Donchian channel Percent D
 method supertrend(maType, length, multiplier, useTrueRange, waitForClose, delayed, c) 
  supertrend Simple supertrend based on atr but also takes into consideration of custom MA Type, sources
  Namespace types: simple CustomSeries
  Parameters:
     maType (simple CustomSeries) : Custom Series
     length (simple int) : ATR Length
     multiplier (simple float) : ATR Multiplier
     useTrueRange (simple bool) : - if set to false, uses high-low.
     waitForClose (simple bool) : : Considers source for direction change crossover if checked. Else, uses highSource and lowSource.
     delayed (simple bool) : : if set to true lags supertrend atr stop based on target levels.
     c (Candle) : Candle object containing ohlc
  Returns: dir : Supertrend direction
supertrend : BuyStop if direction is 1 else SellStop
 method oscillatorRange(seriesType, source, highlowLength, rangeLength, sticky) 
  oscillatorRange - returns Custom overbought/oversold areas for an oscillator input
  Namespace types: simple CustomSeries
  Parameters:
     seriesType (simple CustomSeries) : - Custom series type
     source (float) : - Osillator source such as RSI, COG etc.
     highlowLength (simple int) : - length on which highlow of the oscillator is calculated
     rangeLength (simple int) : - length used for calculating oversold/overbought range - usually same as oscillator length
     sticky (simple bool) : - overbought, oversold levels won't change unless crossed
  Returns: Dynamic overbought and oversold range for oscillator input
 method oscillator(oscillatorType, length, shortLength, longLength, c) 
  oscillator - returns Choice of oscillator with custom overbought/oversold range
  Namespace types: simple OscillatorType
  Parameters:
     oscillatorType (simple OscillatorType) : OscillatorType object
     length (simple int) : - Oscillator length - not used for TSI
     shortLength (simple int) : - shortLength only used for TSI
     longLength (simple int) : - longLength only used for TSI
     c (Candle) : Candle object containing ohlc
  Returns: Oscillator value
 method oscillatorWithRange(oscillatorType, length, shortLength, longLength, seriesType, highlowLength, sticky, c) 
  oscillatorWithRange - returns Choice of oscillator with custom overbought/oversold range
  Namespace types: simple OscillatorType
  Parameters:
     oscillatorType (simple OscillatorType) : OscillatorType object
     length (simple int) : - Oscillator length - not used for TSI
     shortLength (simple int) : - shortLength only used for TSI
     longLength (simple int) : - longLength only used for TSI
     seriesType (simple CustomSeries) : - CustomSeries enum type
     highlowLength (simple int) : - length on which highlow of the oscillator is calculated
     sticky (simple bool) : - overbought, oversold levels won't change unless crossed
     c (Candle) : Candle object containing ohlc
  Returns: Oscillator value along with dynamic overbought and oversold range for oscillator input
 Candle 
  Custom candle object
  Fields:
     o (series float) : open
     h (series float) : high
     l (series float) : low
     c (series float) : close
     barindex (series int) : bar_index
     bartime (series int) : time
     bartimeclose (series int) : time_close
     v (series float) : volume
Hierarchical + K-Means Clustering Strategy===== USER GUIDE =====
Hierarchical + K-Means Clustering Strategy
OVERVIEW:
This strategy combines hierarchical clustering and K-means algorithms to analyze market volatility patterns
and generate trading signals. It uses a modified SuperTrend indicator with ATR-based volatility clustering
to identify potential trend changes and market conditions.
KEY FEATURES:
- Advanced volatility analysis using hierarchical clustering and K-means algorithms
- Modified SuperTrend indicator for trend identification
- Multiple filter options including moving average and ADX trend strength
- Volume-based exit mechanism to protect profits
- Customizable appearance settings
SETTINGS EXPLANATION:
1. SuperTrend Settings:
   - ATR Length: Period for ATR calculation (default: 11)
   - SuperTrend Factor: Multiplier for ATR to determine trend bands (default: 3)
2. Hierarchical Clustering Settings:
   - Training Data Length: Number of bars used for clustering analysis (default: 200)
3. Appearance Settings:
   - Transparency 1 & 2: Control the opacity of trend lines and fills
   - Bullish/Bearish Color: Colors for uptrend and downtrend visualization
4. Time Settings:
   - Start Year/Month: Define when the strategy should start executing trades
5. Filter Settings:
   - Moving Average Filter: Uses SMA to filter trades (only enter when price is on correct side of MA)
   - Trend Strength Filter: Uses ADX to ensure trades are taken in strong trend conditions
6. Volume Stop Loss Settings:
   - Volume Ratio Threshold: Controls sensitivity of volume-based exits
   - Monitoring Delay Bars: Number of bars to wait before monitoring volume for exit signals
HOW TO USE:
1. Apply the indicator to your chart
2. Adjust settings according to your trading preferences and timeframe
3. Long signals appear when price crosses above the SuperTrend line (▲k marker)
4. Short signals appear when price crosses below the SuperTrend line (▼k marker)
5. The strategy automatically manages exits based on volume balance conditions
INTERPRETATION:
- Green line/area: Bullish trend - consider long positions
- Red line/area: Bearish trend - consider short positions
- Yellow line: Moving average for additional trend confirmation
- Volume balance exits occur when buying/selling pressure equalizes
RECOMMENDED TIMEFRAMES:
This strategy works best on 1H, 4H, and daily charts for most markets.
For highly volatile assets, shorter timeframes may also be effective.
RISK MANAGEMENT:
Always use proper position sizing and consider setting additional stop losses
beyond the strategy's built-in exit mechanisms.
===== END OF USER GUIDE =====
Kalman Step Signals [AlgoAlpha]Take your trading to the next level with the Kalman Step Signals indicator by AlgoAlpha! This advanced tool combines the power of Kalman Filtering and the Supertrend indicator, offering a unique perspective on market trends and price movements. Designed for traders who seek clarity and precision in identifying trend shifts and potential trade entries, this indicator is packed with customizable features to suit your trading style.
 Key Features 
 
 🔍  Kalman Filter Smoothing : Dynamically smooths price data with user-defined parameters for Alpha, Beta, and Period, optimizing responsiveness and trend clarity.
 📊  Supertrend Overlay : Incorporates a classic Supertrend indicator to provide clear visual cues for trend direction and potential reversals.
 🎨  Customizable Appearance : Adjust colors for bullish and bearish trends, along with optional exit bands for more nuanced analysis.
 🔔  Smart Alerts : Detect key moments like trend changes or rejection entries for timely trading decisions.
 📈  Advanced Visualization : Includes optional entry signals, exit bands, and rejection markers to pinpoint optimal trading opportunities.
 
 How to Use 
 Add the Indicator : Add the script to your TradingView favorites. Customize inputs like Kalman parameters (Alpha, Beta, Period) and Supertrend settings (Factor, ATR Period) based on your trading strategy.
  
 Interpret the Signals : Watch for trend direction changes using Supertrend lines and directional markers. Utilize rejection entries to identify price rejections at trendlines for precision entry points.
  
 Set Alerts : Enable the built-in alert conditions for trend changes or rejection entries to act swiftly on trading opportunities without constant chart monitoring.
  
 How It Works 
The indicator leverages a Kalman Filter to smooth raw price data, balancing responsiveness and noise reduction using user-controlled parameters. This refined price data is then fed into a Supertrend calculation, combining ATR-based volatility analysis with dynamic upper and lower bands. The result is a clear and reliable trend-detection system. Additionally, it features rejection markers for bullish and bearish reversals when prices reject the trendline, along with exit bands to visualize potential price targets. The integration of customizable alerts ensures traders never miss critical market moves.
Add the Kalman Step Signals to your TradingView charts today and enjoy a smarter, more efficient trading experience! 🚀🌟
Auto Signal Buy/SellAuto Signal Buy/Sell with Time Filter and Dynamic ZLEMA (GMT+2) 🌟  
Are you looking for an indicator that combines efficiency and simplicity while integrating advanced elements like SuperTrend, ZLEMA (Zero Lag EMA), and a MACD DEMA for clear and precise buy/sell signals? 📈 Introducing Auto Signal Buy/Sell, the ultimate indicator designed for intraday and swing traders, optimized for market hours in GMT+2.
🛠️ Key Features:  
- **Advanced SuperTrend**: Follow the dominant trend with a robust SuperTrend, adjustable to your preferences (customizable multiplier and period).
- **Dynamic ZLEMA**: Get a zero-lag EMA curve with a visual signal. Additionally, the ZLEMA turns blue when it’s nearly flat, helping you easily spot market consolidation phases.
- **MACD DEMA**: An enhanced version of the traditional MACD, using the Double EMA to capture more responsive buy/sell cross signals. 📊
- **Buy/Sell Signals**: Visual arrows clearly indicate potential entry and exit points on your chart, filtered by MACD crossovers and the SuperTrend trend.
- **Smart Time Filter (GMT+2)**: This script adapts to trading hours (customizable) and only displays signals during trading hours. The background turns light blue when the market is closed, preventing confusion during inactivity periods. 🕒
⚙️ Full Customization:  
- Adjustable trading hours (default 9 AM to 5 PM in GMT+2) with dynamic background indicating when markets are closed.
- Flexible settings for SuperTrend, ZLEMA, and MACD DEMA to suit any strategy.
🎯 Why Choose This Indicator?  
- Optimized for maximum precision with advanced algorithms like ZLEMA and DEMA.
- Easy to use: it provides clear, visual signals directly on the chart—no need to decipher complex indicators.
- A complete intraday and swing indicator that combines trend analysis and signal filtering with precise market hours.
🚀 Boost Your Trading!  
Add this indicator to your toolkit and enhance your decision-making. Thanks to its intuitive interface and clear visual signals, you can trade with confidence. 💡
Don't forget to like 👍 and comment if you find this indicator useful! Your feedback helps us continue improving such tools. 🚀
📌 How to Use:  
1. Add the indicator to your chart.  
2. Adjust the SuperTrend and ZLEMA settings to suit your needs.  
3. Follow the buy/sell signals and watch for the light blue background outside of trading hours.  
4. Trade effectively and stay in control, even during consolidation phases.
Double AI Super Trend Trading - Strategy [PresentTrading]█ Introduction and How It is Different
The Double AI Super Trend Trading Strategy is a cutting-edge approach that leverages the power of not one, but two AI algorithms, in tandem with the SuperTrend technical indicator. The strategy aims to provide traders with enhanced precision in market entry and exit points. It is designed to adapt to market conditions dynamically, offering the flexibility to trade in both bullish and bearish markets.
*The KNN part is mainly referred from @Zeiierman.
BTCUSD 8hr performance
  
ETHUSD 8hr performance
  
█ Strategy, How It Works: Detailed Explanation
1. SuperTrend Calculation
The SuperTrend is a popular indicator that captures market trends through a combination of the Volume-Weighted Moving Average (VWMA) and the Average True Range (ATR). This strategy utilizes two sets of SuperTrend calculations with varying lengths and factors to capture both short-term and long-term market trends.
2. KNN Algorithm
The strategy employs k-Nearest Neighbors (KNN) algorithms, which are supervised machine learning models. Two sets of KNN algorithms are used, each focused on different lengths of historical data and number of neighbors. The KNN algorithms classify the current SuperTrend data point as bullish or bearish based on the weighted sum of the labels of the k closest historical data points.
3. Signal Generation
Based on the KNN classifications and the SuperTrend indicator, the strategy generates signals for the start of a new trend and the continuation of an existing trend.
4. Trading Logic
The strategy uses these signals to enter long or short positions. It also incorporates dynamic trailing stops for exit conditions.
Local picture
  
█ Trade Direction
The strategy allows traders to specify their trading direction: long, short, or both. This enables the strategy to be versatile and adapt to various market conditions.
█ Usage
ToolTips: Comprehensive tooltips are provided for each parameter to guide the user through the customization process.
Inputs: Traders can customize numerous parameters including the number of neighbors in KNN, ATR multiplier, and types of moving averages.
Plotting: The strategy also provides visual cues on the chart to indicate bullish or bearish trends.
Order Execution: Based on the generated signals, the strategy will execute buy or sell orders automatically.
█ Default Settings
The default settings are configured to offer a balanced approach suitable for most scenarios:
Initial Capital: $10,000
Default Quantity Type: 10% of equity
Commission: 0.1%
Slippage: 1
Currency: USD
These settings can be modified to suit various trading styles and asset classes.
Combined Strategy Trading Bot (RSI ADX 20SMA)Trading Bot V1, This code implements a combined trading strategy that uses several indicators and strategies to make buy and sell decisions in the market. The code is written in Pine Script™, which is a programming language used in the TradingView platform. By BraelonWhitfield.Eth
The strategy uses the Average Directional Movement Index (ADX) and the Pine SuperTrend indicator to identify trends and price movements in the market. The SuperTrend indicator is a popular technical analysis tool that helps to identify the direction of the current trend and provides entry and exit points for trades.
The strategy also uses the Relative Strength Index (RSI) to identify overbought and oversold conditions in the market. The RSI is a momentum indicator that measures the speed and change of price movements in the market.
The first part of the code defines the inputs for the ADX and DI Length, which are used to calculate the ADX and DI values. The dirmov() function is used to calculate the positive and negative directional indicators (plusDM and minusDM) based on the high and low prices. The truerange variable is then calculated using the True Range (TR) formula. Finally, the plus and minus variables are calculated using the smoothed moving average of the plusDM and minusDM values.
The adx() function is then used to calculate the ADX values based on the plus and minus variables. The Pine SuperTrend indicator is defined using the pine_supertrend() function. This function uses the high-low average (hl2) and the Average True Range (ATR) to calculate the upper and lower bands for the indicator. The direction of the current trend is then determined based on whether the current price is above or below the upper or lower bands.
The RSI values are then calculated using the ta.rsi() function, with the inputs for the close price and the RSI period. The overbought and oversold conditions are defined using the OB and OS inputs, which specify the threshold values for the RSI. The upTrend and downTrend variables are defined based on the direction of the Pine SuperTrend indicator.
The next part of the code defines the 20-period Simple Moving Average (SMA) using the ta.sma() function. The os and ob variables are then calculated based on the RSI values and the OB and OS inputs. The strategy.entry() function is used to define the buy and sell orders based on the upTrend and downTrend variables, as well as the Pine SuperTrend indicator, the 20-period SMA, and the os variable.
The final part of the code defines the Channel Breakout Strategy using the ta.highest() and ta.lowest() functions to calculate the upper and lower bounds of the channel. The strategy.entry() function is then used to define the buy and sell orders based on whether the current price is above or below the upper or lower bounds.
In summary, this code implements a combined trading strategy that uses several indicators and strategies to make buy and sell decisions in the market. The strategy is designed to identify trends and price movements in the market, as well as overbought and oversold conditions, to provide entry and exit points for trades. The strategy uses the Pine SuperTrend indicator, the ADX and DI indicators, the RSI, and the 20-period SMA, as well as the Channel Breakout Strategy to make informed trading decisions.
Multi-Timeframe (MTF) Dashboard by RiTzMulti-Timeframe Dashboard
Shows values of different Indiactors on Multiple-Timeframes for the selected script/symbol
VWAP : if LTP is trading above VWAP then Bullish else if LTP is trading below VWAP then Bearish.
ST(21,1) : if LTP is trading above Supertrend (21,1) then Bullish , else if LTP is trading below Supertrend (21,1) then Bearish.
ST(14,2) : if LTP is trading above Supertrend (14,2) then Bullish , else if LTP is trading below Supertrend (14,2) then Bearish.
ST(10,3) : if LTP is trading above Supertrend (10,3) then Bullish , else if LTP is trading below Supertrend (10,3) then Bearish.
RSI(14) : Shows value of RSI (14) for the current timeframe.
ADX : if ADX is > 75 and DI+ > DI- then "Bullish ++".
	  if ADX is < 75 but >50 and DI+ > DI- then "Bullish +".
	  if ADX is < 50 but > 25 and DI+ > DI- then "Bullish".
	  if ADX is above 75 and DI- > DI+ then "Bearish ++".
	  if ADX is < 75 but > 50 and DI- > DI+ then "Bearish+".
	  if ADX is < 50 but > 25 and DI- > DI+ then "Bearish".
	  if ADX is < 25 then "Neutral".
MACD : if MACD line is above Signal Line then "Bullish", else if MACD line is below Signal Line then "Bearish".
	   
PH-PL : "< PH > PL" means LTP is trading between Previous Timeframes High(PH) & Previous Timeframes Low(PL) which indicates Rangebound-ness.
		  "> PH" means LTP is trading above Previous Timeframes High(PH) which indicates Bullish-ness.
		  "< PL" means LTP is trading below Previous Timeframes Low(PL) which indicates Bearish-ness.
Alligator : If Lips > Teeth > Jaw then Bullish.
			If Lips < Teeth < Jaw then Bearish.
			If Lips > Teeth and Teeth < Jaw then Neutral/Sleeping.
			If Lips < Teeth and Teeth > Jaw then Neutral/Sleeping.
Settings :
Style settings :-
Dashboard Location: Location of the dashboard on the chart
Dashboard Size: Size of the dashboard on the chart
Bullish Cell Color: Select the color of cell whose value is showing Bullish-ness.
Bearish Cell Color: Select the color of cell whose value is showing Bearish-ness.
Neutral Cell Color: Select the color of cell whose value is showing Rangebound-ness.
Cell Transparency: Select Transparency of cell.
Column Settings :-
You can select which Indicators values should be displayed/hidden.
Timeframe Settings :-
You can select which timeframes values should be displayed/hidden.
Note :- I'm not a pro Developer/Coder , so if there are any mistakes or any suggestions for improvements in the code then do let me know!
 Note :- Use in Live market , might show wrong values for timeframes other than current timeframe in closed market!!
Nifty / Banknifty Dashboard by RiTzNifty / Banknifty Dashboard :
	Shows Values of different Indicators on current Timeframe for the selected Index & it's main constituents according to weightage in index.
	customized for Nifty & Banknifty (You can customize it according to your needs for the markets/indexes you trade in)
Interpretation :-
VWAP : if LTP is trading above VWAP then Bullish else if LTP is trading below VWAP then Bearish.
ST(21,1) : if LTP is trading above Supertrend (21,1) then Bullish , else if LTP is trading below Supertrend (21,1) then Bearish.
ST(14,2) : if LTP is trading above Supertrend (14,2) then Bullish , else if LTP is trading below Supertrend (14,2) then Bearish.
ST(10,3) : if LTP is trading above Supertrend (10,3) then Bullish , else if LTP is trading below Supertrend (10,3) then Bearish.
RSI(14) : Shows value of RSI (14) for the current timeframe.
ADX : if ADX is > 75 and DI+ > DI- then "Bullish ++".
	  if ADX is < 75 but >50 and DI+ > DI- then "Bullish +".
	  if ADX is < 50 but > 25 and DI+ > DI- then "Bullish".
	  if ADX is above 75 and DI- > DI+ then "Bearish ++".
	  if ADX is < 75 but > 50 and DI- > DI+ then "Bearish+".
	  if ADX is < 50 but > 25 and DI- > DI+ then "Bearish".
	  if ADX is < 25 then "Neutral".
MACD : if MACD line is above Signal Line then "Bullish", else if MACD line is below Signal Line then "Bearish".
	   
PDH-PDL : "< PDH > PDL" means LTP is trading between Previous Days High(PDH) & Previous Days Low(PDL) which indicates Rangebound-ness.
		  "> PDH" means LTP is trading above Previous Days High(PDH) which indicates Bullish-ness.
		  "< PDL" means LTP is trading below Previous Days Low(PDL) which indicates Bearish-ness.
Alligator : If Lips > Teeth > Jaw then Bullish.
			If Lips < Teeth < Jaw then Bearish.
			If Lips > Teeth and Teeth < Jaw then Neutral/Sleeping.
			If Lips < Teeth and Teeth > Jaw then Neutral/Sleeping.
Settings :
Style settings :-
Dashboard Location: Location of the dashboard on the chart
Dashboard Size: Size of the dashboard on the chart
Bullish Cell Color: Select the color of cell whose value is showing Bullish-ness.
Bearish Cell Color: Select the color of cell whose value is showing Bearish-ness.
Neutral Cell Color: Select the color of cell whose value is showing Rangebound-ness.
Cell Transparency: Select Transparency of cell.
Columns Settings :-
You can select which Indicators values should be displayed/hidden.
Rows Settings :-
You can select which Stocks/Symbols values should be displayed/hidden.
Symbol Settings :-
Here you can select the Index & Stocks/Symbols
Dashboard for Index : select Nifty/Banknifty
if you select Nifty then Nifty spot, Nifty current Futures and the stocks with most weightage in Nifty index will be displayed on the Dashboard/Table.
if you select Banknifty then Banknifty spot, Banknifty current Futures and the stocks with most weightage in Banknifty index will be displayed on the Dashboard/Table.
You can Customise it according to your needs, you can choose any Symbols you want to use.
Note :- This is inspired from "RankDelta" by AsitPati and "Nifty and Bank Nifty Dashboard v2" by cvsk123 (Both these scripts are closed source!)
I'm not a pro Developer/Coder , so if there are any mistakes or any suggestions for improvements in the code then do let me know!
Adaptive Trend  1m ### Overview
The "Adaptive Trend Impulse Parallel SL/TP 1m Realistic" strategy is a sophisticated trading system designed specifically for high-volatility markets like cryptocurrencies on 1-minute timeframes. It combines trend-following with momentum filters and adaptive parameters to dynamically adjust to market conditions, ensuring more reliable entries and risk management. This strategy uses SuperTrend for primary trend detection, enhanced by MACD, RSI, Bollinger Bands, and optional volume spikes. It incorporates parallel stop-loss (SL) and multiple take-profit (TP) levels based on ATR, with options for breakeven and trailing stops after the first TP. Optimized for realistic backtesting on short timeframes, it avoids over-optimization by adapting indicators to market speed and efficiency.
### Principles of Operation
The strategy operates on the principle of adaptive impulse trading, where entry signals are generated only when multiple conditions align to confirm a strong trend reversal or continuation:
1. **Trend Detection (SuperTrend)**: The core signal comes from an adaptive SuperTrend indicator. It calculates upper and lower bands using ATR (Average True Range) with dynamic periods and multipliers. A buy signal occurs when the price crosses above the lower band (from a downtrend), and a sell signal when it crosses below the upper band (from an uptrend). Adaptation is based on Rate of Change (ROC) to measure market speed, shortening periods in fast markets for quicker responses.
2. **Momentum and Trend Filters**:
   - **MACD**: Uses adaptive fast and slow lengths. In "Trend Filter" mode (default when "Use MACD Cross" is false), it checks if the MACD line is above/below the signal for long/short. In cross mode, it requires a crossover/crossunder.
   - **RSI**: Adaptive period RSI must be above 50 for longs and below 50 for shorts, confirming overbought/oversold conditions dynamically.
   - **Bollinger Bands (BB)**: Depending on the mode ("Midline" by default), it requires the price to be above/below the BB midline for longs/shorts, or a breakout in "Breakout" mode. Deviation adapts to market efficiency.
   - **Volume Spike Filter** (optional): Entries require volume to exceed an adaptive multiple of its SMA, signaling strong impulse.
3. **Volatility Filter**: Entries are only allowed if current ATR percentage exceeds a historical minimum (adaptive), preventing trades in low-volatility ranges.
4. **Risk Management (Parallel SL/TP)**:
   - **Stop-Loss**: Set at an adaptive ATR multiple below/above entry for long/short.
   - **Take-Profits**: Three levels at adaptive ATR multiples, with partial position closures (e.g., 51% at TP1, 25% at TP2, remainder at TP3).
   - **Post-TP1 Features**: Optional breakeven moves SL to entry after TP1. Trailing SL uses BB midline as a dynamic trail.
   - All levels are calculated per trade using the ATR at entry, making them "realistic" for 1m charts by widening SL and tightening initial TPs.
The strategy enters long on buy signals with all filters met, and short on sell signals. It uses pyramid margin (100% long/short) for full position sizing.
Adaptation is driven by:
- **Market Speed (normSpeed)**: Based on ROC, tightens multipliers in volatile periods.
- **Efficiency Ratio (ER)**: Measures trend strength, adjusting periods for trending vs. ranging markets.
This ensures the strategy "adapts" without manual tweaks, reducing false signals in varying conditions.
### Main Advantages
- **Adaptability**: Unlike static strategies, parameters dynamically adjust to market volatility and trend strength, improving performance across ranging and trending phases without over-optimization.
- **Realistic Risk Management for 1m**: Wider SL and tiered TPs prevent premature stops in noisy short-term charts, while partial profits lock in gains early. Breakeven/trailing options protect profits in extended moves.
- **Multi-Filter Confirmation**: Combines trend, momentum, and volume for high-probability entries, reducing whipsaws. The volatility filter avoids flat markets.
- **Debug Visualization**: Built-in plots for signals, levels, and component checks (when "Show Debug" is enabled) help users verify logic on charts.
- **Efficiency**: Low computational load, suitable for real-time trading on TradingView with alerts.
Backtesting shows robust results on volatile assets, with a focus on sustainable risk (e.g., SL at 3x ATR avoids excessive drawdowns).
### Uniqueness
What sets this strategy apart is its **fully adaptive framework** integrating multiple indicators with real-time market metrics (ROC for speed, ER for efficiency). Most trend strategies use fixed parameters, leading to poor adaptation; here, every key input (periods, multipliers, deviations) scales dynamically within bounds, creating a "self-tuning" system. The "parallel SL/TP with 1m realism" adds custom handling for micro-timeframes: tightened initial TPs for quick wins and adaptive min-ATR filter to skip low-vol bars. Unlike generic mashups, it justifies the combination—SuperTrend for trend, MACD/RSI/BB for impulse confirmation, volume for conviction—working synergistically to capture "trend impulses" while filtering noise. The post-TP1 breakeven/trailing tied to BB adds a unique profit-locking mechanism not common in open-source scripts.
### Recommended Settings
These settings are optimized and recommended for trading ASTER/USDT on Bybit, with 1-minute chart, x10 leverage, and cross margin mode. They provide a balanced risk-reward for this volatile pair:
- **Base Inputs**:
  - Base ATR Period: 10
  - Base SuperTrend ATR Multiplier: 2.5
  - Base MACD Fast: 8
  - Base MACD Slow: 17
  - Base MACD Signal: 6
  - Base RSI Period: 9
  - Base Bollinger Period: 12
  - Bollinger Deviation: 1.8
  - Base Volume SMA Period: 19
  - Base Volume Spike Multiplier: 1.8
  - Adaptation Window: 54
  - ROC Length: 10
- **TP/SL Settings**:
  - Use Stop Loss: True
  - Base SL Multiplier (ATR): 3
  - Use Take Profits: True
  - Base TP1 Multiplier (ATR): 5.5
  - Base TP2 Multiplier (ATR): 10.5
  - Base TP3 Multiplier (ATR): 19
  - TP1 % Position: 51
  - TP2 % Position: 25
  - Breakeven after TP1: False
  - Trailing SL after TP1: False
  - Base Min ATR Filter: 0.001
  - Use Volume Spike Filter: True
  - BB Condition: Midline
  - Use MACD Cross (false=Trend Filter): True
  - Show Debug: True
For backtesting, use initial capital of 30 USD, base currency USDT, order size 100 USDT, pyramiding 1, commission 0.1%, slippage 0 ticks, long/short margin 0%.
Always backtest on your platform and use risk management—risk no more than 1-2% per trade. This is not financial advice; trade at your own risk.
SAP121212 — Close vs VWAP + Optional RSI (Signals)This indicator combines Supertrend, VWAP with bands, and an optional RSI filter to generate Buy/Sell signals.
How it works
Supertrend Flip (ATR-based): Detects when trend direction changes (from bearish to bullish, or bullish to bearish).
VWAP Band Filter: Signals only trigger if the candle close is beyond the VWAP bands:
Buy = Supertrend flips up AND close > VWAP Upper Band
Sell = Supertrend flips down AND close < VWAP Lower Band
Optional RSI Filter:
Buy requires RSI < 20
Sell requires RSI > 80
Can be enabled/disabled in settings.
Features
Choice of VWAP band calculation mode: Standard Deviation or ATR.
Adjustable ATR/StDev length and multiplier for VWAP bands.
Toggle Supertrend, VWAP lines, and Buy/Sell labels.
Alerts included: add alerts on BUY or SELL conditions (use Once Per Bar Close to avoid intrabar signals).
Use
Works best on intraday or higher timeframes where VWAP is relevant.
Use the RSI filter for more selective signals.
Can be combined with your own stop-loss and risk management rules.
⚠️ Disclaimer: This script is for educational and research purposes only. It is not financial advice. Always test thoroughly and trade at your own risk.
Reverse RSI Signals [AlgoAlpha]🟠 OVERVIEW   
This script introduces the  Reverse RSI Signals  system, an original approach that inverts traditional RSI values back into price levels and then overlays them directly on the chart as dynamic bands. Instead of showing RSI in a subwindow, the script calculates the exact price thresholds that correspond to common RSI levels (30/70/50) and displays them as upper, lower, and midline bands. These are further enhanced with an adaptive Supertrend filter and divergence detection, allowing traders to see overbought/oversold zones translated into actionable price ranges and trend signals. The script combines concepts of RSI inversion, volatility envelopes, and divergence tracking to provide a context-driven tool for spotting reversals and regime shifts.
🟠 CONCEPTS   
The script relies on inverting RSI math: by solving for the price that would yield a given RSI level, it generates real chart levels tied to oscillator conditions. These RSI-derived price bands act like support/resistance, adapting each bar as RSI changes. On top of this, a Supertrend built around the RSI midline introduces directional bias, switching regimes when the midline is breached. Regular bullish and bearish divergences are detected by comparing RSI pivots against price pivots, highlighting early reversal conditions. This layered approach means the indicator is not just RSI on price but a hybrid of oscillator translation, volatility-tracking midline envelopes, and divergence analysis.
🟠 FEATURES   
   
 Inverted RSI bands: upper (70), lower (30), and midline (50), smoothed with EMA for noise reduction.  
  
 Supertrend overlay on the RSI midline to confirm regime direction (bullish or bearish).  
  
 Gradient-filled zones between outer and inner RSI bands to visualize proximity and exhaustion.  
  
 Non-repainting bullish and bearish divergence markers plotted directly on chart highs/lows.  
  
   
🟠 USAGE   
Apply the indicator to any chart and use the plotted RSI price bands as adaptive support/resistance. The midline defines equilibrium, while upper and lower bands represent classic RSI thresholds translated into real price action. In bullish regimes (green candles), long trades are stronger when price approaches or bounces from the lower band; in bearish regimes (red candles), shorts are favored near the upper band. Divergence markers (▲ for bullish, ▼ for bearish) flag potential reversal points early. Traders can combine the band proximity, divergence alerts, and Supertrend context to time entries, exits, or to refine ongoing trend trades. Adjust smoothing and Supertrend ATR settings to match the volatility of the instrument being analyzed.
Triple Momentum Core v1🧠 Technical Structure:
Triple Momentum Core analyzes the underlying wave of price movement through a three-stage system:
1. 🔵 Follow Line – The First Spark of Momentum:
Constructed using Bollinger Bands and ATR, this line detects the very first signs of directional price expansion. It gently whispers when the market begins stretching with force in one direction.
2. 🟢 SuperTrend – Confirmation and Directional Validation:
After the initial move, SuperTrend acts as the second checkpoint — validating whether the price action is evolving into a genuine trend or fading out. It confirms whether the impulse has the strength to sustain.
3. 🔴 PMax – Core Trend & Structural Anchor:
Based on Moving Average and ATR logic, PMax tracks the heartbeat of the trend. It serves as a dynamic structural boundary — critical for identifying trend continuation and managing risk.
4. 🟡 PMax MA Line – Smooth Trend Pulse & Adaptive Guide:
This yellow moving average line within the PMax system softly follows the overall trend flow, without reacting to sharp price noise. It acts as a balanced, stable guide to gauge the solidity of the trend’s body structure.
(If you prefer a cleaner view without any moving average lines, you can disable it from the settings.)
🧠 Technical Structure:
Triple Momentum Core analyzes the underlying wave of price movement through a three-stage system:
1. 🔵 Follow Line – The First Spark of Momentum:
Constructed using Bollinger Bands and ATR, this line detects the very first signs of directional price expansion. It gently whispers when the market begins stretching with force in one direction.
2. 🟢 SuperTrend – Confirmation and Directional Validation:
After the initial move, SuperTrend acts as the second checkpoint — validating whether the price action is evolving into a genuine trend or fading out. It confirms whether the impulse has the strength to sustain.
3. 🔴 PMax – Core Trend & Structural Anchor:
Based on Moving Average and ATR logic, PMax tracks the heartbeat of the trend. It serves as a dynamic structural boundary — critical for identifying trend continuation and managing risk.
4. 🟡 PMax MA Line – Smooth Trend Pulse & Adaptive Guide:
This yellow moving average line within the PMax system softly follows the overall trend flow, without reacting to sharp price noise. It acts as a balanced, stable guide to gauge the solidity of the trend’s body structure.
(If you prefer a cleaner view without any moving average lines, you can disable it from the settings.)
💡 Why “Triple Momentum Core”?
Because this indicator doesn’t just detect movement — it breaks it down into its essential phases:
Ignition, validation, and confirmation.
Each layer captures a unique and essential part of price behavior:
The first reaction (Follow Line) ignites the initial spark.
The second reaction (SuperTrend) confirms whether that spark will become a real trend.
The third and final layer (PMax) structurally anchors and follows that trend.
That’s why we call it Triple Momentum Core:
A synchronized 3-engine momentum system working in harmony to capture the lifecycle of a trend — from spark to structure.
Divergence Screener [Trendoscope®]🎲Overview 
The  Divergence Screener  is a powerful TradingView indicator designed to detect and visualize bullish and bearish divergences, including hidden divergences, between price action and a user-selected oscillator. Built with flexibility in mind, it allows traders to customize the oscillator type, trend detection method, and other parameters to suit various trading strategies. The indicator is non-overlay, displaying divergence signals directly on the oscillator plot, with visual cues such as lines and labels on the chart for easy identification.
This indicator is ideal for traders seeking to identify potential reversal or continuation signals based on price-oscillator divergences. It supports multiple oscillators, trend detection methods, and alert configurations, making it versatile for different markets and timeframes.
 🎲Features 
 🎯Customizable Oscillator Selection 
 
 Built-in Oscillators : Choose from a variety of oscillators including RSI, CCI, CMO, COG, MFI, ROC, Stochastic, and WPR.
 External Oscillator Support : Users can input an external oscillator source, allowing integration with custom or third-party indicators.
 Configurable Length : Adjust the oscillator’s period (e.g., 14 for RSI) to fine-tune sensitivity.
 
  
 🎯Divergence Detection 
The screener identifies four types of divergences:
 
 Bullish Divergence : Price forms a lower low, but the oscillator forms a higher low, signaling potential upward reversal.
 Bearish Divergence : Price forms a higher high, but the oscillator forms a lower high, indicating potential downward reversal.
 Bullish Hidden Divergence : Price forms a higher low, but the oscillator forms a lower low, suggesting trend continuation in an uptrend.
 Bearish Hidden Divergence : Price forms a lower high, but the oscillator forms a higher high, suggesting trend continuation in a downtrend.
 
  
  
 🎯Flexible Trend Detection 
 
 The indicator offers three methods to determine the trend context for divergence detection:
 Zigzag : Uses zigzag pivots to identify trends based on higher highs (HH), higher lows (HL), lower highs (LH), and lower lows (LL).
 MA Difference : Calculates the trend based on the difference in a moving average (e.g., SMA, EMA) between divergence pivots.
 External Trend Signal : Allows users to input an external trend signal (positive for uptrend, negative for downtrend) for custom trend analysis.
 
  
 🎯Zigzag-Based Pivot Analysis 
 
 Customizable Zigzag Length : Adjust the zigzag length (default: 13) to control the sensitivity of pivot detection.
 Repaint Option : Choose whether divergence lines repaint based on the latest data or wait for confirmed pivots, balancing responsiveness and reliability.
 
 🎯Visual and Alert Features 
 
 Divergence Visualization : Divergence lines are drawn between price pivots and oscillator pivots, color-coded for easy identification:
 
 Bullish Divergence : Green
 Bearish Divergence : Red
 Bullish Hidden Divergence : Lime
 Bearish Hidden Divergence : Orange
 
 Labels and Tooltips : Labels (e.g., “D” for divergence, “H” for hidden) appear on price and oscillator pivots, with tooltips providing detailed information such as price/oscillator values, ratios, and pivot directions.
   Alerts : Configurable alerts for each divergence type (bullish, bearish, bullish hidden, bearish hidden) trigger on bar close, ensuring timely notifications.
 
  
 🎲 How It Works 
 🎯Oscillator Calculation 
 
 The indicator calculates the selected oscillator (or uses an external source) and plots it on the chart.
 Oscillator values are stored in a map for reference during divergence calculations.
 
 🎯Pivot Detection 
 
 A zigzag algorithm identifies pivots in the oscillator data, with configurable length and repainting options.
 Price and oscillator pivots are compared to detect divergences based on their direction and ratio.
 
 🎯Divergence Identification 
 
 The indicator compares price and oscillator pivot directions (HH, HL, LH, LL) to identify divergences.
 Trend context is determined using the selected method (Zigzag, MA Difference, or External).
 Divergences are classified as bullish, bearish, bullish hidden, or bearish hidden based on price-oscillator relationships and trend direction.
 
 🎯Visualization and Alerts 
 
 Valid divergences are drawn as lines connecting price and oscillator pivots, with corresponding labels.
 Alerts are triggered for allowed divergence types, providing detailed information via tooltips.
 
 🎯Validation 
Divergence lines are validated to ensure no intermediate bars violate the divergence condition, enhancing signal reliability.
 🎲 Usage Instructions as Indicator 
 🎯Add to Chart: 
 
 Add the “Divergence Screener  ” to your TradingView chart.
 The indicator appears in a separate pane below the price chart, plotting the oscillator and divergence signals.
 
 🎯Configure Settings: 
 
 Adjust the oscillator type and length to match your trading style.
 Select a trend detection method and configure related parameters (e.g., MA type/length or external signal).
 Set the zigzag length and repainting preference.
 Enable/disable alerts for specific divergence types.
 
 I🎯nterpret Signals: 
 
 Bullish Divergence (Green) : Look for potential buy opportunities in a downtrend.
 Bearish Divergence (Red) : Consider sell opportunities in an uptrend.
 Bullish Hidden Divergence (Lime) : Confirm continuation in an uptrend.
 Bearish Hidden Divergence (Orange): Confirm continuation in a downtrend.
 Use tooltips on labels to review detailed pivot and divergence information.
 
 🎯Set Alerts: 
 
 Create alerts for each divergence type to receive notifications via TradingView’s alert system.
 Alerts include detailed text with price, oscillator, and divergence information.
 
 🎲 Example Scenarios as Indicator 
 🎯 With External Oscillator (Use MACD Histogram as Oscillator) 
In order to use MACD as an oscillator for divergence signal instead of the built in options, follow these steps.
 
  Load MACD Indicator from Indicator library
  From Indicator settings of Divergence Screener, set  Use External Oscillator  and select MACD Histograme from the dropdown
  You can now see that the oscillator pane shows the data of selected MACD histogram and divergence signals are generated based on the external MACD histogram data.
 
  
 🎯 With External Trend Signal (Supertrend Ladder ATR) 
Now let's demonstrate how to use external direction signals using  Supertrend Ladder ATR  indicator. Please note that in order to use the indicator as trend source, the indicator should return positive integer for uptrend and negative integer for downtrend. Steps are as follows:
 
  Load the desired trend indicator. In this example, we are using  Supertrend Ladder ATR 
  From the settings of Divergence Screener, select "External" as Trend Detection Method
  Select the trend detection plot Direction from the dropdown. You can now see that the divergence signals will rely on the new trend settings rather than the built in options.
 
  
 🎲 Using the Script with Pine Screener 
The primary purpose of the Divergence Screener is to enable traders to scan multiple instruments (e.g., stocks, ETFs, forex pairs) for divergence signals using TradingView’s Pine Screener, facilitating efficient comparison and identification of trading opportunities.
To use the Divergence Screener as a screener, follow these steps:
 
 Add to Favorites : Add the Divergence Screener   to your TradingView favorites to make it available in the Pine Screener.
 Create a Watchlist : Build a watchlist containing the instruments (e.g., stocks, ETFs, or forex pairs) you want to scan for divergences.
 Access Pine Screener : Navigate to the Pine Screener via TradingView’s main menu: Products -> Screeners -> Pine, or directly visit tradingview.com/pine-screener/.
 Select Watchlist : Choose the watchlist you created from the Watchlist dropdown in the Pine Screener interface.
 Choose Indicator : Select Divergence Screener   from the Choose Indicator dropdown.
 Configure Settings : Set the desired timeframe (e.g., 1 hour, 1 day) and adjust indicator settings such as oscillator type, zigzag length, or trend detection method as needed.
 Select Filter Criteria : Select the condition on which the watchlist items needs to be filtered. Filtering can only be done on the plots defined in the script.
 Run Scan : Press the Scan button to display divergence signals across the selected instruments. The screener will show which instruments exhibit bullish, bearish, bullish hidden, or bearish hidden divergences based on the configured settings.
 
  
 🎲 Limitations and Possible Future Enhancements 
Limitations are
 
  Custom input for oscillator and trend detection cannot be used in pine screener.
  Pine screener has max 500 bars available.
  Repaint option is by default enabled. When in repaint mode expect the early signal but the signals are prone to repaint.
 
Possible future enhancements
 
  Add more built-in options for oscillators and trend detection methods so that dependency on external indicators is limited
  Multi level zigzag support
SuperTrade ST1 StrategyOverview 
The SuperTrade ST1 Strategy is a long-only trend-following strategy that combines a Supertrend indicator with a 200-period EMA filter to isolate high-probability bullish trade setups. It is designed to operate in trending markets, using volatility-based exits with a strict 1:4 Risk-to-Reward (R:R) ratio, meaning that each trade targets a profit 4× the size of its predefined risk.
This strategy is ideal for traders looking to align with medium- to long-term trends, while maintaining disciplined risk control and minimal trade frequency.
 How It Works 
This strategy leverages three key components:
 Supertrend Indicator 
 
 A trend-following indicator based on Average True Range (ATR).
 Identifies bullish/bearish trend direction by plotting a trailing stop line that moves with price volatility.
 
 200-period Exponential Moving Average (EMA) Filter 
 
 Trades are only taken when the price is above the EMA, ensuring participation only during confirmed uptrends.
 Helps filter out counter-trend entries during market pullbacks or ranges.
 
 ATR-Based Stop Loss and Take Profit 
 
 Each trade uses the ATR to calculate volatility-adjusted exit levels.
 Stop Loss: 1× ATR below entry.
 Take Profit: 4× ATR above entry (1:4 R:R).
 This asymmetry ensures that even with a lower win rate, the strategy can remain profitable.
 
 Entry Conditions 
A long trade is triggered when:
 
 Supertrend flips from bearish to bullish (trend reversal).
 Price closes above the Supertrend line.
 Price is above the 200 EMA (bullish market bias).
 
 Exit Logic 
Once a long position is entered:
 
 Stop loss is set 1 ATR below entry.
 Take profit is set 4 ATR above entry.
 The strategy automatically exits the position on either target.
 
Backtest Settings
This strategy is configured for realistic backtesting, including:
 
 $10,000 account size
 2% equity risk per trade
 0.1% commission
 1 tick slippage
 
These settings aim to simulate real-world conditions and avoid overly optimistic results.
 How to Use 
 
 Apply the script to any timeframe, though higher timeframes (1H, 4H, Daily) often yield more reliable signals.
 Works best in clearly trending markets (especially in crypto, stocks, indices).
 Can be paired with alerts for live trading or analysis.
 
 Important Notes 
 
 This version is long-only by design. No short positions are executed.
 Ideal for swing traders or position traders seeking asymmetric returns.
 Users can modify the ATR period, Supertrend factor, or EMA filter length based on asset behavior.
 
Williams R Zone Scalper v1.0[BullByte]Originality & Usefulness  
Unlike standard Williams R cross-over scripts, this strategy layers  five dynamic filters—moving-average trend, Supertrend, Choppiness Index, Bollinger Band Width, and volume validation —and presents a real-time dashboard with equity, PnL, filter status, and key indicator values. No other public Pine script combines these elements with toggleable filters and a custom dashboard. In backtests (BTC/USD (Binance), 5 min, 24 Mar 2025 → 28 Apr 2025), adding these filters turned a –2.09 % standalone Williams R into a +5.05 % net winner while cutting maximum drawdown in half.
---
 What This Script Does 
- Monitors Williams R (length 14) for overbought/oversold reversals.  
- Applies up to five dynamic filters to confirm trend strength and volatility direction:  
  - Moving average (SMA/EMA/WMA/HMA)  
  - Supertrend line  
  - Choppiness Index (CI)  
  - Bollinger Band Width (BBW)  
  - Volume vs. its 50-period MA  
- Plots blue arrows for Long entries (R crosses above –80 + all filters green) and red arrows for Short entries (R crosses below –20 + all filters green).  
- Optionally sets dynamic ATR-based stop-loss (1.5×ATR) and take-profit (2×ATR).  
- Shows a dashboard box with current position, equity, PnL, filter status, and real-time Williams R / MA/volume values.
---
 Backtest Summary (BTC/USD(Binance), 5 min, 24 Mar 2025 → 28 Apr 2025)   
•  Total P&L : +50.70 USD (+5.05 %)  
•  Max Drawdown : 31.93 USD (3.11 %)  
•  Total Trades : 198  
•  Win Rate : 55.05 % (109/89)  
•  Profit Factor : 1.288  
•  Commission : 0.01 % per trade  
•  Slippage : 0 ticks  
Even in choppy March–April, this multi-filter approach nets +5 % with a robust risk profile, compared to –2.09 % and higher drawdown for Williams R alone.
---
 Williams R Alone vs. Multi-Filter Version   
•  Total P&L :  
  – Williams R alone → –20.83 USD (–2.09 %)  
  – Multi-Filter → +50.70 USD (+5.05 %)  
•  Max Drawdown :  
  – Williams R alone → 62.13 USD (6.00 %)  
  – Multi-Filter → 31.93 USD (3.11 %)  
•  Total Trades : 543 vs. 198  
•  Win Rate : 60.22 % vs. 55.05 %  
•  Profit Factor : 0.943 vs. 1.288  
---
 Inputs & What They Control 
- wrLen (14): Williams R look-back  
- maType (EMA): Trend filter type (SMA, EMA, WMA, HMA)  
- maLen (20): Moving-average period  
- useChop (true): Toggle Choppiness Index filter  
- ciLen (12): CI look-back length  
- chopThr (38.2): CI threshold (below = trending)  
- useVol (true): Toggle volume-above-average filter  
- volMaLen (50): Volume MA period  
- useBBW (false): Toggle Bollinger Band Width filter  
- bbwMaLen (50): BBW MA period  
- useST (false): Toggle Supertrend filter  
- stAtrLen (10): Supertrend ATR length  
- stFactor (3.0): Supertrend multiplier  
- useSL (false): Toggle ATR-based SL/TP  
- atrLen (14): ATR period for SL/TP  
- slMult (1.5): SL = slMult × ATR  
- tpMult (2.0): TP = tpMult × ATR  
---
 How to Read the Chart   
-  Blue arrow (Long):  Williams R crosses above –80 + all enabled filters green  
-  Red arrow (Short) : Williams R crosses below –20 + all filters green  
-  Dashboard box:   
  -  Top : position and equity  
  -  Next : cumulative PnL in USD & %  
  -  Middle : green/white dots for each filter (green=passing, white=disabled)  
  -  Bottom : Williams R, MA, and volume current values  
---
 Usage Tips   
-  Add the script : Indicators → My Scripts → Williams R Zone Scalper v1.0 → Add to BTC/USD chart on 5 min.  
-  Defaults : Optimized for BTC/USD.  
-  Forex majors : Raise `chopThr` to ~42.  
-  Stocks/high-beta : Enable `useBBW`.  
-  Enable SL/TP : Toggle `useSL`; stop-loss = 1.5×ATR, take-profit = 2×ATR apply automatically.
---
 Common Questions   
- * Why not trade every Williams R reversal?*   
  Raw Williams R whipsaws in sideways markets. Choppiness and volume filters reduce false entries.  
-  *Can I use on 1 min or 15 min?*   
  Yes—adjust ATR length or thresholds accordingly. Defaults target 5 min scalping.  
-  *What if all filters are on?*   
  Fewer arrows, higher-quality signals. Expect ~10 % boost in average win size.
---
 
Disclaimer & License 
Trading carries risk of loss. Use this script “as is” under the Mozilla Public License 2.0 (mozilla.org). Always backtest, paper-trade, and adjust risk settings to your own profile.
---
 Credits & References 
- Pine Script v6, using TradingView’s built-in `ta.supertrend()`.  
- TradingView House Rules: www.tradingview.com
Goodluck!
BullByte






















