OPEN-SOURCE SCRIPT
更新済 TuxAlgo Plus a SMC and Trap Toolkit V0.98r1 by McToga

The “TuxAlgo Plus” script is a powerful, standalone, conceptual open-source project and self-sufficient “smart money toolkit” with automatic trap detection (SMT), liquidity grabs, FVG confluence, and complete bot setup signals for TV charts in the “H1 to H6” time frame and daily charts.
The script is used to improve SMC/trap analyses, i.e., the structure and visualization logic for TradingView charts have been expanded in the “TuxAlgo++” project in line with Smart Money Concepts (SMC) and Smart Money Traps (SMT).
The SMT block (“Smart Money Traps”) supplements classic smart money concepts with:
1. Detection of bull traps (short setups) and bear traps (long setups)
2. Display of trap boxes in the chart (liquidity grab areas)
3. A bot setup box (table) with ready-made entry/SL/TP levels:
as well as age in bars & days and “Valid until ~X d” (remaining term)
SMT / bot setup only run on the following timeframes:
- H1, H2, H3, H4, H6 This means that traps, labels, and the bot setup box are only displayed on these timeframes
Trap definition “Bull Trap (Short Setup)”:
- Valid swing high
- Swing trend bullish
- High (Wick) pierces above the swing high (Liquidity Grab)
- Close falls back below the swing high (false breakout)
-> Result: Short setup (bull trap), marked in orange
Trap definition “Bear Trap (long setup)”:
- Valid swing low
- Swing trend bearish
- Low (wick) pierces below the swing low (liquidity grab)
- Close rises above the swing low again (false breakout)
-> Result: Long setup (bear trap), marked in blue
Entry / SL / TP calculation
A price range is taken for each trap:
Bull trap (short):
- Range = [swing high level, wick top]
- Entry = point within this range:
Entry = hiBT - (hiBT - loBT) * TrapEntryRatio (0..1)
-> 0.0 = at the Wick extreme, 0.5 = middle, 1.0 = at the Swing level
- SL = Wick extreme (upper edge of the trap)
- Risk = |Entry - SL|
- TP1 = Entry - R1 * Risk
- TP2 = Entry - R2 * Risk
Bear Trap (Long):
- Range = [wick bottom, swing low level]
- Entry analogous within the range according to TrapEntryRatio
- SL = wick bottom (lower edge of the trap)
- Risk = |Entry - SL|
- TP1 = Entry + R1 * Risk
- TP2 = Entry + R2 * Risk
R1 / R2 correspond to the inputs:
- botRR1Input = TP1 Risk/Reward (e.g., 1.5R)
- botRR2Input = TP2 Risk/Reward (e.g., 3.0R)
Age & Validity
Each trap stores:
- lastTrapBarIndex -> last bar of the trap
- Age in bars -> bar_index - lastTrapBarIndex
- Age in days (~d) -> AgeBars * BarDurationInDays (depending on TF)
Input: trapMaxAgeBars determines how long a trap is valid.
The bot setup box is only displayed if:
- a trap is present,
- AgeBars <= trapMaxAgeBars,
- SMT + Box + SMC timeframe are active.
Color logic (color blind friendly):
- Blue (accentBlue) = fresh traps (Age <= 1/3 MaxAge)
- Orange (accentOrange) = medium age
- Violet (accentPurple) = old, but still within MaxAge
- Gray (accentGray) = expired (> MaxAge)
The box also shows “Valid until ~X d” as the remaining term.
Day/Night Mode & Colors
- chart.bg_color is used to detect dark or light mode.
- Text/background colors adjust (light/dark).
- Accent colors (blue/orange/purple/gray) are suitable for red/green color blindness.
- Trap labels in the chart:
- Bull trap label = orange (short setup)
- Bear trap label = blue (long setup)
- Text color depends on chart mode (dark/light)
Typical workflow (example):
1. Select a suitable symbol & SMC timeframe (e.g., H4 or H6).
2. Wait for a bull trap (short) or bear trap (long).
3. Read in the bot setup box:
- Direction (long/short)
- Entry, SL, TP1, TP2
- Age & “Valid until ~X d”
4. These values can be used as a template for manual trading or external bot/order systems.
5. Position size & leverage must always be calculated separately in your own risk management
(e.g., 2% rule). This script does not calculate position sizes.
The script is used to improve SMC/trap analyses, i.e., the structure and visualization logic for TradingView charts have been expanded in the “TuxAlgo++” project in line with Smart Money Concepts (SMC) and Smart Money Traps (SMT).
The SMT block (“Smart Money Traps”) supplements classic smart money concepts with:
1. Detection of bull traps (short setups) and bear traps (long setups)
2. Display of trap boxes in the chart (liquidity grab areas)
3. A bot setup box (table) with ready-made entry/SL/TP levels:
as well as age in bars & days and “Valid until ~X d” (remaining term)
SMT / bot setup only run on the following timeframes:
- H1, H2, H3, H4, H6 This means that traps, labels, and the bot setup box are only displayed on these timeframes
Trap definition “Bull Trap (Short Setup)”:
- Valid swing high
- Swing trend bullish
- High (Wick) pierces above the swing high (Liquidity Grab)
- Close falls back below the swing high (false breakout)
-> Result: Short setup (bull trap), marked in orange
Trap definition “Bear Trap (long setup)”:
- Valid swing low
- Swing trend bearish
- Low (wick) pierces below the swing low (liquidity grab)
- Close rises above the swing low again (false breakout)
-> Result: Long setup (bear trap), marked in blue
Entry / SL / TP calculation
A price range is taken for each trap:
Bull trap (short):
- Range = [swing high level, wick top]
- Entry = point within this range:
Entry = hiBT - (hiBT - loBT) * TrapEntryRatio (0..1)
-> 0.0 = at the Wick extreme, 0.5 = middle, 1.0 = at the Swing level
- SL = Wick extreme (upper edge of the trap)
- Risk = |Entry - SL|
- TP1 = Entry - R1 * Risk
- TP2 = Entry - R2 * Risk
Bear Trap (Long):
- Range = [wick bottom, swing low level]
- Entry analogous within the range according to TrapEntryRatio
- SL = wick bottom (lower edge of the trap)
- Risk = |Entry - SL|
- TP1 = Entry + R1 * Risk
- TP2 = Entry + R2 * Risk
R1 / R2 correspond to the inputs:
- botRR1Input = TP1 Risk/Reward (e.g., 1.5R)
- botRR2Input = TP2 Risk/Reward (e.g., 3.0R)
Age & Validity
Each trap stores:
- lastTrapBarIndex -> last bar of the trap
- Age in bars -> bar_index - lastTrapBarIndex
- Age in days (~d) -> AgeBars * BarDurationInDays (depending on TF)
Input: trapMaxAgeBars determines how long a trap is valid.
The bot setup box is only displayed if:
- a trap is present,
- AgeBars <= trapMaxAgeBars,
- SMT + Box + SMC timeframe are active.
Color logic (color blind friendly):
- Blue (accentBlue) = fresh traps (Age <= 1/3 MaxAge)
- Orange (accentOrange) = medium age
- Violet (accentPurple) = old, but still within MaxAge
- Gray (accentGray) = expired (> MaxAge)
The box also shows “Valid until ~X d” as the remaining term.
Day/Night Mode & Colors
- chart.bg_color is used to detect dark or light mode.
- Text/background colors adjust (light/dark).
- Accent colors (blue/orange/purple/gray) are suitable for red/green color blindness.
- Trap labels in the chart:
- Bull trap label = orange (short setup)
- Bear trap label = blue (long setup)
- Text color depends on chart mode (dark/light)
Typical workflow (example):
1. Select a suitable symbol & SMC timeframe (e.g., H4 or H6).
2. Wait for a bull trap (short) or bear trap (long).
3. Read in the bot setup box:
- Direction (long/short)
- Entry, SL, TP1, TP2
- Age & “Valid until ~X d”
4. These values can be used as a template for manual trading or external bot/order systems.
5. Position size & leverage must always be calculated separately in your own risk management
(e.g., 2% rule). This script does not calculate position sizes.
リリースノート
The “TuxAlgo Plus” script is a powerful, standalone, conceptual open-source project and self-sufficient “smart money toolkit” with automatic trap detection (SMT), liquidity grabs, FVG confluence, and complete bot setup signals for TV charts in the “H1 to H6” time frame and daily charts.The script is used to improve SMC/trap analyses, i.e., the structure and visualization logic for TradingView charts have been expanded in the “TuxAlgo++” project in line with Smart Money Concepts (SMC) and Smart Money Traps (SMT).
The SMT block (“Smart Money Traps”) supplements classic smart money concepts with:
1. Detection of bull traps (short setups) and bear traps (long setups)
2. Display of trap boxes in the chart (liquidity grab areas)
3. A bot setup box (table) with ready-made entry/SL/TP levels:
as well as age in bars & days and “Valid until ~X d” (remaining term)
SMT / bot setup only run on the following timeframes:
- H1, H2, H3, H4, H6 This means that traps, labels, and the bot setup box are only displayed on these timeframes
Trap definition “Bull Trap (Short Setup)”:
- Valid swing high
- Swing trend bullish
- High (Wick) pierces above the swing high (Liquidity Grab)
- Close falls back below the swing high (false breakout)
-> Result: Short setup (bull trap), marked in orange
Trap definition “Bear Trap (long setup)”:
- Valid swing low
- Swing trend bearish
- Low (wick) pierces below the swing low (liquidity grab)
- Close rises above the swing low again (false breakout)
-> Result: Long setup (bear trap), marked in blue
Entry / SL / TP calculation
A price range is taken for each trap:
Bull trap (short):
- Range = [swing high level, wick top]
- Entry = point within this range:
Entry = hiBT - (hiBT - loBT) * TrapEntryRatio (0..1)
-> 0.0 = at the Wick extreme, 0.5 = middle, 1.0 = at the Swing level
- SL = Wick extreme (upper edge of the trap)
- Risk = |Entry - SL|
- TP1 = Entry - R1 * Risk
- TP2 = Entry - R2 * Risk
Bear Trap (Long):
- Range = [wick bottom, swing low level]
- Entry analogous within the range according to TrapEntryRatio
- SL = wick bottom (lower edge of the trap)
- Risk = |Entry - SL|
- TP1 = Entry + R1 * Risk
- TP2 = Entry + R2 * Risk
R1 / R2 correspond to the inputs:
- botRR1Input = TP1 Risk/Reward (e.g., 1.5R)
- botRR2Input = TP2 Risk/Reward (e.g., 3.0R)
Age & Validity
Each trap stores:
- lastTrapBarIndex -> last bar of the trap
- Age in bars -> bar_index - lastTrapBarIndex
- Age in days (~d) -> AgeBars * BarDurationInDays (depending on TF)
Input: trapMaxAgeBars determines how long a trap is valid.
The bot setup box is only displayed if:
- a trap is present,
- AgeBars <= trapMaxAgeBars,
- SMT + Box + SMC timeframe are active.
Color logic (color blind friendly):
- Blue (accentBlue) = fresh traps (Age <= 1/3 MaxAge)
- Orange (accentOrange) = medium age
- Violet (accentPurple) = old, but still within MaxAge
- Gray (accentGray) = expired (> MaxAge)
The box also shows “Valid until ~X d” as the remaining term.
Day/Night Mode & Colors
- chart.bg_color is used to detect dark or light mode.
- Text/background colors adjust (light/dark).
- Accent colors (blue/orange/purple/gray) are suitable for red/green color blindness.
- Trap labels in the chart:
- Bull trap label = orange (short setup)
- Bear trap label = blue (long setup)
- Text color depends on chart mode (dark/light)
Typical workflow (example):
1. Select a suitable symbol & SMC timeframe (e.g., H4 or H6).
2. Wait for a bull trap (short) or bear trap (long).
3. Read in the bot setup box:
- Direction (long/short)
- Entry, SL, TP1, TP2
- Age & “Valid until ~X d”
4. These values can be used as a template for manual trading or external bot/order systems.
5. Position size & leverage must always be calculated separately in your own risk management
(e.g., 2% rule). This script does not calculate position sizes.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。