We use cookies to understand how the site is used and improve it. We only load analytics after you accept. Privacy Policy
EMA trend direction with MACD-based hidden-divergence pivot markers for TradingView charts.
Published by AlgoNexta, who builds and documents these tools so you can inspect the logic before using it. About AlgoNexta · Trading Scripts · AlgoNexta Research
One-time payment through Stripe. You get the full source (Pine Script and the other platform versions listed on this page) to use on your own charts.
MacHidden.AlgoNexta is an overlay indicator that uses the relationship between a fast and slow EMA to define the active trend direction, then evaluates price pivots against the MACD line. It plots buy and sell arrows; it does not submit orders, manage a position, or calculate a stop-loss or target.
01 · When trend direction changes
The indicator calculates EMA 60 and EMA 240 from `Source` (default `close`). A bullish crossover sets the active direction to 1 and a bearish cross sets it to -1; when no cross has yet been stored, the current EMA ordering supplies the direction. `Show cross labels` is enabled by default, while the EMA lines themselves are hidden unless `Show EMA lines` is enabled.
02 · How pivots become buy or sell signals
MACD uses defaults of 12, 26, and 9. A strict bullish condition is a higher pivot low with a lower MACD line value; a strict bearish condition is a lower pivot high with a higher MACD line value. However, `More signals / trend pivots` defaults to true, so its soft tests and the broad `trendPivotBull` or `trendPivotBear` alternatives can also produce a signal after a prior same-side pivot exists.
03 · Confirmation timing and visual output
With `Pivot left bars` and `Pivot right bars` both set to 1 by default, a pivot is associated with the prior bar but the large arrow is created on the current confirmation bar. A lime ▲ denotes `hiddenBull`; a red ▼ denotes `hiddenBear`. Alerts use these same booleans. ATR(14) only offsets labels above or below the bar; it does not define a stop or target.
This script's logic could not be confidently reconstructed into an automated reference backtest, so no performance figures are shown rather than estimated ones.
Verify it in TradingView's Strategy Tester (or the equivalent tool for tradingview) before relying on it.
Vision Grade requires a reference backtest with enough reconstructed entries to measure — not available for this script yet.
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.
MacHidden.AlgoNexta is an overlay indicator that uses the relationship between a fast and slow EMA to define the active trend direction, then evaluates price pivots against the MACD line. It plots buy and sell arrows; it does not submit orders, manage a position, or calculate a stop-loss or target.
Fast EMA defaults to 60 and Slow EMA defaults to 240, calculated from Source (default: close). A bullish EMA crossover sets trendDirection to up; a bearish cross sets it to down. Before a crossover is recorded, the script derives direction from which EMA is currently higher.Pivot left bars and Pivot right bars both default to 1. A pivot high or low is therefore evaluated with one bar on each side. The pivot is associated with bar_index - pivotRight, while the large signal arrow is drawn on the later confirmation bar.MACD fast 12, MACD slow 26, and MACD signal 9. A strict hidden bearish condition compares a lower price pivot high with a higher MACD value. A strict hidden bullish condition compares a higher price pivot low with a lower MACD value.More signals / trend pivots is true by default. With it enabled, the code also accepts softer comparisons and, notably, any later pivot of the relevant type after a prior stored pivot in the active trend. This means default arrows are not limited to strict hidden divergences.Require price on EMA side is false by default. If enabled, a sell-side pivot must close below both EMAs and a buy-side pivot must close above both EMAs, measured at the pivot bar.Show pivot dot (where the turn happened) is enabled (default: true), a smaller, faded lime or red ● is back-plotted on the actual pivot bar. It is a reference marker, not the moment the condition became available.Show cross labels is true by default and places a blue Cross label when EMA 60 crosses EMA 240 in either direction. The label itself does not distinguish bullish from bearish direction.Show EMA lines is false by default. If enabled, EMA 60 is red and EMA 240 is blue.Previous signals to show defaults to 20 and limits both arrows and pivot dots. Previous cross labels to show also defaults to 20. Older labels are deleted as new ones are added.The script has no market or timeframe restriction. Its default EMA 60/240 and MACD 12/26/9 settings can be used on any chart, but the chosen timeframe changes the meaning and frequency of pivots. Start by using the chart timeframe you intend to analyse and adjust the EMA, MACD, and pivot inputs only if that changes your intended sensitivity.
Create TradingView alerts from MacIce Buy Hidden and MacIce Sell Hidden. The alert conditions are tied to hiddenBull and hiddenBear, the same booleans that create arrows. The source does not use barstate.isconfirmed; alert behavior on a still-forming realtime bar depends on the alert frequency selected in TradingView. For close-only notification behavior, configure the TradingView alert accordingly.
A no-signal example: during an active uptrend, a pivot low alone does not produce a bullish arrow until there is a previously stored low pivot and the enabled bullish tests pass. If Require price on EMA side is enabled, that pivot's close must additionally be above both EMAs. With More signals / trend pivots disabled, only the strict hidden-divergence comparison can qualify.
strategy.entry, strategy.exit, orders, position sizing, stop-loss, take-profit, or Strategy Tester results.Pivot right bars; with the default of 1, the visual pivot dot appears one bar back while the arrow is plotted on the later bar. Increasing this input increases confirmation delay.More signals / trend pivots enabled by default, many trend-aligned pivots can qualify even without a strict hidden-divergence relationship. Disable it to restrict the logic to strict comparisons.Reset pivot memory on each cross defaults to false. When left off, pivot memory can persist across EMA trend changes, although the signal still requires the current trendDirection and a pivot after the current recorded trend-start bar.The source is included with the one-time purchase ($22). The chart, signals and documentation on this page stay open to everyone.
It sets trend direction from the EMA 60 and EMA 240 relationship, then evaluates price pivot highs/lows against MACD 12/26/9 values. It plots bullish or bearish arrows when its enabled pivot conditions qualify in that trend direction.
Not with the default settings. `More signals / trend pivots` is true by default, and its additional conditions can allow trend-aligned pivots beyond the strict price/MACD hidden-divergence comparison.
Pivot-based conditions require `Pivot right bars` of confirmation, which defaults to 1, so the pivot marker is shown back on the pivot bar while the large arrow is drawn later on the confirmation bar. The source has no `barstate.isconfirmed` gate, so realtime alert behavior also depends on the TradingView alert frequency you choose.
No. It is an indicator with plotted labels and alert conditions only; it does not call TradingView strategy order functions and does not implement trade exits, stops, or targets.
The code does not restrict symbols or timeframes. The default EMA 60/240, MACD 12/26/9, and 1-bar pivots will behave differently as chart resolution changes, so evaluate settings on the specific market and timeframe you plan to analyse.
No. This indicator is not financial advice, and it contains no built-in performance test. TradingView Strategy Tester, where an independently defined strategy is applicable, plus paper and live execution records are the sources of truth for results.
Describe the change in plain English and AlgoNexta rebuilds it as a fresh Pine v6 script — with its own explanation, evidence, and walkthrough.
Buy this script to build your own version of it, or describe a new idea in the Studio.
Educational content only — not financial advice. TradingView is the source of truth for live data, compilation, and Strategy Tester results.