Volume Profile / Fixed Range Strategy with RSI SMAThis strategy utilizes the volume profile of the past x number of bars.
The idea is that the majority of the time price is ranging, during this time the volume profile shows where the vast majority of trading occurs. The assumption is if price exceeds the 1st STD either upwards or downwards there is a good likelihood of a break to the upside.
This is then coupled with the RSI for confluence, once the RSI breaks above the mid-point(50) this indicates strong upward momentum.
Thus the system will go long if: Price is above 1st STD of the Volume Profile and RSI > 50
The system will go to cash if: Price has closed below the upper bound and the RSI < 50
Phân tích Xu hướng
Jalambi Paul modelKey Components
Inputs:
Window Length (window): The number of periods for calculating the rolling statistics. Default is set to 50.
Risk Percentage (risk_percentage): The percentage of capital risked per trade. Default is 1.0%.
Stop Loss and Take Profit Levels:
Stop Loss: Default is 2% of the entry price.
Take Profit: Default is 4% of the entry price.
Logarithmic Returns:
Calculates the logarithmic return of the price series using:
log_return
=
log
(
close
close
)
log_return=log(
close
close
)
This helps in normalizing price changes.
Rolling Statistics:
Mean (rolling_mean): Calculated over the rolling window using the Simple Moving Average (SMA).
Standard Deviation (rolling_std): Measured over the rolling window to understand volatility.
Shiryaev-Zhou Index (SZI):
The SZI is a standardized z-score:
SZI
=
log_return
−
rolling_mean
rolling_std
SZI=
rolling_std
log_return−rolling_mean
This metric is used to detect overbought or oversold conditions.
Signal Generation:
Buy Signal (long_signal): Triggered when SZI is below a fixed threshold (-2.0).
Sell Signal (short_signal): Triggered when SZI is above a fixed threshold (2.0).
Visuals on the Chart:
Buy signals are plotted below the price bars with green upward-pointing labels.
Sell signals are plotted above the price bars with red downward-pointing labels.
Trade Execution:
Entry Conditions:
Long positions are opened when long_signal is true.
Short positions are opened when short_signal is true.
Exit Conditions:
Stop Loss and Take Profit levels are calculated based on the entry price and the respective percentage inputs.
Positions are closed automatically when these levels are hit.
Visualization:
Plots the stop-loss (red line) and take-profit (green line) levels on the chart for easier tracking.
Trend Trader-Remastered StrategyOfficial Strategy for Trend Trader - Remastered
Indicator: Trend Trader-Remastered (TTR)
Overview:
The Trend Trader-Remastered is a refined and highly sophisticated implementation of the Parabolic SAR designed to create strategic buy and sell entry signals, alongside precision take profit and re-entry signals based on marked Bill Williams (BW) fractals. Built with a deep emphasis on clarity and accuracy, this indicator ensures that only relevant and meaningful signals are generated, eliminating any unnecessary entries or exits.
Please check the indicator details and updates via the link above.
Important Disclosure:
My primary objective is to provide realistic strategies and a code base for the TradingView Community. Therefore, the default settings of the strategy version of the indicator have been set to reflect realistic world trading scenarios and best practices.
Key Features:
Strategy execution date&time range.
Take Profit Reduction Rate: The percentage of progressive reduction on active position size for take profit signals.
Example:
TP Reduce: 10%
Entry Position Size: 100
TP1: 100 - 10 = 90
TP2: 90 - 9 = 81
Re-Entry When Rate: The percentage of position size on initial entry of the signal to determine re-entry.
Example:
RE When: 50%
Entry Position Size: 100
Re-Entry Condition: Active Position Size < 50
Re-Entry Fill Rate: The percentage of position size on initial entry of the signal to be completed.
Example:
RE Fill: 75%
Entry Position Size: 100
Active Position Size: 50
Re-Entry Order Size: 25
Final Active Position Size:75
Important: Even RE When condition is met, the active position size required to drop below RE Fill rate to trigger re-entry order.
Key Points:
'Process Orders on Close' is enabled as Take Profit and Re-Entry signals must be executed on candle close.
'Calculate on Every Tick' is enabled as entry signals are required to be executed within candle time.
'Initial Capital' has been set to 10,000 USD.
'Default Quantity Type' has been set to 'Percent of Equity'.
'Default Quantity' has been set to 10% as the best practice of investing 10% of the assets.
'Currency' has been set to USD.
'Commission Type' has been set to 'Commission Percent'
'Commission Value' has been set to 0.05% to reflect the most realistic results with a common taker fee value.
Vikas_RSI Based TradingRSI-Based Trading Strategy with No Trading Zone and ATR Stop Loss
Description of the RSI-Based Trading Strategy with No Trading Zone and ATR Stop Loss
This Pine Script strategy utilizes the Relative Strength Index (RSI) to identify potential entry and exit points for long (buy) and short (sell) positions in a trading instrument. It incorporates a unique "No Trading Zone" feature and an ATR-based stop loss mechanism for risk management.
RMA 15 and RMA 10 Cross Strategy (Exit on Next Signal)
The RMA Cross Strategy involves using two Rolling Moving Averages (RMA), typically one with a short period (e.g., 10) and another with a longer period (e.g., 15). The strategy generates trading signals based on the crossover of these RMAs:
Signals:
Buy Signal: When the RMA with a shorter period (RMA 10) crosses above the RMA with a longer period (RMA 15), indicating an upward trend.
Sell Signal: When the RMA with a shorter period (RMA 10) crosses below the RMA with a longer period (RMA 15), indicating a downward trend.
EMA Cross with both MinhTuanChiến lược này đơn giản.
Ema 9 cắt 21 trên ema 200 thì long.
Ema 9 cắt 21 dưới ema 200 thì short.
Có tuỳ chỉnh both cho anh em lựa chọn.
Chúc ae sẽ có nhiều may mắn giao dịch.
Vĩnh long =))
VWAP Strategy BY VGPATELThis strategy provides clear buy and sell signals based on the interaction of price and VWAP, helping traders to capitalize on intraday price movements while filtering out market noise.
Adaptive VWAP Bands with Garman Klass VolatilityThis strategy utilizes the volume weighted average price, adjusted by volatility. Standard deviation bands are applied to the MA, if price closes above 1STD this indicates a bullish trend and the strategy goes long. If a close below 1STD the long is closed.
The standard deviation bands are adjusted by volatility using the Garman-Klass volatility formula: portfolioslab.com
The assumption is the more volatile an asset the less price is being accepted in a certain price range and thus the threshold to go long or close a long increases. In the inverse, the less volatile an asset is the more it's being accepted, then the threshold for a bullish breakout is lowered.
Bitcoin Exponential Profit Strategy### Strategy Description:
The **Bitcoin Trading Strategy** is an **Exponential Moving Average (EMA) crossover strategy** designed to identify bullish trends for Bitcoin.
1. **Indicators**:
- **Fast EMA (default 9 periods)**: Represents the short-term trend.
- **Slow EMA (default 21 periods)**: Represents the longer-term trend.
2. **Entry Condition**:
- A **bullish crossover** occurs when the Fast EMA crosses above the Slow EMA.
- The strategy enters a **long position** with a user-defined order size (default 0.01 BTC).
3. **Exit Conditions**:
- **Take Profit**: Closes the position when the profit target is reached (default $100).
- **Stop Loss**: Closes the position when the price drops below the stop loss level (default $50).
- **Bearish Crossunder**: Closes the position when the Fast EMA crosses below the Slow EMA.
4. **Visual Signals**:
- **BUY signals**: Displayed when a bullish crossover occurs.
- **SELL signals**: Displayed when a bearish crossunder occurs.
This strategy is optimized for trend-following behavior, ensuring positions are aligned with upward-moving trends while managing risk through clear stop-loss and take-profit levels.
Swing High/Low Pivots Strategy [LV]The Swing High/Low Pivots Strategy was developed as a counter-momentum trading tool.
The strategy is suitable for any market and the default values used in the input settings menu are set for Bitcoin (best on 15min). These values, expressed in minimum ticks (or pips if symbol is Forex) make this tool perfectly adaptable to every symbol and/or timeframe.
Check tooltips in the settings menu for more details about every user input.
STRTEGY ENTRY & EXIT MECHANISMS:
Trades Entry based on the detection of swing highs and lows for short and long entries respectively, validated by:
- Limit orders placed after each new pivot level confirmation
- Moving averages trend filter (if enabled)
- No active trade currently open
Trades Exit when the price reaches take-profit or stop-loss level as defined in the settings menu. A double entry/second take-profit level can be enabled for partial exits, with dynamic stop-loss adjustment for the remaining position.
Enhanced Trade Precision:
By limiting entries to confirmed swing high (HH, LH) or swing low (HL, LL) pivot points, the strategy ensures that trades occur at levels of significant price reversals. This precision reduces the likelihood of entering trades in the midst of a trend or during uncertain price action.
Risk Management Optimization:
The strategy incorporates clearly defined stop-loss (SL) and take-profit (TP) levels derived from the pivot points. This structured approach minimizes potential losses while locking in profits, which is critical for consistent performance in volatile markets.
Trend Filtering for Better Entry:
The use of a configurable moving average filter adds a layer of trend validation. This prevents entering trades against the dominant market trend, increasing the probability of success for each trade.
Avoidance of Noise:
The lookback period (length parameter) confirms pivots only after a set number of bars, effectively filtering out market noise and ensuring that entries are based on reliable, well-defined price movements.
Adaptability Across Markets:
The strategy is versatile and can be applied across different markets (Forex, stocks, crypto) due to its dynamic use of ticks and pips converters. It adapts seamlessly to varying price scales and asset types.
Dual Quantity Entries:
The original and optionnal double-entry mechanism allows traders to capture both short-term and extended profits by scaling out of positions. This adaptive approach caters to varying risk appetites and market conditions.
Clear Visualization:
The plotted pivot points, entry limits, SL, and TP levels provide visual clarity, making it easy for traders to track the strategy's behavior and make informed decisions.
Automated Execution with Alerts:
Integrated alerts for both entries and exits ensure timely actions without the need for constant market monitoring, enhancing efficiency. Configurable alert messages are suitable for API use.
Any feedback, comments, or suggestions for improvement are always welcome.
Hope you enjoy!
R-based Strategy Template [Daveatt]Have you ever wondered how to properly track your trading performance based on risk rather than just profits?
This template solves that problem by implementing R-multiple tracking directly in TradingView's strategy tester.
This script is a tool that you must update with your own trading entry logic.
Quick notes
Before we dive in, I want to be clear: this is a template focused on R-multiple calculation and visualization.
I'm using a basic RSI strategy with dummy values just to demonstrate how the R tracking works. The actual trading signals aren't important here - you should replace them with your own strategy logic.
R multiple logic
Let's talk about what R-multiple means in practice.
Think of R as your initial risk per trade.
For instance, if you have a $10,000 account and you're risking 1% per trade, your 1R would be $100.
A trade that makes twice your risk would be +2R ($200), while hitting your stop loss would be -1R (-$100).
This way of measuring makes it much easier to evaluate your strategy's performance regardless of account size.
Whenever the SL is hit, we lose -1R
Proof showing the strategy tester whenever the SL is hit: i.imgur.com
The magic happens in how we calculate position sizes.
The script automatically determines the right position size to risk exactly your specified percentage on each trade.
This is done through a simple but powerful calculation:
risk_amount = (strategy.equity * (risk_per_trade_percent / 100))
sl_distance = math.abs(entry_price - sl_price)
position_size = risk_amount / (sl_distance * syminfo.pointvalue)
Limitations with lower timeframe gaps
This ensures that if your stop loss gets hit, you'll lose exactly the amount you intended to risk. No more, no less.
Well, could be more or less actually ... let's assume you're trading futures on a 15-minute chart but in the 1-minute chart there is a gap ... then your 15 minute SL won't get filled and you'll likely to not lose exactly -1R
This is annoying but it can't be fixed - and that's how trading works anyway.
Features
The template gives you flexibility in how you set your stop losses. You can use fixed points, ATR-based stops, percentage-based stops, or even tick-based stops.
Regardless of which method you choose, the position sizing will automatically adjust to maintain your desired risk per trade.
To help you track performance, I've added a comprehensive statistics table in the top right corner of your chart.
It shows you everything you need to know about your strategy's performance in terms of R-multiples: how many R you've won or lost, your win rate, average R per trade, and even your longest winning and losing streaks.
Happy trading!
And remember, measuring your performance in R-multiples is one of the most classical ways to evaluate and improve your trading strategies.
Daveatt
IU EMA Channel StrategyIU EMA Channel Strategy
Overview:
The IU EMA Channel Strategy is a simple yet effective trend-following strategy that uses two Exponential Moving Averages (EMAs) based on the high and low prices. It provides clear entry and exit signals by identifying price crossovers relative to the EMAs while incorporating a built-in Risk-to-Reward Ratio (RTR) for effective risk management.
Inputs ( Settings ):
- RTR (Risk-to-Reward Ratio): Define the ratio for risk-to-reward (default = 2).
- EMA Length: Adjust the length of the EMA channels (default = 100).
How the Strategy Works
1. EMA Channels:
- High-based EMA: EMA calculated on the high price.
- Low-based EMA: EMA calculated on the low price.
The area between these two EMAs creates a "channel" that visually highlights potential support and resistance zones.
2. Entry Rules:
- Long Entry: When the price closes above the high-based EMA (crossover).
- Short Entry: When the price closes below the low-based EMA (crossunder).
These entries ensure trades are taken in the direction of momentum.
3. Stop Loss (SL) and Take Profit (TP):
- Stop Loss:
- For long positions, the SL is set at the previous bar's low.
- For short positions, the SL is set at the previous bar's high.
- Take Profit:
- TP is automatically calculated using the Risk-to-Reward Ratio (RTR) you define.
- Example: If RTR = 2, the TP will be 2x the risk distance.
4. Exit Rules:
- Positions are closed at either the stop loss or the take profit level.
- The strategy manages exits automatically to enforce disciplined risk management.
Visual Features
1. EMA Channels:
- The high and low EMAs are dynamically color-coded:
- Green: Price is above the EMA (bullish condition).
- Red: Price is below the EMA (bearish condition).
- The area between the EMAs is shaded for better visual clarity.
2. Stop Loss and Take Profit Zones:
- SL and TP levels are plotted for both long and short positions.
- Zones are filled with:
- Red: Stop Loss area.
- Green: Take Profit area.
Be sure to manage your risk and position size properly.
3 EMA + RSI with Trail Stop [Free990] (LOW TF)This trading strategy combines three Exponential Moving Averages (EMAs) to identify trend direction, uses RSI to signal exit conditions, and applies both a fixed percentage stop-loss and a trailing stop for risk management. It aims to capture momentum when the faster EMAs cross the slower EMA, then uses RSI thresholds, time-based exits, and stops to close trades.
Short Explanation of the Logic
Trend Detection: When the 10 EMA crosses above the 20 EMA and both are above the 100 EMA (and the current price bar closes higher), it triggers a long entry signal. The reverse happens for a short (the 10 EMA crosses below the 20 EMA and both are below the 100 EMA).
RSI Exit: RSI crossing above a set threshold closes long trades; crossing below another threshold closes short trades.
Time-Based Exit: If a trade is in profit after a set number of bars, the strategy closes it.
Stop-Loss & Trailing Stop: A fixed stop-loss based on a percentage from the entry price guards against large drawdowns. A trailing stop dynamically tightens as the trade moves in favor, locking in potential gains.
Detailed Explanation of the Strategy Logic
Exponential Moving Average (EMA) Setup
Short EMA (out_a, length=10)
Medium EMA (out_b, length=20)
Long EMA (out_c, length=100)
The code calculates three separate EMAs to gauge short-term, medium-term, and longer-term trend behavior. By comparing their relative positions, the strategy infers whether the market is bullish (EMAs stacked positively) or bearish (EMAs stacked negatively).
Entry Conditions
Long Entry (entryLong): Occurs when:
The short EMA (10) crosses above the medium EMA (20).
Both EMAs (short and medium) are above the long EMA (100).
The current bar closes higher than it opened (close > open).
This suggests that momentum is shifting to the upside (short-term EMAs crossing up and price action turning bullish). If there’s an existing short position, it’s closed first before opening a new long.
Short Entry (entryShort): Occurs when:
The short EMA (10) crosses below the medium EMA (20).
Both EMAs (short and medium) are below the long EMA (100).
The current bar closes lower than it opened (close < open).
This indicates a potential shift to the downside. If there’s an existing long position, that gets closed first before opening a new short.
Exit Signals
RSI-Based Exits:
For long trades: When RSI exceeds a specified threshold (e.g., 70 by default), it triggers a long exit. RSI > short_rsi generally means overbought conditions, so the strategy exits to lock in profits or avoid a pullback.
For short trades: When RSI dips below a specified threshold (e.g., 30 by default), it triggers a short exit. RSI < long_rsi indicates oversold conditions, so the strategy closes the short to avoid a bounce.
Time-Based Exit:
If the trade has been open for xBars bars (configurable, e.g., 24 bars) and the trade is in profit (current price above entry for a long, or current price below entry for a short), the strategy closes the position. This helps lock in gains if the move takes too long or momentum stalls.
Stop-Loss Management
Fixed Stop-Loss (% Based): Each trade has a fixed stop-loss calculated as a percentage from the average entry price.
For long positions, the stop-loss is set below the entry price by a user-defined percentage (fixStopLossPerc).
For short positions, the stop-loss is set above the entry price by the same percentage.
This mechanism prevents catastrophic losses if the market moves strongly against the position.
Trailing Stop:
The strategy also sets a trail stop using trail_points (the distance in price points) and trail_offset (how quickly the stop “catches up” to price).
As the market moves in favor of the trade, the trailing stop gradually tightens, allowing profits to run while still capping potential drawdowns if the price reverses.
Order Execution Flow
When the conditions for a new position (long or short) are triggered, the strategy first checks if there’s an opposite position open. If there is, it closes that position before opening the new one (prevents going “both long and short” simultaneously).
RSI-based and time-based exits are checked on each bar. If triggered, the position is closed.
If the position remains open, the fixed stop-loss and trailing stop remain in effect until the position is exited.
Why This Combination Works
Multiple EMA Cross: Combining 10, 20, and 100 EMAs balances short-term momentum detection with a longer-term trend filter. This reduces false signals that can occur if you only look at a single crossover without considering the broader trend.
RSI Exits: RSI provides a momentum oscillator view—helpful for detecting overbought/oversold conditions, acting as an extra confirmation to exit.
Time-Based Exit: Prevents “lingering trades.” If the position is in profit but failing to advance further, it takes profit rather than risking a trend reversal.
Fixed & Trailing Stop-Loss: The fixed stop-loss is your safety net to cap worst-case losses. The trailing stop allows the strategy to lock in gains by following the trade as it moves favorably, thus maximizing profit potential while keeping risk in check.
Overall, this approach tries to capture momentum from EMA crossovers, protect profits with trailing stops, and limit risk through both a fixed percentage stop-loss and exit signals from RSI/time-based logic.
Liquidity + Engulfment StrategyThis strategy identifies potential trading opportunities by combining bullish and bearish engulfing candle patterns with liquidity seal-off points. The logic is based on the concept of engulfing candles, which signal a shift in market sentiment, and liquidity lines, which represent local price extremes (highs and lows) that can indicate potential reversal or continuation points.
Key Features:
Mode Selection
The strategy allows for three modes: "Both", "Bullish Only", and "Bearish Only". Users can choose whether to trade both directions, only bullish setups, or only bearish setups.
Time Range
Users can define a specific time range for when the strategy is active, enabling tailored analysis and trade execution over a desired period.
Engulfing Candles
Bullish Engulfing: A candle that closes above the high of the previous bearish candle, signaling potential upward momentum.
Bearish Engulfing: A candle that closes below the low of the previous bullish candle, indicating a potential downtrend.
Liquidity Seal-Off Points
The strategy detects local highs and local lows within a specified lookback period, which can serve as critical support and resistance points.
A bullish signal is triggered when the price touches a lower liquidity point (local low), and a bearish signal is triggered at a higher liquidity point (local high).
Signal Confirmation
Signals are only triggered when both an engulfing candle and the price action at a liquidity seal-off point align. This helps filter out weaker signals.
Consecutive signals are prevented by locking the trade direction after an initial signal and waiting for the liquidity line to be broken before re-triggering a signal.
Entry and Exit Conditions
The strategy can enter both long (bullish) or short (bearish) positions based on the mode and signals.
Exit is based on opposing signals or reaching predefined stop-loss and take-profit levels.
Alerts
The strategy supports alert conditions to notify users when bullish engulfing after a lower liquidity touch or bearish engulfing after an upper liquidity touch is detected.
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).
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.
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.
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
16. SMC Strategy with SL - low TimeframeOverview
The "SMC Strategy with SL - low Timeframe" is a comprehensive trading strategy that uses key concepts from Smart Money Theory to identify favorable areas in the market for buying or selling. This strategy takes advantage of price imbalances, support and resistance zones, and swing highs/lows to generate high-probability trade signals.
The key features of this strategy include:
Swing High/Low Analysis: Used to determine the Premium, Equilibrium, and Discount Zones.
Order Block Integration: An added layer of confluence to identify valid buy and sell signals.
Trend Direction Confirmation: Using a Simple Moving Average (SMA) to determine the overall trend.
Entry and Exit Rules: Based on price position relative to key zones and moving average, along with optional stop-loss and take-profit levels.
Detailed Description
Swing High and Swing Low Analysis
The script calculates Swing High and Swing Low based on the most recent price highs and lows over a specified look-back period (swingHighLength and swingLowLength, set to 8 by default).
It then derives the Premium, Equilibrium, and Discount Zones:
Premium Zone: Represents potential resistance, calculated based on recent swing highs.
Discount Zone: Represents potential support, calculated based on recent swing lows.
Equilibrium: The midpoint between Swing High and Swing Low, dividing the price range into Premium (above equilibrium) and Discount (below equilibrium) areas.
Zone Visualization
The strategy plots the Premium Zone (resistance) in red, the Discount Zone (support) in green, and the Equilibrium level in blue on the chart. This helps visually assess the current price relative to these important areas.
Simple Moving Average (SMA)
A 50-period Simple Moving Average (SMA) is added to help identify the trend direction.
Buy signals are valid only if the price is above the SMA, indicating an uptrend.
Sell signals are valid only if the price is below the SMA, indicating a downtrend.
Entry Rules
The script generates buy or sell signals when certain conditions are met:
A buy signal is triggered when:
Price is below the Equilibrium and within the Discount Zone.
Price is above the SMA.
The buy signal is further confirmed by the presence of an Order Block (recent lowest price area).
A sell signal is triggered when:
Price is above the Equilibrium and within the Premium Zone.
Price is below the SMA.
The sell signal is further confirmed by the presence of an Order Block (recent highest price area).
Order Block
The strategy defines Order Blocks as recent highs and lows within a look-back period (orderBlockLength set to 20 by default).
These blocks represent areas where large players (smart money) have historically been active, increasing the probability of the price reacting in these areas again.
Trade Management and Trade Direction
The user can set Trade Direction to either "Long Only," "Short Only," or "Both." This allows the strategy to adapt based on market conditions or trading preferences.
Based on the Trade Direction, the strategy either:
Closes open trades that are against new signals.
Allows only specific directional trades (either long or short).
Stop-loss levels are defined based on a fixed percentage (stop_loss_percent), which helps to manage risk and minimize losses.
Exit Rules
The strategy uses stop-loss levels for risk management.
A stop-loss price is set at a fixed percentage below the entry price for long positions or above the entry price for short positions.
When the price hits the defined stop-loss level, the trade is closed.
Liquidity Zones
The script identifies recent Swing Highs and Lows as potential liquidity zones. These are levels where price could react strongly, as they represent areas of interest for large traders.
The liquidity zones are plotted as crosses on the chart, marking areas where price may encounter significant buying or selling pressure.
Visual Feedback
The script uses visual markers (green for buy signals and red for sell signals) to indicate potential entries on the chart.
It also plots liquidity zones to help traders identify areas where stop hunts and liquidity grabs might occur.
Monthly Performance Dashboard
The script includes a performance tracking feature that displays monthly profit and loss metrics on the chart.
This dashboard allows the trader to see a visual representation of trading performance over time, providing insights into profitability and consistency.
The table shows profit or loss for each month and year, allowing the user to track the overall success of the strategy.
Key Benefits
Smart Money Concepts (SMC): This strategy incorporates SMC principles like order blocks and liquidity zones, which are used by institutional traders to determine potential market moves.
Zone Analysis: The use of Premium, Discount, and Equilibrium zones provides a solid framework for determining where to enter and exit trades based on price discounts or premiums.
Confluence: Signals are not taken in isolation. They are confirmed by factors like trend direction (SMA) and order blocks, providing greater trade accuracy.
Risk Management: By integrating stop-loss functionality, traders can manage their risks effectively.
Visual Performance Metrics: The monthly and yearly performance dashboard gives valuable feedback on how well the strategy has performed historically.
Practical Use
Buy in Discount Zone: Traders would be looking to buy when the price is discounted relative to its recent range and is above the SMA, indicating an overall uptrend.
Sell in Premium Zone: Conversely, traders would be looking to sell when the price is at a premium relative to its recent range and below the SMA, indicating an overall downtrend.
Order Block Confirmation: Ensures that buying or selling is supported by historical price behavior at significant levels, providing confidence that the market is likely to react at these areas.
This strategy is designed to help traders take advantage of price inefficiencies and areas where institutional traders are likely to be active, increasing the odds of successful trades. By leveraging Smart Money concepts and strong technical confluence, it aims to provide high-probability trade setups.
ADX Breakout Strategy█ OVERVIEW
The ADX Breakout strategy leverages the Average Directional Index (ADX) to identify and execute breakout trades within specified trading sessions. Designed for the NQ and ES 30-minute charts, this strategy aims to capture significant price movements while managing risk through predefined stop losses and trade limits.
This strategy was taken from a strategy that was posted on YouTube. I would link the video, but I believe is is "against house rules".
█ CONCEPTS
The strategy is built upon the following key concepts:
ADX Indicator: Utilizes the ADX to gauge the strength of a trend. Trades are initiated when the ADX value is below a certain threshold, indicating potential for trend development.
Trade Session Management: Limits trading to specific hours to align with optimal market activity periods.
Risk Management: Implements a fixed dollar stop loss and restricts the number of trades per session to control exposure.
█ FEATURES
Customizable Stop Loss: Set your preferred stop loss amount to manage risk effectively.
Trade Session Configuration: Define the trading hours to focus on the most active market periods.
Entry Conditions: Enter long positions when the price breaks above the highest close in the lookback window and the ADX indicates potential trend strength.
Trade Limits: Restrict the number of trades per session to maintain disciplined trading.
Automated Exit: Automatically closes all positions at the end of the trading session to avoid overnight risk.
█ HOW TO USE
Configure Inputs :
Stop Loss ($): Set the maximum loss per trade.
Trade Session: Define the active trading hours.
Highest Lookback Window: Specify the number of bars to consider for the highest close.
Apply the Strategy :
Add the ADX Breakout strategy to your chart on TradingView.
Ensure you are using a 30-minute timeframe for optimal performance.
█ LIMITATIONS
Market Conditions: The strategy is optimized for trending markets and may underperform in sideways or highly volatile conditions.
Timeframe Specific: Designed specifically for 30-minute charts; performance may vary on different timeframes.
Single Asset Focus: Primarily tested on NQ and ES instruments; effectiveness on other symbols is not guaranteed.
█ DISCLAIMER
This ADX Breakout strategy is provided for educational and informational purposes only. It is not financial advice and should not be construed as such. Trading involves significant risk, and you may incur substantial losses. Always perform your own analysis and consider your financial situation before using this or any other trading strategy. The source material for this strategy is publicly available in the comments at the beginning of the code script. This strategy has been published openly for anyone to review and verify its methodology and performance.
Optimized Grid with KNN_2.0Strategy Overview
This strategy, named "Optimized Grid with KNN_2.0," is designed to optimize trading decisions using a combination of grid trading, K-Nearest Neighbors (KNN) algorithm, and a greedy algorithm. The strategy aims to maximize profits by dynamically adjusting entry and exit thresholds based on market conditions and historical data.
Key Components
Grid Trading:
The strategy uses a grid-based approach to place buy and sell orders at predefined price levels. This helps in capturing profits from market fluctuations.
K-Nearest Neighbors (KNN) Algorithm:
The KNN algorithm is used to optimize entry and exit points based on historical price data. It identifies the nearest neighbors (similar price movements) and adjusts the thresholds accordingly.
Greedy Algorithm:
The greedy algorithm is employed to dynamically adjust the stop-loss and take-profit levels. It ensures that the strategy captures maximum profits by adjusting thresholds based on recent price changes.
Detailed Explanation
Grid Trading:
The strategy defines a grid of price levels where buy and sell orders are placed. The openTh and closeTh parameters determine the thresholds for opening and closing positions.
The t3_fast and t3_slow indicators are used to generate trading signals based on the crossover and crossunder of these indicators.
KNN Algorithm:
The KNN algorithm is used to find the nearest neighbors (similar price movements) in the historical data. It calculates the distance between the current price and historical prices to identify the most similar price movements.
The algorithm then adjusts the entry and exit thresholds based on the average change in price of the nearest neighbors.
Greedy Algorithm:
The greedy algorithm dynamically adjusts the stop-loss and take-profit levels based on recent price changes. It ensures that the strategy captures maximum profits by adjusting thresholds in real-time.
The algorithm uses the average_change variable to calculate the average price change of the nearest neighbors and adjusts the thresholds accordingly.
Zig Zag + Aroon StrategyBelow is a trading strategy that combines the Zig Zag indicator and the Aroon indicator. This combination can help identify trends and potential reversal points.
Zig Zag and Aroon Strategy Overview
Zig Zag Indicator:
The Zig Zag indicator helps to identify significant price movements and eliminates smaller fluctuations. It is useful for spotting trends and reversals.
Aroon Indicator:
The Aroon indicator consists of two lines: Aroon Up and Aroon Down. It measures the time since the highest high and the lowest low over a specified period, indicating the strength of a trend.
Strategy Conditions
Long Entry Conditions:
Aroon Up crosses above Aroon Down (indicating a bullish trend).
The Zig Zag indicator shows an upward movement (indicating a potential continuation).
Short Entry Conditions:
Aroon Down crosses above Aroon Up (indicating a bearish trend).
The Zig Zag indicator shows a downward movement (indicating a potential continuation).
Exit Conditions:
Exit long when Aroon Down crosses above Aroon Up.
Exit short when Aroon Up crosses above Aroon Down.