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.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.