This Pine Script v5 strategy is designed to trade on a 5‑minute timeframe using a combination of technical indicators and session filtering, with enhanced visual feedback through on‐chart tables. Here’s an overview of its main components and functionality:
Input Settings and Visuals:
The script defines color inputs for bullish and bearish signals as well as for fair value gap (FVG) markings.
Parameters such as the ATR period, ATR multiplier for stop-loss, and a series of take-profit (TP) multipliers are adjustable to fine-tune the strategy for short-term (5‑minute) trading.
ATR and Price Levels:
A shorter ATR period is used to calculate volatility, which then determines the stop-loss distance and take-profit levels.
The highest high and lowest low over the last 20 bars are computed to help generate entry signals.
Fair Value Gap (FVG) Detection:
The script checks for conditions where a “gap” exists between previous bars (a bullish or bearish fair value gap).
If a fair value gap is detected, it can trigger entry signals. FVG zones are drawn on the chart with high transparency for subtle visual reference.
Session Timing Based on Nairobi Time (UTC+3):
Session start and end times for London, New York, and Tokyo are defined using the "Africa/Nairobi" timezone.
A helper function determines whether each session is “Ongoing,” “Not Started,” or “Ended” based on the current time, and calculates the remaining time until the next session start.
Trading is enabled only when at least one of these sessions is “Ongoing,” and the strategy is further restricted to weekdays (Monday to Friday).
Entry and Exit Logic:
The strategy generates buy signals when the close crosses over the recent low or when a bullish FVG is identified; conversely, it generates sell signals when the close crosses under the recent high or a bearish FVG is detected.
For each trade signal, the code enters 5 orders (each with varying TP levels calculated using the ATR and TP multipliers) and sets the stop-loss based on the ATR multiplied by the user-defined multiplier.
Trade Information Table (Bottom Right):
A trade information table is created with 2 columns by 9 rows.
Each row is dedicated to a specific trade metric:
Row 0: Trade side (e.g., “BUY NOW” or “SELL NOW”)
Row 1: Entry price
Rows 2–6: Five TP levels (TP1 to TP5)
Row 7: Stop-loss level
Row 8: Timer showing the elapsed time since the trade entry
The table updates dynamically based on trade executions and includes conditional cell background colors (for example, highlighting TP levels when certain conditions are met).
Session Information Table (Top Right):
A separate table displays session information, including the session name, its current status (with dynamic background colors: red for “Ended,” orange for “Not Started,” and dark green for “Ongoing”), and the time remaining in the session.
Overall Strategy Behavior:
The strategy only executes trades when the market is active during one or more of the specified sessions and only on trading days (Monday to Friday).
It is tuned for a 5‑minute chart, with more reactive ATR and TP levels suitable for short-term trading.
This comprehensive script not only defines a technical trading strategy but also provides real-time visual feedback and session-based filtering, making it a robust tool for traders who operate on short timeframes and need clear, dynamic information on trade performance and market sessions.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.