Scalping Strategy RSI & ADXThis Pine Script implements a scalping strategy that leverages the Relative Strength Index (RSI) and the Average Directional Index (ADX) to identify short-term trading opportunities. The strategy is designed for traders who aim to profit from quick price movements in highly volatile markets.
Key Components:
RSI (Relative Strength Index):
RSI is used to identify overbought and oversold conditions in the market.
If RSI is below the oversold level (default: 30), the script generates a buy signal.
If RSI is above the overbought level (default: 70), the script generates a sell signal.
ADX (Average Directional Index):
ADX measures the strength of a trend.
The script only triggers buy or sell signals when ADX is above a specified threshold (default: 25), ensuring trades occur only in strong trending markets.
Combined Logic:
A buy condition is met when RSI is below the oversold level and ADX indicates a strong trend.
A sell condition is met when RSI is above the overbought level and ADX indicates a strong trend.
Inputs:
RSI Length: Period for RSI calculation (default: 14).
RSI Overbought Level: Threshold for overbought conditions (default: 70).
RSI Oversold Level: Threshold for oversold conditions (default: 30).
ADX Length: Period for ADX calculation (default: 14).
ADX Smoothing: Smoothing factor for ADX (default: 14).
ADX Threshold: Minimum value for ADX to consider a trend strong (default: 25).
Visual Signals:
Green upward arrows indicate buy signals.
Red downward arrows indicate sell signals.
Strategy Execution:
The script uses strategy.entry to open positions based on the defined conditions.
It plots RSI and ADX values for additional visual confirmation.
How to Use:
Apply this script to your TradingView chart.
Adjust the input parameters to suit your preferred market and timeframe.
Backtest the strategy on historical data to assess its performance.
Use in live markets with appropriate risk management measures.
This strategy is ideal for traders who prefer a systematic and rule-based approach to scalping. However, always test and validate the strategy before using it with real funds.
指标和策略
EMA Crossover Buy/Sell Signals 29 decbuy when 20 ema crosses above 50 ema and sell when 20 ema crosses below 50 ema
Linear Signal-Based Strategy[Kopottaja]
Strategy Description for "Linear Signal-Based Strategy"
Key Features:
Linear Signal Calculation:
Combines the RSI (or other exogenous variables) with BTC price data using a weighted sum. The weight (signal_alpha) can be adjusted to emphasize either the exogenous variable or price.
Z-Score Normalization:
Standardizes the linear signal into a Z-score, enabling robust threshold-based decisions for long and short trades.
Threshold-Based Entry:
Long Position: Triggered when the Z-score falls below the lower threshold (-risk_adjustment_factor), indicating a potential oversold condition in BTC.
Short Position: Triggered when the Z-score rises above the upper threshold (risk_adjustment_factor), indicating a potential overbought condition in BTC.
Risk Management:
Configurable stop-loss and take-profit levels automatically manage risk and lock in profits for each trade.
Timeframe Focus:
Optimized for 15-minute and 5-minute charts, making it ideal for intraday and high-frequency trading in BTC/USDT.
How It Works:
The strategy calculates a linear signal as a weighted combination of RSI and BTC price data.
It computes the mean and standard deviation of the linear signal over a configurable lookback_period.
A Z-score is calculated to measure how far the current signal deviates from its mean.
Trading signals are generated when the Z-score crosses the specified thresholds:
Long trades: When the Z-score is below -risk_adjustment_factor.
Short trades: When the Z-score is above risk_adjustment_factor.
Trades are closed automatically at take-profit or stop-loss levels.
Customizable Parameters:
lookback_period: Number of bars for calculating moving averages and Z-score.
signal_alpha: Weight assigned to the exogenous variable (RSI) versus BTC price.
take_profit_percent and stop_loss_percent: Define the profit and risk limits for each trade.
risk_adjustment_factor: Controls the sensitivity of the strategy by setting thresholds for entry conditions.
Applications:
This strategy is optimized for BTC/USDT on 15-minute and 5-minute timeframes, making it suitable for intraday and scalping strategies. It is versatile and can be adapted for other cryptocurrencies or volatile assets with high liquidity. The configurable parameters make it adaptable to various market conditions and risk preferences.
Dynamic Support Resistance Strategy @tradingbauhausDynamic Support Resistance Strategy @tradingbauhaus
This script is designed to identify dynamic support and resistance levels on a trading chart based on pivots (highs and lows) detected over a specific period. It also includes a basic strategy logic to generate entry signals when the price breaks these support or resistance levels. Below is a step-by-step explanation of how it works:
How the Script Works:
Pivot Detection:
The script identifies pivots (highs and lows) using the pivothigh and pivotlow functions.
The period for detecting pivots is configurable (Pivot Period).
The source for pivots can be either High/Low (highs and lows) or Close/Open (close and open), depending on user selection.
Creation of Support and Resistance Channels:
The detected pivots are used to create dynamic support and resistance channels.
The maximum channel width is defined as a percentage (Maximum Channel Width %) of the price range over a 300-bar period.
Only channels containing a minimum number of pivots (Minimum Strength) are considered valid.
Visualization of Channels:
Support and resistance channels are plotted on the chart as shaded areas.
Channel colors are customizable:
Resistance: Red.
Support: Blue.
Channel (price inside): Gray.
Optionally, the detected pivots can be displayed on the chart.
Breakout Detection:
The script checks if the price breaks a support or resistance level.
If the price breaks a resistance level, a buy signal is generated.
If the price breaks a support level, a sell signal is generated.
Breakouts are visually marked with triangles (optional) and trigger alerts.
Moving Averages (Optional):
The script allows displaying two moving averages (SMA or EMA) with configurable periods.
These moving averages can be used as additional reference tools for analysis.
Strategy Logic:
When the price breaks a resistance level, the script enters a long position.
When the price breaks a support level, the script enters a short position.
Script Workflow:
Pivot Identification:
The script searches for highs and lows on the chart based on the configurable period.
These pivots are stored in arrays for later use.
Channel Creation:
For each pivot, the script calculates a support/resistance channel, ensuring it meets the maximum width and minimum pivot requirements.
Valid channels are stored and sorted by "strength" (number of included pivots).
Visualization:
Channels are plotted on the chart as shaded areas using the configured colors.
If enabled, pivots are marked on the chart with labels.
Breakout Detection:
The script checks if the price has broken a support or resistance level on the current bar.
If a breakout is detected, a signal is generated and optionally marked on the chart.
Strategy:
If the price breaks a resistance level, a buy signal is triggered.
If the price breaks a support level, a sell signal is triggered.
User Configuration:
The script allows customization of several parameters to adapt it to different trading styles and assets:
Pivot Period: Period for detecting pivots.
Source: Source for pivots (High/Low or Close/Open).
Maximum Channel Width %: Maximum channel width as a percentage of the price range.
Minimum Strength: Minimum number of pivots required to form a channel.
Maximum Number of S/R: Maximum number of channels to display.
Loopback Period: Lookback period for detecting pivots.
Colors: Customization of colors for resistance, support, and channel.
Extras: Options to display pivots, breakouts, and moving averages.
Example Use Case:
Chart Analysis:
On a daily chart, the script identifies key support and resistance levels based on pivots from the last 10 candles.
Channels are plotted as shaded areas, providing a clear visualization of key zones.
Breakout Trading:
If the price breaks a resistance level, the script generates a buy signal.
If the price breaks a support level, the script generates a sell signal.
Moving Averages:
If moving averages are enabled, they can be used as additional confirmation for signals.
Conclusion:
This script is a powerful tool for traders looking to identify dynamic support and resistance levels and capitalize on breakouts as trading signals. Its flexibility and customization make it suitable for a variety of assets and timeframes.
Sunil High-Frequency Strategy with Simple MACD & RSISunil High-Frequency Strategy with Simple MACD & RSI
This high-frequency trading strategy uses a combination of MACD and RSI to identify quick market opportunities. By leveraging these indicators, combined with dynamic risk management using ATR, it aims to capture small but frequent price movements while ensuring tight control over risk.
Key Features:
Indicators Used:
MACD (Moving Average Convergence Divergence): The strategy uses a shorter MACD configuration (Fast Length of 6 and Slow Length of 12) to capture quick price momentum shifts. A MACD crossover above the signal line triggers a buy signal, while a crossover below the signal line triggers a sell signal.
RSI (Relative Strength Index): A shorter RSI length of 7 is used to gauge overbought and oversold market conditions. The strategy looks for RSI confirmation, with a long trade initiated when RSI is below the overbought level (70) and a short trade initiated when RSI is above the oversold level (30).
Risk Management:
Dynamic Stop Loss and Take Profit: The strategy uses ATR (Average True Range) to calculate dynamic stop loss and take profit levels based on market volatility.
Stop Loss is set at 0.5x ATR to limit risk.
Take Profit is set at 1.5x ATR to capture reasonable price moves.
Trailing Stop: As the market moves in the strategy’s favor, the position is protected by a trailing stop set at 0.5x ATR, allowing the strategy to lock in profits as the price moves further.
Entry & Exit Signals:
Long Entry: Triggered when the MACD crosses above the signal line (bullish crossover) and RSI is below the overbought level (70).
Short Entry: Triggered when the MACD crosses below the signal line (bearish crossover) and RSI is above the oversold level (30).
Exit Conditions: The strategy exits long or short positions based on the stop loss, take profit, or trailing stop activation.
Frequent Trades:
This strategy is designed for high-frequency trading, with trade signals occurring frequently as the MACD and RSI indicators react quickly to price movements. It works best on lower timeframes such as 1-minute, 5-minute, or 15-minute charts, but can be adjusted for different timeframes based on the asset’s volatility.
Customizable Parameters:
MACD Settings: Adjust the Fast Length, Slow Length, and Signal Length to tune the MACD’s sensitivity.
RSI Settings: Customize the RSI Length, Overbought, and Oversold levels to better match your trading style.
ATR Settings: Modify the ATR Length and multipliers for Stop Loss, Take Profit, and Trailing Stop to optimize risk management according to market volatility.
Important Notes:
Market Conditions: This strategy is designed to capture smaller, quicker moves in trending markets. It may not perform well during choppy or sideways markets.
Optimizing for Asset Volatility: Adjust the ATR multipliers based on the asset’s volatility to suit the risk-reward profile that fits your trading goals.
Backtesting: It's recommended to backtest the strategy on different assets and timeframes to ensure optimal performance.
Summary:
The Sunil High-Frequency Strategy leverages a simple combination of MACD and RSI with dynamic risk management (using ATR) to trade small but frequent price movements. The strategy ensures tight stop losses and reasonable take profits, with trailing stops to lock in profits as the price moves in favor of the trade. It is ideal for scalping or intraday trading on lower timeframes, aiming for quick entries and exits with controlled risk.
Adaptive Crypto Trading Strategy with Martingale[Kopottaja]
Adaptive Crypto Trading Strategy with Martingale
Key Features:
Autoencoder-Based Smoothing:
Uses a simple moving average (SMA) to smooth price data and reduce market noise.
Momentum Feature Extraction:
Calculates momentum as the difference between the current price and a longer SMA, simulating CNN-like pattern recognition.
Volatility Thresholds:
Combines momentum signals with volatility levels (measured by standard deviation) to filter high-probability trades.
Martingale Position Sizing:
Automatically increases lot size after losing trades using a configurable multiplier (Martingale Multiplier), with a cap (Maximum Lot Size) to limit risk.
Resets the position size after a winning trade.
Risk Management:
Configurable take-profit and stop-loss percentages to ensure disciplined exits.
Designed for BTC/USDT:
Optimized for trading Bitcoin on short-term timeframes (e.g., 15-minute and 5-minute charts).
How It Works:
Smoothing & Feature Extraction:
Smooths price data over a Smoothing Length period to reduce noise.
Extracts momentum signals and evaluates volatility for trade decision-making.
Entry Conditions:
Long Entry: Triggered when momentum is positive, and volatility exceeds the threshold (Volatility Threshold).
Short Entry: Triggered when momentum is negative, and volatility exceeds the threshold.
Martingale Logic:
After a losing trade, the lot size is increased by the multiplier to recover losses.
Lot size resets to the base size after a profitable trade.
Dynamic Exits:
Positions are automatically closed when the price reaches the take-profit or stop-loss levels.
Customizable Parameters:
Smoothing Length: Adjusts the noise reduction for price data.
Momentum Window: Controls the length of the momentum calculation.
Volatility Threshold: Sets the minimum volatility level required for trade triggers.
Take Profit and Stop Loss: Defines the profit and risk limits for each trade.
Martingale Multiplier: Determines how much to increase the lot size after a losing trade.
Maximum Lot Size: Caps the lot size to prevent excessive risk.
Applications:
Optimized for BTC/USDT trading, particularly on volatile short-term timeframes like 15-minute and 5-minute charts.
Suitable for traders using scalping or intraday strategies looking to exploit high-probability patterns.
Combines advanced statistical techniques with adaptive risk management for robust performance.
S & R - Trend Lines & Channels (Prince of Arabs)Support and Resistance with Trend Channels
This indicator identifies key support and resistance levels based on swing highs and lows over a user-defined lookback period. It also visualizes dynamic trend channels to help traders understand price ranges and market structure.
Key features include:
Support Level: Marked with a green line and labeled "Support," indicating potential buying areas.
Resistance Level: Marked with a red line and labeled "Resistance," indicating potential selling areas.
Trend Channels: Dashed blue (upper) and purple (lower) lines show the price range above resistance and below support, helping to identify overbought and oversold conditions.
Clear Entry Signals: A "Buy" label is displayed near the price when it approaches the support level within a user-defined backtesting range.
Stop Loss and Take Profit Levels: Automatically calculated based on customizable percentages and visualized on the chart for each trade.
Risk-to-Reward Visualization: The indicator simplifies risk management by showing trade levels dynamically.
Bull Market Support Band Strategy rbsemteiThis strategy uses the weekly 20-period SMA and 21-period EMA to determine buy and sell signals. It buys when the EMA crosses above the SMA and sells (or closes the position) when the EMA crosses below the SMA. The strategy uses 100% of available equity for trades, includes a 10% equity stop-loss, and accounts for a commission of 0.1% and slippage of 3 ticks. It is designed to match weekly calculations on a daily timeframe without peeking ahead at future data.
Stochastic RSI + Volume Osc + BBTrend + ATRThis Pine Script strategy integrates multiple technical indicators to automate trading decisions on TradingView. It focuses on identifying long trade opportunities using Stochastic RSI, Volume Oscillator, and BBTrend while managing risk through ATR (Average True Range) for stop-loss and trailing stop calculations.
RSI StrategyCondições de entrada e saída da estratégia:
Entrada em posição longa: A estratégia entra em uma posição comprada (longa) quando o RSI cai abaixo do nível de sobrevenda (20), indicando um possível momento de compra.
Saída de posição longa: A estratégia sai da posição longa em três cenários:
Realização de lucro: Quando o RSI atinge o nível de sobrecompra (70), indicando uma possível reversão de alta para baixa e uma oportunidade de obter lucro.
Stop-loss: Quando o RSI cai abaixo do nível de stop-loss (-15), limitando as perdas em caso de movimento adverso do preço.
Sinal de venda: Quando o RSI atinge novamente o nível de sobrecompra (70), indicando um sinal de venda.
3. Parâmetros da estratégia:
Período do RSI: O período de 14 dias é comumente utilizado para o cálculo do RSI, mas pode ser ajustado de acordo com a preferência do trader e as características do ativo.
Níveis de sobrecompra e sobrevenda: Os níveis de 70 e 20 são valores padrão, mas podem ser ajustados para aumentar ou diminuir a sensibilidade da estratégia.
Nível de stop-loss: O nível de stop-loss de -15 determina o ponto em que a posição é encerrada para limitar as perdas.
Improved Strategy with RSI Trending UpwardsThis strategy is trying to test RSI affect on price trend.
EMA 20/8 with RSI 14 StrategyThe **EMA 20/8 with RSI 14 Strategy** is a trading strategy designed to identify entry and exit points in the market using two Exponential Moving Averages (EMAs) and the Relative Strength Index (RSI). It employs a short EMA (8 periods) and a long EMA (20 periods), capitalizing on crossover signals to indicate potential buying or selling opportunities.
The strategy generates a **long entry** when the short EMA crosses above the long EMA while the RSI is below the oversold threshold (30), suggesting a bullish trend reversal. Conversely, a **short entry** is triggered when the short EMA crosses below the long EMA and the RSI exceeds the overbought level (70), indicating a possible bearish trend reversal.
To manage risk, the strategy incorporates stop-loss and take-profit levels set as percentages of the entry price, ensuring structured exit points for both long and short trades. The script visualizes trade conditions using background colors for easy identification of entry signals directly on the chart. Additionally, it operates with a dynamic position sizing method, allowing the strategy to adjust order sizes based on a percentage of available equity, promoting better capital management during backtesting or live trading scenarios.
EMA + Stochastic Strategy (day trading)Setup Instructions
Exponential Moving Averages (EMA):
Use two EMAs:
50-period EMA for the overall trend.
20-period EMA for shorter-term movements.
Trend Confirmation:
If the 20 EMA is above the 50 EMA, focus on buy opportunities.
If the 20 EMA is below the 50 EMA, focus on sell opportunities.
Stochastic Oscillator:
Set Stochastic to a 14, 3, 3 period (default).
Overbought level = 80; Oversold level = 20.
Look for crossovers:
Buy: Stochastic %K crosses above %D in the oversold zone (below 20).
Sell: Stochastic %K crosses below %D in the overbought zone (above 80).
Entry and Exit Rules
Buy Signal:
The 20 EMA is above the 50 EMA, confirming an uptrend.
The Stochastic Oscillator is in the oversold zone (below 20), and %K crosses above %D.
Enter when the price retraces to and bounces off the 20 EMA in the direction of the trend.
Sell Signal:
The 20 EMA is below the 50 EMA, confirming a downtrend.
The Stochastic Oscillator is in the overbought zone (above 80), and %K crosses below %D.
Enter when the price retraces to and rejects off the 20 EMA in the direction of the trend.
Stop Loss and Take Profit
Stop Loss:
For buy trades: Place the stop loss below the recent swing low.
For sell trades: Place the stop loss above the recent swing high.
Take Profit:
Use a risk-to-reward ratio of 1:2 or higher.
Alternatively, exit the trade when Stochastic reaches the opposite extreme (80 for buys, 20 for sells).
Example
Scenario: GBP/USD on a 15-minute chart.
The 20 EMA is above the 50 EMA, indicating an uptrend.
The Stochastic Oscillator dips below 20, and %K crosses above %D.
Enter a buy trade when the price bounces off the 20 EMA.
Place a stop loss below the nearest swing low and a take profit at twice the risk.
Tips for Success
Avoid Choppy Markets: Ensure the EMAs are diverging, and there’s a clear trend.
Use Stochastic for Confirmation: Only take trades when the Stochastic Oscillator aligns with the EMA trend.
Combine with Price Action:
Watch for candlestick patterns (e.g., pin bars, engulfing candles) near the 20 EMA for additional confirmation.
Practice Discipline: Stick to your stop-loss and take-profit rules.
Bull Market Support Band buy - NJThis strategy buys when the weekly 21-period EMA (Exponential Moving Average) crosses above the weekly 20-period SMA (Simple Moving Average), signaling potential bullish momentum. It closes the position (sells) when the EMA crosses below the SMA, indicating a potential trend reversal.
Dynamic Pairs Trading Strategy[Kopottaja]Dynamic Pairs Trading Strategy
Key Features:
Spread Monitoring:
The strategy computes the spread between two assets (Primary Asset and Secondary Asset) and tracks its deviation from the mean using a Z-score.
Threshold-Based Entry and Exit:
Entry Signal:
A long position is initiated when the Z-score falls below the lower threshold (indicating the spread is unusually low).
A short position is initiated when the Z-score exceeds the upper threshold (indicating the spread is unusually high).
Exit Signal:
Positions are closed when the Z-score returns to a neutral range, as defined by the Exit Threshold.
Highly Effective with Finnish Asset Pairs:
This strategy is particularly effective for pairs like Nordea (NDA_FI) and Aktia (AKTIA) due to their historical correlation and similar market dynamics.
Customizable Parameters:
Users can adjust the Lookback Period, Entry Threshold, and Exit Threshold to suit different asset pairs or market conditions.
Visualizations:
The Z-score and threshold levels are plotted for clear real-time monitoring.
Recommended Asset Pairs: This strategy is flexible and can be applied to various correlated asset pairs. Examples include:
Nordea (NDA_FI) and Aktia (AKTIA):
Both are Finnish financial institutions with a high degree of correlation, making them an ideal pair for this strategy.
Fortum (FORTUM) and Neste (NESTE):
Two major players in the Finnish energy sector, exhibiting co-movement due to similar industry dynamics.
Kone (KNEBV) and Cargotec (CGCBV):
Industrial companies with shared exposure to global markets, providing opportunities for pairs trading.
How It Works:
Spread Calculation:
The spread between the two assets is calculated in real time (Primary Asset - Secondary Asset).
Z-Score Normalization:
The spread is standardized into a Z-score, measuring how far it deviates from its mean over a user-defined Lookback Period.
Trade Execution:
A long or short position is opened when the Z-score crosses the entry thresholds.
Positions are closed when the Z-score returns to a neutral range (within the Exit Threshold).
Why Use This Strategy?
This strategy is designed for market-neutral trading, allowing traders to profit from the mean-reverting tendencies of correlated assets while minimizing directional market risk. Its effectiveness is enhanced when applied to highly correlated asset pairs like Nordea and Aktia, or other similar pairs from the Finnish or global markets.
5분봉 자동매매 전략 (최적화: 안정화)//@version=5
strategy("5분봉 자동매매 전략 (최적화: 안정화)", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === PARAMETERS ===
// RSI
rsiPeriod = input.int(14, title="RSI Period", minval=1)
overbought = input.float(70.0, title="RSI Overbought Level", step=0.1)
oversold = input.float(30.0, title="RSI Oversold Level", step=0.1)
// 이동평균선
smaShort = input.int(50, title="Short SMA Length", minval=1)
smaLong = input.int(200, title="Long SMA Length", minval=1)
// 거래량 필터
volumeThreshold = input.float(1.2, title="Volume Multiplier", step=0.1)
// 리스크 관리
takeProfit = input.float(3.0, title="Take Profit %", step=0.1)
stopLoss = input.float(1.0, title="Stop Loss %", step=0.1)
trailOffset = input.float(0.5, title="Trailing Stop Offset (Points)", step=0.1)
// === INDICATORS ===
rsiValue = ta.rsi(close, rsiPeriod)
smaShortValue = ta.sma(close, smaShort)
smaLongValue = ta.sma(close, smaLong)
= ta.macd(close, 12, 26, 9)
= ta.bb(close, 20, 2)
avgVolume = ta.sma(volume, 20)
// 상위 시간대 RSI 필터
higherRSI = request.security(syminfo.tickerid, "15", ta.rsi(close, rsiPeriod), lookahead=barmerge.lookahead_on)
// === LONG ENTRY CONDITION ===
longCondition = (rsiValue < oversold) and
(smaShortValue > smaLongValue) and
(macdLine > signalLine) and
(close <= lowerBB) and
(volume > avgVolume * volumeThreshold) and
(higherRSI < 50)
// === SHORT ENTRY CONDITION ===
shortCondition = (rsiValue > overbought) and
(smaShortValue < smaLongValue) and
(macdLine < signalLine) and
(close >= upperBB) and
(volume > avgVolume * volumeThreshold) and
(higherRSI > 50)
// === POSITIONS ===
if (longCondition and strategy.position_size == 0)
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", stop=strategy.position_avg_price * (1 - stopLoss / 100), limit=strategy.position_avg_price * (1 + takeProfit / 100), trail_points=trailOffset)
if (shortCondition and strategy.position_size == 0)
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", stop=strategy.position_avg_price * (1 + stopLoss / 100), limit=strategy.position_avg_price * (1 - takeProfit / 100), trail_points=trailOffset)
// === 손절 신호 표시 ===
var bool stopLongShown = false
var bool stopShortShown = false
if (strategy.position_size > 0 and close <= strategy.position_avg_price * (1 - stopLoss / 100) and not stopLongShown)
label.new(bar_index, close, text="STOP_LONG", color=color.red, style=label.style_label_down, textcolor=color.white)
stopLongShown := true
if (strategy.position_size < 0 and close >= strategy.position_avg_price * (1 + stopLoss / 100) and not stopShortShown)
label.new(bar_index, close, text="STOP_SHORT", color=color.red, style=label.style_label_up, textcolor=color.white)
stopShortShown := true
if (strategy.position_size == 0)
stopLongShown := false
stopShortShown := false
// === VISUAL INDICATORS ===
plot(smaShortValue, title="SMA 50", color=color.blue)
plot(smaLongValue, title="SMA 200", color=color.red)
plot(upperBB, title="Upper BB", color=color.green)
plot(lowerBB, title="Lower BB", color=color.red)
plot(rsiValue, title="RSI", color=color.purple)
plot(longCondition ? close : na, title="Long Signal", style=plot.style_cross, color=color.green, linewidth=2)
plot(shortCondition ? close : na, title="Short Signal", style=plot.style_cross, color=color.red, linewidth=2)
charan Below is the updated Pine Script code, incorporating the additional logic for candle overlap conditions. The script now automatically buys or sells 0.1 BTC based on candle body overlap and exits the position when a 20% profit is achieved.
Pressure Reversal & Candle OverlapBelow is the updated Pine Script code, incorporating the additional logic for candle overlap conditions. The script now automatically buys or sells 0.1 BTC based on candle body overlap and exits the position when a 20% profit is achieved.
IU Higher Timeframe MA Cross StrategyIU Higher Timeframe MA Cross Strategy
The IU Higher Timeframe MA Cross Strategy is a versatile trading tool designed to identify trend by utilizing two customizable moving averages (MAs) across different timeframes and types. This strategy includes detailed entry and exit rules with fully configurable inputs, offering flexibility to suit various trading styles.
Key Features:
- Two moving averages (MA1 and MA2) with customizable types, lengths, sources, and timeframes.
- Both long and short trade setups based on MA crossovers.
- Integrated risk management with adjustable stop-loss and take-profit levels based on a user-defined risk-to-reward (RTR) ratio.
- Clear visualization of MAs, entry points, stop-loss, and take-profit zones.
Inputs:
1. Risk-to-Reward Ratio (RTR):
- Defines the take-profit level in relation to the stop-loss distance. Default is 2.
2. MA1 Settings:
- Source: Select the data source for calculating MA1 (e.g., close, open, high, low). Default is close.
- Timeframe: Specify the timeframe for MA1 calculation. Default is 60 (60-minute chart).
- Length: Set the lookback period for MA1 calculation. Default is 20.
- Type: Choose the type of moving average (options: SMA, EMA, SMMA, WMA, VWMA). Default is EMA.
- Smooth: Option to enable or disable smoothing of MA1 to merge gaps. Default is true.
3. MA2 Settings:
- Source: Select the data source for calculating MA2 (e.g., close, open, high, low). Default is close.
- Timeframe: Specify the timeframe for MA2 calculation. Default is 60 (60-minute chart).
- Length: Set the lookback period for MA2 calculation. Default is 50.
- Type: Choose the type of moving average (options: SMA, EMA, SMMA, WMA, VWMA). Default is EMA.
- Smooth: Option to enable or disable smoothing of MA2 to merge gaps. Default is true.
Entry Rules:
- Long Entry:
- Triggered when MA1 crosses above MA2 (crossover).
- Entry is confirmed only when the bar is closed and no existing position is active.
- Short Entry:
- Triggered when MA1 crosses below MA2 (crossunder).
- Entry is confirmed only when the bar is closed and no existing position is active.
Exit Rules:
- Stop-Loss:
- For long positions: Set at the low of the bar preceding the entry.
- For short positions: Set at the high of the bar preceding the entry.
- Take-Profit:
- For long positions: Calculated as (Entry Price - Stop-Loss) * RTR + Entry Price.
- For short positions: Calculated as Entry Price - (Stop-Loss - Entry Price) * RTR.
Visualization:
- Plots MA1 and MA2 on the chart with distinct colors for easy identification.
- Highlights stop-loss and take-profit levels using shaded zones for clear visual representation.
- Displays the entry level for active positions.
This strategy provides a robust framework for traders to identify and act on trend reversals while maintaining strict risk management. The flexibility of its inputs allows for seamless customization to adapt to various market conditions and trading preferences.
Multi-Timeframe RSI + Volume Trend StrategyThis TradingView strategy combines three core components to identify potential long entries and custom sell signals:
Moving Average (MA) Crossover for Long Entries
Uses a short-term MA crossover (MA A crosses above MA B) while both are above a longer-term MA C.
This indicates a bullish shift in short- and medium-term trends.
A position is only opened if no current long position exists.
Multi-Timeframe RSI Confirmation
Requires the RSI on 1-hour, 4-hour, and Daily charts to be within a specified range (e.g., 20–70).
This filters out entries when RSI is overly high or too low on multiple timeframes, aiming to catch reversals or healthy momentum.
Volume Filter for Buys
Confirms that the current bar’s volume exceeds a specified multiple (e.g., 1.5×) of its recent average volume.
Helps ensure that you only enter on higher-volume bars, potentially signifying stronger market interest.
Custom SELL Condition
High “Sell” Volume: The bar’s volume is above another user-defined threshold (e.g., 1.5× the volume MA).
RSI Cross-Down on Multiple Timeframes: At least two of the three timeframes’ RSIs (1h, 4h, Daily) must cross below 70 on the same bar.
MACD Bearish Crossover: The MACD line crosses below its signal line, suggesting a potential downshift in momentum.
When all these sell criteria align on the same bar, the strategy plots a “SELL” label above that bar. Optionally, you can automate a short entry or exit an existing long position at that point.
Stop Loss & Take Profit (ATR-Based)
Uses the Average True Range (ATR) to define dynamic stop loss and take profit levels.
Each bar recalculates these levels based on a multiplier of the ATR (e.g., 10.5× for stop loss, 30× for take profit).
Key Benefits
Trend Alignment: MA crossovers plus a longer MA filter keep the strategy aligned with a broader uptrend for longs.
Reduced False Signals: RSI confirmation on multiple timeframes and a volume check cut down on low-quality trades.
Adaptive Risk Management: ATR-based stops and targets scale with volatility, preventing stops from being too tight in volatile markets or too loose in quieter conditions.
Usage Tips
Parameter Tuning: Adjust RSI bounds, volume multipliers, and MA lengths to suit your market (crypto, forex, stocks).
Backtesting: Thoroughly test on historical data to gauge performance metrics (profit factor, drawdown, etc.).
Market Conditions: The strategy tends to do best in moderately trending environments. Highly choppy markets may produce more whipsaws.
Alerts: You can add alertcondition() calls to receive notifications when either BUY or SELL signals trigger.
With these features, the Multi-Timeframe RSI + Volume Trend Strategy aims to provide high-probability buy entries backed by bullish crossovers, momentum checks, and sufficient volume, while also identifying bearish conditions for exit or shorting through a robust, multi-factor sell signal.