OPEN-SOURCE SCRIPT
업데이트됨

TrinityBar

584
**TrinityBar Strategy Description**

The TrinityBar strategy is a price‐action based trading model that leverages Bill Williams’ bar thirds concept to generate entry signals and execute market orders automatically. Here’s how it works:

1. **Bar Thirds Calculation:**
The strategy calculates the range of both the current fully formed bar and the previous fully formed bar. It then divides each bar’s range into three equal parts (thirds).
- For the current bar, the lower third and upper third levels are computed.
- The same is done for the previous bar.

2. **Bar Type Classification:**
Each bar is classified into one of several types based on where its open and close fall relative to its thirds:
- **Bullish Patterns:**
- *1‑3 Bar:* Opens in the lower third and closes in the upper third.
- *2‑3 Bar:* Opens in the middle third and closes in the upper third.
- *3‑3 Bar:* Both open and close are in the upper third.
- **Bearish Patterns:**
- *3‑1 Bar:* Opens in the upper third and closes in the lower third.
- *2‑1 Bar:* Opens in the middle third and closes in the lower third.
- *1‑1 Bar:* Both open and close are in the lower third.

3. **Signal Generation:**
- **Bullish Signal:** A valid buy is generated when the previous bar exhibits any bullish pattern (1‑3, 2‑3, or 3‑3) and the current bar is either a 1‑3 or a 3‑3 bar.
- **Bearish Signal:** A valid sell is generated when the previous bar shows any bearish pattern (1‑1, 2‑1, or 3‑1) and the current bar is either a 1‑1 or a 3‑1 bar.

4. **Visual Alerts:**
When a valid signal is identified, the strategy plots a small triangle below the bar for a buy signal (labeled “B” in green) and a triangle above the bar for a sell signal (labeled “S” in red).

5. **Trade Execution:**
Once a signal is confirmed:
- If a bullish signal is generated, any short positions are closed, and if there is no existing long position, a market long order is entered.
- Conversely, if a bearish signal occurs, any long positions are closed, and a market short order is entered if not already in a short position.

This strategy is designed to capture significant price expansions by relying solely on price action and bar structure, without relying on lagging indicators. It provides a mechanical, systematic approach that removes emotional bias from trading decisions.
릴리즈 노트
Strategy Overview:
The “Simplified TrinityBar with VWAP Filter” strategy combines classical price pattern analysis with a custom, daily-resetting VWAP filter to refine entry signals. It’s designed to enter trades only when both a specific price action pattern and favorable market conditions relative to the volume-weighted average price are present.

Key Components:

Price Pattern Analysis:

Bar Thirds Calculation: The strategy divides a bar’s range (specifically, bar index 2 for the current pattern and bar index 3 for the previous pattern) into thirds.

Bullish Patterns:

A “1-3” bullish pattern is identified when the current bar opens in the lower third and closes in the upper third.

A “3-3” bullish pattern occurs when both the open and close fall in the upper third.

Bearish Patterns:

A “1-1” bearish pattern is confirmed when the current bar both opens and closes in the lower third.

A “3-1” bearish pattern is when the bar opens in the upper third and closes in the lower third.

Valid Signal Criteria:

For a buy signal, the current bar must display a bullish pattern, with the previous bar’s low being below the current bar’s low.

For a sell signal, the current bar must display a bearish pattern, with the previous bar’s high being above the current bar’s high.

VWAP Filter Integration:

VWAP Calculation: A custom VWAP is computed by accumulating the typical price (the average of high, low, and close) weighted by volume, resetting at the start of each trading day.

Filter Conditions:

A long signal is only valid if the previous bar’s low is below the VWAP and the current bar closes above it.

Conversely, a short signal is only valid if the previous bar’s high is above the VWAP and the current bar closes below it.
This filter helps ensure that trades are taken in the direction of the prevailing average price, aiming to improve trade quality and reduce false signals.

Trade Execution and Risk Management:

Entry and Exit Rules:

Upon a valid long signal, the strategy closes any short positions before entering a long position, and vice versa for a valid short signal.

Take Profit and Stop Loss:

Profit targets are calculated using a multiplier (defaulted to 1.618) applied to the range between the current and previous bars.

Stop losses are set at the low (for long positions) or high (for short positions) of the current bar, managing downside risk.

High-Leverage Actions:

Backtest and Optimize: Rigorously backtest the strategy under various market conditions to confirm that the VWAP filter and pattern criteria improve trade performance.

Monitor VWAP Behavior: Ensure the custom VWAP calculation resets correctly with each session and aligns with your intended market dynamics.

Iterate Based on Findings: If necessary, refine the thresholds or the multiplier for profit-taking to better suit specific market environments.

This strategy is a disciplined approach designed to capture moves that are supported by both technical patterns and the underlying market trend, as indicated by the VWAP filter.
릴리즈 노트
Strategy Overview:
The “TrinityBar with VWAP Filter” strategy combines classical price pattern analysis with a custom, daily-resetting VWAP filter to refine entry signals. It’s designed to enter trades only when both a specific price action pattern and favorable market conditions relative to the volume-weighted average price are present.

Key Components:

Price Pattern Analysis:

Bar Thirds Calculation: The strategy divides a bar’s range (specifically, bar index 2 for the current pattern and bar index 3 for the previous pattern) into thirds.

Bullish Patterns:

A “1-3” bullish pattern is identified when the current bar opens in the lower third and closes in the upper third.

A “3-3” bullish pattern occurs when both the open and close fall in the upper third.

Bearish Patterns:

A “1-1” bearish pattern is confirmed when the current bar both opens and closes in the lower third.

A “3-1” bearish pattern is when the bar opens in the upper third and closes in the lower third.

Valid Signal Criteria:

For a buy signal, the current bar must display a bullish pattern, with the previous bar’s low being below the current bar’s low.

For a sell signal, the current bar must display a bearish pattern, with the previous bar’s high being above the current bar’s high.

VWAP Filter Integration:

VWAP Calculation: A custom VWAP is computed by accumulating the typical price (the average of high, low, and close) weighted by volume, resetting at the start of each trading day.

Filter Conditions:

A long signal is only valid if the previous bar’s low is below the VWAP and the current bar closes above it.

Conversely, a short signal is only valid if the previous bar’s high is above the VWAP and the current bar closes below it.
This filter helps ensure that trades are taken in the direction of the prevailing average price, aiming to improve trade quality and reduce false signals.

Trade Execution and Risk Management:

Entry and Exit Rules:

Upon a valid long signal, the strategy closes any short positions before entering a long position, and vice versa for a valid short signal.

Take Profit and Stop Loss:

Profit targets are calculated using a multiplier (defaulted to 1.618) applied to the range between the current and previous bars.

Stop losses are set at the low (for long positions) or high (for short positions) of the current bar, managing downside risk.

This strategy is a disciplined approach designed to capture moves that are supported by both technical patterns and the underlying market trend, as indicated by the VWAP filter.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.