OPEN-SOURCE SCRIPT
מעודכן Strategy with Reference Lines

📊 Strategy with Reference Lines
Description:
This strategy uses a contrarian approach based on the analysis of the previous candle to identify entry and exit points. The strategy draws horizontal reference lines at important levels of the previous candle and generates buy/sell signals based on the candle's direction.
Key Features:
🔹 Multi-Timeframe Analysis: Configurable for 1H, 2H, 3H, 4H, 6H, 12H, and 1D
🔹 Reference Lines: High, low, close, and midpoint (50%) of the previous candle
🔹 Visual Signals: Labels with prices and actions (BUY/SELL/TP)
🔹 Optional Trading: Enable/disable automatic order execution
🔹 Complete System: Automatic entry, Take Profit, and Stop Loss
🔹 Alerts: Notifications when a new candle is detected
Strategy Logic:
When the previous candle is POSITIVE:
Signal: 🔴 SELL at the previous candle's close
Take Profit: 🎯 Midpoint (50%) of the previous candle
Stop Loss: 🔴 High of the previous candle
When the previous candle is NEGATIVE:
Signal: 🟢 BUY at the previous candle's close
Take Profit: 🎯 Midpoint (50%) of the previous candle
Stop Loss: 🟢 Low of the previous candle
Visual Elements:
Green Line: High of the previous candle (when positive)
Red Line: Low of the previous candle (when negative)
Yellow Line: Close of the previous candle (always present)
Blue Line: Midpoint (50%) of the previous candle (always present)
Labels: Prices and actions with emojis for easy identification
Settings:
Timeframe: Default 4H (configurable)
Auto Trading: Disabled by default (safety)
Alerts: Include entry prices, TP, and SL
Recommended Usage:
✅ Visual Analysis: Use with trading disabled for analysis
✅ Backtesting: Enable trading to test historically
✅ Swing Trading: Ideal for 4H or higher timeframes
✅ Risk Management: Automatic SL and TP for protection
Risk Disclaimer:
This strategy is for educational and analysis purposes only. Always test in a simulation environment before using with real capital. Trading involves significant risks and may result in losses.
Description:
This strategy uses a contrarian approach based on the analysis of the previous candle to identify entry and exit points. The strategy draws horizontal reference lines at important levels of the previous candle and generates buy/sell signals based on the candle's direction.
Key Features:
🔹 Multi-Timeframe Analysis: Configurable for 1H, 2H, 3H, 4H, 6H, 12H, and 1D
🔹 Reference Lines: High, low, close, and midpoint (50%) of the previous candle
🔹 Visual Signals: Labels with prices and actions (BUY/SELL/TP)
🔹 Optional Trading: Enable/disable automatic order execution
🔹 Complete System: Automatic entry, Take Profit, and Stop Loss
🔹 Alerts: Notifications when a new candle is detected
Strategy Logic:
When the previous candle is POSITIVE:
Signal: 🔴 SELL at the previous candle's close
Take Profit: 🎯 Midpoint (50%) of the previous candle
Stop Loss: 🔴 High of the previous candle
When the previous candle is NEGATIVE:
Signal: 🟢 BUY at the previous candle's close
Take Profit: 🎯 Midpoint (50%) of the previous candle
Stop Loss: 🟢 Low of the previous candle
Visual Elements:
Green Line: High of the previous candle (when positive)
Red Line: Low of the previous candle (when negative)
Yellow Line: Close of the previous candle (always present)
Blue Line: Midpoint (50%) of the previous candle (always present)
Labels: Prices and actions with emojis for easy identification
Settings:
Timeframe: Default 4H (configurable)
Auto Trading: Disabled by default (safety)
Alerts: Include entry prices, TP, and SL
Recommended Usage:
✅ Visual Analysis: Use with trading disabled for analysis
✅ Backtesting: Enable trading to test historically
✅ Swing Trading: Ideal for 4H or higher timeframes
✅ Risk Management: Automatic SL and TP for protection
Risk Disclaimer:
This strategy is for educational and analysis purposes only. Always test in a simulation environment before using with real capital. Trading involves significant risks and may result in losses.
הערות שחרור
adjustmentsהערות שחרור
TradingView Indicator Update DescriptionIndicator Name
Strategy with Reference Lines
Version
v2.0
General Description
Indicator that creates reference lines based on the previous candle of the configured timeframe, providing objective entry points and technical analysis.
Main Features
1. Timeframe Configuration
Selection between: 1H, 2H, 3H, 4H, 6H, 12H, 1D
Analysis based on chosen timeframe, regardless of current chart timeframe
2. Automatic Reference Lines
Green Line: Previous candle high (when candle was bullish)
Red Line: Previous candle low (when candle was bearish)
Yellow Line: Previous candle close (always present)
Blue Line: Midpoint (50% between open and close)
3. Informative Labels
Exact prices of reference lines
Temporal observation: "Wait for 1H elapsed from candle"
Configured timeframe information
4. Smart Alerts
Notification when new timeframe candle closes
Complete previous candle data
Temporal guidance for analysis
5. Automatic Trading (Optional)
Automatic entry based on previous candle direction
Take Profit at midpoint (50%)
Stop Loss at previous candle high/low
How to Use
Initial Setup
Select desired timeframe in input
Enable/disable automatic trading as needed
Apply indicator to chart
Line Interpretation
Previous Bullish Candle: Green line at high + yellow line at close
Previous Bearish Candle: Red line at low + yellow line at close
Midpoint: Always present as blue line (TP reference)
Recommended Strategy
Wait for candle close in configured timeframe
Observe created reference lines
Wait 1 hour elapsed from candle for analysis
Use lines as entry/exit points
Technical Characteristics
Compatibility
Works on any visualization timeframe
Updates only when on configured timeframe
Accurate data from chosen timeframe
Performance
Optimized calculation with request.security()
lookahead_off and gaps_off parameters for precision
Automatic new candle detection
Customization
Configurable line colors
Adjustable line styles
Customizable label sizes
Version 2.0 Updates
Implemented Improvements
✅ Removal of trading texts (SELL/BUY/TP)
✅ Addition of temporal observation "Wait for 1H elapsed"
✅ Cleaner and more objective interface
✅ Informative alerts without trading bias
✅ Accurate configured timeframe data
Technical Fixes
✅ Correct new candle detection
✅ Data consistent with Data Window
✅ Multi-timeframe functionality
✅ Optimized Pine Script v6 syntax
Installation Instructions
Copy complete code from teste.txt file
Paste into TradingView Pine Script editor
Save and apply to chart
Configure desired timeframe
Enable alerts if needed
Support and Feedback
Version tested on multiple assets
Compatible with all markets
Optimized for objective technical analysis
Note: This indicator provides only objective technical information. Always conduct your own analysis before making trading decisions.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.