IU Opening range Breakout StrategyIU Opening Range Breakout Strategy
This Pine Script strategy is designed to capitalize on the breakout of the opening range, which is a popular trading approach. The strategy identifies the high and low prices of the opening session and takes trades based on price crossing these levels, with built-in risk management and trade limits for intraday trading.
Key Features:
1. Risk Management:
- Risk-to-Reward Ratio (RTR):
Set a customizable risk-to-reward ratio to calculate target prices based on stop-loss levels.
Default: 2:1
- Max Trades in a Day:
Specify the maximum number of trades allowed per day to avoid overtrading.
Default: 2 trades in a day.
- End-of-Day Close:
Automatically closes all open positions at a user-defined session end time to ensure no overnight exposure.
Default: 3:15 PM
2. Opening Range Identification
- Opening Range High and Low:
The script detects the high and low of the first trading session using Pine Script's session functions.
These levels are plotted as visual guides on the chart:
- High: Lime-colored circles.
- Low: Red-colored circles.
3. Trade Entry Logic
- Long Entry:
A long trade is triggered when the price closes above the opening range high.
- Entry condition: Crossover of the price above the opening range high.
-Short Entry:
A short trade is triggered when the price closes below the opening range low.
- Entry condition: Crossunder of the price below the opening range low.
Both entries are conditional on the absence of an existing position.
4. Stop Loss and Take Profit
- Long Position:
- Stop Loss: Previous candle's low.
- Take Profit: Calculated based on the RTR.
- **Short Position:**
- **Stop Loss:** Previous candle's high.
- **Take Profit:** Calculated based on the RTR.
The strategy plots these levels for visual reference:
- Stop Loss: Red dashed lines.
- Take Profit: Green dashed lines.
5. Visual Enhancements
-Trade Level Highlighting:
The script dynamically shades the areas between the entry price and SL/TP levels:
- Red shading for the stop-loss region.
- Green shading for the take-profit region.
- Entry Price Line:
A silver-colored line marks the average entry price for active trades.
How to Use:
1.Input Configuration:
Adjust the Risk-to-Reward ratio, max trades per day, and session end time to suit your trading preferences.
2.Visual Cues:
Use the opening range high/low lines and shading to identify potential breakout opportunities.
3.Execution:
The strategy will automatically enter and exit trades based on the conditions. Review the plotted SL and TP levels to monitor the risk-reward setup.
Important Notes:
- This strategy is designed for intraday trading and works best in markets with high volatility during the opening session.
- Backtest the strategy on your preferred market and timeframe to ensure compatibility.
- Proper risk management and position sizing are essential when using this strategy in live markets.
Wskaźniki i strategie
Overnight Effect High Volatility Crypto (AiBitcoinTrend)👽 Overview of the Strategy
This strategy leverages the overnight effect in the cryptocurrency market, specifically targeting the two-hour window from 21:00 UTC to 23:00 UTC. The strategy is designed to be applied only during periods of high volatility, which is determined using historical volatility data. This approach, inspired by research from Padyšák and Vojtko (2022), aims to capitalize on statistically significant return patterns observed during these hours.
Deep Backtesting with a High Volatility Filter
Deep Backtesting without a High Volatility Filter
👽 How the Strategy Works
Volatility Calculation:
Each day at 00:00 UTC, the strategy calculates the 30-day historical volatility of crypto returns (typically Bitcoin). The historical volatility is the standard deviation of the log returns over the past 30 days, representing the market's recent volatility level.
Median Volatility Benchmark:
The median of the 30-day historical volatility is calculated over a 365-day period (one year). This median acts as a benchmark to classify each day as either:
👾 High Volatility: When the current 30-day volatility exceeds the median volatility.
👾 Low Volatility: When the current 30-day volatility is below the median.
Trading Rule:
If the day is classified as a High Volatility Day, the strategy executes the following trades:
👾 Buy at 21:00 UTC.
👾 Sell at 23:00 UTC.
Trade Execution Details:
The strategy uses a 0.02% fee per trade.
Each trade is executed with 25% of the available capital. This allocation helps manage risk while allowing for compounding returns.
Rationale:
The returns during the 22:00 and 23:00 UTC hours have been found to be statistically significant during high volatility periods. The overnight effect is believed to drive this phenomenon due to the asynchronous closing hours of global financial markets. This creates unique trading opportunities in the cryptocurrency market, where exchanges remain open 24/7.
👽 Market Context and Global Time Zone Impact
👾 Why 21:00 to 23:00 UTC?
During this window, major traditional financial markets are closed:
NYSE (New York) closes at 21:00 UTC.
London and European markets are closed during these hours.
Asian markets (Tokyo, Hong Kong, etc.) open later, leaving this window largely unaffected by traditional trading flows.
This global market inactivity creates a period where significant moves can occur in the cryptocurrency market, particularly during high volatility.
👽 Strategy Parameters
Volatility Period: 30 days.
The lookback period for calculating historical volatility.
Median Period: 365 days.
The lookback period for calculating the median volatility benchmark.
Entry Time: 21:00 UTC.
Adjust this to your local time if necessary (e.g., 16:00 in New York, 22:00 in Stockholm).
Exit Time: 23:00 UTC.
Adjust this to your local time if necessary (e.g., 18:00 in New York, 00:00 midnight in Stockholm).
👽 Benefits of the Strategy
Seasonality Effect:
The strategy captures consistent patterns driven by the overnight effect and high volatility periods.
Risk Reduction:
Since trades are executed during a specific window and only on high volatility days, the strategy helps mitigate exposure to broader market risk.
Simplicity and Efficiency:
The strategy is moderately complex, making it accessible for traders while offering significant returns.
Global Applicability:
Suitable for traders worldwide, with clear guidelines on adjusting for local time zones.
👽 Considerations
Market Conditions: The strategy works best in a high-volatility environment.
Execution: Requires precise timing to enter and exit trades at the specified hours.
Time Zone Adjustments: Ensure you convert UTC times accurately based on your location to execute trades at the correct local times.
Disclaimer: This information is for entertainment purposes only and does not constitute financial advice. Please consult with a qualified financial advisor before making any investment decisions.
DCA Strategy with Mean Reversion and Bollinger BandDCA Strategy with Mean Reversion and Bollinger Band
The Dollar-Cost Averaging (DCA) Strategy with Mean Reversion and Bollinger Bands is a sophisticated trading strategy that combines the principles of DCA, mean reversion, and technical analysis using Bollinger Bands. This strategy aims to capitalize on market corrections by systematically entering positions during periods of price pullbacks and reversion to the mean.
Key Concepts and Principles
1. Dollar-Cost Averaging (DCA)
DCA is an investment strategy that involves regularly purchasing a fixed dollar amount of an asset, regardless of its price. The idea behind DCA is that by spreading out investments over time, the impact of market volatility is reduced, and investors can avoid making large investments at inopportune times. The strategy reduces the risk of buying all at once during a market high and can smooth out the cost of purchasing assets over time.
In the context of this strategy, the Investment Amount (USD) is set by the user and represents the amount of capital to be invested in each buy order. The strategy executes buy orders whenever the price crosses below the lower Bollinger Band, which suggests a potential market correction or pullback. This is an effective way to average the entry price and avoid the emotional pitfalls of trying to time the market perfectly.
2. Mean Reversion
Mean reversion is a concept that suggests prices will tend to return to their historical average or mean over time. In this strategy, mean reversion is implemented using the Bollinger Bands, which are based on a moving average and standard deviation. The lower band is considered a potential buy signal when the price crosses below it, indicating that the asset has become oversold or underpriced relative to its historical average. This triggers the DCA buy order.
Mean reversion strategies are popular because they exploit the natural tendency of prices to revert to their mean after experiencing extreme deviations, such as during market corrections or panic selling.
3. Bollinger Bands
Bollinger Bands are a technical analysis tool that consists of three lines:
Middle Band: The moving average, usually a 200-period Exponential Moving Average (EMA) in this strategy. This serves as the "mean" or baseline.
Upper Band: The middle band plus a certain number of standard deviations (multiplier). The upper band is used to identify overbought conditions.
Lower Band: The middle band minus a certain number of standard deviations (multiplier). The lower band is used to identify oversold conditions.
In this strategy, the Bollinger Bands are used to identify potential entry points for DCA trades. When the price crosses below the lower band, this is seen as a potential opportunity for mean reversion, suggesting that the asset may be oversold and could reverse back toward the middle band (the EMA). Conversely, when the price crosses above the upper band, it indicates overbought conditions and signals potential market exhaustion.
4. Time-Based Entry and Exit
The strategy has specific entry and exit points defined by time parameters:
Open Date: The date when the strategy begins opening positions.
Close Date: The date when all positions are closed.
This time-bound approach ensures that the strategy is active only during a specified window, which can be useful for testing specific market conditions or focusing on a particular time frame.
5. Position Sizing
Position sizing is determined by the Investment Amount (USD), which is the fixed amount to be invested in each buy order. The quantity of the asset to be purchased is calculated by dividing the investment amount by the current price of the asset (investment_amount / close). This ensures that the amount invested remains constant despite fluctuations in the asset's price.
6. Closing All Positions
The strategy includes an exit rule that closes all positions once the specified close date is reached. This allows for controlled exits and limits the exposure to market fluctuations beyond the strategy's timeframe.
7. Background Color Based on Price Relative to Bollinger Bands
The script uses the background color of the chart to provide visual feedback about the price's relationship with the Bollinger Bands:
Red background indicates the price is above the upper band, signaling overbought conditions.
Green background indicates the price is below the lower band, signaling oversold conditions.
This provides an easy-to-interpret visual cue for traders to assess the current market environment.
Postscript: Configuring Initial Capital for Backtesting
To ensure the backtest results align with the actual investment scenario, users must adjust the Initial Capital in the TradingView strategy properties. This is done by calculating the Initial Capital as the product of the Total Closed Trades and the Investment Amount (USD). For instance:
If the user is investing 100 USD per trade and has 10 closed trades, the Initial Capital should be set to 1,000 USD.
Similarly, if the user is investing 200 USD per trade and has 24 closed trades, the Initial Capital should be set to 4,800 USD.
This adjustment ensures that the backtesting results reflect the actual capital deployed in the strategy and provides an accurate representation of potential gains and losses.
Conclusion
The DCA strategy with Mean Reversion and Bollinger Bands is a systematic approach to investing that leverages the power of regular investments and technical analysis to reduce market timing risks. By combining DCA with the insights offered by Bollinger Bands and mean reversion, this strategy offers a structured way to navigate volatile markets while targeting favorable entry points. The clear entry and exit rules, coupled with time-based constraints, make it a robust and disciplined approach to long-term investing.
Precision Trading Strategy: Golden EdgeThe PTS: Golden Edge strategy is designed for scalping Gold (XAU/USD) on lower timeframes, such as the 1-minute chart. It captures high-probability trade setups by aligning with strong trends and momentum, while filtering out low-quality trades during consolidation or low-volatility periods.
The strategy uses a combination of technical indicators to identify optimal entry points:
1. Exponential Moving Averages (EMAs): A fast EMA (3-period) and a slow EMA (33-period) are used to detect short-term trend reversals via crossover signals.
2. Hull Moving Average (HMA): A 66-period HMA acts as a higher-timeframe trend filter to ensure trades align with the overall market direction.
3. Relative Strength Index (RSI): A 12-period RSI identifies momentum. The strategy requires RSI > 55 for long trades and RSI < 45 for short trades, ensuring entries are backed by strong buying or selling pressure.
4. Average True Range (ATR): A 14-period ATR ensures trades occur only during volatile conditions, avoiding choppy or low-movement markets.
By combining these tools, the PTS: Golden Edge strategy creates a precise framework for scalping and offers a systematic approach to capitalize on Gold’s price movements efficiently.
MultiLayer Acceleration/Deceleration Strategy [Skyrexio]Overview
MultiLayer Acceleration/Deceleration Strategy leverages the combination of Acceleration/Deceleration Indicator(AC), Williams Alligator, Williams Fractals and Exponential Moving Average (EMA) to obtain the high probability long setups. Moreover, strategy uses multi trades system, adding funds to long position if it considered that current trend has likely became stronger. Acceleration/Deceleration Indicator is used for creating signals, while Alligator and Fractal are used in conjunction as an approximation of short-term trend to filter them. At the same time EMA (default EMA's period = 100) is used as high probability long-term trend filter to open long trades only if it considers current price action as an uptrend. More information in "Methodology" and "Justification of Methodology" paragraphs. The strategy opens only long trades.
Unique Features
No fixed stop-loss and take profit: Instead of fixed stop-loss level strategy utilizes technical condition obtained by Fractals and Alligator to identify when current uptrend is likely to be over (more information in "Methodology" and "Justification of Methodology" paragraphs)
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Multilayer trades opening system: strategy uses only 10% of capital in every trade and open up to 5 trades at the same time if script consider current trend as strong one.
Short and long term trend trade filters: strategy uses EMA as high probability long-term trend filter and Alligator and Fractal combination as a short-term one.
Methodology
The strategy opens long trade when the following price met the conditions:
1. Price closed above EMA (by default, period = 100). Crossover is not obligatory.
2. Combination of Alligator and Williams Fractals shall consider current trend as an upward (all details in "Justification of Methodology" paragraph)
3. Acceleration/Deceleration shall create one of two types of long signals (all details in "Justification of Methodology" paragraph). Buy stop order is placed one tick above the candle's high of last created long signal.
4. If price reaches the order price, long position is opened with 10% of capital.
5. If currently we have opened position and price creates and hit the order price of another one long signal, another one long position will be added to the previous with another one 10% of capital. Strategy allows to open up to 5 long trades simultaneously.
6. If combination of Alligator and Williams Fractals shall consider current trend has been changed from up to downtrend, all long trades will be closed, no matter how many trades has been opened.
Script also has additional visuals. If second long trade has been opened simultaneously the Alligator's teeth line is plotted with the green color. Also for every trade in a row from 2 to 5 the label "Buy More" is also plotted just below the teeth line. With every next simultaneously opened trade the green color of the space between teeth and price became less transparent.
Strategy settings
In the inputs window user can setup strategy setting: EMA Length (by default = 100, period of EMA, used for long-term trend filtering EMA calculation). User can choose the optimal parameters during backtesting on certain price chart.
Justification of Methodology
Let's explore the key concepts of this strategy and understand how they work together. We'll begin with the simplest: the EMA.
The Exponential Moving Average (EMA) is a type of moving average that assigns greater weight to recent price data, making it more responsive to current market changes compared to the Simple Moving Average (SMA). This tool is widely used in technical analysis to identify trends and generate buy or sell signals. The EMA is calculated as follows:
1.Calculate the Smoothing Multiplier:
Multiplier = 2 / (n + 1), Where n is the number of periods.
2. EMA Calculation
EMA = (Current Price) × Multiplier + (Previous EMA) × (1 − Multiplier)
In this strategy, the EMA acts as a long-term trend filter. For instance, long trades are considered only when the price closes above the EMA (default: 100-period). This increases the likelihood of entering trades aligned with the prevailing trend.
Next, let’s discuss the short-term trend filter, which combines the Williams Alligator and Williams Fractals. Williams Alligator
Developed by Bill Williams, the Alligator is a technical indicator that identifies trends and potential market reversals. It consists of three smoothed moving averages:
Jaw (Blue Line): The slowest of the three, based on a 13-period smoothed moving average shifted 8 bars ahead.
Teeth (Red Line): The medium-speed line, derived from an 8-period smoothed moving average shifted 5 bars forward.
Lips (Green Line): The fastest line, calculated using a 5-period smoothed moving average shifted 3 bars forward.
When the lines diverge and align in order, the "Alligator" is "awake," signaling a strong trend. When the lines overlap or intertwine, the "Alligator" is "asleep," indicating a range-bound or sideways market. This indicator helps traders determine when to enter or avoid trades.
Fractals, another tool by Bill Williams, help identify potential reversal points on a price chart. A fractal forms over at least five consecutive bars, with the middle bar showing either:
Up Fractal: Occurs when the middle bar has a higher high than the two preceding and two following bars, suggesting a potential downward reversal.
Down Fractal: Happens when the middle bar shows a lower low than the surrounding two bars, hinting at a possible upward reversal.
Traders often use fractals alongside other indicators to confirm trends or reversals, enhancing decision-making accuracy.
How do these tools work together in this strategy? Let’s consider an example of an uptrend.
When the price breaks above an up fractal, it signals a potential bullish trend. This occurs because the up fractal represents a shift in market behavior, where a temporary high was formed due to selling pressure. If the price revisits this level and breaks through, it suggests the market sentiment has turned bullish.
The breakout must occur above the Alligator’s teeth line to confirm the trend. A breakout below the teeth is considered invalid, and the downtrend might still persist. Conversely, in a downtrend, the same logic applies with down fractals.
In this strategy if the most recent up fractal breakout occurs above the Alligator's teeth and follows the last down fractal breakout below the teeth, the algorithm identifies an uptrend. Long trades can be opened during this phase if a signal aligns. If the price breaks a down fractal below the teeth line during an uptrend, the strategy assumes the uptrend has ended and closes all open long trades.
By combining the EMA as a long-term trend filter with the Alligator and fractals as short-term filters, this approach increases the likelihood of opening profitable trades while staying aligned with market dynamics.
Now let's talk about Acceleration/Deceleration signals. AC indicator is calculated using the Awesome Oscillator, so let's first of all briefly explain what is Awesome Oscillator and how it can be calculated. The Awesome Oscillator (AO), developed by Bill Williams, is a momentum indicator designed to measure market momentum by contrasting recent price movements with a longer-term historical perspective. It helps traders detect potential trend reversals and assess the strength of ongoing trends.
The formula for AO is as follows:
AO = SMA5(Median Price) − SMA34(Median Price)
where:
Median Price = (High + Low) / 2
SMA5 = 5-period Simple Moving Average of the Median Price
SMA 34 = 34-period Simple Moving Average of the Median Price
The Acceleration/Deceleration (AC) Indicator, introduced by Bill Williams, measures the rate of change in market momentum. It highlights shifts in the driving force of price movements and helps traders spot early signs of trend changes. The AC Indicator is particularly useful for identifying whether the current momentum is accelerating or decelerating, which can indicate potential reversals or continuations. For AC calculation we shall use the AO calculated above is the following formula:
AC = AO − SMA5(AO), where SMA5(AO)is the 5-period Simple Moving Average of the Awesome Oscillator
When the AC is above the zero line and rising, it suggests accelerating upward momentum.
When the AC is below the zero line and falling, it indicates accelerating downward momentum.
When the AC is below zero line and rising it suggests the decelerating the downtrend momentum. When AC is above the zero line and falling, it suggests the decelerating the uptrend momentum.
Now we can explain which AC signal types are used in this strategy. The first type of long signal is when AC value is below zero line. In this cases we need to see three rising bars on the histogram in a row after the falling one. The second type of signals occurs above the zero line. There we need only two rising AC bars in a row after the falling one to create the signal. The signal bar is the last green bar in this sequence. The strategy places the buy stop order one tick above the candle's high, which corresponds to the signal bar on AC indicator.
After that we can have the following scenarios:
Price hit the order on the next candle in this case strategy opened long with this price.
Price doesn't hit the order price, the next candle set lower high. If current AC bar is increasing buy stop order changes by the script to the high of this new bar plus one tick. This procedure repeats until price finally hit buy order or current AC bar become decreasing. In the second case buy order cancelled and strategy wait for the next AC signal.
If long trades are initiated, the strategy continues utilizing subsequent signals until the total number of trades reaches a maximum of 5. All open trades are closed when the trend shifts to a downtrend, as determined by the combination of the Alligator and Fractals described earlier.
Why we use AC signals? If currently strategy algorithm considers the high probability of the short-term uptrend with the Alligator and Fractals combination pointed out above and the long-term trend is also suggested by the EMA filter as bullish. Rising AC bars after period of falling AC bars indicates the high probability of local pull back end and there is a high chance to open long trade in the direction of the most likely main uptrend. The numbers of rising bars are different for the different AC values (below or above zero line). This is needed because if AC below zero line the local downtrend is likely to be stronger and needs more rising bars to confirm that it has been changed than if AC is above zero.
Why strategy use only 10% per signal? Sometimes we can see the false signals which appears on sideways. Not risking that much script use only 10% per signal. If the first long trade has been open and price continue going up and our trend approximation by Alligator and Fractals is uptrend, strategy add another one 10% of capital to every next AC signal while number of active trades no more than 5. This capital allocation allows to take part in long trades when current uptrend is likely to be strong and use only 10% of capital when there is a high probability of sideways.
Backtest Results
Operating window: Date range of backtests is 2023.01.01 - 2024.11.01. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Initial capital: 10000 USDT
Percent of capital used in every trade: 10%
Maximum Single Position Loss: -5.15%
Maximum Single Profit: +24.57%
Net Profit: +2108.85 USDT (+21.09%)
Total Trades: 111 (36.94% win rate)
Profit Factor: 2.391
Maximum Accumulated Loss: 367.61 USDT (-2.97%)
Average Profit per Trade: 19.00 USDT (+1.78%)
Average Trade Duration: 75 hours
How to Use
Add the script to favorites for easy access.
Apply to the desired timeframe and chart (optimal performance observed on 3h BTC/USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters.
Volume-Weighted Delta Strategy[Kopottaja]Volume-Weighted Delta Strategy
The Volume-Weighted Delta Strategy combines price movement and trading volume to identify potential bullish and bearish market conditions. The strategy calculates a delta value that measures the difference between the close and open prices, weighted by volume over a specified period. This delta is compared against its moving average (SMA) to determine potential trend changes. Key features include:
Volume-Weighted Delta Calculation:
The delta is calculated by summing up the volume-weighted differences between close and open prices over the defined length (Delta Length).
Trend Identification:
If the delta value crosses above its SMA, the strategy interprets this as a bullish condition.
If the delta value crosses below its SMA, the strategy interprets this as a bearish condition.
EMA Integration:
A 20-period EMA is included as an additional trend indicator. The EMA line changes color based on whether the delta value is above or below its SMA:
Green: Bullish (delta > SMA)
Red: Bearish (delta < SMA)
Volume Filter:
A volume threshold can be applied to ensure trades are only executed when significant volume is present, helping to avoid false signals in low-volume conditions.
Entry Conditions:
Buy: When the delta crosses below its SMA (bearish signal).
Sell: When the delta crosses above its SMA (bullish signal).
Customizable Inputs:
Length for delta calculation (Delta Length)
Length for moving average (MA Length)
Volume threshold for trade activation
Optimal Timeframes:
This strategy works best on the 4-hour and 1-day timeframes, where volume and price trends are more stable, reducing noise from smaller timeframes.
How It Works:
This strategy is ideal for traders leveraging the relationship between price movement, volume, and trend indicators. Focusing on volume-weighted price action aims to provide a clearer picture of market sentiment, improving the accuracy of entry and exit signals.
Nifty Options Trendy Markets with TSLNifty options strategy that works on volume, technical analysis etc
Ichimoku by FarmerBTCLegal Disclaimer
This strategy, "Ichimoku by FarmerBTC," is provided for educational and informational purposes only. It does not constitute financial advice and should not be relied upon as such. Trading and investing involve substantial risk, including the potential for losing more than your initial investment. Past performance is not indicative of future results. Always consult with a qualified financial advisor before making trading or investment decisions. The author of this strategy is not responsible for any financial losses incurred through its use.
Overview
The "Ichimoku by FarmerBTC" strategy is a trend-following system built on the Ichimoku Cloud indicator, enhanced with volume analysis and a high-timeframe Simple Moving Average (HTF SMA) condition. It is designed to identify long-only trade opportunities and performs optimally on higher timeframes, such as the daily chart or above.
Core Components
1. Ichimoku Cloud
The Ichimoku Cloud is a comprehensive trend-following indicator that helps identify the overall market direction and momentum. It consists of:
Conversion Line (Tenkan-Sen): Measures short-term momentum.
Base Line (Kijun-Sen): Filters medium-term trends.
Leading Span A: The average of the Conversion and Base Lines, forming one cloud boundary.
Leading Span B: The midpoint of the highest high and lowest low over a longer period, forming the other cloud boundary.
Key Ichimoku Rules Applied:
The strategy identifies bullish trends when:
The price is above the cloud.
The cloud is bullish (Leading Span A > Leading Span B).
2. High-Timeframe Simple Moving Average (HTF SMA)
This condition ensures alignment with the broader trend:
Default SMA Length: 13 periods.
Default Timeframe: 1 day.
HTF SMA Rule:
Trades are allowed only when the price is above the HTF SMA, ensuring alignment with the larger trend.
3. Volume Analysis
The strategy uses volume to validate trade setups:
Volume MA: A 20-period moving average of volume is calculated.
Trades are allowed only when the current volume is at least 1.5x the Volume MA, indicating strong market participation.
Entry and Exit Rules
Entry Condition (Long Only):
Price above the Ichimoku Cloud: Confirms a bullish trend.
Bullish Cloud: Leading Span A > Leading Span B indicates upward momentum.
Price above the HTF SMA: Ensures alignment with the broader trend.
Volume exceeds threshold: Confirms strong market participation.
Exit Condition:
The strategy exits the position when the price moves below the Ichimoku Cloud, signaling a potential trend reversal.
Best Timeframes
This strategy is optimized for daily (1D) or higher timeframes (e.g., weekly 1W). Using it on lower timeframes may produce false signals due to increased noise in price and volume data.
Default Settings
Ichimoku Settings:
Conversion Line Period: 10
Base Line Period: 30
Lagging Span Period: 53
Displacement: 26
HTF SMA Settings:
SMA Length: 13
Timeframe: 1 Day
Volume Settings:
Volume MA Length: 20
Volume Multiplier: 1.5x
Visualization
Ichimoku Cloud:
Dynamic cloud coloring (green for bullish, red for bearish) helps identify the current trend.
HTF SMA:
A purple line overlays the chart, providing a clear representation of the high-timeframe trend.
Volume Panel:
An optional panel displays volume (blue histogram) and the Volume Moving Average (orange line) to analyze market participation.
Advantages of This Strategy
High Accuracy on Higher Timeframes:
Filtering trades using the Ichimoku Cloud, HTF SMA, and volume ensures robust trend alignment, reducing false signals.
Volume Confirmation:
Incorporates volume as a validation metric to enter trades only during strong market participation.
Easy Customization:
Parameters like Ichimoku periods, SMA length, timeframe, and volume thresholds can be adjusted to suit different assets or trading styles.
Limitations
Not Suitable for Low Timeframes:
Lower timeframes can produce excessive noise, leading to false signals.
Long-Only:
The strategy is designed only for bullish markets and does not support short trades.
Lagging Nature of Indicators:
Both the Ichimoku Cloud and SMA are lagging indicators, meaning they react to past price movements.
Conclusion
The "Ichimoku by FarmerBTC" strategy is an excellent tool for trend-following on daily or higher timeframes. Its combination of Ichimoku Cloud, high-timeframe SMA, and volume ensures a robust framework for identifying high-probability long trades in trending markets. However, users are advised to test the strategy thoroughly and manage their risk appropriately. Always consult with a financial professional before making trading decisions.
TTM Grid StrategyThis strategy uses a TTM (based on EMAs of highs and lows) to determine the market's trend direction.
It then deploys a grid trading system around a dynamically updated base price, with the grid's direction and levels adjusting based on the trend.
Trades are executed as the price crosses the predefined grid levels, with the strategy risking a set percentage of equity per trade.
Core Strategy Logic:
TTM State Calculation (ttmState() function):
* Calculates two EMAs based on the `ttmPeriod`: one for the lows (`lowMA`) and one for the highs (`highMA`).
* Defines two threshold levels: `lowThird` (1/3 from the bottom) and `highThird` (2/3 from the bottom) of the range between `highMA` and `lowMA`.
* Returns the current TTM state as an integer:
+ `1` if the close price is above `highThird` (indicating an uptrend).
+ `0` if the close price is below `lowThird` (indicating a downtrend).
+ `-1` if the close price is between `lowThird` and `highThird` (indicating a neutral state).
Enhanced Swing Trading Strategy//@version=5
strategy("Enhanced Swing Trading Strategy", overlay=true)
// Input Parameters
smaShortLength = input.int(50, title="Short SMA Length")
smaLongLength = input.int(200, title="Long SMA Length")
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
takeProfitPerc = input.float(2.0, title="Take Profit (%)")
stopLossPerc = input.float(1.0, title="Stop Loss (%)")
riskPerc = input.float(1.0, title="Risk per Trade (%)")
alertOnSignal = input.bool(true, title="Enable Alerts")
// Indicators
smaShort = ta.sma(close, smaShortLength)
smaLong = ta.sma(close, smaLongLength)
rsi = ta.rsi(close, rsiLength)
= ta.macd(close, 12, 26, 9)
// Conditions
longCondition = ta.crossover(smaShort, smaLong) and rsi > rsiOversold and macdLine > signalLine
shortCondition = ta.crossunder(smaShort, smaLong) and rsi < rsiOverbought and macdLine < signalLine
// Position Sizing based on Risk
capital = strategy.equity
riskAmount = capital * (riskPerc / 100)
stopLossValue = riskAmount / (stopLossPerc / 100)
positionSize = stopLossValue / close
// Entry Signals
if (longCondition)
strategy.entry("Long", strategy.long, qty=positionSize)
if alertOnSignal
alert("Swing Trading: Long Position Opened", alert.freq_once)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=positionSize)
if alertOnSignal
alert("Swing Trading: Short Position Opened", alert.freq_once)
// Exit Conditions
strategy.exit("Take Profit/Stop Loss",
from_entry="Long",
profit=takeProfitPerc,
loss=stopLossPerc)
strategy.exit("Take Profit/Stop Loss",
from_entry="Short",
profit=takeProfitPerc,
loss=stopLossPerc)
// Plotting
plot(smaShort, color=color.blue, title="SMA 50")
plot(smaLong, color=color.red, title="SMA 200")
hline(rsiOverbought, "RSI Overbought", color=color.red)
hline(rsiOversold, "RSI Oversold", color=color.green)
plot(macdLine, color=color.green, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
// Draw Entry and Exit Labels
if (strategy.position_size > 0)
label.new(bar_index, high, "Long Open", style=label.style_label_up, color=color.green)
if (strategy.position_size < 0)
label.new(bar_index, low, "Short Open", style=label.style_label_down, color=color.red)
VIDYA Auto-Trading(Reversal Logic)
Purpose and Unique Features
This script leverages the Variable Index Dynamic Average (VIDYA) to implement a dynamic trend-following auto-trading strategy. By adapting to price volatility, it optimizes entry points and strengthens risk management. Key differentiators of this strategy include:
VIDYA Characteristics:
Quickly responds to price momentum changes through dynamic calculations.
Incorporates volatility adjustments for enhanced trend detection accuracy.
ATR Band Utilization:
Measures market volatility to set stop-loss levels and guide risk management.
Supports more calculated trade entries in volatile markets.
Visual Trend Representation:
Displays "green zones" for uptrends and "red zones" for downtrends.
Enables intuitive understanding of trend continuation and reversal.
Usage Instructions
Entry Conditions
Long Entry:
Enter when the price crosses above the upper band.
Close any previous short positions and initiate a new long position.
Short Entry:
Enter when the price crosses below the lower band.
Close any previous long positions and initiate a new short position.
Exit Conditions
Take Profit and Stop Loss:
Reverse Position Strategy or Position Reversal Strategy
Account Size: ¥100,0000
Commissions and Slippage: Assumed commission of 94 pips per trade and slippage of 1 pip.
Risk per Trade: 10% of account equity (adjustable based on risk tolerance).
Script Parameters
VIDYA Length: The period for calculating the trend (e.g., 14).
Momentum Period: The lookback period for calculating the Chande Momentum Oscillator (CMO).
ATR Band Distance: Adjustment coefficient for the band width (e.g., 1.5).
Price Source: Choose from close, open, high, or low prices for VIDYA calculation.
Trend Display Colors: Customize the colors for uptrend and downtrend zones.
Visualization Options: Toggle the display of trend lines, bands, and other elements on or off.
Strategy Features and Enhancements
Dynamic Momentum Adaptation:
Utilizes VIDYA's sensitivity to momentum changes for rapid trend detection.
Volatility-Aware Risk Management:
Employs ATR to dynamically adjust risk levels, ensuring resilience in volatile markets.
Enhanced Visual Indicators:
Clearly plots trend zones and entry points on the chart.
Simplifies analysis with intuitive visual cues.
Credits
This script is inspired by the innovative work of BigBeluga, whose indicators laid the foundation for this enhanced trend-following strategy. By leveraging BigBeluga’s insights, this script integrates VIDYA, ATR Bands, and other technical elements to create a more dynamic and intuitive trading tool.
We extend our gratitude to BigBeluga and the broader trading community for their invaluable contributions, which have enabled this advanced implementation.
Disclaimer:
This script is provided for educational purposes, and past performance does not guarantee future results. Always practice proper risk management in live trading scenarios.
By leveraging VIDYA, this strategy provides a precise and intuitive approach to trend-following. It is particularly effective in capturing market reversals and adapting to sudden price changes in volatile environments.
DNSE VN301!, SMA & EMA Cross StrategyDiscover the tailored Pinescript to trade VN30F1M Future Contracts intraday, the strategy focuses on SMA & EMA crosses to identify potential entry/exit points. The script closes all positions by 14:25 to avoid holding any contracts overnight.
HNX:VN301!
www.tradingview.com
Setting & Backtest result:
1-minute chart, initial capital of VND 100 million, entering 4 contracts per time, backtest result from Jan-2024 to Nov-2024 yielded a return over 40%, executed over 1,000 trades (average of 4 trades/day), winning trades rate ~ 30% with a profit factor of 1.10.
The default setting of the script:
A decent optimization is reached when SMA and EMA periods are set to 60 and 15 respectively while the Long/Short stop-loss level is set to 20 ticks (2 points) from the entry price.
Entry & Exit conditions:
Long signals are generated when ema(15) crosses over sma(60) while Short signals happen when ema(15) crosses under sma(60). Long orders are closed when ema(15) crosses under sma(60) while Short orders are closed when ema(15) crosses over sma(60).
Exit conditions happen when (whichever came first):
Another Long/Short signal is generated
The Stop-loss level is reached
The Cut-off time is reached (14:25 every day)
*Disclaimers:
Futures Contracts Trading are subjected to a high degree of risk and price movements can fluctuate significantly. This script functions as a reference source and should be used after users have clearly understood how futures trading works, accessed their risk tolerance level, and are knowledgeable of the functioning logic behind the script.
Users are solely responsible for their investment decisions, and DNSE is not responsible for any potential losses from applying such a strategy to real-life trading activities. Past performance is not indicative/guarantee of future results, kindly reach out to us should you have specific questions about this script.
---------------------------------------------------------------------------------------
Khám phá Pinescript được thiết kế riêng để giao dịch Hợp đồng tương lai VN30F1M trong ngày, chiến lược tập trung vào các đường SMA & EMA cắt nhau để xác định các điểm vào/ra tiềm năng. Chiến lược sẽ đóng tất cả các vị thế trước 14:25 để tránh giữ bất kỳ hợp đồng nào qua đêm.
Thiết lập & Kết quả backtest:
Chart 1 phút, vốn ban đầu là 100 triệu đồng, vào 4 hợp đồng mỗi lần, kết quả backtest từ tháng 1/2024 tới tháng 11/2024 mang lại lợi nhuận trên 40%, thực hiện hơn 1.000 giao dịch (trung bình 4 giao dịch/ngày), tỷ lệ giao dịch thắng ~ 30% với hệ số lợi nhuận là 1,10.
Thiết lập mặc định của chiến lược:
Đạt được một mức tối ưu ổn khi SMA và EMA periods được đặt lần lượt là 60 và 15 trong khi mức cắt lỗ được đặt thành 20 tick (2 điểm) từ giá vào.
Điều kiện Mở và Đóng vị thế:
Tín hiệu Long được tạo ra khi ema(15) cắt trên sma(60) trong khi tín hiệu Short xảy ra khi ema(15) cắt dưới sma(60). Lệnh Long được đóng khi ema(15) cắt dưới sma(60) trong khi lệnh Short được đóng khi ema(15) cắt lên sma(60).
Điều kiện đóng vị thể xảy ra khi (tùy điều kiện nào đến trước):
Một tín hiệu Long/Short khác được tạo ra
Giá chạm mức cắt lỗ
Lệnh chưa đóng nhưng tới giờ cut-off (14:25 hàng ngày)
*Tuyên bố miễn trừ trách nhiệm:
Giao dịch hợp đồng tương lai có mức rủi ro cao và giá có thể dao động đáng kể. Chiến lược này hoạt động như một nguồn tham khảo và nên được sử dụng sau khi người dùng đã hiểu rõ cách thức giao dịch hợp đồng tương lai, đã đánh giá mức độ chấp nhận rủi ro của bản thân và hiểu rõ về logic vận hành của chiến lược này.
Người dùng hoàn toàn chịu trách nhiệm về các quyết định đầu tư của mình và DNSE không chịu trách nhiệm về bất kỳ khoản lỗ tiềm ẩn nào khi áp dụng chiến lược này vào các hoạt động giao dịch thực tế. Hiệu suất trong quá khứ không chỉ ra/cam kết kết quả trong tương lai, vui lòng liên hệ với chúng tôi nếu bạn có thắc mắc cụ thể về chiến lược giao dịch này.
Gold Friday Anomaly StrategyThis script implements the " Gold Friday Anomaly Strategy ," a well-known historical trading strategy that leverages the gold market's behavior from Thursday evening to Friday close. It is a backtesting-focused strategy designed to assess the historical performance of this pattern. Traders use this anomaly as it captures a recurring market tendency observed over the years.
What It Does:
Entry Condition: The strategy enters a long position at the beginning of the Friday trading session (Thursday evening close) within the defined backtesting period.
Exit Condition: Friday evening close.
Backtesting Controls: Allows users to set custom backtesting periods to evaluate strategy performance over specific date ranges.
Key Features:
Custom Backtest Periods: Easily configurable inputs to set the start and end date of the backtesting range.
Fixed Slippage and Commission Settings: Ensures realistic simulation of trading conditions.
Process Orders on Close: Backtesting is optimized by processing orders at the bar's close.
Important Notes:
Backtesting Only: This script is intended purely for backtesting purposes. Past performance is not indicative of future results.
Live Trading Recommendations: For live trading, it is highly recommended to use limit orders instead of market orders, especially during evening sessions, as market order slippage can be significant.
Default Settings:
Entry size: 10% of equity per trade.
Slippage: 1 tick.
Commission: 0.05% per trade.
Bollinger Breakout Strategy with Direction Control [4H crypto]Bollinger Breakout Strategy with Direction Control - User Guide
This strategy leverages Bollinger Bands, RSI, and directional filters to identify potential breakout trading opportunities. It is designed for traders looking to capitalize on significant price movements while maintaining control over trade direction (long, short, or both). Here’s how to use this strategy effectively:
How the Strategy Works
Indicators Used:
Bollinger Bands:
A volatility-based indicator with an upper and lower band around a simple moving average (SMA). The bands expand or contract based on market volatility.
RSI (Relative Strength Index):
Measures momentum to determine overbought or oversold conditions. In this strategy, RSI is used to confirm breakout strength.
Trade Direction Control:
You can select whether to trade:
Long only: Buy positions.
Short only: Sell positions.
Both: Trade in both directions depending on conditions.
Breakout Conditions:
Long Trade:
The price closes above the upper Bollinger Band.
RSI is above the midline (50), confirming upward momentum.
The "Trade Direction" setting allows either "Long" or "Both."
Short Trade:
The price closes below the lower Bollinger Band.
RSI is below the midline (50), confirming downward momentum.
The "Trade Direction" setting allows either "Short" or "Both."
Risk Management:
Stop-Loss:
Long trades: Set at 2% below the entry price.
Short trades: Set at 2% above the entry price.
Take-Profit:
Calculated using a Risk/Reward Ratio (default is 2:1).
Adjust this in the strategy settings.
Inputs and Customization
Key Parameters:
Bollinger Bands Length: Default is 20. Adjust based on the desired sensitivity.
Multiplier: Default is 2.0. Higher values widen the bands; lower values narrow them.
RSI Length: Default is 14, which is standard for RSI.
Risk/Reward Ratio: Default is 2.0. Increase for more aggressive profit targets, decrease for conservative exits.
Trade Direction:
Options: "Long," "Short," or "Both."
Example: Set to "Long" in a bullish market to focus only on buy trades.
How to Use This Strategy
Adding the Strategy:
Paste the script into TradingView’s Pine Editor and add it to your chart.
Setting Parameters:
Adjust the Bollinger Band settings, RSI, and Risk/Reward Ratio to fit the asset and timeframe you're trading.
Analyzing Signals:
Green line (Upper Band): Signals breakout potential for long trades.
Red line (Lower Band): Signals breakout potential for short trades.
Blue line (Basis): Central Bollinger Band (SMA), helpful for understanding price trends.
Testing the Strategy:
Use the Strategy Tester in TradingView to backtest performance on your chosen asset and timeframe.
Optimizing for Assets:
Forex pairs, cryptocurrencies (like BTC), or stocks with high volatility are ideal for this strategy.
Works best on higher timeframes like 4H or Daily.
Best Practices
Combine with Volume: Confirm breakouts with increased volume for higher reliability.
Avoid Sideways Markets: Use additional trend filters (like ADX) to avoid trades in low-volatility conditions.
Optimize Parameters: Regularly adjust the Bollinger Bands multiplier and RSI settings to match the asset's behavior.
By utilizing this strategy, you can effectively trade breakouts while maintaining flexibility in trade direction. Adjust the parameters to match your trading style and market conditions for optimal results!
MultiLayer Awesome Oscillator Saucer Strategy [Skyrexio]Overview
MultiLayer Awesome Oscillator Saucer Strategy leverages the combination of Awesome Oscillator (AO), Williams Alligator, Williams Fractals and Exponential Moving Average (EMA) to obtain the high probability long setups. Moreover, strategy uses multi trades system, adding funds to long position if it considered that current trend has likely became stronger. Awesome Oscillator is used for creating signals, while Alligator and Fractal are used in conjunction as an approximation of short-term trend to filter them. At the same time EMA (default EMA's period = 100) is used as high probability long-term trend filter to open long trades only if it considers current price action as an uptrend. More information in "Methodology" and "Justification of Methodology" paragraphs. The strategy opens only long trades.
Unique Features
No fixed stop-loss and take profit: Instead of fixed stop-loss level strategy utilizes technical condition obtained by Fractals and Alligator to identify when current uptrend is likely to be over (more information in "Methodology" and "Justification of Methodology" paragraphs)
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Multilayer trades opening system: strategy uses only 10% of capital in every trade and open up to 5 trades at the same time if script consider current trend as strong one.
Short and long term trend trade filters: strategy uses EMA as high probability long-term trend filter and Alligator and Fractal combination as a short-term one.
Methodology
The strategy opens long trade when the following price met the conditions:
1. Price closed above EMA (by default, period = 100). Crossover is not obligatory.
2. Combination of Alligator and Williams Fractals shall consider current trend as an upward (all details in "Justification of Methodology" paragraph)
3. Awesome Oscillator shall create the "Saucer" long signal (all details in "Justification of Methodology" paragraph). Buy stop order is placed one tick above the candle's high of last created "Saucer signal".
4. If price reaches the order price, long position is opened with 10% of capital.
5. If currently we have opened position and price creates and hit the order price of another one "Saucer" signal another one long position will be added to the previous with another one 10% of capital. Strategy allows to open up to 5 long trades simultaneously.
6. If combination of Alligator and Williams Fractals shall consider current trend has been changed from up to downtrend, all long trades will be closed, no matter how many trades has been opened.
Script also has additional visuals. If second long trade has been opened simultaneously the Alligator's teeth line is plotted with the green color. Also for every trade in a row from 2 to 5 the label "Buy More" is also plotted just below the teeth line. With every next simultaneously opened trade the green color of the space between teeth and price became less transparent.
Strategy settings
In the inputs window user can setup strategy setting: EMA Length (by default = 100, period of EMA, used for long-term trend filtering EMA calculation). User can choose the optimal parameters during backtesting on certain price chart.
Justification of Methodology
Let's go through all concepts used in this strategy to understand how they works together. Let's start from the easies one, the EMA. Let's briefly explain what is EMA. The Exponential Moving Average (EMA) is a type of moving average that gives more weight to recent prices, making it more responsive to current price changes compared to the Simple Moving Average (SMA). It is commonly used in technical analysis to identify trends and generate buy or sell signals. It can be calculated with the following steps:
1.Calculate the Smoothing Multiplier:
Multiplier = 2 / (n + 1), Where n is the number of periods.
2. EMA Calculation
EMA = (Current Price) × Multiplier + (Previous EMA) × (1 − Multiplier)
In this strategy uses EMA an initial long term trend filter. It allows to open long trades only if price close above EMA (by default 50 period). It increases the probability of taking long trades only in the direction of the trend.
Let's go to the next, short-term trend filter which consists of Alligator and Fractals. Let's briefly explain what do these indicators means. The Williams Alligator, developed by Bill Williams, is a technical indicator designed to spot trends and potential market reversals. It uses three smoothed moving averages, referred to as the jaw, teeth, and lips:
Jaw (Blue Line): The slowest of the three, based on a 13-period smoothed moving average shifted 8 bars ahead.
Teeth (Red Line): The medium-speed line, derived from an 8-period smoothed moving average shifted 5 bars forward.
Lips (Green Line): The fastest line, calculated using a 5-period smoothed moving average shifted 3 bars forward.
When these lines diverge and are properly aligned, the "alligator" is considered "awake," signaling a strong trend. Conversely, when the lines overlap or intertwine, the "alligator" is "asleep," indicating a range-bound or sideways market. This indicator assists traders in identifying when to act on or avoid trades.
The Williams Fractals, another tool introduced by Bill Williams, are used to pinpoint potential reversal points on a price chart. A fractal forms when there are at least five consecutive bars, with the middle bar displaying the highest high (for an up fractal) or the lowest low (for a down fractal), relative to the two bars on either side.
Key Points:
Up Fractal: Occurs when the middle bar has a higher high than the two preceding and two following bars, suggesting a potential downward reversal.
Down Fractal: Happens when the middle bar shows a lower low than the surrounding two bars, hinting at a possible upward reversal.
Traders often combine fractals with other indicators to confirm trends or reversals, improving the accuracy of trading decisions.
How we use their combination in this strategy? Let’s consider an uptrend example. A breakout above an up fractal can be interpreted as a bullish signal, indicating a high likelihood that an uptrend is beginning. Here's the reasoning: an up fractal represents a potential shift in market behavior. When the fractal forms, it reflects a pullback caused by traders selling, creating a temporary high. However, if the price manages to return to that fractal’s high and break through it, it suggests the market has "changed its mind" and a bullish trend is likely emerging.
The moment of the breakout marks the potential transition to an uptrend. It’s crucial to note that this breakout must occur above the Alligator's teeth line. If it happens below, the breakout isn’t valid, and the downtrend may still persist. The same logic applies inversely for down fractals in a downtrend scenario.
So, if last up fractal breakout was higher, than Alligator's teeth and it happened after last down fractal breakdown below teeth, algorithm considered current trend as an uptrend. During this uptrend long trades can be opened if signal was flashed. If during the uptrend price breaks down the down fractal below teeth line, strategy considered that uptrend is finished with the high probability and strategy closes all current long trades. This combination is used as a short term trend filter increasing the probability of opening profitable long trades in addition to EMA filter, described above.
Now let's talk about Awesome Oscillator's "Sauser" signals. Briefly explain what is the Awesome Oscillator. The Awesome Oscillator (AO), created by Bill Williams, is a momentum-based indicator that evaluates market momentum by comparing recent price activity to a broader historical context. It assists traders in identifying potential trend reversals and gauging trend strength.
AO = SMA5(Median Price) − SMA34(Median Price)
where:
Median Price = (High + Low) / 2
SMA5 = 5-period Simple Moving Average of the Median Price
SMA 34 = 34-period Simple Moving Average of the Median Price
Now we know what is AO, but what is the "Saucer" signal? This concept was introduced by Bill Williams, let's briefly explain it and how it's used by this strategy. Initially, this type of signal is a combination of the following AO bars: we need 3 bars in a row, the first one shall be higher than the second, the third bar also shall be higher, than second. All three bars shall be above the zero line of AO. The price bar, which corresponds to third "saucer's" bar is our signal bar. Strategy places buy stop order one tick above the price bar which corresponds to signal bar.
After that we can have the following scenarios.
Price hit the order on the next candle in this case strategy opened long with this price.
Price doesn't hit the order price, the next candle set lower low. If current AO bar is increasing buy stop order changes by the script to the high of this new bar plus one tick. This procedure repeats until price finally hit buy order or current AO bar become decreasing. In the second case buy order cancelled and strategy wait for the next "Saucer" signal.
If long trades has been opened strategy use all the next signals until number of trades doesn't exceed 5. All trades are closed when the trend changes to downtrend according to combination of Alligator and Fractals described above.
Why we use "Saucer" signals? If AO above the zero line there is a high probability that price now is in uptrend if we take into account our two trend filters. When we see the decreasing bars on AO and it's above zero it's likely can be considered as a pullback on the uptrend. When we see the stop of AO decreasing and the first increasing bar has been printed there is a high probability that this local pull back is finished and strategy open long trade in the likely direction of a main trend.
Why strategy use only 10% per signal? Sometimes we can see the false signals which appears on sideways. Not risking that much script use only 10% per signal. If the first long trade has been open and price continue going up and our trend approximation by Alligator and Fractals is uptrend, strategy add another one 10% of capital to every next saucer signal while number of active trades no more than 5. This capital allocation allows to take part in long trades when current uptrend is likely to be strong and use only 10% of capital when there is a high probability of sideways.
Backtest Results
Operating window: Date range of backtests is 2023.01.01 - 2024.11.25. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Initial capital: 10000 USDT
Percent of capital used in every trade: 10%
Maximum Single Position Loss: -5.10%
Maximum Single Profit: +22.80%
Net Profit: +2838.58 USDT (+28.39%)
Total Trades: 107 (42.99% win rate)
Profit Factor: 3.364
Maximum Accumulated Loss: 373.43 USDT (-2.98%)
Average Profit per Trade: 26.53 USDT (+2.40%)
Average Trade Duration: 78 hours
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters.
How to Use
Add the script to favorites for easy access.
Apply to the desired timeframe and chart (optimal performance observed on 3h BTC/USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
Supertrend and MACD strategyThe Supertrend and MACD Strategy is a comprehensive trading approach designed to capitalize on market trends by using a combination of the Supertrend indicator, the Exponential Moving Average (EMA), and the Moving Average Convergence Divergence (MACD). This strategy aims to identify optimal entry and exit points for both long and short trades, while incorporating strict risk management rules.
Indicators Used:
Supertrend: This indicator is used to identify the overall trend direction. It provides clear signals for trend reversals, helping traders to enter trades in the direction of the prevailing trend.
200-period EMA: This long-term moving average is used to determine the primary trend direction. The strategy only takes long trades when the price is above the 200 EMA and short trades when the price is below it.
MACD: The MACD is used to gauge the momentum and confirm the signals provided by the Supertrend and EMA. It consists of the MACD line, the signal line, and the histogram.
Entry Conditions:
Long Entry:
The Supertrend indicator shows an uptrend (direction > 0).
The MACD line is above the signal line (macd > signal).
The price is above the 200-period EMA (close > ema200).
Short Entry:
The Supertrend indicator shows a downtrend (direction < 0).
The MACD line is below the signal line (macd < signal).
The price is below the 200-period EMA (close < ema200).
Exit Conditions:
Long Exit:
Exit the long position when the MACD line crosses below the signal line (ta.crossunder(macd, signal)).
Set a stop loss (SL) below the lowest low of the last 10 periods (lowestLow - 1).
Short Exit:
Exit the short position when the MACD line crosses above the signal line (ta.crossover(macd, signal)).
Set a stop loss (SL) above the highest high of the last 10 periods (highestHigh + 1).
Risk Management:
The strategy ensures that no new positions are opened if there is already an open trade, preventing overexposure in the market.
Alerts:
Alerts are set to notify traders when the MACD crosses the signal line, providing timely updates for potential exit points.
Triple CCI Strategy MFI Confirmed [Skyrexio]Overview
Triple CCI Strategy MFI Confirmed leverages 3 different periods Commodity Channel Index (CCI) indicator in conjunction Money Flow Index (MFI) and Exponential Moving Average (EMA) to obtain the high probability setups. Fast period CCI is used for having the high probability to enter in the direction of short term trend, middle and slow period CCI are used for confirmation, if market now likely in the mid and long-term uptrend. MFI is used to confirm trade with the money inflow/outflow with the high probability. EMA is used as an additional trend filter. Moreover, strategy uses exponential moving average (EMA) to trail the price when it reaches the specific level. More information in "Methodology" and "Justification of Methodology" paragraphs. The strategy opens only long trades.
Unique Features
Dynamic stop-loss system: Instead of fixed stop-loss level strategy utilizes average true range (ATR) multiplied by user given number subtracted from the position entry price as a dynamic stop loss level.
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Four layers trade filtering system: Strategy utilizes two different period CCI indicators, MFI and EMA indicators to confirm the signals produced by fast period CCI.
Trailing take profit level: After reaching the trailing profit activation level scrip activate the trailing of long trade using EMA. More information in methodology.
Methodology
The strategy opens long trade when the following price met the conditions:
Fast period CCI shall crossover the zero-line.
Slow and Middle period CCI shall be above zero-lines.
Price shall close above the EMA. Crossover is not obligatory
MFI shall be above 50
When long trade is executed, strategy set the stop-loss level at the price ATR multiplied by user-given value below the entry price. This level is recalculated on every next candle close, adjusting to the current market volatility.
At the same time strategy set up the trailing stop validation level. When the price crosses the level equals entry price plus ATR multiplied by user-given value script starts to trail the price with EMA. If price closes below EMA long trade is closed. When the trailing starts, script prints the label “Trailing Activated”.
Strategy settings
In the inputs window user can setup the following strategy settings:
ATR Stop Loss (by default = 1.75)
ATR Trailing Profit Activation Level (by default = 2.25)
CCI Fast Length (by default = 14, used for calculation short term period CCI)
CCI Middle Length (by default = 25, used for calculation short term period CCI)
CCI Slow Length (by default = 50, used for calculation long term period CCI)
MFI Length (by default = 14, used for calculation MFI
EMA Length (by default = 50, period of EMA, used for trend filtering EMA calculation)
Trailing EMA Length (by default = 20)
User can choose the optimal parameters during backtesting on certain price chart.
Justification of Methodology
Before understanding why this particular combination of indicator has been chosen let's briefly explain what is CCI, MFI and EMA.
The Commodity Channel Index (CCI) is a momentum-based technical indicator that measures the deviation of a security's price from its average price over a specific period. It helps traders identify overbought or oversold conditions and potential trend reversals.
The CCI formula is:
CCI = (Typical Price − SMA) / (0.015 × Mean Deviation)
Typical Price (TP): This is calculated as the average of the high, low, and closing prices for the period.
Simple Moving Average (SMA): This is the average of the Typical Prices over a specific number of periods.
Mean Deviation: This is the average of the absolute differences between the Typical Price and the SMA.
The result is a value that typically fluctuates between +100 and -100, though it is not bounded and can go higher or lower depending on the price movement.
The Money Flow Index (MFI) is a technical indicator that measures the strength of money flowing into and out of a security. It combines price and volume data to assess buying and selling pressure and is often used to identify overbought or oversold conditions. The formula for MFI involves several steps:
1. Calculate the Typical Price (TP):
TP = (high + low + close) / 3
2. Calculate the Raw Money Flow (RMF):
Raw Money Flow = TP × Volume
3. Determine Positive and Negative Money Flow:
If the current TP is greater than the previous TP, it's Positive Money Flow.
If the current TP is less than the previous TP, it's Negative Money Flow.
4. Calculate the Money Flow Ratio (MFR):
Money Flow Ratio = Sum of Positive Money Flow (over n periods) / Sum of Negative Money Flow (over n periods)
5. Calculate the Money Flow Index (MFI):
MFI = 100 − (100 / (1 + Money Flow Ratio))
MFI above 80 can be considered as overbought, below 20 - oversold.
The Exponential Moving Average (EMA) is a type of moving average that places greater weight and significance on the most recent data points. It is widely used in technical analysis to smooth price data and identify trends more quickly than the Simple Moving Average (SMA).
Formula:
1. Calculate the multiplier
Multiplier = 2 / (n + 1) , Where n is the number of periods.
2. EMA Calculation
EMA = (Current Price) × Multiplier + (Previous EMA) × (1 − Multiplier)
This strategy leverages Fast period CCI, which shall break the zero line to the upside to say that probability of short term trend change to the upside increased. This zero line crossover shall be confirmed by the Middle and Slow periods CCI Indicators. At the moment of breakout these two CCIs shall be above 0, indicating that there is a high probability that price is in middle and long term uptrend. This approach increases chances to have a long trade setup in the direction of mid-term and long-term trends when the short-term trend starts to reverse to the upside.
Additionally strategy uses MFI to have a greater probability that fast CCI breakout is confirmed by this indicator. We consider the values of MFI above 50 as a higher probability that trend change from downtrend to the uptrend is real. Script opens long trades only if MFI is above 50. As you already know from the MFI description, it incorporates volume in its calculation, therefore we have another one confirmation factor.
Finally, strategy uses EMA an additional trend filter. It allows to open long trades only if price close above EMA (by default 50 period). It increases the probability of taking long trades only in the direction of the trend.
ATR is used to adjust the strategy risk management to the current market volatility. If volatility is low, we don’t need the large stop loss to understand the there is a high probability that we made a mistake opening the trade. User can setup the settings ATR Stop Loss and ATR Trailing Profit Activation Level to realize his own risk to reward preferences, but the unique feature of a strategy is that after reaching trailing profit activation level strategy is trying to follow the trend until it is likely to be finished instead of using fixed risk management settings. It allows sometimes to be involved in the large movements. It’s also important to make a note, that script uses another one EMA (by default = 20 period) as a trailing profit level.
Backtest Results
Operating window: Date range of backtests is 2022.04.01 - 2024.11.25. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Initial capital: 10000 USDT
Percent of capital used in every trade: 50%
Maximum Single Position Loss: -4.13%
Maximum Single Profit: +19.66%
Net Profit: +5421.21 USDT (+54.21%)
Total Trades: 108 (44.44% win rate)
Profit Factor: 2.006
Maximum Accumulated Loss: 777.40 USDT (-7.77%)
Average Profit per Trade: 50.20 USDT (+0.85%)
Average Trade Duration: 44 hours
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters.
How to Use
Add the script to favorites for easy access.
Apply to the desired timeframe and chart (optimal performance observed on 2h BTC/USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
BTCUSD Momentum After Abnormal DaysThis indicator identifies abnormal days in the Bitcoin market (BTCUSD) based on daily returns exceeding specific thresholds defined by a statistical approach. It is inspired by the findings of Caporale and Plastun (2020), who analyzed the cryptocurrency market's inefficiencies and identified exploitable patterns, particularly around abnormal returns.
Key Concept:
Abnormal Days:
Days where the daily return significantly deviates (positively or negatively) from the historical average.
Positive abnormal days: Returns exceed the mean return plus k times the standard deviation.
Negative abnormal days: Returns fall below the mean return minus k times the standard deviation.
Momentum Effect:
As described in the academic paper, on abnormal days, prices tend to move in the direction of the abnormal return until the end of the trading day, creating momentum effects. This can be leveraged by traders for profit opportunities.
How It Works:
Calculation:
The script calculates the daily return as the percentage difference between the open and close prices. It then derives the mean and standard deviation of returns over a configurable lookback period.
Thresholds:
The script dynamically computes upper and lower thresholds for abnormal days using the mean and standard deviation. Days exceeding these thresholds are flagged as abnormal.
Visualization:
The mean return and thresholds are plotted as dynamic lines.
Abnormal days are visually highlighted with transparent green (positive) or red (negative) backgrounds on the chart.
References:
This indicator is based on the methodology discussed in "Momentum Effects in the Cryptocurrency Market After One-Day Abnormal Returns" by Caporale and Plastun (2020). Their research demonstrates that hourly returns during abnormal days exhibit a strong momentum effect, moving in the same direction as the abnormal return. This behavior contradicts the efficient market hypothesis and suggests profitable trading opportunities.
"Prices tend to move in the direction of abnormal returns till the end of the day, which implies the existence of a momentum effect on that day giving rise to exploitable profit opportunities" (Caporale & Plastun, 2020).
SMA Buy/Sell Strategy with Significant Slope and Dynamic TP/SLDescription:
This strategy uses a simple moving average (SMA) to detect trading opportunities based on the slope and proximity of price action. It ensures trades are only executed during significant trends, reducing false signals caused by sideways movements. The strategy incorporates dynamic risk management with an initial ambitious Take Profit (TP) and a Trailing Stop Loss (SL) to protect profits.
Key Features:
Trend Detection with SMA:
Two SMAs are calculated: one on High values and one on Low values.
Signals are generated when the price crosses these SMAs, ensuring:
Buy: Price closes above the SMA on High, with a significant upward slope.
Sell: Price closes below the SMA on Low, with a significant downward slope.
Slope Significance Check:
The slope of the SMA is calculated over a configurable period.
Only trends with a slope variation exceeding a user-defined percentage threshold are considered significant.
Dynamic Risk Management:
Ambitious Initial TP: Positions target a high percentage gain upon entry.
Trailing SL: Automatically adjusts as the price moves in favor of the trade, locking in profits.
Automatic Position Management:
Opposing signals close existing positions to avoid conflicting trades.
Configurable position size for risk control.
Parameters:
SMA Period: Number of candles for calculating the SMA.
Initial Take Profit (%): Percentage gain for the initial TP.
Trailing Stop Loss (%): Percentage for trailing SL based on the current price.
Slope Threshold (%): Minimum percentage change in SMA slope to confirm trend significance.
How It Works:
Buy Signal:
The price closes above the SMA on High values.
The slope of the SMA (on High) is positive and exceeds the slope threshold.
Sell Signal:
The price closes below the SMA on Low values.
The slope of the SMA (on Low) is negative and exceeds the slope threshold.
Exits:
A position closes at the Take Profit level, Trailing Stop Loss, or when an opposing signal is generated.
Use Case:
This strategy is ideal for trending markets where price action respects moving averages. It can be used on any timeframe or asset but is particularly effective in markets with clear directional movements.
Recommended Settings:
Timeframe: Works well on higher timeframes (e.g., 1H, 4H, Daily).
Slope Threshold (%): Default is 5%, adjust based on market volatility.
Initial TP and Trailing SL: Tailor to your risk/reward preferences.
By utilizing this strategy, traders can capitalize on significant market trends while dynamically managing risk. Test it on historical data to optimize the parameters for your preferred market!
Breaks and Retests - Free990Strategy Description: "Breaks and Retests - Free990"
The "Breaks and Retests - Free990" strategy is based on identifying breakout and retest opportunities for potential entries in both long and short trades. The idea is to detect price breakouts above resistance levels or below support levels, and subsequently identify retests that confirm the breakout levels. The strategy offers an automated approach to enter trades after a breakout followed by a retest, which serves as a confirmation of trend continuation.
Key Components:
Support and Resistance Detection:
The strategy calculates pivot levels based on historical price movements to define support and resistance areas. A lookback range is used to determine these key levels.
Breakouts and Retests:
The system identifies when a breakout occurs above a resistance level or below a support level.
It then waits for a retest of the previously broken level as confirmation, which is often a better entry opportunity.
Trade Direction Selection:
Users can choose between "Long Only," "Short Only," or "Both" directions for trading based on their market view.
Stop Loss and Trailing Stop:
An initial stop loss is placed at a defined percentage away from the entry.
The trailing stop loss is activated after the position gains a specified percentage in profit.
Long Entry:
A long entry is triggered if the price breaks above a resistance level and subsequently retests that level successfully.
The entry condition checks if the breakout was confirmed and if a retest was valid.
The long entry is only executed if the user-selected direction is either "Long Only" or "Both."
Short Entry:
A short entry is triggered if the price breaks below a support level and subsequently retests that level.
The short entry is only executed if the user-selected direction is either "Short Only" or "Both."
sell_condition checks whether the support has been broken and whether the retest condition is valid.
An initial stop loss is placed when the trade is opened to limit the risk if the trade moves against the position.
The stop loss is calculated based on a user-defined percentage (stop_loss_percent) of the entry price.
pinescript
Copy code
stop_loss_price := strategy.position_avg_price * (1 - stop_loss_percent / 100)
For long positions, the stop loss is placed below the entry price.
For short positions, the stop loss is placed above the entry price.
Trailing Stop:
When a position achieves a certain profit threshold (profit_threshold_percent), the trailing stop mechanism is activated.
For long positions, the trailing stop follows the highest price reached, ensuring that some profit is locked in if the price reverses.
For short positions, the trailing stop follows the lowest price reached.
Code Logic for Trailing Stop:
Exit Execution:
The strategy exits the position when the price hits the calculated stop loss level.
This includes both the initial stop loss and the trailing stop that adjusts as the trade progresses.
Code Logic for Exit:
Summary:
Breaks and Retests - Free990 uses support and resistance levels to identify breakouts, followed by retests for confirmation.
Entry Points: Triggered when a breakout is confirmed and a retest occurs, for both long and short trades.
Exit Points:
Initial Stop Loss: Limits risk for both long and short trades.
Trailing Stop Loss: Locks in profits as the price moves in favor of the position.
This strategy aims to capture the momentum after breakouts and minimize losses through effective use of stop loss and trailing stops. It gives the flexibility of selecting trade direction and ensures trades are taken with confirmation through the retest, which helps to reduce false breakouts.
Original Code by @HoanGhetti
30-Minute Candle Strategy30-Minute Candle Trading Strategy
This strategy works on a 30-minute candle timeframe. When a new 30-minute candle opens, the following actions will take place based on the previous 30-minute candle's closing price:
Buy Trade Setup:
If the market opens above the previous 30-minute candle's closing price, a buy trade will be executed immediately at the market price.
The stop-loss will be set at the previous 30-minute candle's closing price.
There will be no fixed target.
The trade will be closed 1 minute before the current 30-minute candle closes, regardless of profit or loss.
Sell Trade Setup:
If a buy trade hits the stop-loss and the market moves below the previous 30-minute candle's closing price, a sell trade will be executed immediately at the market price.
The stop-loss for the sell trade will also be set at the previous 30-minute candle's closing price.
There will be no fixed target.
The trade will be closed 1 minute before the current 30-minute candle closes, regardless of profit or loss.
Procedure:
This process will repeat for every 30-minute candle.
If the market crosses the previous 30-minute candle's closing price to the upside, a buy trade will be executed, and the stop-loss will be set at the previous candle's closing price.
If the market crosses the previous 30-minute candle's closing price to the downside, a sell trade will be executed, and the stop-loss will also be set at the previous candle's closing price.
Each trade will be closed 1 minute before the current candle closes.
Key Points:
This strategy applies to every new 30-minute candle.
The stop-loss will always be based on the previous 30-minute candle's closing price.
If a stop-loss is hit, the strategy will automatically switch to the opposite trade (buy to sell or sell to buy) based on market movement crossing the previous candle's closing price.
This is a repetitive and systematic approach to trading, ensuring the rules are followed for every 30-minute candle.
BTC Seasonality Strategy (Weekly)This strategy identifies potential weekend opportunities in Bitcoin (BTC) markets by leveraging the concept of seasonality, entering a position at a predefined time and day, and exiting at a specified time and day.
Key Features
Customizable Time and Day Selection:
Users can select the entry and exit days and corresponding times (in EST).
Directional Flexibility:
The strategy allows traders to choose between long or short positions.
TradingView Compliance:
The script adheres to TradingView's house rules, avoids overly complex conditions, and provides clear user-configurable inputs.
How It Works
The script determines the current weekday and hour in EST, converting TradingView's UTC time for accurate comparisons.
If the current day and hour match the selected entry conditions, a trade (long or short) is opened.
The position is closed when the current day and hour match the specified exit conditions.
Theoretical Basis
Market Seasonality:
The concept of seasonality in financial markets refers to predictable patterns based on time, such as weekends or specific days of the week. Studies have shown that cryptocurrency markets exhibit unique trading behaviors during weekends due to reduced institutional activity and higher retail participation behavioral Biases**:
Retail traders often dominate weekend markets, potentially causing predictable inefficiencies .
Reverences**
Baur, D. G., Hong, K., & Lee, A. D. (2018). Bitcoin: Medium of exchange or speculative assets? Journal of International Financial Markets, Institutions and Money, 54, 177–189.
Urquhart, A. (2016). The inefficiency of Bitcoin. Economics Letters, 148, 80–82.
RSI Strategy With TP/SL - Lower TFThis Pine Script strategy integrates the Relative Strength Index (RSI) for trade signals with user-defined Take Profit (TP) and Stop Loss (SL) levels. It's designed for flexible application in different market conditions, offering long, short, or dual-direction trading.
Short Description
The strategy uses the RSI to identify overbought and oversold market conditions:
Buy signal: When RSI drops below the specified "Buy Level."
Sell signal: When RSI rises above the "Sell Level."
Additionally, it manages risk and profit targets with:
Take Profit (TP): Exits trades when the price reaches a percentage gain.
Stop Loss (SL): Exits trades to limit losses if the price falls by a certain percentage.
The strategy is versatile and includes options for visualizing performance, monthly profit/loss data, and detailed trade metrics.
How to Use
Set Parameters:
RSI Period: Default is 14. Adjust based on your analysis.
RSI Buy/Sell Levels:
Buy Level: Default is 40. Consider higher levels for conservative entries.
Sell Level: Default is 60. Lower this for earlier exits.
Take Profit (%): Set your profit target (default: 5%).
Stop Loss (%): Set your risk tolerance (default: 2%).
Trade Direction: Choose "Long Only," "Short Only," or "Both."
Interpret Signals:
Buy signals appear when RSI crosses below the buy threshold.
Sell signals appear when RSI crosses above the sell threshold.
Risk Management:
The strategy dynamically calculates TP and SL levels for each trade.
TP/SL is applied using the percentage input based on the entry price.
Monitor Performance:
Review trade statistics in the "Strategy Tester."
Use the monthly performance table to track P/L across months.
Customize Alerts:
Alerts for buy, sell, TP, and SL events can be used to automate notifications.
Key Features
Configurable RSI Settings: Adaptable to various market conditions.
Risk Management: Built-in TP and SL management.
Customizable Trade Direction: Tailored for long-only, short-only, or both directions.
Monthly P/L Table: Visualizes performance trends over time.
Alerts: Notifies when critical trade events occur.
Please do your own research before ase this to your real trading.