High-Return Trend Strategy (Final)Developed with AI, Sends you notif for buy and sell, just trust the process. NFA
Indicadores de Banda
Bollinger Bands Strategy with SL/TPOverview
This code implements a trading strategy based on Bollinger Bands with customizable Stop Loss (SL) and Take Profit (TP) levels. It's designed to work on TradingView's Pine Script version 6.
Key Parameters
length: The period for calculating the Bollinger Bands (default: 20)
mult: The multiplier for the standard deviation (default: 2.0)
direction: Strategy direction (-1 for short only, 0 for both, 1 for long only)
sl_pips: Stop Loss in pips
tp_pips: Take Profit in pips
How It Works
The strategy calculates Bollinger Bands based on the closing price.
It enters a long position when the price crosses above the lower Bollinger Band.
It enters a short position when the price crosses below the upper Bollinger Band.
Stop Loss and Take Profit are set for each trade based on the input parameters.
Usage Instructions
Copy this code into a new TradingView Pine Script editor.
Adjust the input parameters as needed:
Modify the Bollinger Bands period and multiplier
Set your desired Stop Loss and Take Profit levels in pips
Choose the strategy direction (long, short, or both)
Apply the script to your desired chart and timeframe.
Use TradingView's strategy tester to backtest and optimize the strategy.
Monitor the strategy's performance and adjust parameters as necessary.
Important Notes
The strategy uses OCAs (One-Cancels-All orders) to manage entries.
It automatically cancels pending orders when conditions are not met.
Always test thoroughly on historical data before using in live trading.
Consider market conditions and your risk tolerance when setting parameters.
Advanced Multi-Timeframe Trading System (Risk Managed)Description:
This strategy is an original approach that combines two main analytical components to identify potential trade opportunities while simulating realistic trading conditions:
1. Market Trend Analysis via an Approximate Hurst Exponent
• What It Does:
The strategy computes a rough measure of market trending using an approximate Hurst exponent. A value above 0.5 suggests persistent, trending behavior, while a value below 0.5 indicates a tendency toward mean-reversion.
• How It’s Used:
The Hurst exponent is calculated on both the chart’s current timeframe and a higher timeframe (default: Daily) to capture both local and broader market dynamics.
2. Fibonacci Retracement Levels
• What It Does:
Using daily high and low data from a selected timeframe (default: Daily), the script computes key Fibonacci retracement levels.
• How It’s Used:
• The 61.8% level (Golden Ratio) serves as a key threshold:
• A long entry is signaled when the price crosses above this level if the daily Hurst exponent confirms a trending market.
• The 38.2% level is used to identify short-entry opportunities when the price crosses below it and the daily Hurst indicates non-trending conditions.
Signal Logic:
• Long Entry:
When the price crosses above the 61.8% Fibonacci level (Golden Ratio) and the daily Hurst exponent is greater than 0.5, suggesting a trending market.
• Short Entry:
When the price crosses below the 38.2% Fibonacci level and the daily Hurst exponent is less than 0.5, indicating a less trending or potentially reversing market.
Risk Management & Trade Execution:
• Stop-Loss:
Each trade is risk-managed with a stop-loss set at 2% below (for longs) or above (for shorts) the entry price. This ensures that no single trade risks more than a small, sustainable portion of the account.
• Take Profit:
A take profit order targets a risk-reward ratio of 1:2 (i.e., the target profit is twice the amount risked).
• Position Sizing:
Trades are executed with a fixed position size equal to 10% of account equity.
• Trade Frequency Limits:
• Daily Limit: A maximum of 5 trades per day
• Overall Limit: No more than 510 trades during the backtesting period (e.g., since 2019)
These limits are imposed to simulate realistic trading frequency and to avoid overtrading in backtest results.
Backtesting Parameters:
• Initial Capital: $10,000
• Commission: 0.1% per trade
• Slippage: 1 tick per bar
These settings aim to reflect the conditions faced by the average trader and help ensure that the backtesting results are realistic and not misleading.
Chart Overlays & Visual Aids:
• Fibonacci Levels:
The key Fibonacci retracement levels are plotted on the chart, and the zone between the 61.8% and 38.2% levels is highlighted to show a key retracement area.
• Market Trend Background:
The chart background is tinted green when the daily Hurst exponent indicates a trending market (value > 0.5) and red otherwise.
• Information Table:
An on-chart table displays key parameters such as the current Hurst exponent, daily Hurst value, the number of trades executed today, and the global trade count.
Disclaimer:
Past performance is not indicative of future results. This strategy is experimental and provided solely for educational purposes. It is essential that you backtest and paper trade using your own settings before considering any live deployment. The Hurst exponent calculation is an approximation and should be interpreted as a rough gauge of market behavior. Adjust the parameters and risk management settings according to your personal risk tolerance and market conditions.
Additional Notes:
• Originality & Usefulness:
This script is an original mashup that combines trend analysis with Fibonacci retracement methods. The description above explains how these components work together to provide trading signals.
• Realistic Results:
The strategy uses realistic account sizes, commission rates, slippage, and risk management rules to generate backtesting results that are representative of real-world trading.
• Educational Purpose:
This script is intended to support the TradingView community by offering insights into combining multiple analysis techniques in one strategy. It is not a “get-rich-quick” system but rather an educational tool to help traders understand risk management and trade signal logic.
By using this script, you acknowledge that trading involves risk and that you are responsible for testing and adjusting the strategy to fit your own trading environment. This publication is fully open source, and any modifications should include proper attribution if significant portions of the code are reused.
SMA Crossover Strategy by AARYAN Buy Signal: When the 50-period SMA crosses above the 200-period SMA
Sell Signal: When the 50-period SMA crosses below the 200-period SMA
This script also includes:
✔️ Visual buy/sell markers on the chart
✔️ Alerts for buy and sell signals
✔️ Backtesting capability to analyze past performance
Leading Indicator Strategy – Daily Signals It implements the daily RSI strategy with buy/sell signals, alert integration, and backtesting capability. You can copy-paste this into the TradingView Pine Editor. Remember to select “Indian stock” symbol and 1D timeframe on your chart for intended use.
Usage: After adding the script to your chart, use the Strategy Tester to review historical performance. You can modify input parameters in the script’s settings to optimize as needed. To set up real-time alerts, open the Alerts menu in TradingView, choose this strategy under Condition, and select “Order fills or alert() function calls” to trigger notifications on each buy/sell signal
. This will pop-up or send an alert whenever a new “BUY” or “SELL” label appears on the chart, allowing you to act quickly.
By combining a proven leading indicator (RSI) with sensible filters and clear visuals, this script provides an easy-to-use tool for swing trading Indian stocks on a daily timeframe.
Parabolic SAR + MACD Strategy v1.2 improved winrateParabolic SAR + MACD + MA200 Strategy
This strategy combines the Parabolic SAR and MACD indicators to generate buy and sell signals, with the MA200 serving as a trend filter.
Buy Signal: Triggered when the MACD line crosses above the signal line, the price is above the Parabolic SAR, and the price is also above the MA200, confirming an uptrend.
Sell Signal: Triggered when the MACD line crosses below the signal line, the price is below the Parabolic SAR, and the price is also below the MA200, confirming a downtrend.
This approach ensures long positions are only taken during bullish trends and short positions during bearish trends, helping to avoid trades against the prevailing market direction.
Forex Prince by Prince 1Greetings Friends,
Disclaimer: This is not financial advice or a trading recommendation. The information provided is for educational purposes only. Always conduct your own research and consult with a qualified financial advisor before making any investment decisions. Trade at your own risk. 📊📉📈
Forex Auto Trading Bot - 5 By Ayebale John BobThis Forex Auto Trading Bot - 5 Orders strategy is designed for automated forex trading, leveraging a combination of technical indicators and specific market conditions to enter and exit trades. Below is a detailed description of how the strategy works:
Overview
The strategy is designed to automatically execute 5 buy or 5 sell orders based on entry signals derived from Fair Value Gaps (FVG) and a crossover/crossunder logic of price with a specific range (50 periods). The strategy uses an Average True Range (ATR) multiplier to calculate stop-loss levels and multiple take-profit (TP) levels to ensure proper risk management. The strategy is optimized for trading during major forex sessions, such as London, Tokyo, and New York, and only executes trades on weekdays.
Key Features:
Entry Conditions:
Buy Signal: A buy order is triggered when the price crosses over the 50-period low or when a Bullish Fair Value Gap (FVG) is detected.
Sell Signal: A sell order is triggered when the price crosses under the 50-period high or when a Bearish Fair Value Gap (FVG) is detected.
Risk Management:
Stop-Loss: The stop-loss is calculated using the ATR (Average True Range), multiplied by a user-defined multiplier. This provides a dynamic stop-loss level based on current market volatility.
Take-Profit: The strategy uses multiple take-profit levels, with five different levels defined by the ATR multiplied by increasing factors (from 1.0 to 3.0). This helps secure profits at different price levels.
Session-based Trading:
The strategy only executes trades during key forex trading sessions (London, Tokyo, New York) and restricts trading to weekdays, ensuring that trades are placed during active market hours when volatility is typically higher.
Table Display:
A table on the chart provides real-time updates of the latest trade information, including the entry price, stop-loss, and multiple take-profit levels. This allows traders to quickly assess their current trade setup.
Fair Value Gap (FVG) Detection:
Fair Value Gaps are calculated by comparing recent high and low price levels to identify potential market inefficiencies. These gaps are used to trigger buy or sell signals depending on whether they are bullish or bearish.
Multiple Orders:
For each valid entry signal, up to five orders are executed (either long or short). This enables the strategy to scale into a position and take advantage of price movements over a series of smaller trades rather than one large position.
Trade Execution:
The strategy uses strategy.entry() to enter positions and strategy.exit() to exit them based on predefined stop-loss and take-profit levels.
Inputs:
Bull Color & Bear Color: Defines the color for bullish and bearish signals.
FVG Color: Defines the color for the Fair Value Gap lines.
ATR Multiplier: Multiplier for adjusting the stop-loss size based on ATR.
Take-Profit Multipliers: Array of multipliers that define five take-profit levels.
Execution Logic:
When a valid buy or sell signal is detected, the strategy enters up to five positions with increasing take-profit targets. For each position, the strategy exits once the price hits one of the take-profit levels or the stop-loss is triggered.
The strategy only executes trades during specific forex sessions (London, Tokyo, New York) and only on weekdays to avoid less volatile periods like weekends.
Summary:
The Forex Auto Trading Bot - 5 Orders strategy aims to automate trading by identifying key market opportunities based on Fair Value Gap detection and price action signals. It uses a dynamic stop-loss, multiple take-profit levels, and session-based filtering to maximize profit potential while managing risk.
Delta SMA 1-Year High/Low Strategy### Summary:
This Pine Script code implements a trading strategy based on the **Delta SMA (Simple Moving Average)** of buy and sell volumes over a 1-year lookback period. The strategy identifies potential buy and sell signals by analyzing the relationship between the Delta SMA and its historical high/low thresholds. Key features include:
1. **Delta Calculation**:
- The Delta is calculated as the difference between buy volume (when close > open) and sell volume (when close < open).
- A 14-period SMA is applied to the Delta to smooth the data.
2. **1-Year High/Low Thresholds**:
- The strategy calculates the 1-year high and low of the Delta SMA.
- Buy and sell conditions are derived from thresholds set at 70% of the 1-year low and 90% and 50% of the 1-year high, respectively.
3. **Buy Condition**:
- A buy signal is triggered when the Delta SMA crosses above 0 after being below 70% of the 1-year low.
4. **Sell Condition**:
- A sell signal is triggered when the Delta SMA drops below 60% of the 1-year high after crossing above 90% of the 1-year high.
5. **Visualization**:
- The Delta SMA and its thresholds are plotted on the chart for easy monitoring.
- Optional buy/sell signals can be plotted as labels on the chart.
This strategy is designed to capture trends in volume-based momentum over a long-term horizon, making it suitable for swing or position trading.
SMA + RSI + Volume + ATR StrategySMA + RSI + Volume + ATR Strategy
1. Indicators Used:
SMA (Simple Moving Average): This is a trend-following indicator that calculates the average price of a security over a specified period (50 periods in this case). It's used to identify the overall trend of the market.
RSI (Relative Strength Index): This measures the speed and change of price movements. It tells us if the market is overbought (too high) or oversold (too low). Overbought is above 70 and oversold is below 30.
Volume: This is the amount of trading activity. A higher volume often indicates strong interest in a particular price move.
ATR (Average True Range): This measures volatility, or how much the price is moving in a given period. It helps us adjust stop losses and take profits based on market volatility.
2. Conditions for Entering Trades:
Buy Signal (Green Up Arrow):
Price is above the 50-period SMA (indicating an uptrend).
RSI is below 30 (indicating the market might be oversold or undervalued, signaling a potential reversal).
Current volume is higher than average volume (indicating strong interest in the move).
ATR is increasing (indicating higher volatility, suggesting that the market might be ready for a move).
Sell Signal (Red Down Arrow):
Price is below the 50-period SMA (indicating a downtrend).
RSI is above 70 (indicating the market might be overbought or overvalued, signaling a potential reversal).
Current volume is higher than average volume (indicating strong interest in the move).
ATR is increasing (indicating higher volatility, suggesting that the market might be ready for a move).
3. Take Profit & Stop Loss:
Take Profit: When a trade is made, the strategy will set a target price at a certain percentage above or below the entry price (1.5% in this case) to automatically exit the trade once that target is hit.
Stop Loss: If the price goes against the position, a stop loss is set at a percentage below or above the entry price (0.5% in this case) to limit losses.
4. Execution of Trades:
When the buy condition is met, the strategy will enter a long position (buying).
When the sell condition is met, the strategy will enter a short position (selling).
5. Visual Representation:
Green Up Arrow: Appears on the chart when the buy condition is met.
Red Down Arrow: Appears on the chart when the sell condition is met.
These arrows help you see at a glance when the strategy suggests you should buy or sell.
In Summary:
This strategy uses a combination of trend-following (SMA), momentum (RSI), volume, and volatility (ATR) to decide when to buy or sell a stock. It looks for opportunities when the market is either oversold (buy signal) or overbought (sell signal) and makes sure there’s enough volume and volatility to back up the move. It also includes take-profit and stop-loss levels to manage risk.
SPY/TLT Strategy█ STRATEGY OVERVIEW
The "SPY/TLT Strategy" is a trend-following crossover strategy designed to trade the relationship between TLT and its Simple Moving Average (SMA). The default configuration uses TLT (iShares 20+ Year Treasury Bond ETF) with a 20-period SMA, entering long positions on bullish crossovers and exiting on bearish crossunders. **This strategy is NOT optimized and performs best in trending markets.**
█ KEY FEATURES
SMA Crossover System: Uses price/SMA relationship for signal generation (Default: 20-period)
Dynamic Time Window: Configurable backtesting period (Default: 2014-2099)
Equity-Based Position Sizing: Default 100% equity allocation per trade
Real-Time Visual Feedback: Price/SMA plot with trend-state background coloring
Event-Driven Execution: Processes orders at bar close for accurate backtesting
█ SIGNAL GENERATION
1. LONG ENTRY CONDITION
TLT closing price crosses ABOVE SMA
Occurs within specified time window
Generates market order at next bar open
2. EXIT CONDITION
TLT closing price crosses BELOW SMA
Closes all open positions immediately
█ ADDITIONAL SETTINGS
SMA Period: Simple Moving Average length (Default: 20)
Start Time and End Time: The time window for trade execution (Default: 1 Jan 2014 - 1 Jan 2099)
Security Symbol: Ticker for analysis (Default: TLT)
█ PERFORMANCE OVERVIEW
Ideal Market Conditions: Strong trending environments
Potential Drawbacks: Whipsaws in range-bound markets
Backtesting results should be analyzed to optimize the MA Period and EMA Filter settings for specific instruments
3 Down, 3 Up Strategy█ STRATEGY DESCRIPTION
The "3 Down, 3 Up Strategy" is a mean-reversion strategy designed to capitalize on short-term price reversals. It enters a long position after consecutive bearish closes and exits after consecutive bullish closes. This strategy is NOT optimized and can be used on any timeframes.
█ WHAT ARE CONSECUTIVE DOWN/UP CLOSES?
- Consecutive Down Closes: A sequence of trading bars where each close is lower than the previous close.
- Consecutive Up Closes: A sequence of trading bars where each close is higher than the previous close.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The price closes lower than the previous close for Consecutive Down Closes for Entry (default: 3) consecutive bars.
The signal occurs within the specified time window (between Start Time and End Time).
If enabled, the close price must also be above the 200-period EMA (Exponential Moving Average).
2. EXIT CONDITION
A Sell Signal is generated when the price closes higher than the previous close for Consecutive Up Closes for Exit (default: 3) consecutive bars.
█ ADDITIONAL SETTINGS
Consecutive Down Closes for Entry: Number of consecutive lower closes required to trigger a buy. Default = 3.
Consecutive Up Closes for Exit: Number of consecutive higher closes required to exit. Default = 3.
EMA Filter: Optional 200-period EMA filter to confirm long entries in bullish trends. Default = disabled.
Start Time and End Time: Restrict trading to specific dates (default: 2014-2099).
█ PERFORMANCE OVERVIEW
Designed for volatile markets with frequent short-term reversals.
Performs best when price oscillates between clear support/resistance levels.
The EMA filter improves reliability in trending markets but may reduce trade frequency.
Backtest to optimize consecutive close thresholds and EMA period for specific instruments.
Buy on 5 day low Strategy█ STRATEGY DESCRIPTION
The "Buy on 5 Day Low Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price drops below the lowest low of the previous five days. It enters a long position when specific conditions are met and exits when the price exceeds the high of the previous day. This strategy is optimized for use on daily or higher timeframes.
█ WHAT IS THE 5-DAY LOW?
The 5-Day Low is the lowest price observed over the last five days. This level is used as a reference to identify potential oversold conditions and reversal points.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price is below the lowest low of the previous five days (`close < _lowest `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous day (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently oscillates around key support levels.
It is sensitive to oversold conditions, as indicated by the 5-Day Low, and overbought conditions, as indicated by the previous day's high.
Backtesting results should be analyzed to optimize the strategy for specific instruments and market conditions.
3-Bar Low Strategy█ STRATEGY DESCRIPTION
The "3-Bar Low Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price drops below the lowest low of the previous three bars. It enters a long position when specific conditions are met and exits when the price exceeds the highest high of the previous seven bars. This strategy is suitable for use on various timeframes.
█ WHAT IS THE 3-BAR LOW?
The 3-Bar Low is the lowest price observed over the last three bars. This level is used as a reference to identify potential oversold conditions and reversal points.
█ WHAT IS THE 7-BAR HIGH?
The 7-Bar High is the highest price observed over the last seven bars. This level is used as a reference to identify potential overbought conditions and exit points.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price is below the lowest low of the previous three bars (`close < _lowest `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
If the EMA Filter is enabled, the close price must also be above the 200-period Exponential Moving Average (EMA).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the highest high of the previous seven bars (`close > _highest `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
MA Period: The lookback period for the 200-period EMA used in the EMA Filter. Default is 200.
Use EMA Filter: Enables or disables the EMA Filter for long entries. Default is disabled.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently oscillates around key support and resistance levels.
It is sensitive to oversold conditions, as indicated by the 3-Bar Low, and overbought conditions, as indicated by the 7-Bar High.
Backtesting results should be analyzed to optimize the MA Period and EMA Filter settings for specific instruments.
Bollinger Bands Reversal + IBS Strategy█ STRATEGY DESCRIPTION
The "Bollinger Bands Reversal Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price deviates below the lower Bollinger Band and the Internal Bar Strength (IBS) indicates oversold conditions. It enters a long position when specific conditions are met and exits when the IBS indicates overbought conditions. This strategy is suitable for use on various timeframes.
█ WHAT ARE BOLLINGER BANDS?
Bollinger Bands consist of three lines:
- **Basis**: A Simple Moving Average (SMA) of the price over a specified period.
- **Upper Band**: The basis plus a multiple of the standard deviation of the price.
- **Lower Band**: The basis minus a multiple of the standard deviation of the price.
Bollinger Bands help identify periods of high volatility and potential reversal points.
█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) is a measure of where the closing price is relative to the high and low of the bar. It is calculated as:
IBS = (Close - Low) / (High - Low)
A low IBS value (e.g., below 0.2) indicates that the close is near the low of the bar, suggesting oversold conditions. A high IBS value (e.g., above 0.8) indicates that the close is near the high of the bar, suggesting overbought conditions.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The IBS value is below 0.2, indicating oversold conditions.
The close price is below the lower Bollinger Band.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the IBS value exceeds 0.8, indicating overbought conditions. This prompts the strategy to exit the position.
█ ADDITIONAL SETTINGS
Length: The lookback period for calculating the Bollinger Bands. Default is 20.
Multiplier: The number of standard deviations used to calculate the upper and lower Bollinger Bands. Default is 2.0.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently deviates from the Bollinger Bands.
It is sensitive to oversold and overbought conditions, as indicated by the IBS, which helps to identify potential reversals.
Backtesting results should be analyzed to optimize the Length and Multiplier parameters for specific instruments.
Average High-Low Range + IBS Reversal Strategy█ STRATEGY DESCRIPTION
The "Average High-Low Range + IBS Reversal Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price deviates significantly from its average high-low range and the Internal Bar Strength (IBS) indicates oversold conditions. It enters a long position when specific conditions are met and exits when the price shows strength by exceeding the previous bar's high. This strategy is suitable for use on various timeframes.
█ WHAT IS THE AVERAGE HIGH-LOW RANGE?
The Average High-Low Range is calculated as the Simple Moving Average (SMA) of the difference between the high and low prices over a specified period. It helps identify periods of increased volatility and potential reversal points.
█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) is a measure of where the closing price is relative to the high and low of the bar. It is calculated as:
IBS = (Close - Low) / (High - Low)
A low IBS value (e.g., below 0.2) indicates that the close is near the low of the bar, suggesting oversold conditions.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been below the buy threshold (calculated as `upper - (2.5 * hl_avg)`) for a specified number of consecutive bars (`bars_below_threshold`).
The IBS value is below the specified buy threshold (`ibs_buy_treshold`).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Length: The lookback period for calculating the average high-low range. Default is 20.
Bars Below Threshold: The number of consecutive bars the price must remain below the buy threshold to trigger a Buy Signal. Default is 2.
IBS Buy Threshold: The IBS value below which a Buy Signal is triggered. Default is 0.2.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently deviates from its average high-low range.
It is sensitive to oversold conditions, as indicated by the IBS, which helps to identify potential reversals.
Backtesting results should be analyzed to optimize the Length, Bars Below Threshold, and IBS Buy Threshold parameters for specific instruments.
Turn of the Month Strategy on Steroids█ STRATEGY DESCRIPTION
The "Turn of the Month Strategy on Steroids" is a seasonal mean-reversion strategy designed to capitalize on price movements around the end of the month. It enters a long position when specific conditions are met and exits when the Relative Strength Index (RSI) indicates overbought conditions. This strategy is optimized for use on daily or higher timeframes.
█ WHAT IS THE TURN OF THE MONTH EFFECT?
The Turn of the Month effect refers to the observed tendency of stock prices to rise around the end of the month. This strategy leverages this phenomenon by entering long positions when the price shows signs of a reversal during this period.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The current day of the month is greater than or equal to the specified `dayOfMonth` threshold (default is 25).
The close price is lower than the previous day's close (`close < close `).
The previous day's close is also lower than the close two days ago (`close < close `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
There is no existing open position (`strategy.position_size == 0`).
2. EXIT CONDITION
A Sell Signal is generated when the 2-period RSI exceeds 65, indicating overbought conditions. This prompts the strategy to exit the position.
█ ADDITIONAL SETTINGS
Day of Month: The day of the month threshold for triggering a Buy Signal. Default is 25.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed to exploit seasonal price patterns around the end of the month.
It performs best in markets where the Turn of the Month effect is pronounced.
Backtesting results should be analyzed to optimize the `dayOfMonth` threshold and RSI parameters for specific instruments.
Consecutive Bars Above/Below EMA Buy the Dip Strategy█ STRATEGY DESCRIPTION
The "Consecutive Bars Above/Below EMA Buy the Dip Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price dips below a moving average for a specified number of consecutive bars. It enters a long position when the dip condition is met and exits when the price shows strength by exceeding the previous bar's high. This strategy is suitable for use on various timeframes.
█ WHAT IS THE MOVING AVERAGE?
The strategy uses either a Simple Moving Average (SMA) or an Exponential Moving Average (EMA) as a reference for identifying dips. The type and length of the moving average can be customized in the settings.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price is below the selected moving average for a specified number of consecutive bars (`consecutiveBarsTreshold`).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Consecutive Bars Threshold: The number of consecutive bars the price must remain below the moving average to trigger a Buy Signal. Default is 3.
MA Type: The type of moving average used (SMA or EMA). Default is SMA.
MA Length: The length of the moving average. Default is 5.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently oscillates around the moving average.
It is sensitive to the number of consecutive bars below the moving average, which helps to identify potential dips.
Backtesting results should be analysed to optimize the Consecutive Bars Threshold, MA Type, and MA Length for specific instruments.
Turn around Tuesday on Steroids Strategy█ STRATEGY DESCRIPTION
The "Turn around Tuesday on Steroids Strategy" is a mean-reversion strategy designed to identify potential price reversals at the start of the trading week. It enters a long position when specific conditions are met and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for ETFs, stocks, and other instruments on the daily timeframe.
█ WHAT IS THE STARTING DAY?
The Starting Day determines the first day of the trading week for the strategy. It can be set to either Sunday or Monday, depending on the instrument being traded. For ETFs and stocks, Monday is recommended. For other instruments, Sunday is recommended.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The current day is the first day of the trading week (either Sunday or Monday, depending on the Starting Day setting).
The close price is lower than the previous day's close (`close < close `).
The previous day's close is also lower than the close two days ago (`close < close `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
If the MA Filter is enabled, the close price must also be above the 200-period Simple Moving Average (SMA).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Starting Day: Determines the first day of the trading week. Options are Sunday or Monday. Default is Sunday.
Use MA Filter: Enables or disables the 200-period SMA filter for long entries. Default is disabled.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for markets with frequent weekly reversals.
It performs best in volatile conditions where price movements are significant at the start of the trading week.
Backtesting results should be analysed to optimize the Starting Day and MA Filter settings for specific instruments.
Consecutive Bearish Candle Strategy█ STRATEGY DESCRIPTION
The "Consecutive Bearish Candle Strategy" is a momentum-based strategy designed to identify potential reversals after a sustained bearish move. It enters a long position when a specific number of consecutive bearish candles occur and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for use on various timeframes and instruments.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been lower than the previous close for at least `Lookback` consecutive bars. This indicates a sustained bearish move, suggesting a potential reversal.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Lookback: The number of consecutive bearish bars required to trigger a Buy Signal. Default is 3.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for markets with frequent momentum shifts.
It performs best in volatile conditions where price movements are significant.
Backtesting results should be analysed to optimize the `Lookback` parameter for specific instruments.
4 Bar Momentum Reversal strategy█ STRATEGY DESCRIPTION
The "4 Bar Momentum Reversal Strategy" is a mean-reversion strategy designed to identify price reversals following a sustained downward move. It enters a long position when a reversal condition is met and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for indices and stocks on the daily timeframe.
█ WHAT IS THE REFERENCE CLOSE?
The Reference Close is the closing price from X bars ago, where X is determined by the Lookback period. Think of it as a moving benchmark that helps the strategy assess whether prices are trending upwards or downwards relative to past performance. For example, if the Lookback is set to 4, the Reference Close is the closing price 4 bars ago (`close `).
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been lower than the Reference Close for at least `Buy Threshold` consecutive bars. This indicates a sustained downward move, suggesting a potential reversal.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Buy Threshold: The number of consecutive bearish bars needed to trigger a Buy Signal. Default is 4.
Lookback: The number of bars ago used to calculate the Reference Close. Default is 4.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for trending markets with frequent reversals.
It performs best in volatile conditions where price movements are significant.
Backtesting results should be analysed to optimize the Buy Threshold and Lookback parameters for specific instruments.
Fibonacci Trend - Aynet1. Inputs
lookbackPeriod: Defines the number of bars to consider for calculating swing highs and lows. Default is 20.
fibLevel1 to fibLevel5: Fibonacci retracement levels to calculate price levels (23.6%, 38.2%, 50%, 61.8%, 78.6%).
useTime: Enables or disables time-based Fibonacci projections.
riskPercent: Defines the percentage of risk for trading purposes (currently not used in calculations).
2. Functions
isSwingHigh(index): Identifies a swing high at the given index, where the high of that candle is higher than both its previous and subsequent candles.
isSwingLow(index): Identifies a swing low at the given index, where the low of that candle is lower than both its previous and subsequent candles.
3. Variables
swingHigh and swingLow: Store the most recent swing high and swing low prices.
swingHighTime and swingLowTime: Store the timestamps of the swing high and swing low.
fib1 to fib5: Fibonacci levels based on the difference between swingHigh and swingLow.
4. Swing Point Detection
The script checks if the last bar is a swing high or swing low using the isSwingHigh() and isSwingLow() functions.
If a swing high is detected:
The high price is stored in swingHigh.
The timestamp of the swing high is stored in swingHighTime.
If a swing low is detected:
The low price is stored in swingLow.
The timestamp of the swing low is stored in swingLowTime.
5. Fibonacci Levels Calculation
If both swingHigh and swingLow are defined, the script calculates the Fibonacci retracement levels (fib1 to fib5) based on the price difference (priceDiff = swingHigh - swingLow).
6. Plotting Fibonacci Levels
Fibonacci levels (fib1 to fib5) are plotted as horizontal lines using the line.new() function.
Labels (e.g., "23.6%") are added near the lines to indicate the level.
Lines and labels are color-coded:
23.6% → Blue
38.2% → Green
50.0% → Yellow
61.8% → Orange
78.6% → Red
7. Filling Between Fibonacci Levels
The plot() function creates lines for each Fibonacci level.
The fill() function is used to fill the space between two levels with semi-transparent colors:
Blue → Between fib1 and fib2
Green → Between fib2 and fib3
Yellow → Between fib3 and fib4
Orange → Between fib4 and fib5
8. Time-Based Fibonacci Projections
If useTime is enabled:
The time difference (timeDiff) between the swing high and swing low is calculated.
Fibonacci time projections are added based on multiples of 23.6%.
If the current time reaches a projected time, a label (e.g., "T1", "T2") is displayed near the high price.
9. Trading Logic
Two placeholder variables are defined for trading logic:
longCondition: Tracks whether a condition for a long trade is met (currently not implemented).
shortCondition: Tracks whether a condition for a short trade is met (currently not implemented).
These variables can be extended to define entry/exit signals based on Fibonacci levels.
How It Works
Detect Swing Points: It identifies recent swing high and swing low points on the chart.
Calculate Fibonacci Levels: Based on the swing points, it computes retracement levels.
Visualize Levels: Plots the levels on the chart with labels and fills between them.
Time Projections: Optionally calculates time-based projections for future price movements.
Trading Opportunities: The framework provides tools for detecting potential reversal or breakout zones using Fibonacci levels.