OPEN-SOURCE SCRIPT
Actualizado Manual Wedge Setup [WillyAlgoTrader]

📐 Manual Wedge Setup [WillyAlgoTrader]
Manual Wedge is an interactive four-candle wedge planner for TradingView.
📌 MANUAL SETUP — FOUR POINTS REQUIRED
You must manually select FOUR distinct candles on the chart using the Candle 1, Candle 2, Candle 3, and Candle 4 inputs.
The indicator does not automatically search for wedges and does not select the four candles for you.
After the four candles are selected, the script automatically determines whether each selected candle should use its High or Low as a contact point. It then fits the upper and lower boundaries, checks the geometry, classifies the formation, and prepares the trade plan.
To analyze another formation, manually move the four candle markers to four different candles.
🧩 HOW THE INDICATOR WORKS
The indicator combines four manually selected candles, automatic High/Low assignment, wedge geometry, breakout confirmation, target projection, stop calculation, position planning, break-even management, and an extreme-anchored VWAP.
The selected candles define the formation. Their automatically assigned High and Low prices determine the upper and lower boundaries.
A confirmed close outside the formation creates the modeled entry. The distance between the first two chronological assigned points determines the potential target range.
The same confirmed trade timeline controls:
— Entry.
— Initial stop.
— TP1, TP2, and TP3.
— Break-even activation.
— Final exit.
— Stop-line endpoint.
— Target-line endpoint.
— VWAP endpoint.
— Event alerts.
This keeps the chart drawings and dashboard synchronized.
🔍 MAIN FEATURES
1️⃣ Four manually selected candles
The user selects four distinct candles directly on the chart.
The inputs are:
— Candle 1.
— Candle 2.
— Candle 3.
— Candle 4.
The selected candles are sorted chronologically. Point numbers follow chronological order, regardless of the order in which the input fields were selected.
The indicator evaluates possible High/Low assignments and requires two upper contacts and two lower contacts.
2️⃣ Automatic High/Low assignment
The script determines whether each selected candle contributes its High to the upper boundary or its Low to the lower boundary.
The assignment is selected according to:
— Valid upper and lower geometry.
— Positive formation width.
— Boundary convergence.
— Anchor fitting error.
— Candle excursions outside the fitted boundaries.
— The selected Contact Order setting.
The default Contact Order is Any. This allows all valid High/Low combinations.
Alternating restricts the assignment so that upper and lower contacts alternate chronologically.
3️⃣ Tolerance-based geometry validation
The selected candle range is calculated as:
Selected Range = Highest Selected High − Lowest Selected Low
The maximum fitting tolerance is:
Tolerance = max(Selected Range × Tolerance % / 100, 0.5 minimum tick)
The default tolerance is 5%.
Higher tolerance accepts looser formations. Lower tolerance requires more accurate contact points.
Tolerance is used for geometric validation. It is not a breakout buffer, stop distance, or probability estimate.
Only the four selected candles are checked against the fitted boundaries. Intermediate candles are not required to remain inside the formation.
4️⃣ Falling and Rising Wedge classification
When both boundaries slope downward, the formation is classified as a Falling Wedge.
A Falling Wedge receives:
— Bullish expected bias.
— Transparent green fill.
— Stop based on the lowest assigned Low.
— VWAP anchored to the lowest assigned Low.
When both boundaries slope upward, the formation is classified as a Rising Wedge.
A Rising Wedge receives:
— Bearish expected bias.
— Transparent red fill.
— Stop based on the highest assigned High.
— VWAP anchored to the highest assigned High.
The Bullish or Bearish label describes the expected wedge direction. It does not automatically create a BUY or SELL trade.
The actual trade direction comes from the confirmed breakout:
— Close above the upper boundary creates a BUY plan.
— Close below the lower boundary creates a SELL plan.
If same-direction boundaries are disabled, converging triangles may be accepted. Triangles do not have a defined wedge stop or VWAP anchor rule and therefore may not produce a valid trade plan.
5️⃣ Projected apex
The upper and lower boundaries can be extended with dashed lines until their calculated intersection.
The apex is calculated from the fitted linear boundaries in bar coordinates.
On session-based or irregular charts, the future apex timestamp is an estimate because the script must convert a fractional bar position into chart time.
6️⃣ Optional mirrored upper parallel
The optional Mirrored Upper Parallel displays a thin dashed orange line.
The line is not permanently tied to point 1.
The script finds the earliest assigned lower contact, measures the distance between that candle’s Low and the upper boundary at the same candle, and reflects this distance through the upper boundary.
This creates a symmetrical channel reference based on the actual selected formation.
🎯 TARGET ZONE AND POTENTIAL
The reference height is calculated from the first two chronological assigned points:
H = |Point 2 Price − Point 1 Price|
Point prices may be assigned Highs or Lows depending on the automatic contact assignment.
The target projection starts from the broken boundary at the breakout candle.
The far target boundary is:
Far Boundary + Direction × H
The nearest target boundary is:
TP3 = Breakout Boundary + Direction × 0.90 × H
The transparent yellow target zone covers the range between 90% and 100% of H.
TP3 is the nearest boundary of the yellow zone. It is the final modeled take-profit level and closes the remaining position.
The target height is based specifically on points 1 and 2. It is not the maximum distance between all four points.
📈 ENTRY LOGIC
All four selected candles must be closed before a trade plan becomes valid.
The script searches for the first confirmed closing-price cross after candle 4 and before the apex.
A BUY setup requires:
— Current close above the upper boundary.
— Previous close at or below the previous upper-boundary value.
A SELL setup requires:
— Current close below the lower boundary.
— Previous close at or above the previous lower-boundary value.
The entry price is the breakout candle’s closing price.
A wick outside the wedge does not create an entry by itself.
The indicator uses the first qualifying breakout. It does not search for a later breakout if the first plan has invalid stop placement or invalid target spacing.
🛡 STOP LOGIC
The initial stop is based on the formation extreme.
For a Falling Wedge:
Initial Stop = Lowest Assigned Low − Stop Offset
For a Rising Wedge:
Initial Stop = Highest Assigned High − Stop Offset
The default Stop Offset is 2 ticks.
The stop line begins at the opening of the modeled trade, meaning the breakout candle where the entry is confirmed.
The stop line ends on the candle where the modeled trade reaches:
— TP3.
— The initial stop.
— The break-even stop.
The initial stop remains fixed. It does not trail with later candles.
A valid trade plan requires the stop to be on the risk side of the entry.
If the calculated stop is on the wrong side of the entry, the dashboard reports an invalid trade plan and does not activate the trade drawings.
🎯 THREE TAKE-PROFIT LEVELS
TP1 and TP2 divide the price distance between the entry and TP3.
Default target positions:
— TP1: one third of the entry-to-TP3 distance.
— TP2: two thirds of the entry-to-TP3 distance.
— TP3: the 90% H target boundary.
The target-distance inputs and the position-closing inputs are independent.
Default position allocation:
— TP1 closes 33% of the initial position.
— TP2 closes 33% of the initial position.
— TP3 closes the remaining 34%.
TP1 and TP2 closing percentages must total less than 100%. TP3 always closes the remainder.
A target touch is confirmed only on a closed candle.
⚖️ BREAK-EVEN MANAGEMENT
Break-Even After TP1 is enabled by default.
After the first confirmed TP1 touch:
— TP1 closes its configured position share.
— The remaining position stop moves to the entry price.
— The break-even stop becomes active from the following candle.
The activation candle itself cannot be stopped at break-even.
The initial stop segment ends when break-even activates. A new stop segment begins at the entry price on the following candle.
The trade finishes only when the remaining position reaches:
— TP3.
— The initial stop.
— The active break-even stop.
TP1 and TP2 are partial exits. They do not fully close the trade.
📊 POSITION AND PROFIT CALCULATIONS
The indicator uses a linear contract model.
Notional = Margin × Leverage
Quantity = Notional / (Entry × Symbol Point Value)
Theoretical quantities are calculated from the initial position:
Q1 = Initial Quantity × TP1 Closing Share
Q2 = Initial Quantity × TP2 Closing Share
Q3 = Initial Quantity − Q1 − Q2
Profit for each target is calculated as:
Profit = Direction × (Target − Entry) × Closed Quantity × Point Value
The dashboard displays:
— Margin.
— Leverage.
— Position notional.
— Theoretical quantity.
— TP1 closing quantity and profit.
— TP2 closing quantity and profit.
— TP3 closing quantity and profit.
— Total target profit.
— Loss if the full position reaches the initial stop.
— Result after TP1 followed by stop or break-even.
— Result after TP1 and TP2 followed by stop or break-even.
— Modeled final result.
— Plan RR.
The initial price-distance R:R is calculated from the initial stop and TP3:
Risk Distance = Direction × (Entry − Initial Stop)
Reward Distance = Direction × (TP3 − Entry)
R:R = Reward Distance / Risk Distance
Plan RR uses the sum of all partial target profits divided by the initial full-position stop risk.
The calculations exclude:
— Commission.
— Spread.
— Slippage.
— Funding.
— Swaps.
— Liquidation.
— Inverse-contract settlement.
— Account-currency conversion.
— Broker lot-size rounding.
Quantities are theoretical units or contracts.
📉 EXTREME-ANCHORED VWAP
For a Falling Wedge, the average starts from the lowest assigned Low and uses candle Low as its source.
For a Rising Wedge, the average starts from the highest assigned High and uses candle High as its source.
When valid positive volume exists, the calculation is:
VWAP = Sum(Source Price × Volume) / Sum(Volume)
VWAP monitoring begins after a valid entry and ends at the same modeled exit as the trade.
The final exit candle is included.
VWAP Weighting / Forex options:
— Auto.
— Volume Only.
— Unweighted.
Auto uses volume weighting when the data is usable. If volume is missing or invalid, the entire displayed span switches to an equal-weight average.
Volume Only hides the curve when usable volume is unavailable.
Unweighted always uses:
Average = Sum(Source Price) / Number of Candles
The unweighted fallback is explicitly labeled “Unweighted Average.”
📖 HOW TO USE
1. Add the indicator to the chart.
2. Open the Main Settings group.
3. Manually select four distinct candles using Candle 1, Candle 2, Candle 3, and Candle 4.
4. Check the numbered H/L labels on the chart.
5. Confirm the formation status in the dashboard.
6. Start with Contact Order = Any and Tolerance = 5%.
7. Configure margin, leverage, stop offset, target percentages, and closing shares.
8. Wait for a confirmed breakout close.
9. Use the entry marker, target levels, stop line, yellow potential zone, VWAP, and dashboard together.
If no wedge is found, check:
— The four candles are distinct.
— The candles are within the loaded history.
— The boundaries can converge.
— Tolerance is not too strict.
— The selected candles are closed.
— Contact Order is not unnecessarily restrictive.
Changing the four selected candles changes the entire formation and trade plan.
📋 READING THE CHART
— Orange solid line: upper wedge boundary.
— Teal solid line: lower wedge boundary.
— Dashed boundary extensions: projected apex.
— Thin dashed orange line: optional mirrored upper parallel.
— Transparent green fill: Falling Wedge.
— Transparent red fill: Rising Wedge.
— Yellow fill: 90–100% H target zone.
— Green BUY marker: confirmed upward breakout.
— Red SELL marker: confirmed downward breakout.
— Dotted entry line: modeled breakout closing price.
— Solid stop line: initial or active stop.
— Dashed target lines: TP1, TP2, and TP3.
— Checkmark and solid teal target line: confirmed target touch.
— Purple curve: anchored VWAP or unweighted fallback.
The dashboard uses the following expected formation bias:
— Falling Wedge → Bullish.
— Rising Wedge → Bearish.
This expected bias is independent of the actual breakout direction.
📊 DASHBOARD SECTIONS
Market
Shows:
— Expected formation bias.
— Confirmed breakout signal.
— Chart timeframe.
— High/Low assignment status.
Formation
Shows:
— Formation type.
— Fit error.
— Number of valid assignments.
— Selected-candle range.
— Target height.
— Target zone.
— VWAP status.
Trade Levels
Shows:
— Entry.
— Initial or break-even stop.
— TP1.
— TP2.
— TP3.
— R:R to TP3.
— Current stop distance.
Position Plan
Shows:
— Margin and leverage.
— Position notional.
— Theoretical quantity.
— Closing quantity and profit for each target.
— Total target profit.
— Stop-loss scenarios.
— Plan RR.
— Modeled active or final result.
All dashboard sections can be hidden independently.
⚙️ KEY SETTINGS
Main Settings
— Candle 1: manual chart selection.
— Candle 2: manual chart selection.
— Candle 3: manual chart selection.
— Candle 4: manual chart selection.
Visual Settings
— Theme: Auto.
— Show Wedge Boundaries: enabled.
— Show Wedge Fill: enabled.
— Extend Boundaries to Apex: enabled.
— Show Mirrored Upper Parallel: disabled.
— Show Anchor Labels: enabled.
— Show Entry Signal Marker: enabled.
— Show Price-Level Labels: enabled.
— Show Target Zone: enabled.
— Show Extreme-Anchored VWAP: enabled.
— Show Watermark: enabled.
— Signal Label Size: Small.
— Price Label Size: Small.
Filters
— Contact Order: Any.
— Tolerance: 5%.
— Require Same-Direction Boundaries: enabled.
Risk Management
— Show Stop Line: enabled.
— Stop Offset: 2 ticks.
— Show Entry and Three Targets: enabled.
— TP1 Distance: 33.33% of the entry-to-TP3 path.
— TP2 Distance: 66.67% of the entry-to-TP3 path.
— Margin: 100 quote-currency units.
— Leverage: 5×.
— TP1 Close: 33%.
— TP2 Close: 33%.
— TP3 Close: remaining position.
— Entry Line Style: Dotted.
— SL Line Style: Solid.
— TP Line Style: Dashed.
— Show % Distance on Labels: enabled.
— Break-Even After TP1: enabled.
Dashboard
— Show Dashboard: enabled.
— Dashboard Position: Top Right.
— Dashboard Font Size: Small.
— Market: enabled.
— Formation: enabled.
— Trade Levels: enabled.
— Position Plan: enabled.
Alerts
— Enable Event Alerts: enabled.
— Webhook JSON Format: disabled.
— Alert on Entry: enabled.
— Alert on SL / TP / BE Events: enabled.
Colors
— Upper Boundary: orange.
— Lower Boundary: teal.
— Target Boundary: yellow.
— VWAP: purple.
— BUY Marker: green.
— SELL Marker: red.
Advanced
— VWAP Weighting / Forex: Auto.
— Volume Only: requires usable volume.
— Unweighted: always uses equal candle weights.
🔔 ALERTS
Create a TradingView alert using:
Any alert() function call
Supported events:
— BUY.
— SELL.
— TP1_TOUCH.
— TP2_TOUCH.
— BREAK_EVEN.
— TP3_TOUCH.
— SL_TOUCH.
— BE_STOP_OUT.
Multiple events on one confirmed candle are bundled into one alert message.
Readable alerts include:
— Event names.
— Symbol.
— Timeframe.
— Closing price.
— Bar time.
— Entry.
— Effective stop.
— TP1.
— TP2.
— TP3.
— Initial R:R.
Optional JSON alerts include:
— events.
— ticker.
— timeframe.
— time.
— price.
— side.
— entry.
— sl.
— initial_sl.
— tp1.
— tp2.
— tp3.
— rr.
Historical reconstruction does not generate retrospective alerts.
The indicator does not create alerts automatically and does not execute trades.
⚠️ IMPORTANT NOTES
This is a manual formation and trade-planning indicator. It is not an automatic scanner, broker execution system, or strategy backtest.
The four candles must be selected manually. The indicator only automates High/Low assignment and subsequent calculations.
Selecting historical candles introduces hindsight. Historical formations should not be interpreted as proof that the same setup would have been selected in real time.
Geometry based on an unfinished anchor candle is provisional.
Confirmed trade events require closed candles. Changing the selected candles, settings, symbol, timeframe, or chart data can change the reconstructed result.
The indicator uses linear price geometry and bar coordinates. Future apex timestamps are estimated on session-based or irregular charts.
The supported anchor lookback is 9,999 bars and requires the selected history to be loaded.
Only the selected candles are validated against the fitted boundaries. Intermediate candles are not used for full formation containment.
The first qualifying breakout determines the trade plan.
The OHLC management model cannot know the exact intrabar sequence when several levels are touched inside one candle. New target touches receive optimistic priority over a stop on the same candle.
The break-even stop cannot close the trade on the candle where break-even is activated.
Profit and loss values are theoretical gross estimates. They do not guarantee execution results.
Use Manual Wedge as a structured analysis and planning tool. Always evaluate market conditions, liquidity, execution costs, and personal risk before making a trading decision.
Manual Wedge is an interactive four-candle wedge planner for TradingView.
📌 MANUAL SETUP — FOUR POINTS REQUIRED
You must manually select FOUR distinct candles on the chart using the Candle 1, Candle 2, Candle 3, and Candle 4 inputs.
The indicator does not automatically search for wedges and does not select the four candles for you.
After the four candles are selected, the script automatically determines whether each selected candle should use its High or Low as a contact point. It then fits the upper and lower boundaries, checks the geometry, classifies the formation, and prepares the trade plan.
To analyze another formation, manually move the four candle markers to four different candles.
🧩 HOW THE INDICATOR WORKS
The indicator combines four manually selected candles, automatic High/Low assignment, wedge geometry, breakout confirmation, target projection, stop calculation, position planning, break-even management, and an extreme-anchored VWAP.
The selected candles define the formation. Their automatically assigned High and Low prices determine the upper and lower boundaries.
A confirmed close outside the formation creates the modeled entry. The distance between the first two chronological assigned points determines the potential target range.
The same confirmed trade timeline controls:
— Entry.
— Initial stop.
— TP1, TP2, and TP3.
— Break-even activation.
— Final exit.
— Stop-line endpoint.
— Target-line endpoint.
— VWAP endpoint.
— Event alerts.
This keeps the chart drawings and dashboard synchronized.
🔍 MAIN FEATURES
1️⃣ Four manually selected candles
The user selects four distinct candles directly on the chart.
The inputs are:
— Candle 1.
— Candle 2.
— Candle 3.
— Candle 4.
The selected candles are sorted chronologically. Point numbers follow chronological order, regardless of the order in which the input fields were selected.
The indicator evaluates possible High/Low assignments and requires two upper contacts and two lower contacts.
2️⃣ Automatic High/Low assignment
The script determines whether each selected candle contributes its High to the upper boundary or its Low to the lower boundary.
The assignment is selected according to:
— Valid upper and lower geometry.
— Positive formation width.
— Boundary convergence.
— Anchor fitting error.
— Candle excursions outside the fitted boundaries.
— The selected Contact Order setting.
The default Contact Order is Any. This allows all valid High/Low combinations.
Alternating restricts the assignment so that upper and lower contacts alternate chronologically.
3️⃣ Tolerance-based geometry validation
The selected candle range is calculated as:
Selected Range = Highest Selected High − Lowest Selected Low
The maximum fitting tolerance is:
Tolerance = max(Selected Range × Tolerance % / 100, 0.5 minimum tick)
The default tolerance is 5%.
Higher tolerance accepts looser formations. Lower tolerance requires more accurate contact points.
Tolerance is used for geometric validation. It is not a breakout buffer, stop distance, or probability estimate.
Only the four selected candles are checked against the fitted boundaries. Intermediate candles are not required to remain inside the formation.
4️⃣ Falling and Rising Wedge classification
When both boundaries slope downward, the formation is classified as a Falling Wedge.
A Falling Wedge receives:
— Bullish expected bias.
— Transparent green fill.
— Stop based on the lowest assigned Low.
— VWAP anchored to the lowest assigned Low.
When both boundaries slope upward, the formation is classified as a Rising Wedge.
A Rising Wedge receives:
— Bearish expected bias.
— Transparent red fill.
— Stop based on the highest assigned High.
— VWAP anchored to the highest assigned High.
The Bullish or Bearish label describes the expected wedge direction. It does not automatically create a BUY or SELL trade.
The actual trade direction comes from the confirmed breakout:
— Close above the upper boundary creates a BUY plan.
— Close below the lower boundary creates a SELL plan.
If same-direction boundaries are disabled, converging triangles may be accepted. Triangles do not have a defined wedge stop or VWAP anchor rule and therefore may not produce a valid trade plan.
5️⃣ Projected apex
The upper and lower boundaries can be extended with dashed lines until their calculated intersection.
The apex is calculated from the fitted linear boundaries in bar coordinates.
On session-based or irregular charts, the future apex timestamp is an estimate because the script must convert a fractional bar position into chart time.
6️⃣ Optional mirrored upper parallel
The optional Mirrored Upper Parallel displays a thin dashed orange line.
The line is not permanently tied to point 1.
The script finds the earliest assigned lower contact, measures the distance between that candle’s Low and the upper boundary at the same candle, and reflects this distance through the upper boundary.
This creates a symmetrical channel reference based on the actual selected formation.
🎯 TARGET ZONE AND POTENTIAL
The reference height is calculated from the first two chronological assigned points:
H = |Point 2 Price − Point 1 Price|
Point prices may be assigned Highs or Lows depending on the automatic contact assignment.
The target projection starts from the broken boundary at the breakout candle.
The far target boundary is:
Far Boundary + Direction × H
The nearest target boundary is:
TP3 = Breakout Boundary + Direction × 0.90 × H
The transparent yellow target zone covers the range between 90% and 100% of H.
TP3 is the nearest boundary of the yellow zone. It is the final modeled take-profit level and closes the remaining position.
The target height is based specifically on points 1 and 2. It is not the maximum distance between all four points.
📈 ENTRY LOGIC
All four selected candles must be closed before a trade plan becomes valid.
The script searches for the first confirmed closing-price cross after candle 4 and before the apex.
A BUY setup requires:
— Current close above the upper boundary.
— Previous close at or below the previous upper-boundary value.
A SELL setup requires:
— Current close below the lower boundary.
— Previous close at or above the previous lower-boundary value.
The entry price is the breakout candle’s closing price.
A wick outside the wedge does not create an entry by itself.
The indicator uses the first qualifying breakout. It does not search for a later breakout if the first plan has invalid stop placement or invalid target spacing.
🛡 STOP LOGIC
The initial stop is based on the formation extreme.
For a Falling Wedge:
Initial Stop = Lowest Assigned Low − Stop Offset
For a Rising Wedge:
Initial Stop = Highest Assigned High − Stop Offset
The default Stop Offset is 2 ticks.
The stop line begins at the opening of the modeled trade, meaning the breakout candle where the entry is confirmed.
The stop line ends on the candle where the modeled trade reaches:
— TP3.
— The initial stop.
— The break-even stop.
The initial stop remains fixed. It does not trail with later candles.
A valid trade plan requires the stop to be on the risk side of the entry.
If the calculated stop is on the wrong side of the entry, the dashboard reports an invalid trade plan and does not activate the trade drawings.
🎯 THREE TAKE-PROFIT LEVELS
TP1 and TP2 divide the price distance between the entry and TP3.
Default target positions:
— TP1: one third of the entry-to-TP3 distance.
— TP2: two thirds of the entry-to-TP3 distance.
— TP3: the 90% H target boundary.
The target-distance inputs and the position-closing inputs are independent.
Default position allocation:
— TP1 closes 33% of the initial position.
— TP2 closes 33% of the initial position.
— TP3 closes the remaining 34%.
TP1 and TP2 closing percentages must total less than 100%. TP3 always closes the remainder.
A target touch is confirmed only on a closed candle.
⚖️ BREAK-EVEN MANAGEMENT
Break-Even After TP1 is enabled by default.
After the first confirmed TP1 touch:
— TP1 closes its configured position share.
— The remaining position stop moves to the entry price.
— The break-even stop becomes active from the following candle.
The activation candle itself cannot be stopped at break-even.
The initial stop segment ends when break-even activates. A new stop segment begins at the entry price on the following candle.
The trade finishes only when the remaining position reaches:
— TP3.
— The initial stop.
— The active break-even stop.
TP1 and TP2 are partial exits. They do not fully close the trade.
📊 POSITION AND PROFIT CALCULATIONS
The indicator uses a linear contract model.
Notional = Margin × Leverage
Quantity = Notional / (Entry × Symbol Point Value)
Theoretical quantities are calculated from the initial position:
Q1 = Initial Quantity × TP1 Closing Share
Q2 = Initial Quantity × TP2 Closing Share
Q3 = Initial Quantity − Q1 − Q2
Profit for each target is calculated as:
Profit = Direction × (Target − Entry) × Closed Quantity × Point Value
The dashboard displays:
— Margin.
— Leverage.
— Position notional.
— Theoretical quantity.
— TP1 closing quantity and profit.
— TP2 closing quantity and profit.
— TP3 closing quantity and profit.
— Total target profit.
— Loss if the full position reaches the initial stop.
— Result after TP1 followed by stop or break-even.
— Result after TP1 and TP2 followed by stop or break-even.
— Modeled final result.
— Plan RR.
The initial price-distance R:R is calculated from the initial stop and TP3:
Risk Distance = Direction × (Entry − Initial Stop)
Reward Distance = Direction × (TP3 − Entry)
R:R = Reward Distance / Risk Distance
Plan RR uses the sum of all partial target profits divided by the initial full-position stop risk.
The calculations exclude:
— Commission.
— Spread.
— Slippage.
— Funding.
— Swaps.
— Liquidation.
— Inverse-contract settlement.
— Account-currency conversion.
— Broker lot-size rounding.
Quantities are theoretical units or contracts.
📉 EXTREME-ANCHORED VWAP
For a Falling Wedge, the average starts from the lowest assigned Low and uses candle Low as its source.
For a Rising Wedge, the average starts from the highest assigned High and uses candle High as its source.
When valid positive volume exists, the calculation is:
VWAP = Sum(Source Price × Volume) / Sum(Volume)
VWAP monitoring begins after a valid entry and ends at the same modeled exit as the trade.
The final exit candle is included.
VWAP Weighting / Forex options:
— Auto.
— Volume Only.
— Unweighted.
Auto uses volume weighting when the data is usable. If volume is missing or invalid, the entire displayed span switches to an equal-weight average.
Volume Only hides the curve when usable volume is unavailable.
Unweighted always uses:
Average = Sum(Source Price) / Number of Candles
The unweighted fallback is explicitly labeled “Unweighted Average.”
📖 HOW TO USE
1. Add the indicator to the chart.
2. Open the Main Settings group.
3. Manually select four distinct candles using Candle 1, Candle 2, Candle 3, and Candle 4.
4. Check the numbered H/L labels on the chart.
5. Confirm the formation status in the dashboard.
6. Start with Contact Order = Any and Tolerance = 5%.
7. Configure margin, leverage, stop offset, target percentages, and closing shares.
8. Wait for a confirmed breakout close.
9. Use the entry marker, target levels, stop line, yellow potential zone, VWAP, and dashboard together.
If no wedge is found, check:
— The four candles are distinct.
— The candles are within the loaded history.
— The boundaries can converge.
— Tolerance is not too strict.
— The selected candles are closed.
— Contact Order is not unnecessarily restrictive.
Changing the four selected candles changes the entire formation and trade plan.
📋 READING THE CHART
— Orange solid line: upper wedge boundary.
— Teal solid line: lower wedge boundary.
— Dashed boundary extensions: projected apex.
— Thin dashed orange line: optional mirrored upper parallel.
— Transparent green fill: Falling Wedge.
— Transparent red fill: Rising Wedge.
— Yellow fill: 90–100% H target zone.
— Green BUY marker: confirmed upward breakout.
— Red SELL marker: confirmed downward breakout.
— Dotted entry line: modeled breakout closing price.
— Solid stop line: initial or active stop.
— Dashed target lines: TP1, TP2, and TP3.
— Checkmark and solid teal target line: confirmed target touch.
— Purple curve: anchored VWAP or unweighted fallback.
The dashboard uses the following expected formation bias:
— Falling Wedge → Bullish.
— Rising Wedge → Bearish.
This expected bias is independent of the actual breakout direction.
📊 DASHBOARD SECTIONS
Market
Shows:
— Expected formation bias.
— Confirmed breakout signal.
— Chart timeframe.
— High/Low assignment status.
Formation
Shows:
— Formation type.
— Fit error.
— Number of valid assignments.
— Selected-candle range.
— Target height.
— Target zone.
— VWAP status.
Trade Levels
Shows:
— Entry.
— Initial or break-even stop.
— TP1.
— TP2.
— TP3.
— R:R to TP3.
— Current stop distance.
Position Plan
Shows:
— Margin and leverage.
— Position notional.
— Theoretical quantity.
— Closing quantity and profit for each target.
— Total target profit.
— Stop-loss scenarios.
— Plan RR.
— Modeled active or final result.
All dashboard sections can be hidden independently.
⚙️ KEY SETTINGS
Main Settings
— Candle 1: manual chart selection.
— Candle 2: manual chart selection.
— Candle 3: manual chart selection.
— Candle 4: manual chart selection.
Visual Settings
— Theme: Auto.
— Show Wedge Boundaries: enabled.
— Show Wedge Fill: enabled.
— Extend Boundaries to Apex: enabled.
— Show Mirrored Upper Parallel: disabled.
— Show Anchor Labels: enabled.
— Show Entry Signal Marker: enabled.
— Show Price-Level Labels: enabled.
— Show Target Zone: enabled.
— Show Extreme-Anchored VWAP: enabled.
— Show Watermark: enabled.
— Signal Label Size: Small.
— Price Label Size: Small.
Filters
— Contact Order: Any.
— Tolerance: 5%.
— Require Same-Direction Boundaries: enabled.
Risk Management
— Show Stop Line: enabled.
— Stop Offset: 2 ticks.
— Show Entry and Three Targets: enabled.
— TP1 Distance: 33.33% of the entry-to-TP3 path.
— TP2 Distance: 66.67% of the entry-to-TP3 path.
— Margin: 100 quote-currency units.
— Leverage: 5×.
— TP1 Close: 33%.
— TP2 Close: 33%.
— TP3 Close: remaining position.
— Entry Line Style: Dotted.
— SL Line Style: Solid.
— TP Line Style: Dashed.
— Show % Distance on Labels: enabled.
— Break-Even After TP1: enabled.
Dashboard
— Show Dashboard: enabled.
— Dashboard Position: Top Right.
— Dashboard Font Size: Small.
— Market: enabled.
— Formation: enabled.
— Trade Levels: enabled.
— Position Plan: enabled.
Alerts
— Enable Event Alerts: enabled.
— Webhook JSON Format: disabled.
— Alert on Entry: enabled.
— Alert on SL / TP / BE Events: enabled.
Colors
— Upper Boundary: orange.
— Lower Boundary: teal.
— Target Boundary: yellow.
— VWAP: purple.
— BUY Marker: green.
— SELL Marker: red.
Advanced
— VWAP Weighting / Forex: Auto.
— Volume Only: requires usable volume.
— Unweighted: always uses equal candle weights.
🔔 ALERTS
Create a TradingView alert using:
Any alert() function call
Supported events:
— BUY.
— SELL.
— TP1_TOUCH.
— TP2_TOUCH.
— BREAK_EVEN.
— TP3_TOUCH.
— SL_TOUCH.
— BE_STOP_OUT.
Multiple events on one confirmed candle are bundled into one alert message.
Readable alerts include:
— Event names.
— Symbol.
— Timeframe.
— Closing price.
— Bar time.
— Entry.
— Effective stop.
— TP1.
— TP2.
— TP3.
— Initial R:R.
Optional JSON alerts include:
— events.
— ticker.
— timeframe.
— time.
— price.
— side.
— entry.
— sl.
— initial_sl.
— tp1.
— tp2.
— tp3.
— rr.
Historical reconstruction does not generate retrospective alerts.
The indicator does not create alerts automatically and does not execute trades.
⚠️ IMPORTANT NOTES
This is a manual formation and trade-planning indicator. It is not an automatic scanner, broker execution system, or strategy backtest.
The four candles must be selected manually. The indicator only automates High/Low assignment and subsequent calculations.
Selecting historical candles introduces hindsight. Historical formations should not be interpreted as proof that the same setup would have been selected in real time.
Geometry based on an unfinished anchor candle is provisional.
Confirmed trade events require closed candles. Changing the selected candles, settings, symbol, timeframe, or chart data can change the reconstructed result.
The indicator uses linear price geometry and bar coordinates. Future apex timestamps are estimated on session-based or irregular charts.
The supported anchor lookback is 9,999 bars and requires the selected history to be loaded.
Only the selected candles are validated against the fitted boundaries. Intermediate candles are not used for full formation containment.
The first qualifying breakout determines the trade plan.
The OHLC management model cannot know the exact intrabar sequence when several levels are touched inside one candle. New target touches receive optimistic priority over a stop on the same candle.
The break-even stop cannot close the trade on the candle where break-even is activated.
Profit and loss values are theoretical gross estimates. They do not guarantee execution results.
Use Manual Wedge as a structured analysis and planning tool. Always evaluate market conditions, liquidity, execution costs, and personal risk before making a trading decision.
Notas de prensa
Fixed the bugs in the wedge geometry.Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.