Skip to content
← Indicator library
tradingviewdivergenceindicatorpinescript-v6

Arrow.AlgoNexta

AlgoNexta Bow & Arrow: dual-timeframe MACD corrections and hidden-divergence signals with trend, range, session, and alert controls.

Vision Grade

36.5

E · LOW confidence · E2

Published by AlgoNexa. AlgoNexa builds and documents evidence-first trading tools so you can inspect the logic before using it.About AlgoNexaIndicator library
Published Aug 9, 2026#macd#hidden-divergence#ema#adx#atr#overlay#indicator#pinescript-v6

How it works

Read the logic before you use it.

1

When it signals

A correction-release signal needs a fast MACD cross in the slow-MACD regime after an ATR-normalized correction. Hidden divergence instead compares confirmed price pivots with the selected fast-MACD oscillator, then waits for the selected confirmation mode.

2

What confirms it

The default EMA filter requires EMA 60 versus EMA 240 alignment and a directionally sloped EMA 240. The default Balanced range filter also requires two of the ADX, EMA-separation, and slow-MACD-strength conditions.

3

How risk is framed

On an accepted signal, the optional projection uses the signal close and a pivot-based or ATR-based stop calculation. It draws visual reward levels at the configured 1R, 2R, and 3R defaults; these are not orders.

Walkthrough

Watch how it reads the chart.

Live market chart

The logic on real candles.

Backtest evidence

What the numbers actually show.

E0 · Reconstructed reference

algonexta-reference · Yahoo Finance · EURUSD · 1h

Net profit

0.0190

Max drawdown

0.0098

Trades

72

Symbol · TF

EURUSD · 1h

Equity curve

Reference trades (144)
TimeSidePrice
Jun 22, 04:00 AMshort1.14587
Jun 22, 07:00 PMexit1.14248
Jun 23, 02:00 AMlong1.14299
Jun 23, 07:00 AMexit1.14133
Jun 23, 07:00 AMshort1.14155
Jun 23, 03:00 PMexit1.13803
Jun 23, 09:00 PMlong1.13882
Jun 24, 12:00 AMexit1.13770
Jun 24, 06:00 AMshort1.13623
Jun 24, 12:00 PMexit1.13306
Jun 24, 03:00 PMlong1.13533
Jun 25, 11:00 AMexit1.13366
Jun 25, 11:00 AMshort1.13404
Jun 25, 12:00 PMexit1.13601
Jun 25, 01:00 PMlong1.13649
Jun 26, 12:00 AMexit1.13688
Jun 26, 12:00 AMshort1.13688
Jun 26, 04:00 AMexit1.13792
Jun 26, 04:00 AMlong1.13792
Jun 26, 09:00 AMexit1.14155
Jun 26, 05:00 PMshort1.13895
Jun 29, 06:00 AMexit1.14051
Jun 29, 06:00 AMlong1.14181
Jun 29, 08:00 AMexit1.14011
Jun 30, 12:00 AMshort1.14194
Jun 30, 04:00 AMexit1.13957
Jun 30, 02:00 PMlong1.14364
Jun 30, 04:00 PMexit1.14157
Jul 1, 01:00 AMshort1.14077
Jul 1, 12:00 PMexit1.13744
Jul 2, 01:00 AMlong1.13843
Jul 2, 08:00 AMexit1.14151
Jul 2, 10:00 PMshort1.14312
Jul 3, 04:00 AMexit1.14458
Jul 3, 05:00 AMlong1.14508
Jul 3, 09:00 AMexit1.14443
Jul 3, 09:00 AMshort1.14443
Jul 3, 11:00 AMexit1.14589
Jul 6, 04:00 PMlong1.14338
Jul 7, 05:00 AMexit1.14351
Jul 7, 05:00 AMshort1.14351
Jul 7, 11:00 PMexit1.14060
Jul 8, 05:00 AMlong1.14233
Jul 8, 09:00 AMexit1.14072
Jul 8, 11:00 AMshort1.13999
Jul 8, 04:00 PMexit1.14168
Jul 8, 04:00 PMlong1.14168
Jul 9, 06:00 AMexit1.14433
Jul 9, 12:00 PMshort1.14273
Jul 9, 01:00 PMexit1.14416
Jul 9, 01:00 PMlong1.14416
Jul 9, 07:00 PMexit1.14312
Jul 9, 07:00 PMshort1.14312
Jul 10, 12:00 AMexit1.14429
Jul 10, 01:00 AMlong1.14521
Jul 10, 07:00 AMexit1.14403
Jul 10, 07:00 AMshort1.14403
Jul 12, 11:00 PMexit1.14110
Jul 13, 07:00 AMlong1.14273
Jul 13, 02:00 PMexit1.14082
Jul 13, 03:00 PMshort1.14064
Jul 14, 03:00 AMexit1.13973
Jul 14, 03:00 AMlong1.13973
Jul 14, 12:00 PMexit1.14454
Jul 14, 11:00 PMshort1.14273
Jul 15, 12:00 AMexit1.14377
Jul 15, 12:00 AMlong1.14377
Jul 15, 07:00 AMexit1.14236
Jul 15, 07:00 AMshort1.14260
Jul 15, 02:00 PMexit1.14416
Jul 15, 04:00 PMlong1.14456
Jul 16, 12:00 AMexit1.14735
Jul 16, 04:00 AMshort1.14692
Jul 16, 05:00 PMexit1.14373
Jul 17, 06:00 AMlong1.14534
Jul 17, 08:00 AMexit1.14418
Jul 17, 10:00 AMshort1.14299
Jul 17, 02:00 PMexit1.14437
Jul 17, 03:00 PMlong1.14430
Jul 19, 11:00 PMexit1.14303
Jul 20, 10:00 AMshort1.14351
Jul 20, 02:00 PMexit1.14068
Jul 21, 01:00 AMlong1.14181
Jul 21, 02:00 PMexit1.14065
Jul 21, 02:00 PMshort1.14090
Jul 22, 02:00 AMexit1.14090
Jul 22, 02:00 AMlong1.14090
Jul 23, 02:00 AMexit1.14270
Jul 23, 09:00 AMshort1.14155
Jul 23, 12:00 PMexit1.13838
Jul 24, 12:00 AMlong1.13869
Jul 24, 12:00 PMexit1.13732
Jul 24, 06:00 PMshort1.13727
Jul 26, 11:00 PMexit1.13866
Jul 26, 11:00 PMlong1.13986
Jul 27, 11:00 AMexit1.13895
Jul 27, 11:00 AMshort1.13895
Jul 28, 03:00 AMexit1.13779
Jul 28, 03:00 AMlong1.13779
Jul 28, 05:00 AMexit1.13668
Jul 28, 05:00 AMshort1.13701
Jul 28, 08:00 AMexit1.13753
Jul 28, 08:00 AMlong1.13753
Jul 28, 09:00 AMexit1.13624
Jul 29, 10:00 AMshort1.13882
Jul 29, 05:00 PMexit1.14024
Jul 29, 06:00 PMlong1.14534
Jul 30, 06:00 AMexit1.14508
Jul 30, 06:00 AMshort1.14508
Jul 30, 09:00 AMexit1.14702
Jul 30, 11:00 AMlong1.14784
Jul 30, 06:00 PMexit1.15289
Jul 30, 11:00 PMshort1.15260
Jul 31, 12:00 PMexit1.14906
Jul 31, 06:00 PMlong1.15340
Aug 3, 06:00 AMexit1.15300
Aug 3, 06:00 AMshort1.15300
Aug 4, 05:00 AMexit1.15091
Aug 4, 07:00 AMlong1.15141
Aug 4, 10:00 PMexit1.15344
Aug 5, 10:00 PMshort1.15580
Aug 5, 11:00 PMexit1.15607
Aug 5, 11:00 PMlong1.15607
Aug 6, 03:00 AMexit1.15513
Aug 7, 04:00 AMlong1.15274
Aug 7, 12:00 PMexit1.15611
Aug 10, 02:00 AMshort1.15553
Aug 10, 07:00 AMexit1.15650
Aug 11, 12:00 PMlong1.15460
Aug 12, 03:00 AMexit1.15394
Aug 12, 03:00 AMshort1.15380
Aug 12, 09:00 AMexit1.15460
Aug 12, 11:00 AMlong1.15473
Aug 12, 04:00 PMexit1.15311
Aug 12, 04:00 PMshort1.15314
Aug 13, 08:00 AMexit1.15274
Aug 13, 08:00 AMlong1.15274
Aug 13, 07:00 PMexit1.15314
Aug 13, 07:00 PMshort1.15314
Aug 13, 11:00 PMexit1.15367
Aug 13, 11:00 PMlong1.15367
Aug 14, 07:00 AMexit1.15538
Aug 14, 08:00 PMshort1.15727
Aug 14, 09:00 PMexit1.15727

Executed from the versioned AlgoNexta IR on the same OHLC dataset used by the chart.

This is an independent reference backtest; TradingView Strategy Tester remains the official comparison.

This is an AI-reconstructed approximation of the script’s logic, not an execution of the exact source — verify the real script in TradingView Strategy Tester.

Vision Grade

What was measured, and how confident we are in it.

E2 · LOW confidence

VG-Signal — the measured component of Vision Grade. See the methodology for the Evidence Tier and Confidence axes it is always shown beside.

36.5

/ 100

Predictive power

22

Trading performance

16.2

Robustness

40

Risk

100

Signal-Based Performance

Signals

71

Win rate

42.3%

Profit factor

0.66

Max drawdown

0.0150

Robustness — chronological out-of-sample split

In-sample IC

Out-of-sample IC

OOS retention

OOS_SAMPLE_TOO_SMALL

ic here is a pooled event-conditional Spearman rank correlation (signal_strength vs forward return), not a cross-sectional factor IC — see methodology.

Vision Grade measures the strength of statistical and trading-quality evidence. It does not predict future returns.

A high Information Coefficient does not guarantee profitability.

Trading Performance here is Signal-Based Performance, not an execution backtest against the original source.

Historical results do not guarantee future performance.

Only 72 valid signals (config minimum is 100) — results below are directional, not reliable.

Horizon 3: 1 signals dropped (not enough forward OHLC bars).

Horizon 5: 1 signals dropped (not enough forward OHLC bars).

Horizon 10: 1 signals dropped (not enough forward OHLC bars).

Horizon 20: 1 signals dropped (not enough forward OHLC bars).

Horizon 50: 4 signals dropped (not enough forward OHLC bars).

Full breakdown

How the script behaves.

About AlgoNexta

Published by AlgoNexta, an evidence-first platform for building, reviewing, and documenting algorithmic trading tools. This page explains the script's actual logic and intended use; it does not promise profitability or replace verification in TradingView.

What it does

AlgoNexta Bow & Arrow is a chart overlay that combines two MACD configurations with optional hidden-divergence and correction-release logic. The fast oscillator uses 12/26/9 settings and the slower confirmation uses 48/104/36 settings by default; both are configurable.

Signal construction

The script can wait for a fast MACD correction and signal-line confirmation, or for a confirmed hidden-divergence pattern built from price pivots. Signals may be filtered by the 60/240 EMA trend relationship, slow-EMA slope, ADX and EMA separation. An optional London, New York, or custom session filter and a same-direction cooldown help control when markers are displayed.

What appears on the chart

Depending on the display settings, the indicator plots correction-release, hidden-divergence, and combined markers, divergence lines, EMA references, regime shading, and rejected-signal diagnostics. Alerts are available for the script's emitted signal events. It does not place orders, calculate broker fills, or guarantee that a displayed setup will continue in the indicated direction.

AlgoNexa publication note

This is an AlgoNexa publication for research and education. Confirm the source in TradingView, review the inputs for the symbol and timeframe, and validate behavior with TradingView's own chart and alert tools before relying on it.

Source

pinescript-v6 · full source

arrow-algonexta.pine
// ============================================================================
// © algonexta
// This script is for education and research; it does not guarantee results.
// Verify this source in TradingView before use.
// ============================================================================

//@version=6
indicator(
     "B&A - Bow & Arrow",
     shorttitle = "B&A",
     overlay = true,
     max_labels_count = 500,
     max_lines_count = 500,
     max_boxes_count = 500
)

//──────────────────────────────────────────────────────────────────────────────
// Input groups
//──────────────────────────────────────────────────────────────────────────────
string gFast = "1. Fast MACD - MACD 60"
string gSlow = "2. Slow MACD - MACD 240"
string gDiv = "3. Hidden Divergence"
string gConfirm = "4. Signal Confirmation"
string gCycle = "5. Cycle Control"
string gEma = "6. EMA Trend Filter"
string gRange = "7. Range Filter"
string gSession = "8. Session Filter"
string gVisual = "9. Visual Settings"
string gRisk = "10. SL/TP Projection"
string gDebug = "11. Alerts and Debug"

src = input.source(close, "Source", group = gFast)
fastMacdFastLen = input.int(12, "Fast MACD Fast Length", minval = 1, group = gFast, tooltip = "Fast length for MACD 60.")
fastMacdSlowLen = input.int(26, "Fast MACD Slow Length", minval = 1, group = gFast, tooltip = "Slow length for MACD 60.")
fastMacdSignalLen = input.int(9, "Fast MACD Signal Length", minval = 1, group = gFast, tooltip = "Signal EMA length for MACD 60.")

slowMacdFastLen = input.int(48, "Slow MACD Fast Length", minval = 1, group = gSlow, tooltip = "Fast length for MACD 240.")
slowMacdSlowLen = input.int(104, "Slow MACD Slow Length", minval = 1, group = gSlow, tooltip = "Slow length for MACD 240.")
slowMacdSignalLen = input.int(36, "Slow MACD Signal Length", minval = 1, group = gSlow, tooltip = "Signal EMA length for MACD 240.")
slowZeroBuffer = input.float(0.0, "Slow MACD Zero Buffer", minval = 0.0, step = 0.00001, group = gSlow, tooltip = "Neutral zone around zero. No directional signals are allowed inside this band.")

divOscSource = input.string("MACD Value", "Divergence Oscillator Source", options = ["MACD Value", "Histogram"], group = gDiv)
pivotLeft = input.int(3, "Pivot Left Bars", minval = 1, group = gDiv)
pivotRight = input.int(3, "Pivot Right Bars", minval = 1, group = gDiv)
minPivotDistance = input.int(5, "Minimum Pivot Distance", minval = 1, group = gDiv)
maxPivotDistance = input.int(100, "Maximum Pivot Distance", minval = 2, group = gDiv)
maxDivLines = input.int(50, "Maximum Divergence Lines", minval = 1, maxval = 500, group = gDiv)

requireFastBelowAtBuyTrigger = input.bool(true, "Require Fast MACD Below Zero At Trigger", group = gConfirm, tooltip = "When disabled, the fast MACD may cross its signal slightly above zero after a prior below-zero correction.")
requireFastAboveAtSellTrigger = input.bool(true, "Require Fast MACD Above Zero At Trigger", group = gConfirm, tooltip = "When disabled, the fast MACD may cross its signal slightly below zero after a prior above-zero correction.")
hiddenConfirmMode = input.string("Fast MACD Crosses Signal Line", "Hidden Divergence Confirmation", options = ["Immediate On Pivot Confirmation", "Oscillator Turns Up", "Fast MACD Crosses Signal Line"], group = gConfirm)
maxTriggerWaitBars = input.int(20, "Maximum Trigger Wait Bars", minval = 1, group = gConfirm)

minBarsBetweenSameDirection = input.int(20, "Minimum Bars Between Same-Direction Signals", minval = 0, group = gCycle)
minCorrectionDepthAtrRatio = input.float(0.05, "Minimum Correction Depth (ATR Ratio)", minval = 0.0, step = 0.01, group = gCycle, tooltip = "Fast MACD correction depth must reach this ATR-normalized amount before Type A or hidden-divergence triggers are allowed. Set to 0 for original loose behavior.")

enableEmaFilter = input.bool(true, "Enable EMA Trend Filter", group = gEma)
fastEmaLen = input.int(60, "Fast EMA Length", minval = 1, group = gEma)
slowEmaLen = input.int(240, "Slow EMA Length", minval = 1, group = gEma)
enableSlowEmaSlopeFilter = input.bool(true, "Enable Slow EMA Slope Filter", group = gEma)
slowEmaSlopeLookback = input.int(10, "Slow EMA Slope Lookback", minval = 1, group = gEma)
minSlowEmaSlopeAtrRatio = input.float(0.05, "Minimum Slow EMA Slope ATR Ratio", minval = 0.0, step = 0.01, group = gEma)

rangeFilterMode = input.string("Balanced", "Range Filter Mode", options = ["Off", "Balanced", "Strict"], group = gRange)
adxLen = input.int(14, "ADX Length", minval = 1, group = gRange)
minAdx = input.float(20.0, "Minimum ADX", minval = 0.0, step = 0.5, group = gRange)
minEmaSeparationAtr = input.float(0.20, "Minimum EMA Separation (ATR)", minval = 0.0, step = 0.01, group = gRange)
strengthLookback = input.int(50, "Strength Lookback", minval = 1, group = gRange)
minStrengthMultiplier = input.float(0.50, "Minimum Strength Multiplier", minval = 0.0, step = 0.05, group = gRange)

enableSessionFilter = input.bool(false, "Enable Session Filter", group = gSession)
sessionMode = input.string("London + New York", "Session Mode", options = ["London", "New York", "London + New York", "Custom"], group = gSession)
sessionTimezone = input.string("Etc/UTC", "Timezone", group = gSession)
londonSession = input.session("0700-1600", "London Session", group = gSession)
newYorkSession = input.session("1300-2200", "New York Session", group = gSession)
customSession = input.session("0000-2359", "Custom Session", group = gSession)

showCorrectionSignals = input.bool(true, "Show Correction Release Signals", group = gVisual)
showHiddenSignals = input.bool(true, "Show Hidden Divergence Signals", group = gVisual)
showCombinedSignals = input.bool(true, "Show Combined Signals", group = gVisual)
showSignalText = input.bool(true, "Show Signal Text", group = gVisual)
showDivergenceLines = input.bool(true, "Show Divergence Lines", group = gVisual)
showRejectedSignals = input.bool(false, "Show Rejected Signals", group = gVisual)
showEma60 = input.bool(false, "Show EMA 60", group = gVisual)
showEma240 = input.bool(false, "Show EMA 240", group = gVisual)
showRegimeBackground = input.bool(false, "Show Regime Background", group = gVisual)
showMacdDataWindow = input.bool(true, "Show MACD Values In Data Window", group = gVisual)

showRiskProjection = input.bool(true, "Show SL/TP Projection", group = gRisk)
slMode = input.string("Pivot + ATR Buffer", "SL Mode", options = ["Pivot", "ATR", "Pivot + ATR Buffer"], group = gRisk)
riskAtrLen = input.int(14, "Risk ATR Length", minval = 1, group = gRisk)
slAtrFallback = input.float(1.5, "ATR SL Fallback Multiplier", minval = 0.1, step = 0.1, group = gRisk, tooltip = "Used when ATR mode is selected or no valid pivot exists on the correct side of entry.")
slAtrBuffer = input.float(0.2, "Pivot SL ATR Buffer", minval = 0.0, step = 0.05, group = gRisk)
tp1Rr = input.float(1.0, "TP1 RR", minval = 0.1, step = 0.1, group = gRisk)
tp2Rr = input.float(2.0, "TP2 RR", minval = 0.1, step = 0.1, group = gRisk)
tp3Rr = input.float(3.0, "TP3 RR", minval = 0.1, step = 0.1, group = gRisk)
projectionBars = input.int(25, "Projection Width (Bars)", minval = 1, maxval = 300, group = gRisk)
maxRiskProjections = input.int(20, "Maximum SL/TP Projections", minval = 1, maxval = 50, group = gRisk)

enableDebug = input.bool(false, "Enable Debug Mode", group = gDebug)
showDebugMarkers = input.bool(false, "Show Debug Markers", group = gDebug)

//──────────────────────────────────────────────────────────────────────────────
// Helpers
//──────────────────────────────────────────────────────────────────────────────
f_macd(series float source, int fastLen, int slowLen, int signalLen) =>
    float value = ta.ema(source, fastLen) - ta.ema(source, slowLen)
    float signal = ta.ema(value, signalLen)
    float hist = value - signal
    [value, signal, hist]

f_inSession() =>
    bool london = not na(time(timeframe.period, londonSession, sessionTimezone))
    bool ny = not na(time(timeframe.period, newYorkSession, sessionTimezone))
    bool custom = not na(time(timeframe.period, customSession, sessionTimezone))
    bool allowed = switch sessionMode
        "London" => london
        "New York" => ny
        "London + New York" => london or ny
        => custom
    not enableSessionFilter or allowed

f_rangeFilter(float slowMacd, float emaFast, float emaSlow, float atrValue) =>
    float safeAtr = math.max(atrValue, syminfo.mintick)
    [plusDi, minusDi, adxValue] = ta.dmi(adxLen, adxLen)
    bool adxValid = adxValue >= minAdx
    bool emaSepValid = math.abs(emaFast - emaSlow) / safeAtr >= minEmaSeparationAtr
    float slowStrengthAvg = ta.sma(math.abs(slowMacd), strengthLookback)
    bool strengthValid = math.abs(slowMacd) > slowStrengthAvg * minStrengthMultiplier
    int passCount = (adxValid ? 1 : 0) + (emaSepValid ? 1 : 0) + (strengthValid ? 1 : 0)
    bool rangeOk = switch rangeFilterMode
        "Off" => true
        "Balanced" => passCount >= 2
        => adxValid and emaSepValid and strengthValid
    [rangeOk, adxValid, emaSepValid, strengthValid]

f_emaFilter(bool isBuy, float emaFast, float emaSlow, float atrValue) =>
    bool trendOk = not enableEmaFilter or (isBuy ? emaFast > emaSlow : emaFast < emaSlow)
    float slope = emaSlow - emaSlow[slowEmaSlopeLookback]
    float slopeRatio = math.abs(slope) / math.max(atrValue, syminfo.mintick)
    bool slopeDirectionOk = isBuy ? slope > 0 : slope < 0
    bool slopeOk = not enableSlowEmaSlopeFilter or (slopeDirectionOk and slopeRatio >= minSlowEmaSlopeAtrRatio)
    trendOk and slopeOk

f_signalText(bool isBuy, int signalType) =>
    string dir = isBuy ? "BUY" : "SELL"
    string kind = signalType == 3 ? "COMBO" : signalType == 2 ? "HID" : "REL"
    showSignalText ? "B&A " + dir + "\n" + kind : ""

f_signalColor(bool isBuy, int signalType) =>
    signalType == 3 ? color.yellow : signalType == 2 ? (isBuy ? color.lime : color.red) : (isBuy ? color.aqua : color.orange)

//──────────────────────────────────────────────────────────────────────────────
// MACD, filters, and regime
//──────────────────────────────────────────────────────────────────────────────
[fastMacd, fastSignal, fastHist] = f_macd(src, fastMacdFastLen, fastMacdSlowLen, fastMacdSignalLen)
[slowMacd, slowSignal, slowHist] = f_macd(src, slowMacdFastLen, slowMacdSlowLen, slowMacdSignalLen)

fastDivOsc = divOscSource == "MACD Value" ? fastMacd : fastHist
emaFast = ta.ema(src, fastEmaLen)
emaSlow = ta.ema(src, slowEmaLen)
atr = ta.atr(14)
riskAtr = ta.atr(riskAtrLen)

bullRegime = slowMacd > slowZeroBuffer
bearRegime = slowMacd < -slowZeroBuffer
neutralRegime = not bullRegime and not bearRegime

[rangeOk, adxOk, emaSepOk, strengthOk] = f_rangeFilter(slowMacd, emaFast, emaSlow, atr)
sessionOk = f_inSession()
emaBuyOk = f_emaFilter(true, emaFast, emaSlow, atr)
emaSellOk = f_emaFilter(false, emaFast, emaSlow, atr)

//──────────────────────────────────────────────────────────────────────────────
// State
//──────────────────────────────────────────────────────────────────────────────
var bool bullCorrectionArmed = false
var bool bearCorrectionArmed = false
var bool bullHiddenArmed = false
var bool bearHiddenArmed = false
var bool bullLocked = false
var bool bearLocked = false
var bool bullSawPositiveAfterLock = false
var bool bearSawNegativeAfterLock = false
var float bullCorrectionDepth = 0.0
var float bearCorrectionDepth = 0.0
var int bullHiddenArmedBar = na
var int bearHiddenArmedBar = na
var int lastBuyBar = na
var int lastSellBar = na
var int lastSignalType = 0

var float prevLowPrice = na
var float prevLowOsc = na
var int prevLowBar = na
var float currLowPrice = na
var float currLowOsc = na
var int currLowBar = na

var float prevHighPrice = na
var float prevHighOsc = na
var int prevHighBar = na
var float currHighPrice = na
var float currHighOsc = na
var int currHighBar = na

var array<line> divLines = array.new<line>()
var array<line> riskLines = array.new<line>()
var array<label> riskLabels = array.new<label>()
var array<box> riskBoxes = array.new<box>()

// Reset directional state on opposite/neutral regimes.
if not bullRegime
    bullCorrectionArmed := false
    bullHiddenArmed := false
    bullHiddenArmedBar := na
    bullCorrectionDepth := 0.0

if not bearRegime
    bearCorrectionArmed := false
    bearHiddenArmed := false
    bearHiddenArmedBar := na
    bearCorrectionDepth := 0.0

// A cycle unlocks only after the fast MACD visits the opposite side and then
// starts a fresh correction. This avoids duplicate arrows inside one correction.
if bullLocked
    bullSawPositiveAfterLock := bullSawPositiveAfterLock or fastMacd > 0
    if bullSawPositiveAfterLock and fastMacd <= 0 and bullRegime
        bullLocked := false
        bullSawPositiveAfterLock := false
        bullCorrectionArmed := true
        bullCorrectionDepth := math.abs(fastMacd)

if bearLocked
    bearSawNegativeAfterLock := bearSawNegativeAfterLock or fastMacd < 0
    if bearSawNegativeAfterLock and fastMacd >= 0 and bearRegime
        bearLocked := false
        bearSawNegativeAfterLock := false
        bearCorrectionArmed := true
        bearCorrectionDepth := math.abs(fastMacd)

if bullRegime and fastMacd < 0 and not bullLocked
    bullCorrectionArmed := true
    bullCorrectionDepth := math.max(bullCorrectionDepth, math.abs(fastMacd))

if bearRegime and fastMacd > 0 and not bearLocked
    bearCorrectionArmed := true
    bearCorrectionDepth := math.max(bearCorrectionDepth, math.abs(fastMacd))

minCorrectionDepth = minCorrectionDepthAtrRatio * math.max(atr, syminfo.mintick)
bullCorrectionDepthOk = bullCorrectionArmed and bullCorrectionDepth >= minCorrectionDepth
bearCorrectionDepthOk = bearCorrectionArmed and bearCorrectionDepth >= minCorrectionDepth

//──────────────────────────────────────────────────────────────────────────────
// Confirmed hidden divergence
// Pivot lines are drawn back on the actual pivot bars after confirmation.
// Signal markers are never backdated; they appear only on the confirmation or
// trigger candle after bar close.
//──────────────────────────────────────────────────────────────────────────────
pivotLow = ta.pivotlow(low, pivotLeft, pivotRight)
pivotHigh = ta.pivothigh(high, pivotLeft, pivotRight)
newLowPivot = not na(pivotLow)
newHighPivot = not na(pivotHigh)

bullHiddenConfirmed = false
bearHiddenConfirmed = false

if newLowPivot
    int pivotBar = bar_index - pivotRight
    float pivotOsc = fastDivOsc[pivotRight]
    prevLowPrice := currLowPrice
    prevLowOsc := currLowOsc
    prevLowBar := currLowBar
    currLowPrice := pivotLow
    currLowOsc := pivotOsc
    currLowBar := pivotBar
    int dist = na(prevLowBar) ? na : currLowBar - prevLowBar
    bool distanceOk = not na(dist) and dist >= minPivotDistance and dist <= maxPivotDistance
    bullHiddenConfirmed := bullRegime and not bullLocked and bullCorrectionDepthOk and distanceOk and not na(prevLowPrice) and not na(prevLowOsc) and currLowPrice > prevLowPrice and currLowOsc < prevLowOsc
    if bullHiddenConfirmed
        bullHiddenArmed := true
        bullHiddenArmedBar := bar_index
        if showDivergenceLines and not na(prevLowBar)
            line ln = line.new(prevLowBar, prevLowPrice, currLowBar, currLowPrice, xloc = xloc.bar_index, extend = extend.none, color = color.lime, width = 2)
            array.push(divLines, ln)
            if array.size(divLines) > maxDivLines
                line.delete(array.shift(divLines))

if newHighPivot
    int pivotBar = bar_index - pivotRight
    float pivotOsc = fastDivOsc[pivotRight]
    prevHighPrice := currHighPrice
    prevHighOsc := currHighOsc
    prevHighBar := currHighBar
    currHighPrice := pivotHigh
    currHighOsc := pivotOsc
    currHighBar := pivotBar
    int dist = na(prevHighBar) ? na : currHighBar - prevHighBar
    bool distanceOk = not na(dist) and dist >= minPivotDistance and dist <= maxPivotDistance
    bearHiddenConfirmed := bearRegime and not bearLocked and bearCorrectionDepthOk and distanceOk and not na(prevHighPrice) and not na(prevHighOsc) and currHighPrice < prevHighPrice and currHighOsc > prevHighOsc
    if bearHiddenConfirmed
        bearHiddenArmed := true
        bearHiddenArmedBar := bar_index
        if showDivergenceLines and not na(prevHighBar)
            line ln = line.new(prevHighBar, prevHighPrice, currHighBar, currHighPrice, xloc = xloc.bar_index, extend = extend.none, color = color.red, width = 2)
            array.push(divLines, ln)
            if array.size(divLines) > maxDivLines
                line.delete(array.shift(divLines))

if bullHiddenArmed and (not bullRegime or bar_index - bullHiddenArmedBar > maxTriggerWaitBars)
    bullHiddenArmed := false
    bullHiddenArmedBar := na

if bearHiddenArmed and (not bearRegime or bar_index - bearHiddenArmedBar > maxTriggerWaitBars)
    bearHiddenArmed := false
    bearHiddenArmedBar := na

//──────────────────────────────────────────────────────────────────────────────
// Core triggers
//──────────────────────────────────────────────────────────────────────────────
buyReleaseCore = bullRegime and not bullLocked and bullCorrectionDepthOk and ta.crossover(fastMacd, fastSignal) and (not requireFastBelowAtBuyTrigger or fastMacd < 0)
sellReleaseCore = bearRegime and not bearLocked and bearCorrectionDepthOk and ta.crossunder(fastMacd, fastSignal) and (not requireFastAboveAtSellTrigger or fastMacd > 0)

buyHiddenCore = false
sellHiddenCore = false

if bullHiddenArmed and bullRegime and not bullLocked
    buyHiddenCore := switch hiddenConfirmMode
        "Immediate On Pivot Confirmation" => bullHiddenConfirmed
        "Oscillator Turns Up" => fastDivOsc > fastDivOsc[1]
        => ta.crossover(fastMacd, fastSignal)

if bearHiddenArmed and bearRegime and not bearLocked
    sellHiddenCore := switch hiddenConfirmMode
        "Immediate On Pivot Confirmation" => bearHiddenConfirmed
        "Oscillator Turns Down" => fastDivOsc < fastDivOsc[1]
        => ta.crossunder(fastMacd, fastSignal)

// The options list uses "Oscillator Turns Up" for both directions in TradingView's
// single shared input. For bearish logic, that mode is interpreted symmetrically.
if bearHiddenArmed and bearRegime and not bearLocked and hiddenConfirmMode == "Oscillator Turns Up"
    sellHiddenCore := fastDivOsc < fastDivOsc[1]

buyTypeCore = buyReleaseCore and buyHiddenCore ? 3 : buyHiddenCore ? 2 : buyReleaseCore ? 1 : 0
sellTypeCore = sellReleaseCore and sellHiddenCore ? 3 : sellHiddenCore ? 2 : sellReleaseCore ? 1 : 0

buyCore = buyTypeCore > 0
sellCore = sellTypeCore > 0
buyFiltersOk = bullRegime and emaBuyOk and rangeOk and sessionOk
sellFiltersOk = bearRegime and emaSellOk and rangeOk and sessionOk
buyBarsOk = na(lastBuyBar) or bar_index - lastBuyBar >= minBarsBetweenSameDirection
sellBarsOk = na(lastSellBar) or bar_index - lastSellBar >= minBarsBetweenSameDirection

buyAccepted = barstate.isconfirmed and buyCore and buyFiltersOk and buyBarsOk
sellAccepted = barstate.isconfirmed and sellCore and sellFiltersOk and sellBarsOk
buyRejected = barstate.isconfirmed and buyCore and not buyAccepted
sellRejected = barstate.isconfirmed and sellCore and not sellAccepted

// Consume accepted or rejected core signals so blocked setups do not repeatedly
// produce markers for the same correction.
if buyAccepted or buyRejected
    bullLocked := true
    bullSawPositiveAfterLock := fastMacd > 0
    bullCorrectionArmed := false
    bullCorrectionDepth := 0.0
    bullHiddenArmed := false
    bullHiddenArmedBar := na
    lastSignalType := buyTypeCore
    if buyAccepted
        lastBuyBar := bar_index

if sellAccepted or sellRejected
    bearLocked := true
    bearSawNegativeAfterLock := fastMacd < 0
    bearCorrectionArmed := false
    bearCorrectionDepth := 0.0
    bearHiddenArmed := false
    bearHiddenArmedBar := na
    lastSignalType := sellTypeCore
    if sellAccepted
        lastSellBar := bar_index

buyReleaseSignal = buyAccepted and buyTypeCore == 1
sellReleaseSignal = sellAccepted and sellTypeCore == 1
buyHiddenSignal = buyAccepted and buyTypeCore == 2
sellHiddenSignal = sellAccepted and sellTypeCore == 2
buyCombinedSignal = buyAccepted and buyTypeCore == 3
sellCombinedSignal = sellAccepted and sellTypeCore == 3

buyAny = buyAccepted
sellAny = sellAccepted

//──────────────────────────────────────────────────────────────────────────────
// SL/TP projection
// This remains indicator-only: projected levels are visual guidance from the
// signal close and never place, manage, or simulate orders.
//──────────────────────────────────────────────────────────────────────────────
recentPivotWindow = pivotLeft + pivotRight + 1
recentLowFallback = ta.lowest(low, recentPivotWindow)
recentHighFallback = ta.highest(high, recentPivotWindow)

if showRiskProjection and (buyAccepted or sellAccepted)
    bool isBuyProjection = buyAccepted
    int signalType = isBuyProjection ? buyTypeCore : sellTypeCore
    string signalKind = signalType == 3 ? "COMBO" : signalType == 2 ? "HID" : "REL"
    float entry = close
    float pivotCandidate = isBuyProjection ? currLowPrice : currHighPrice
    float recentFallback = isBuyProjection ? recentLowFallback : recentHighFallback
    bool pivotCandidateOk = not na(pivotCandidate) and (isBuyProjection ? pivotCandidate < entry : pivotCandidate > entry)
    bool recentFallbackOk = not na(recentFallback) and (isBuyProjection ? recentFallback < entry : recentFallback > entry)
    float basePivot = pivotCandidateOk ? pivotCandidate : recentFallbackOk ? recentFallback : na
    float atrStop = isBuyProjection ? entry - riskAtr * slAtrFallback : entry + riskAtr * slAtrFallback
    float pivotStop = na(basePivot) ? atrStop : basePivot
    float sl = switch slMode
        "ATR" => atrStop
        "Pivot" => pivotStop
        => isBuyProjection ? pivotStop - riskAtr * slAtrBuffer : pivotStop + riskAtr * slAtrBuffer
    bool slOk = isBuyProjection ? sl < entry : sl > entry
    if slOk
        float risk = math.abs(entry - sl)
        if risk > syminfo.mintick
            float tp1 = isBuyProjection ? entry + risk * tp1Rr : entry - risk * tp1Rr
            float tp2 = isBuyProjection ? entry + risk * tp2Rr : entry - risk * tp2Rr
            float tp3 = isBuyProjection ? entry + risk * tp3Rr : entry - risk * tp3Rr
            int x1 = bar_index
            int x2 = bar_index + projectionBars
            float riskTop = math.max(entry, sl)
            float riskBottom = math.min(entry, sl)
            float rewardTop = math.max(entry, tp3)
            float rewardBottom = math.min(entry, tp3)

            box riskBox = box.new(left = x1, top = riskTop, right = x2, bottom = riskBottom, xloc = xloc.bar_index, border_color = color.new(color.red, 40), bgcolor = color.new(color.red, 82))
            box rewardBox = box.new(left = x1, top = rewardTop, right = x2, bottom = rewardBottom, xloc = xloc.bar_index, border_color = color.new(color.teal, 40), bgcolor = color.new(color.teal, 82))
            array.push(riskBoxes, riskBox)
            array.push(riskBoxes, rewardBox)

            line entryLine = line.new(x1 = x1, y1 = entry, x2 = x2, y2 = entry, xloc = xloc.bar_index, color = color.new(color.white, 0), style = line.style_dotted, width = 1)
            line slLine = line.new(x1 = x1, y1 = sl, x2 = x2, y2 = sl, xloc = xloc.bar_index, color = color.new(color.red, 0), style = line.style_solid, width = 1)
            line tp1Line = line.new(x1 = x1, y1 = tp1, x2 = x2, y2 = tp1, xloc = xloc.bar_index, color = color.new(color.lime, 0), style = line.style_dotted, width = 1)
            line tp2Line = line.new(x1 = x1, y1 = tp2, x2 = x2, y2 = tp2, xloc = xloc.bar_index, color = color.new(color.lime, 0), style = line.style_dashed, width = 1)
            line tp3Line = line.new(x1 = x1, y1 = tp3, x2 = x2, y2 = tp3, xloc = xloc.bar_index, color = color.new(color.lime, 0), style = line.style_solid, width = 1)
            array.push(riskLines, entryLine)
            array.push(riskLines, slLine)
            array.push(riskLines, tp1Line)
            array.push(riskLines, tp2Line)
            array.push(riskLines, tp3Line)

            label entryLabel = label.new(x = x2, y = entry, xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.white, 10), textcolor = color.black, text = "Entry " + signalKind)
            label slLabel = label.new(x = x2, y = sl, xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 0), textcolor = color.white, text = "SL")
            label tp1Label = label.new(x = x2, y = tp1, xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.lime, 0), textcolor = color.black, text = "TP1 " + str.tostring(tp1Rr) + "R")
            label tp2Label = label.new(x = x2, y = tp2, xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.lime, 0), textcolor = color.black, text = "TP2 " + str.tostring(tp2Rr) + "R")
            label tp3Label = label.new(x = x2, y = tp3, xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.lime, 0), textcolor = color.black, text = "TP3 " + str.tostring(tp3Rr) + "R")
            array.push(riskLabels, entryLabel)
            array.push(riskLabels, slLabel)
            array.push(riskLabels, tp1Label)
            array.push(riskLabels, tp2Label)
            array.push(riskLabels, tp3Label)

            while array.size(riskBoxes) > maxRiskProjections * 2
                box.delete(array.shift(riskBoxes))
            while array.size(riskLines) > maxRiskProjections * 5
                line.delete(array.shift(riskLines))
            while array.size(riskLabels) > maxRiskProjections * 5
                label.delete(array.shift(riskLabels))

//──────────────────────────────────────────────────────────────────────────────
// Visual output
//──────────────────────────────────────────────────────────────────────────────
plot(showEma60 ? emaFast : na, "EMA 60", color = color.new(color.aqua, 0), linewidth = 2)
plot(showEma240 ? emaSlow : na, "EMA 240", color = color.new(color.orange, 0), linewidth = 2)

bgcolor(showRegimeBackground ? (bullRegime ? color.new(color.green, 90) : bearRegime ? color.new(color.red, 90) : color.new(color.gray, 92)) : na)

plotshape(showSignalText and showCorrectionSignals and buyReleaseSignal, title = "Buy Correction Release", style = shape.labelup, location = location.belowbar, color = f_signalColor(true, 1), textcolor = color.black, text = "B&A BUY\nREL", size = size.small)
plotshape(showSignalText and showCorrectionSignals and sellReleaseSignal, title = "Sell Correction Release", style = shape.labeldown, location = location.abovebar, color = f_signalColor(false, 1), textcolor = color.black, text = "B&A SELL\nREL", size = size.small)
plotshape(showSignalText and showHiddenSignals and buyHiddenSignal, title = "Buy Hidden Divergence", style = shape.labelup, location = location.belowbar, color = f_signalColor(true, 2), textcolor = color.black, text = "B&A BUY\nHID", size = size.small)
plotshape(showSignalText and showHiddenSignals and sellHiddenSignal, title = "Sell Hidden Divergence", style = shape.labeldown, location = location.abovebar, color = f_signalColor(false, 2), textcolor = color.white, text = "B&A SELL\nHID", size = size.small)
plotshape(showSignalText and showCombinedSignals and buyCombinedSignal, title = "Buy Combined", style = shape.labelup, location = location.belowbar, color = f_signalColor(true, 3), textcolor = color.black, text = "B&A BUY\nCOMBO", size = size.normal)
plotshape(showSignalText and showCombinedSignals and sellCombinedSignal, title = "Sell Combined", style = shape.labeldown, location = location.abovebar, color = f_signalColor(false, 3), textcolor = color.black, text = "B&A SELL\nCOMBO", size = size.normal)
plotshape(not showSignalText and showCorrectionSignals and buyReleaseSignal, title = "Buy Correction Release Arrow", style = shape.triangleup, location = location.belowbar, color = f_signalColor(true, 1), size = size.small)
plotshape(not showSignalText and showCorrectionSignals and sellReleaseSignal, title = "Sell Correction Release Arrow", style = shape.triangledown, location = location.abovebar, color = f_signalColor(false, 1), size = size.small)
plotshape(not showSignalText and showHiddenSignals and buyHiddenSignal, title = "Buy Hidden Divergence Arrow", style = shape.triangleup, location = location.belowbar, color = f_signalColor(true, 2), size = size.small)
plotshape(not showSignalText and showHiddenSignals and sellHiddenSignal, title = "Sell Hidden Divergence Arrow", style = shape.triangledown, location = location.abovebar, color = f_signalColor(false, 2), size = size.small)
plotshape(not showSignalText and showCombinedSignals and buyCombinedSignal, title = "Buy Combined Arrow", style = shape.triangleup, location = location.belowbar, color = f_signalColor(true, 3), size = size.normal)
plotshape(not showSignalText and showCombinedSignals and sellCombinedSignal, title = "Sell Combined Arrow", style = shape.triangledown, location = location.abovebar, color = f_signalColor(false, 3), size = size.normal)

plotshape(showRejectedSignals and buyRejected, title = "Rejected Buy", style = shape.circle, location = location.belowbar, color = color.gray, size = size.tiny)
plotshape(showRejectedSignals and sellRejected, title = "Rejected Sell", style = shape.circle, location = location.abovebar, color = color.gray, size = size.tiny)

plotshape(showDebugMarkers and ta.cross(fastMacd, 0), title = "Fast MACD Zero Cross", style = shape.xcross, location = location.bottom, color = color.gray, size = size.tiny)
plotshape(showDebugMarkers and ta.cross(fastMacd, fastSignal), title = "Fast MACD Signal Cross", style = shape.diamond, location = location.bottom, color = color.blue, size = size.tiny)
plotshape(showDebugMarkers and newLowPivot, title = "Confirmed Pivot Low", style = shape.triangleup, location = location.belowbar, color = color.new(color.lime, 30), size = size.tiny)
plotshape(showDebugMarkers and newHighPivot, title = "Confirmed Pivot High", style = shape.triangledown, location = location.abovebar, color = color.new(color.red, 30), size = size.tiny)
plotshape(showDebugMarkers and bullHiddenConfirmed, title = "Bull Hidden Confirmed", style = shape.circle, location = location.belowbar, color = color.lime, size = size.tiny)
plotshape(showDebugMarkers and bearHiddenConfirmed, title = "Bear Hidden Confirmed", style = shape.circle, location = location.abovebar, color = color.red, size = size.tiny)

plot(showMacdDataWindow ? fastMacd : na, "Fast MACD Value", display = display.data_window, color = color.aqua)
plot(showMacdDataWindow ? fastSignal : na, "Fast Signal Line", display = display.data_window, color = color.red)
plot(showMacdDataWindow ? fastHist : na, "Fast Histogram", display = display.data_window, color = color.gray)
plot(showMacdDataWindow ? slowMacd : na, "Slow MACD Value", display = display.data_window, color = color.blue)
plot(showMacdDataWindow ? slowSignal : na, "Slow Signal Line", display = display.data_window, color = color.orange)
plot(showMacdDataWindow ? slowHist : na, "Slow Histogram", display = display.data_window, color = color.gray)

//──────────────────────────────────────────────────────────────────────────────
// Alerts
//──────────────────────────────────────────────────────────────────────────────
alertcondition(buyAny, "B&A Buy - Any", "B&A BUY | Any | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(sellAny, "B&A Sell - Any", "B&A SELL | Any | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(buyReleaseSignal, "B&A Buy - Correction Release", "B&A BUY | Correction Release | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(sellReleaseSignal, "B&A Sell - Correction Release", "B&A SELL | Correction Release | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(buyHiddenSignal, "B&A Buy - Hidden Divergence", "B&A BUY | Hidden Divergence | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(sellHiddenSignal, "B&A Sell - Hidden Divergence", "B&A SELL | Hidden Divergence | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(buyCombinedSignal, "B&A Buy - Combined", "B&A BUY | Combined | {{ticker}} | {{interval}} | Close: {{close}}")
alertcondition(sellCombinedSignal, "B&A Sell - Combined", "B&A SELL | Combined | {{ticker}} | {{interval}} | Close: {{close}}")

//──────────────────────────────────────────────────────────────────────────────
// Debug table
//──────────────────────────────────────────────────────────────────────────────
var table dbg = table.new(position.top_right, 2, 11, border_width = 1)

if enableDebug and barstate.islast
    string regime = bullRegime ? "Bullish" : bearRegime ? "Bearish" : "Neutral"
    string fastPos = fastMacd > 0 ? "Above 0" : fastMacd < 0 ? "Below 0" : "At 0"
    string lastTypeText = lastSignalType == 3 ? "Combined" : lastSignalType == 2 ? "Hidden" : lastSignalType == 1 ? "Release" : "None"
    string barsSinceBuy = na(lastBuyBar) ? "na" : str.tostring(bar_index - lastBuyBar)
    string barsSinceSell = na(lastSellBar) ? "na" : str.tostring(bar_index - lastSellBar)
    table.cell(dbg, 0, 0, "Slow regime", text_color = color.white)
    table.cell(dbg, 1, 0, regime, text_color = color.white)
    table.cell(dbg, 0, 1, "Fast MACD", text_color = color.white)
    table.cell(dbg, 1, 1, fastPos, text_color = color.white)
    table.cell(dbg, 0, 2, "Bull correction", text_color = color.white)
    table.cell(dbg, 1, 2, str.tostring(bullCorrectionArmed), text_color = color.white)
    table.cell(dbg, 0, 3, "Bear correction", text_color = color.white)
    table.cell(dbg, 1, 3, str.tostring(bearCorrectionArmed), text_color = color.white)
    table.cell(dbg, 0, 4, "Bull hidden", text_color = color.white)
    table.cell(dbg, 1, 4, str.tostring(bullHiddenArmed), text_color = color.white)
    table.cell(dbg, 0, 5, "Bear hidden", text_color = color.white)
    table.cell(dbg, 1, 5, str.tostring(bearHiddenArmed), text_color = color.white)
    table.cell(dbg, 0, 6, "Range filter", text_color = color.white)
    table.cell(dbg, 1, 6, str.tostring(rangeOk), text_color = color.white)
    table.cell(dbg, 0, 7, "EMA filter", text_color = color.white)
    table.cell(dbg, 1, 7, "B:" + str.tostring(emaBuyOk) + " S:" + str.tostring(emaSellOk), text_color = color.white)
    table.cell(dbg, 0, 8, "Session filter", text_color = color.white)
    table.cell(dbg, 1, 8, str.tostring(sessionOk), text_color = color.white)
    table.cell(dbg, 0, 9, "Last signal", text_color = color.white)
    table.cell(dbg, 1, 9, lastTypeText, text_color = color.white)
    table.cell(dbg, 0, 10, "Bars since B/S", text_color = color.white)
    table.cell(dbg, 1, 10, barsSinceBuy + " / " + barsSinceSell, text_color = color.white)

FAQ

Common questions.

What does Arrow.AlgoNexta detect?

It detects fast-MACD correction releases and confirmed hidden divergence, then accepts them only when the slow-MACD regime and enabled EMA, range, session, and spacing filters agree. The default fast MACD is 12/26/9 and the slow MACD is 48/104/36.

Do its arrows repaint?

Accepted arrows require `barstate.isconfirmed`, so they are produced on closed bars rather than intrabar. Hidden-divergence pivots require the default 3 right-side bars for confirmation, and their divergence lines are drawn back at the pivot locations after confirmation.

Does this indicator place trades or manage the projected stop and targets?

No. It is an indicator, not a strategy: the SL, TP1, TP2, and TP3 levels are visual projections from the signal close and do not place, manage, or simulate orders.

How do I create alerts?

Create a TradingView alert from one of the supplied conditions: B&A Buy/Sell - Any, Correction Release, Hidden Divergence, or Combined. Each alert condition is based on an accepted closed-bar signal.

What do the Balanced and Strict range filters do?

Balanced mode, the default, requires any two of ADX, EMA-separation, and slow-MACD-strength checks to pass. Strict requires all three, while Off bypasses this filter; the default ADX length is 14 and minimum ADX is 20.

Is Arrow.AlgoNexta financial advice, and where can I verify results?

No, this indicator is not financial advice and the script contains no performance claim. Use TradingView Strategy Tester or an equivalent platform with your own executable rules, costs, and market data as the source of truth for live or simulated results.

Want a version tuned to your market?

Describe the change in plain English and AlgoNexta rebuilds it as a fresh Pine v6 script — with its own explanation, evidence, and walkthrough.

Build your own version

Educational content only — not financial advice. TradingView is the source of truth for live data, compilation, and Strategy Tester results.