Strategy: Friday Bond Short Strategy (1H Timeframe)
Objective: This strategy aims to open short positions on a specified day and hour (Eastern Time) and close those positions on another specified day and hour. The background color of the chart will turn green when a position is active, providing a visual cue of an open trade.
Parameters:
1. Entry Day: • Defines the day of the week on which the short position will be opened. • Value: 6 for Friday (Pine Script’s weekday numbering: Monday = 2, Friday = 6). 2. Entry Hour: • Specifies the hour (Eastern Time) when the short position will be opened. • Value: 13 for 13:00 ET (1:00 PM). 3. Exit Day: • Defines the day of the week on which the short position will be closed. • Value: 2 for Monday. 4. Exit Hour: • Specifies the hour (Eastern Time) when the position will be closed. • Value: 13 for 13:00 ET (1:00 PM).
How It Works:
1. Time Adjustment to Eastern Time: • The script converts all time references to Eastern Time (America/New_York) to ensure the strategy operates according to the desired time zone. 2. Entry Conditions: • The strategy checks if the current day of the week matches the specified entry_day and if the current hour matches the specified entry_hour. • If both conditions are met, a short position is opened (strategy.entry("Short", strategy.short)). 3. Exit Conditions: • Similarly, the strategy checks if the current day of the week matches the specified exit_day and if the current hour matches the specified exit_hour. • If both conditions are met, the open short position is closed (strategy.close("Short")). 4. Background Color: • The background color of the chart is adjusted based on whether there is an open position: • Green Background: If the strategy has an open position (strategy.position_size > 0), the background is set to light green. • No Background Color: If there is no open position, the background color is not set (na).
Summary:
The Friday Bond Short Strategy is designed to enter short positions on Fridays at 1:00 PM ET and close them on Mondays at 1:00 PM ET. The chart background color turns green when a short position is active, providing a clear visual indication of when the strategy is engaged in a trade.
Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.