MULTIPLE TIME-FRAME STRATEGY(TREND, MOMENTUM, ENTRY) Hey everyone, this is one strategy that I have found profitable over time. It is a multiple time frame strategy that utilizes 3 time-frames. Highest time-frame is the trend, medium time-frame is the momentum and short time-frame is the entry point.
Long Term:
- If closed candle is above entry then we are looking for longs, otherwise we are looking for shorts
Medium Term:
- If Stoch SmoothK is above or below SmoothK and the momentum matches long term trend then we look for entries.
Short Term:
- If a moving average crossover(long)/crossunder(short) occurs then place a trade in the direction of the trend.
Close Trade:
- Trade is closed when the Medium term SmoothK Crosses under/above SmoothD.
You can mess with the settings to get the best Profit Factor / Percent Profit that matches your plan.
Best of luck!
Cari dalam skrip untuk "entry"
T3 Entry and ExitI made this indicator to give clear entry and exit signals plus give signals when I should add onto my trades with no repainting!! The bottom indicator is set to 34 (the default settings). This gives me my entries and exits as shown by the green and red arrow. I use a 14 period setting for my signals to add onto my trade. If I am in a long trade as shown in the chart above and the 14 period T3EE has a fast line cross under the slow line and then a cross back over and I have not had my signal to close trade yet on the 34 period T3EE I will add to my long position. I cut the size of they order in half with each addition to my position. So if I entered with 2 lots I would add 1 lot with my first signal to add (shown by orange arrow) and then .5 lots with the second signal to add to my position and so on until it is time to close the position. If you day trade avoid entering positions between 4pm est and 9pm est. and the larger the ranges and the more trendy the market the better. Good Luck!!!
If you have any questions let me know :)
Price Action + Support/Resistance with LabelsEntry Conditions:
Long Entry (BUY): Based on the bullish engulfing pattern and price being above the resistance level.
Short Entry (SELL): For demonstration, the short entry condition is set as price being below the support level and a bullish candle in the previous bar. You can modify this logic for your own use case.
Stop Loss and Take Profit:
Stoploss is plotted at the calculated stop loss level.
Target is plotted at the calculated take profit level.
Labels:
For long trades, labels are added with "BUY", "STOPLOSS", and "TARGET".
For short trades (if enabled), labels are added with "SELL", "STOPLOSS", and "TARGET".
Labels are placed using label.new at specific locations on the chart (above or below bars).
Alert Conditions:
Alerts are created for both long and short entry signals so you can get notified when the entry conditions are met.
How it works:
BUY label will appear below the bar when a long entry condition is met.
SELL label will appear above the bar when a short entry condition is met.
STOPLOSS and TARGET labels will appear at their respective levels when an entry signal is triggered.
The labels will appear on the chart to give you a clear visual cue of the entry, stop loss, and take profit levels.
How to Use:
Copy the script into your Pine Editor on TradingView and apply it to your chart.
Observe the labels that show up on the chart:
"BUY" will appear below the bar when long conditions are met.
"SELL" will appear above the bar when short conditions are met (if using short logic).
"STOPLOSS" will be plotted at the stop loss level.
"TARGET" will be plotted at the take profit level.
Optional Customization:
You can modify the short entry condition based on your preferred method.
You can adjust the length for the support/resistance calculation, the stopLossRR, and other parameters to fine-tune the strategy for Nifty 50 or any other asset.
Let me know if you have any further questions or need additional modifications!
MACD + RSI + EMA + BB + ATR Day Trading StrategyEntry Conditions and Signals
The strategy implements a multi-layered filtering approach to entry conditions, requiring alignment across technical indicators, timeframes, and market conditions .
Long Entry Requirements
Trend Filter: Fast EMA (9) must be above Slow EMA (21), price must be above Fast EMA, and higher timeframe must confirm uptrend
MACD Signal: MACD line crosses above signal line, indicating increasing bullish momentum
RSI Condition: RSI below 70 (not overbought) but above 40 (showing momentum)
Volume & Volatility: Current volume exceeds 1.2x 20-period average and ATR shows sufficient market movement
Time Filter: Trading occurs during optimal hours (9:30-11:30 AM ET) when market volatility is typically highest
Exit Strategies
The strategy employs multiple exit mechanisms to adapt to changing market conditions and protect profits :
Stop Loss Management
Initial Stop: Placed at 2.0x ATR from entry price, adapting to current market volatility
Trailing Stop: 1.5x ATR trailing stop that moves up (for longs) or down (for shorts) as price moves favorably
Time-Based Exits: All positions closed by end of trading day (4:00 PM ET) to avoid overnight risk
Best Practices for Implementation
Settings
Chart Setup: 5-minute timeframe for execution with 15-minute chart for trend confirmation
Session Times: Focus on 9:30-11:30 AM ET trading for highest volatility and opportunity
Perfect OrderEntry Point
How to Entry
Perfect Order Entry
SMA5,13,21 & EMA75,90,200
Please enjoy your entry
ENTRY CONFIRMATION V2An indicator from candle man. Helps determine whether supply and demand zone are truly supply or demand.
Entry Percent: EssamThis Pine Script code is designed to perform the task of computing and showcasing the profit percentage, profit value, and the duration for which a specific asset is held, all in real-time. The script effectively leverages the built-in resources to provide a seamless and robust experience, as it presents the calculated figures in an easily readable format on the chart, without causing any lag or disruptions to the chart.
MA_Script- Entry Point : base on MA20, MA50, MA100, MA200.
- Exit Point : base on stop loss, MA and trailing stop.
sa-strategy with HTF-TSLEntry- based on HA close above HMA confirmation done with ST and HTF ATR
Exit- based on close below ATR which works as trailing SL
[MV] %B with SMA + Volume Based Colored Bars
Entry Signal when %B Crosses with SMA and this is more meaningful if it supports colored bars.
Black Bar when prices go down and volume is bigger than 150% of its average, that indicates us price action is supported by a strong bearish volume
Blue Bar when prices go up and volume bigger than 150% of its average, that indicates us price action is supported by a strong bullish volume
VBC author @KIVANCfr3762
FX Sniper: T3-CCI Strategy - With 100 IndicatorsEntry signal when moving above -100, sell signal when going below 100
Amazing Crossover SystemEntry Rules
BUY when the 5 EMA crosses above the 10 EMA from underneath and the RSI crosses above the 50.0 mark from the bottom.
SELL when the 5 EMA crosses below the 10 EMA from the top and the RSI crosses below the 50.0 mark from the top.
Make sure that the RSI did cross 50.0 from the top or bottom and not just ranging tightly around the level.
How to setup Alert:
1) Add the Amazing Crossover System to your chart via Indicators
2) Find your currency pair
3) Set the timeframe on the chart to 1 hour
4) Press 'Alt + A' (create alert shortcut)
5) Set the following criteria for the alert:
Condition = 'Amazing Crossover System', Plot, ' BUY Signal'
The rest of the alert can be customized to your preferences
5) Repeat steps 1 - 4, but set the Condition = 'Amazing Crossover System', Plot, ' SELL Signal'
MFI × RSI × VWAP Multi-Timeframe Suite# MFI × RSI × VWAP Multi-Timeframe Suite - Usage Guide & Precautions
## 📊 Indicator Overview
This indicator integrates **RSI (Relative Strength Index)**, **MFI (Money Flow Index)**, and **VWAP (Volume Weighted Average Price)** for comprehensive multi-timeframe analysis. It provides high-precision trading signals through confluence analysis.
## 🎯 Primary Objectives
- **Comprehensive trend analysis across short, medium, and long-term timeframes**
- **Enhanced accuracy through multi-indicator confluence**
- **Optimized entry and exit timing**
---
## 📈 Basic Interpretation
### 1. Main Plot Lines
- **Blue Line (RSI)**: Price momentum
- **Purple Line (MFI)**: Money flow momentum
- **Orange Line (VWAP Relative)**: Relative position to VWAP (0-100 scale)
### 2. Background Color Meaning
- **Green**: All indicators aligned bullishly (buying dominance)
- **Red**: All indicators aligned bearishly (selling dominance)
- **Color Intensity**: Strength of confluence
### 3. Signal Arrows
- **🔼 Green Up Arrow**: Long signal
- **🔽 Red Down Arrow**: Short signal
- **🟠 Small Circles**: VWAP crossover signals
---
## 🎛️ Configuration Settings
### Basic Parameters
```
RSI Length: 14 (standard)
MFI Length: 14 (standard)
RSI Overbought: 70
RSI Oversold: 30
MFI Overbought: 80
MFI Oversold: 20
```
### VWAP Settings
```
VWAP Anchor: Session (use "Week" or "Month" for daily charts)
Std Dev Multiplier: 2.0 (Bollinger Band-style application)
```
### Multi-Timeframe Configuration
```
TF1: 15min (short-term)
TF2: 1hour (medium-term)
TF3: 4hour (long-term)
TF4: Daily (trend)
```
---
## 📋 Dashboard Interpretation
### Trend Strength Scores
- **+70 to +100**: 💪 Very strong uptrend
- **+30 to +69**: 🟢 Uptrend
- **-29 to +29**: ➖ Sideways/No clear direction
- **-30 to -69**: 🔴 Downtrend
- **-70 to -100**: ⚠️ Very strong downtrend
### Consensus (Overall Assessment)
Average score across all timeframes. **Absolute value ≥50** indicates strong trend.
---
## 🎯 Practical Trading Methods
### 🔵 Long Entry Conditions
1. **RSI crosses above MFI** OR **synchronized oversold exit**
2. **Price above VWAP**
3. **Multi-timeframe consensus is positive (+)**
4. **Green background (confluence present)**
### 🔴 Short Entry Conditions
1. **RSI crosses below MFI** OR **synchronized overbought exit**
2. **Price below VWAP**
3. **Multi-timeframe consensus is negative (-)**
4. **Red background (confluence present)**
### ⚡ Strongest Signals
- **All timeframes align in trend direction**
- **Consensus score ±70 or higher**
- **🚀 STRONG display**
---
## ⏰ Timeframe-Specific Applications
### Scalping (1min-5min charts)
- Focus on RSI/MFI crossovers
- Target VWAP bounces
- Require 15min+ timeframe trend filter
### Day Trading (15min-1hour charts)
- Emphasize overbought/oversold exit signals
- Follow 1hour to daily trend direction
- Confirm with confluence background color
### Swing Trading (4hour-daily charts)
- Prioritize daily+ consensus
- Use weekly VWAP for big picture
- Wait for multi-timeframe alignment
---
## 🚨 Alert Utilization
### Basic Alerts
- **Long/Short Signal**: Basic entry signals
- **Strong Consensus**: Powerful signals with multi-timeframe confluence
- **VWAP Cross**: Important support/resistance breakouts
### Alert Configuration Example
```
Long Signal → Begin monitoring as candidate
Strong Consensus + Long → Consider aggressive entry
VWAP Bullish Cross → Potential trend reversal
```
---
## ⚠️ Important Precautions & Limitations
### Avoiding False Signals
1. **Wait for multiple conditions to align simultaneously**
2. **Never trade against higher timeframe trends**
3. **Avoid major economic news releases**
4. **Exercise caution during extremely low volatility**
### Market Environment Adjustments
- **Trending Markets**: Emphasize crossover signals
- **Range-bound Markets**: Focus on overbought/oversold levels
- **High Volatility**: Strengthen filters
- **Low Volatility**: Adjust sensitivity
### Risk Management Rules
1. **Never risk more than 2% per trade**
2. **Always set stop-loss before entry**
3. **Use proper position sizing**
4. **Maintain trading journal**
---
## 🎓 Learning & Improvement Guidelines
### Backtesting Recommendations
- **Test on 6+ months of historical data**
- **Verify performance across different market conditions**
- **Adapt settings to your trading style**
### Continuous Optimization
- **Track win rate and risk-reward ratios**
- **Analyze performance by timeframe**
- **Measure impact of parameter adjustments**
---
## 🚫 Critical Don'ts
### Never Do These:
❌ **Trade during major news events** (FOMC, NFP, CPI)
❌ **Ignore higher timeframe bias**
❌ **Chase signals after they've already moved significantly**
❌ **Override risk management rules**
❌ **Trade when emotionally compromised**
### Red Flags - Stop Trading When:
⚠️ **Consensus shows conflicting signals across timeframes**
⚠️ **VWAP shows choppy, directionless movement**
⚠️ **Multiple false signals occur consecutively**
⚠️ **Market volatility exceeds 300% of normal levels**
---
## 📊 Performance Monitoring
### Daily Checklist
```
□ Check overall market sentiment
□ Verify economic calendar for news events
□ Review multi-timeframe alignment
□ Confirm proper risk management setup
□ Monitor position sizing appropriateness
```
### Weekly Review
```
□ Analyze win rate by timeframe
□ Review entry/exit execution quality
□ Assess adherence to trading rules
□ Identify pattern improvements
□ Adjust parameters if necessary
```
### Monthly Evaluation
```
□ Calculate overall profitability
□ Review maximum drawdown periods
□ Assess emotional discipline
□ Update trading plan based on results
□ Consider strategy refinements
```
---
## 🎖️ Advanced Tips for Professionals
### Multi-Monitor Setup
```
Primary Screen: Main chart with indicator
Secondary Screen: Multi-timeframe view
Third Screen: Economic calendar + news
Mobile Device: Alert notifications
```
### Professional Entry Techniques
1. **Wait for 2+ confluence factors**
2. **Confirm with volume analysis**
3. **Use limit orders near VWAP levels**
4. **Scale into positions on strong signals**
### Exit Strategy Optimization
1. **Take partial profits at key levels**
2. **Trail stops on trending moves**
3. **Exit immediately on trend reversal signals**
4. **Honor predetermined risk-reward ratios**
---
## ⚡ Quick Reference Card
### Best Practices Summary
✅ **Always check higher timeframe first**
✅ **Wait for confluence of multiple indicators**
✅ **Use proper position sizing**
✅ **Set stops before entering**
✅ **Follow your trading plan strictly**
### Signal Reliability Ranking
1. **🚀 Strong Consensus** (Highest reliability)
2. **Multi-timeframe alignment** (High reliability)
3. **VWAP + RSI/MFI confluence** (Medium-high reliability)
4. **Single timeframe signals** (Medium reliability)
5. **Isolated crossovers** (Lowest reliability)
---
## 🔧 Troubleshooting Common Issues
### If Signals Are Too Frequent:
- Increase RSI/MFI periods
- Tighten overbought/oversold levels
- Add more confluence requirements
- Use higher timeframe bias
### If Signals Are Too Rare:
- Decrease RSI/MFI periods
- Widen overbought/oversold levels
- Reduce confluence requirements
- Lower signal smoothing value
### If Accuracy Is Poor:
- Review market conditions compatibility
- Strengthen higher timeframe filters
- Improve risk management
- Consider different timeframe combinations
**Remember**: This indicator is a comprehensive analysis tool. It's **not perfect in isolation** and must be used with proper **risk management** and **market understanding**!
Quarterly-Inspired EMA Swing Strategy🚀 Quarterly EMA Strategy: Simplified
This strategy uses quarterly trends and pullbacks to EMAs (Exponential Moving Averages) to buy low and sell high in strong uptrends (longs) or short weak stocks in strong downtrends.
⸻
🔧 Core Setup
• Timeframe: Quarterly (1 candle = 3 months or ~65 trading days).
• Stocks: Liquid NSE F&O stocks (e.g., Reliance, Bajaj Finance, Tata Motors, etc.).
• Indicators Used:
• 10-quarter EMA → Shorter-term trend.
• 21-quarter EMA → Long-term trend.
• 13-week EMA → Weekly confirmation.
• ATR → For stop-loss.
• VIX → Volatility control.
• Relative Strength vs Nifty → Filter strong/weak stocks.
⸻
🟢 LONG SETUP (Buy on Pullback in Uptrend)
✅ Conditions:
1. Quarterly Trend is Bullish
Price > 10Q EMA > 21Q EMA
2. Pullback Happens
Price closes within 3% of 10Q or 21Q EMA, or touches it and bounces.
• E.g., Stock close = 8200, 10Q EMA = 8000 → Pullback = Valid (2.5% gap)
3. Previous Trend is Strong
• Last 1-2 quarters were making higher highs OR closing well above 10Q EMA
4. Candle Shows Rejection
• Lower wick (buying pressure from EMA)
• Small body (<5% total candle range)
5. Market Support Filters
• Nifty > its 4-quarter EMA (sloping upward)
• India VIX < 20 (low panic)
• Stock’s last 2 quarters’ return > 1.1× Nifty’s return
6. Weekly Confirmation
• Price > 13-week EMA
• 13W EMA is rising
• Bullish pattern in last 2 candles
• Volume ≥ 75% of 20-week average
⸻
📈 Example (Bajaj Finance):
• Close: 8200,
• 10Q EMA: 8000 (bullish),
• 21Q EMA: 7800
• Weekly price > 13W EMA → Confirmation ✅
⸻
🎯 Trade Plan (Long):
• Entry: 8200 (Quarterly) or near 13W EMA (Weekly)
• Stop-Loss: 2× ATR below 21Q EMA or candle low
• Target: 2:1 reward
• Exit 1: Book 50% at target
• Exit 2: Trail 21Q EMA
• Optional Hedge: Buy Nifty PUT if VIX > 15
⸻
🔴 SHORT SETUP (Sell on Pullback in Downtrend)
✅ Conditions:
1. Quarterly Trend is Bearish
Price < 10Q EMA < 21Q EMA
2. Pullback to EMA
Price closes within 3% of 10Q or 21Q EMA, or touches and gets rejected
3. Prior Trend is Down
Last 1-2 quarters had lower lows or closing >5% below 10Q EMA
4. Bearish Candle Setup
• Upper wick (rejection from EMA)
• Small body
5. Market Support Filters
• Nifty < its 4-quarter EMA (sloping down)
• India VIX < 20
• Stock’s 2-quarter return < 0.9× Nifty’s return
6. Weekly Confirmation
• Price < 13-week EMA
• 13W EMA is falling
• Bearish candles (engulfing, lower highs)
• Volume ≥ 75% of 20-week average
⸻
📉 Example (Vodafone Idea):
• Close: ₹8
• 10Q EMA: ₹8.2 → Close is 2.5% below
• Weekly close < 13W EMA
• Bearish candle → Confirmation ✅
⸻
🔻 Trade Plan (Short):
• Entry: 8
• Stop-Loss: 2× ATR above 21Q EMA or candle high
• Target: 2:1 reward
• Exit 1: Book 50% at target
• Exit 2: Trail 21Q EMA
• Optional Hedge: Buy Nifty CALL if VIX > 15
⸻
📊 Position Sizing (Same for Long & Short):
• Risk per trade: 0.5–1% of total capital
• Example:
• Capital = ₹10 lakh
• Risk = ₹10,000
• Stop = 800 points → Buy 12 shares
⸻
✅ Exit Rules Summary
MULTI-STRATEGY SYSTEMThis trading system combines three different strategies to help you trade better.
The first strategy follows trends using a 50-period EMA and confirms signals with volume spikes and RSI momentum.
The second strategy catches trends early by watching for EMA 9 and 21 crossovers to get in at the beginning of moves.
The third strategy uses multiple technical indicators like RSI, MACD, and EMAs to find precise entry points.
Each strategy shows triangle signals on your chart, green for long trades and red for short trades. The system also displays colored zones between the moving averages to visualize market conditions.
You can use just one strategy or combine all three for more trading opportunities. This works on any timeframe whether you're day trading, swing trading, or position trading.
Big Candle Identifier with RSI Divergence and Advanced Stops1. Strategy Objective
The main goal of this strategy is to:
Identify significant price momentum (big candles).
Enter trades at opportune moments based on market signals (candlestick patterns and RSI divergence).
Limit initial risk through a fixed stop loss.
Maximize profits by using a trailing stop that activates only after the trade moves a specified distance in the profitable direction.
2. Components of the Strategy
A. Big Candle Identification
The strategy identifies big candles as indicators of strong momentum.
A big candle is defined as:
The body (absolute difference between close and open) of the current candle (body0) is larger than the bodies of the last five candles.
The candle is:
Bullish Big Candle: If close > open.
Bearish Big Candle: If open > close.
Purpose: Big candles signal potential continuation or reversal of trends, serving as the primary entry trigger.
B. RSI Divergence
Relative Strength Index (RSI): A momentum oscillator used to detect overbought/oversold conditions and divergence.
Fast RSI: A 5-period RSI, which is more sensitive to short-term price movements.
Slow RSI: A 14-period RSI, which smoothens fluctuations over a longer timeframe.
Divergence: The difference between the fast and slow RSIs.
Positive divergence (divergence > 0): Bullish momentum.
Negative divergence (divergence < 0): Bearish momentum.
Visualization: The divergence is plotted on the chart, helping traders confirm momentum shifts.
C. Stop Loss
Initial Stop Loss:
When entering a trade, an immediate stop loss of 200 points is applied.
This stop loss ensures the maximum risk is capped at a predefined level.
Implementation:
Long Trades: Stop loss is set below the entry price at low - 200 points.
Short Trades: Stop loss is set above the entry price at high + 200 points.
Purpose:
Prevents significant losses if the price moves against the trade immediately after entry.
D. Trailing Stop
The trailing stop is a dynamic risk management tool that adjusts with price movements to lock in profits. Here’s how it works:
Activation Condition:
The trailing stop only starts trailing when the trade moves 200 ticks (profit) in the right direction:
Long Position: close - entry_price >= 200 ticks.
Short Position: entry_price - close >= 200 ticks.
Trailing Logic:
Once activated, the trailing stop:
For Long Positions: Trails behind the price by 150 ticks (trail_stop = close - 150 ticks).
For Short Positions: Trails above the price by 150 ticks (trail_stop = close + 150 ticks).
Exit Condition:
The trade exits automatically if the price touches the trailing stop level.
Purpose:
Ensures profits are locked in as the trade progresses while still allowing room for price fluctuations.
E. Trade Entry Logic
Long Entry:
Triggered when a bullish big candle is identified.
Stop loss is set at low - 200 points.
Short Entry:
Triggered when a bearish big candle is identified.
Stop loss is set at high + 200 points.
F. Trade Exit Logic
Trailing Stop: Automatically exits the trade if the price touches the trailing stop level.
Fixed Stop Loss: Exits the trade if the price hits the predefined stop loss level.
G. 21 EMA
The strategy includes a 21-period Exponential Moving Average (EMA), which acts as a trend filter.
EMA helps visualize the overall market direction:
Price above EMA: Indicates an uptrend.
Price below EMA: Indicates a downtrend.
H. Visualization
Big Candle Identification:
The open and close prices of big candles are plotted for easy reference.
Trailing Stop:
Plotted on the chart to visualize its progression during the trade.
Green Line: Indicates the trailing stop for long positions.
Red Line: Indicates the trailing stop for short positions.
RSI Divergence:
Positive divergence is shown in green.
Negative divergence is shown in red.
3. Key Parameters
trail_start_ticks: The number of ticks required before the trailing stop activates (default: 200 ticks).
trail_distance_ticks: The distance between the trailing stop and price once the trailing stop starts (default: 150 ticks).
initial_stop_loss_points: The fixed stop loss in points applied at entry (default: 200 points).
tick_size: Automatically calculates the minimum tick size for the trading instrument.
4. Workflow of the Strategy
Step 1: Entry Signal
The strategy identifies a big candle (bullish or bearish).
If conditions are met, a trade is entered with a fixed stop loss.
Step 2: Initial Risk Management
The trade starts with an initial stop loss of 200 points.
Step 3: Trailing Stop Activation
If the trade moves 200 ticks in the profitable direction:
The trailing stop is activated and follows the price at a distance of 150 ticks.
Step 4: Exit the Trade
The trade is exited if:
The price hits the trailing stop.
The price hits the initial stop loss.
5. Advantages of the Strategy
Risk Management:
The fixed stop loss ensures that losses are capped.
The trailing stop locks in profits after the trade becomes profitable.
Momentum-Based Entries:
The strategy uses big candles as entry triggers, which often indicate strong price momentum.
Divergence Confirmation:
RSI divergence helps validate momentum and avoid false signals.
Dynamic Profit Protection:
The trailing stop adjusts dynamically, allowing the trade to capture larger moves while protecting gains.
6. Ideal Market Conditions
This strategy performs best in:
Trending Markets:
Big candles and momentum signals are more effective in capturing directional moves.
High Volatility:
Larger price swings improve the probability of reaching the trailing stop activation level (200 ticks).
Nef33 Forex & Crypto Trading Signals PRO
1. Understanding the Indicator's Context
The indicator generates signals based on confluence (trend, volume, key zones, etc.), but it does not include predefined SL or TP levels. To establish them, we must:
Use dynamic or static support/resistance levels already present in the script.
Incorporate volatility (such as ATR) to adjust the levels based on market conditions.
Define a risk/reward ratio (e.g., 1:2).
2. Options for Determining SL and TP
Below, I provide several ideas based on the tools available in the script:
Stop Loss (SL)
The SL should protect you from adverse movements. You can base it on:
ATR (Volatility): Use the smoothed ATR (atr_smooth) multiplied by a factor (e.g., 1.5 or 2) to set a dynamic SL.
Buy: SL = Entry Price - (atr_smooth * atr_mult).
Sell: SL = Entry Price + (atr_smooth * atr_mult).
Key Zones: Place the SL below a support (for buys) or above a resistance (for sells), using Order Blocks, Fair Value Gaps, or Liquidity Zones.
Buy: SL below the nearest ob_lows or fvg_lows.
Sell: SL above the nearest ob_highs or fvg_highs.
VWAP: Use the daily VWAP (vwap_day) as a critical level.
Buy: SL below vwap_day.
Sell: SL above vwap_day.
Take Profit (TP)
The TP should maximize profits. You can base it on:
Risk/Reward Ratio: Multiply the SL distance by a factor (e.g., 2 or 3).
Buy: TP = Entry Price + (SL Distance * 2).
Sell: TP = Entry Price - (SL Distance * 2).
Key Zones: Target the next resistance (for buys) or support (for sells).
Buy: TP at the next ob_highs, fvg_highs, or liq_zone_high.
Sell: TP at the next ob_lows, fvg_lows, or liq_zone_low.
Ichimoku: Use the cloud levels (Senkou Span A/B) as targets.
Buy: TP at senkou_span_a or senkou_span_b (whichever is higher).
Sell: TP at senkou_span_a or senkou_span_b (whichever is lower).
3. Practical Implementation
Since the script does not automatically draw SL/TP, you can:
Calculate them manually: Observe the chart and use the levels mentioned.
Modify the code: Add SL/TP as labels (label.new) at the moment of the signal.
Here’s an example of how to modify the code to display SL and TP based on ATR with a 1:2 risk/reward ratio:
Modified Code (Signals Section)
Find the lines where the signals (trade_buy and trade_sell) are generated and add the following:
pinescript
// Calculate SL and TP based on ATR
atr_sl_mult = 1.5 // Multiplier for SL
atr_tp_mult = 3.0 // Multiplier for TP (1:2 ratio)
sl_distance = atr_smooth * atr_sl_mult
tp_distance = atr_smooth * atr_tp_mult
if trade_buy
entry_price = close
sl_price = entry_price - sl_distance
tp_price = entry_price + tp_distance
label.new(bar_index, low, "Buy: " + str.tostring(math.round(bull_conditions, 1)), color=color.green, textcolor=color.white, style=label.style_label_up, size=size.tiny)
label.new(bar_index, sl_price, "SL: " + str.tostring(math.round(sl_price, 2)), color=color.red, textcolor=color.white, style=label.style_label_down, size=size.tiny)
label.new(bar_index, tp_price, "TP: " + str.tostring(math.round(tp_price, 2)), color=color.blue, textcolor=color.white, style=label.style_label_up, size=size.tiny)
if trade_sell
entry_price = close
sl_price = entry_price + sl_distance
tp_price = entry_price - tp_distance
label.new(bar_index, high, "Sell: " + str.tostring(math.round(bear_conditions, 1)), color=color.red, textcolor=color.white, style=label.style_label_down, size=size.tiny)
label.new(bar_index, sl_price, "SL: " + str.tostring(math.round(sl_price, 2)), color=color.red, textcolor=color.white, style=label.style_label_up, size=size.tiny)
label.new(bar_index, tp_price, "TP: " + str.tostring(math.round(tp_price, 2)), color=color.blue, textcolor=color.white, style=label.style_label_down, size=size.tiny)
Code Explanation
SL: Calculated by subtracting/adding sl_distance to the entry price (close) depending on whether it’s a buy or sell.
TP: Calculated with a double distance (tp_distance) for a 1:2 risk/reward ratio.
Visualization: Labels are added to the chart to display SL (red) and TP (blue).
4. Practical Strategy Without Modifying the Code
If you don’t want to modify the script, follow these steps manually:
Entry: Take the trade_buy or trade_sell signal.
SL: Check the smoothed ATR (atr_smooth) on the chart or calculate a fixed level (e.g., 1.5 times the ATR). Also, review nearby key zones (OB, FVG, VWAP).
TP: Define a target based on the next key zone or multiply the SL distance by 2 or 3.
Example:
Buy at 100, ATR = 2.
SL = 100 - (2 * 1.5) = 97.
TP = 100 + (2 * 3) = 106.
5. Recommendations
Test in Demo: Apply this logic in a demo account to adjust the multipliers (atr_sl_mult, atr_tp_mult) based on the market (forex or crypto).
Combine with Zones: If the ATR-based SL is too wide, use the nearest OB or FVG as a reference.
Risk/Reward Ratio: Adjust the TP based on your tolerance (1:1, 1:2, 1:3)
Dave Trading Indicator (with Arrows)//@version=5
indicator("A1 SMC Clean Entry (Arrows + SL/TP) - Publishable", overlay=true,
max_labels_count=500, max_lines_count=500, max_boxes_count=200)
// === USER SETTINGS ===
rsiLength = input.int(14, "RSI Length")
slATRMult = input.float(1.5, "Stop Loss (ATR Multiplier)", step=0.1)
tpRR = input.float(2.0, "Take Profit (R:R)", step=0.1)
htfEMA = input.int(200, "Trend EMA (filter)", minval=1)
lookbackHigh = input.int(20, "Liquidity High Lookback")
lookbackLow = input.int(20, "Liquidity Low Lookback")
obLookback = input.int(8, "Order Block Lookback")
keepOnlyLast = input.bool(true, "Keep only latest drawings", tooltip="Deletes previous label/box/lines when a new signal appears")
// === INDICATORS / FILTERS ===
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(14)
trendEMA = ta.ema(close, htfEMA)
// === LIQUIDITY SWEEP LOGIC ===
// A "grab" means price briefly sweeps the recent extreme then closes back beyond it
liqHigh = ta.highest(high, lookbackHigh)
liqLow = ta.lowest(low, lookbackLow)
grabHigh = high > liqHigh and close < liqHigh // stop-hunt above recent highs
grabLow = low < liqLow and close > liqLow // stop-hunt below recent lows
// === CORE ENTRY RULES ===
// Multi-confirmation: liquidity sweep + RSI + EMA trend
longCondition = grabLow and rsi > 50 and close > trendEMA
shortCondition = grabHigh and rsi < 50 and close < trendEMA
// === GLOBAL ARROWS (must be in global scope) ===
plotshape(longCondition, title="BUY Arrow", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.large, text="BUY")
plotshape(shortCondition, title="SELL Arrow", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.large, text="SELL")
// === ALERTS ===
alertcondition(longCondition, title="BUY setup", message="{{ticker}} BUY setup")
alertcondition(shortCondition, title="SELL setup", message="{{ticker}} SELL setup")
// === OBJECT MANAGEMENT: keep only last drawings if enabled ===
var label lastLabel = na
var line lastSL = na
var line lastTP = na
var box lastBox = na
f_delete_prev() =>
if not na(lastLabel)
label.delete(lastLabel)
lastLabel := na
if not na(lastSL)
line.delete(lastSL)
lastSL := na
if not na(lastTP)
line.delete(lastTP)
lastTP := na
if not na(lastBox)
box.delete(lastBox)
lastBox := na
// === WHEN LONG TRIGGERS ===
if longCondition
if keepOnlyLast
f_delete_prev()
entryPrice = close
stopLoss = entryPrice - atr * slATRMult
takeProfit = entryPrice + (entryPrice - stopLoss) * tpRR
// Label (entry)
lastLabel := label.new(bar_index, entryPrice, text="BUY", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
// SL and TP lines (extend a few bars to the right)
lastSL := line.new(bar_index, stopLoss, bar_index + 20, stopLoss, color=color.red, style=line.style_dashed, width=1)
lastTP := line.new(bar_index, takeProfit, bar_index + 20, takeProfit, color=color.green, style=line.style_dashed, width=1)
// Order Block (approx): use last bearish range before move up
bearOB_top = ta.highest(high, obLookback)
bearOB_bot = ta.lowest(low, obLookback)
// draw a box that covers last obLookback candles and spans bot..top
lastBox := box.new(bar_index - obLookback, bearOB_top, bar_index, bearOB_bot, bgcolor=color.new(color.green, 85), border_color=color.green)
// === WHEN SHORT TRIGGERS ===
if shortCondition
if keepOnlyLast
f_delete_prev()
entryPrice = close
stopLoss = entryPrice + atr * slATRMult
takeProfit = entryPrice - (stopLoss - entryPrice) * tpRR
// Label (entry)
lastLabel := label.new(bar_index, entryPrice, text="SELL", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
// SL and TP lines
lastSL := line.new(bar_index, stopLoss, bar_index + 20, stopLoss, color=color.red, style=line.style_dashed, width=1)
lastTP := line.new(bar_index, takeProfit, bar_index + 20, takeProfit, color=color.green, style=line.style_dashed, width=1)
// Order Block (approx): last bullish range before move down
bullOB_top = ta.highest(high, obLookback)
bullOB_bot = ta.lowest(low, obLookback)
lastBox := box.new(bar_index - obLookback, bullOB_top, bar_index, bullOB_bot, bgcolor=color.new(color.red, 85), border_color=color.red)
// === OPTIONAL DEBUG PLOTS (comment out if you don't want them) ===
// plot(rsi, title="RSI", color=color.orange) // off by default to keep chart clean
// plot(trendEMA, title="EMA200", color=color.blue)
// keep indicator valid even if nothing plotted
plot(na)
DLC INDICATOR//@version=5
indicator("A1 SMC Day Trading Indicator (OB + Liquidity Grab)", overlay=true, max_lines_count=500, max_labels_count=500)
// === INPUTS ===
rsiLength = input.int(14, "RSI Length")
slATRMult = input.float(1.5, "Stop Loss (ATR Multiplier)")
tpRR = input.float(2.0, "Take Profit (Risk/Reward)")
htfEMA = input.int(200, "Trend EMA (Filter)")
lookbackHigh = input.int(20, "Liquidity High Lookback")
lookbackLow = input.int(20, "Liquidity Low Lookback")
obLookback = input.int(10, "Order Block Lookback")
// === INDICATORS ===
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(14)
trendEMA = ta.ema(close, htfEMA) // only as filter
// === ORDER BLOCK DETECTION ===
bullOB = ta.lowest(low, obLookback)
bearOB = ta.highest(high, obLookback)
// === LIQUIDITY SWEEPS ===
liqHigh = ta.highest(high, lookbackHigh)
liqLow = ta.lowest(low, lookbackLow)
grabHigh = high > liqHigh and close < liqHigh // stop hunt above highs
grabLow = low < liqLow and close > liqLow // stop hunt below lows
// === ENTRY CONDITIONS ===
longCondition = grabLow and rsi > 50 and close > trendEMA
shortCondition = grabHigh and rsi < 50 and close < trendEMA
// === VARIABLES ===
var float entryPrice = na
var float stopLoss = na
var float takeProfit = na
// === LONG ENTRY ===
if (longCondition)
entryPrice := close
stopLoss := entryPrice - atr * slATRMult
takeProfit := entryPrice + (entryPrice - stopLoss) * tpRR
// Label
label.new(bar_index, entryPrice, "BUY (SMC) ✅",
style=label.style_label_up, color=color.green, textcolor=color.white, size=size.normal)
// SL / TP lines
line.new(bar_index, stopLoss, bar_index+10, stopLoss, color=color.red, style=line.style_dashed)
line.new(bar_index, takeProfit, bar_index+10, takeProfit, color=color.green, style=line.style_dashed)
// Highlight Order Block
box.new(bar_index-obLookback, bullOB, bar_index, entryPrice, bgcolor=color.new(color.green, 85), border_color=color.green)
// === SHORT ENTRY ===
if (shortCondition)
entryPrice := close
stopLoss := entryPrice + atr * slATRMult
takeProfit := entryPrice - (stopLoss - entryPrice) * tpRR
// Label
label.new(bar_index, entryPrice, "SELL (SMC) ✅",
style=label.style_label_down, color=color.red, textcolor=color.white, size=size.normal)
// SL / TP lines
line.new(bar_index, stopLoss, bar_index+10, stopLoss, color=color.red, style=line.style_dashed)
line.new(bar_index, takeProfit, bar_index+10, takeProfit, color=color.green, style=line.style_dashed)
// Highlight Order Block
box.new(bar_index-obLookback, entryPrice, bar_index, bearOB, bgcolor=color.new(color.red, 85), border_color=color.red)
BackTestLibLibrary "BackTestLib"
Allows backtesting indicator performance. Tracks typical metrics such as won/loss, profit factor, draw down, etc. Trading View strategy library provides similar (and more comprehensive)
functionality but only works with strategies. This libary was created to address performance tracking within indicators.
Two primary outputs are generated:
1. Summary Table: Displays overall performance metrics for the indicator over the chart's loaded timeframe and history
2. Details Table: Displays a table of individual trade entries and exits. This table can grow larger than the available chart space. It does have a max number of rows supported. I haven't
found a way to add scroll bars or scroll bar equivalents yet.
f_init(data, _defaultStopLoss, _defaultTakeProfit, _useTrailingStop, _useTraingStopToBreakEven, _trailingStopActivation, _trailingStopOffset)
f_init Initialize the backtest data type. Called prior to using the backtester functions
Parameters:
data (backtesterData) : backtesterData to initialize
_defaultStopLoss (float) : Default trade stop loss to apply
_defaultTakeProfit (float) : Default trade take profit to apply
_useTrailingStop (bool) : Trailing stop enabled
_useTraingStopToBreakEven (bool) : When trailing stop active, trailing stop will increase no further than the entry price
_trailingStopActivation (int) : When trailing stop active, trailing will begin once price exceeds base stop loss by this number of points
_trailingStopOffset (int) : When trailing stop active, it will trail the max price achieved by this number of points
Returns: Initialized data set
f_buildResultStr(_resultType, _price, _resultPoints, _numWins, _pointsWon, _numLoss, _pointsLost)
f_buildResultStr Helper function to construct a string of resutling data for exit tooltip labels
Parameters:
_resultType (string)
_price (float)
_resultPoints (float)
_numWins (int)
_pointsWon (float)
_numLoss (int)
_pointsLost (float)
f_buildResultLabel(data, labelVertical, labelOffset, long)
f_buildResultLabel Helper function to construct an Exit label for display on the chart
Parameters:
data (backtesterData)
labelVertical (bool)
labelOffset (int)
long (bool)
f_updateTrailingStop(_entryPrice, _curPrice, _sl, _tp, trailingStopActivationInput, trailingStopOffsetInput, useTrailingStopToBreakEven)
f_updateTrailingStop Helper function to advance the trailing stop as price action dictates
Parameters:
_entryPrice (float)
_curPrice (float)
_sl (float)
_tp (float)
trailingStopActivationInput (float)
trailingStopOffsetInput (float)
useTrailingStopToBreakEven (bool)
Returns: Updated stop loss for current price action
f_enterShort(data, entryPrice, fixedStopLoss)
f_enterShort Helper function to enter a short and collect data necessary for tracking the trade entry
Parameters:
data (backtesterData)
entryPrice (float)
fixedStopLoss (float)
Returns: Updated backtest data
f_enterLong(data, entryPrice, fixedStopLoss)
f_enterLong Helper function to enter a long and collect data necessary for tracking the trade entry
Parameters:
data (backtesterData)
entryPrice (float)
fixedStopLoss (float)
Returns: Updated backtest data
f_exitTrade(data)
f_enterLong Helper function to exit a trade and update/reset tracking data
Parameters:
data (backtesterData)
Returns: Updated backtest data
f_checkTradeConditionForExit(data, condition, curPrice, enableRealTime)
f_checkTradeConditionForExit Helper function to determine if provided condition indicates an exit
Parameters:
data (backtesterData)
condition (bool) : When true trade will exit
curPrice (float)
enableRealTime (bool) : When true trade will evaluate if barstate is relatime or barstate is confirmed; otherwise just checks on is confirmed
Returns: Updated backtest data
f_checkTrade(data, curPrice, curLow, curHigh, enableRealTime)
f_checkTrade Helper function to determine if current price action dictates stop loss or take profit exit
Parameters:
data (backtesterData)
curPrice (float)
curLow (float)
curHigh (float)
enableRealTime (bool) : When true trade will evaluate if barstate is relatime or barstate is confirmed; otherwise just checks on is confirmed
Returns: Updated backtest data
f_fillCell(_table, _column, _row, _title, _value, _bgcolor, _txtcolor, _text_size)
f_fillCell Helper function to construct result table cells
Parameters:
_table (table)
_column (int)
_row (int)
_title (string)
_value (string)
_bgcolor (color)
_txtcolor (color)
_text_size (string)
Returns: Table cell
f_prepareStatsTable(data, drawTesterSummary, drawTesterDetails, summaryTableTextSize, detailsTableTextSize, displayRowZero, summaryTableLocation, detailsTableLocation)
f_fillCell Helper function to populate result table
Parameters:
data (backtesterData)
drawTesterSummary (bool)
drawTesterDetails (bool)
summaryTableTextSize (string)
detailsTableTextSize (string)
displayRowZero (bool)
summaryTableLocation (string)
detailsTableLocation (string)
Returns: Updated backtest data
backtesterData
backtesterData - container for backtest performance metrics
Fields:
tradesArray (array) : Array of strings with entries for each individual trade and its results
pointsBalance (series float) : Running sum of backtest points won/loss results
drawDown (series float) : Running sum of backtest total draw down points
maxDrawDown (series float) : Running sum of backtest total draw down points
maxRunup (series float) : Running sum of max points won over the backtest
numWins (series int) : Number of wins of current backtes set
numLoss (series int) : Number of losses of current backtes set
pointsWon (series float) : Running sum of points won to date
pointsLost (series float) : Running sum of points lost to date
entrySide (series string) : Current entry long/short
tradeActive (series bool) : Indicates if a trade is currently active
tradeComplete (series bool) : Indicates if a trade just exited (due to stop loss or take profit)
entryPrice (series float) : Current trade entry price
entryTime (series int) : Current trade entry time
sl (series float) : Current trade stop loss
tp (series float) : Current trade take profit
defaultStopLoss (series float) : Default trade stop loss to apply
defaultTakeProfit (series float) : Default trade take profit to apply
useTrailingStop (series bool) : Trailing stop enabled
useTrailingStopToBreakEven (series bool) : When trailing stop active, trailing stop will increase no further than the entry price
trailingStopActivation (series int) : When trailing stop active, trailing will begin once price exceeds base stop loss by this number of points
trailingStopOffset (series int) : When trailing stop active, it will trail the max price achieved by this number of points
resultType (series string) : Current trade won/lost
exitPrice (series float) : Current trade exit price
resultPoints (series float) : Current trade points won/lost
summaryTable (series table) : Table to deisplay summary info
tradesTable (series table) : Table to display per trade info
position_toolLibrary "position_tool"
Trying to turn TradingView's position tool into a library from which you can draw position tools for your strategies on the chart. Not sure if this is going to work
calcBaseUnit()
Calculates the chart symbol's base unit of change in asset prices.
Returns: (float) A ticks or pips value of base units of change.
calcOrderPipsOrTicks(orderSize, unit)
Converts the `orderSize` to ticks.
Parameters:
orderSize (float) : (series float) The order size to convert to ticks.
unit (simple float) : (simple float) The basic units of change in asset prices.
Returns: (int) A tick value based on a given order size.
calcProfitLossSize(price, entryPrice, isLongPosition)
Calculates a difference between a `price` and the `entryPrice` in absolute terms.
Parameters:
price (float) : (series float) The price to calculate the difference from.
entryPrice (float) : (series float) The price of entry for the position.
isLongPosition (bool)
Returns: (float) The absolute price displacement of a price from an entry price.
calcRiskRewardRatio(profitSize, lossSize)
Calculates a risk to reward ratio given the size of profit and loss.
Parameters:
profitSize (float) : (series float) The size of the profit in absolute terms.
lossSize (float) : (series float) The size of the loss in absolute terms.
Returns: (float) The ratio between the `profitSize` to the `lossSize`
createPosition(entryPrice, entryTime, tpPrice, slPrice, entryColor, tpColor, slColor, textColor, showExtendRight)
Main function to create a position visualization with entry, TP, and SL
Parameters:
entryPrice (float) : (float) The entry price of the position
entryTime (int) : (int) The entry time of the position in bar_time format
tpPrice (float) : (float) The take profit price
slPrice (float) : (float) The stop loss price
entryColor (color) : (color) Color for entry line
tpColor (color) : (color) Color for take profit zone
slColor (color) : (color) Color for stop loss zone
textColor (color) : (color) Color for text labels
showExtendRight (bool) : (bool) Whether to extend lines to the right
Returns: (bool) Returns true when position is closed
CalculatePercentageSlTpLibrary "CalculatePercentageSlTp"
This Library calculate the sl and tp amount in percentage
sl_percentage(entry_price, sl_price)
this function calculates the sl value in percentage
Parameters:
entry_price : indicates the entry level
sl_price : indicates the stop loss level
Returns: stop loss in percentage
tp_percentage(entry_price, tp_price)
this function calculates the tp value in percentage
Parameters:
entry_price : indicates the entry level
tp_price : indicates the take profit level
Returns: take profit in percentage
sl_level(entry_price, sl_percentage)
this function calculates the sl level price
Parameters:
entry_price : indicates the entry level
sl_percentage : indicates the stop loss percentage
Returns: stop loss price in $
tp_level(entry_price, tp_percentage)
this function calculates the tp level price
Parameters:
entry_price : indicates the entry level
tp_percentage : indicates the take profit percentage
Returns: take profit price in $