HH-HL / LL-LH Structure + MA Confluence Strategy by cryptosquanch
By cryptosquanch
Performance Metrics
- Author: cryptosquanch
- Symbol: OANDA:USDJPY
- Timeframe: 15 minutes
Description
HH-HL / LL-LH Structure + MA Confluence Strategy is an open-source market-structure strategy. It enters after a confirmed higher high is followed by a confirmed higher low (longs), or a confirmed lower low is followed by a confirmed lower high (shorts), but only when a moving-average stack agrees with the direction. It is published as a research and testing framework. The default backtest is negative after costs, and that result is reported below.CREDITSwing points are labelled with the five-pivot HH / HL / LH / LL classification from the open-source "Higher High Lower Low Strategy (With Source Code)" by LonesomeTheBlue. Credit to the original author. That script labels structure and draws support and resistance. This script uses the labels as a two-step entry sequence and adds MA confluence, entry-distance rules, stops and targets anchored to the pivots, optional higher-timeframe structure, time blocks and trade review, none of which are part of the original.HOW IT WORKSStructure detectionPivot highs and lows are found with ta.pivothigh / ta.pivotlow (default 12 bars left and 12 right). Each new pivot is compared with the previous four alternating pivots and classified as HH, HL, LH or LL. A pivot is only known 12 bars after it forms, so every signal is a confirmed, non-repainting event. The HH/HL markers are drawn back on the pivot bar for readability, but the strategy acts on the confirmation bar.Entries- Long setup: a confirmed HH, then a confirmed HL. The entry happens on the bar that confirms the HL.- Short setup: a confirmed LL, then a confirmed LH.- MA confluence (ON by default): when the second pivot confirms, EMA 20 / 50 / 100 / 200 must be strictly stacked in the trade's direction. Otherwise the setup is invalid.- Minimum entry distance (default 3 pips): a long must have room below the HH, and a short must have room above the LL. This avoids entries right under the target.- Optional setup timeout, higher-timeframe structure source, minimum stop-distance filter and time blocks.Why these parts are combinedHH followed by HL is a common description of an uptrend, but pivot labels alone also fire inside ranges. Requiring the MA stack to agree when the second pivot confirms filters out structure that goes against the broader trend. The entry-distance rule removes trades with too little room to the target. Each part can be switched off to measure its effect.Exits- Default stop: 3 pips beyond the signal pivot (below the HL wick for longs, above the LH wick for shorts). Alternatives: fixed pips, percent, ATR or recent swing.- Default target: 10 pips beyond the first pivot (above the HH for longs, below the LL for shorts). Alternatives: fixed pips, percent, ATR or risk:reward.- Optional trailing stop that activates after the target is touched.DEFAULT SETTINGS AND STRATEGY PROPERTIES (used for the published chart)- Chart: OANDA:USDJPY, 15 minutes. Strategy Tester range: the regular chart history, Jan 2026 to Nov 2026. The 15-minute chart and 12/12 pivots are used so that the published report contains more than 100 trades.- Pivots 12/12 on the chart timeframe, MA stack EMA 20/50/100/200 ON, minimum entry distance 3 pips, timeout OFF, time blocks OFF.- Initial capital: 10,000 USD. Order size: 10,000 USD of notional per trade (0.10 lot on USDJPY), converted to units at the entry price. Margin 5% (20:1).- Commission 0.005% per side. Slippage 5 ticks per fill (0.5 pip). Together these roughly represent a typical retail spread of about 1 pip round trip.- Risk per trade: in the test period the largest single loss was about 40 USD, roughly 0.4% of starting equity.WHAT THE BACKTEST SHOWSWith these defaults the strategy made 119 trades over the test period. About 43% were winners, and after costs the net result was negative (about -3.0%), with a maximum drawdown of about 4.4% and a profit factor of about 0.75. Longs were roughly flat and shorts lost money over this period. With the slower 25/25 pivot setting tested over Jan 2023 to Nov 2026 (Deep Backtesting), the result was about 275 trades and about -2.5% net. I am publishing the honest default result rather than settings tuned to the past. The script is meant for studying structure-based entries, not as a ready-made system. Past results do not predict future performance.HOW TO USE IT1. Set Strategy Properties (capital, commission, slippage) to match your broker, and set the pip size for your instrument.2. Smaller pivot settings give more, noisier structure. Larger settings give fewer, more significant swings.3. Try the higher-timeframe structure source, the timeout and the different stop and target modes, and compare the Strategy Tester results with the defaults.This script is for research and education. It is not financial advice.Release NotesUpdate: default pivot length and published test rangeThe first version's chart report only covered the regular chart history (Jan to Nov 2026 on 15 minutes), which gave 59 trades with 25/25 pivots. That is below a meaningful sample size and did not match the longer test range described above. This version changes the default pivot setting so the chart report itself has more than 100 trades:- Pivots (current timeframe): left 12 / right 12 (was 25 / 25). A pivot is now confirmed 12 bars after it forms.- Everything else is unchanged: MA stack EMA 20/50/100/200 ON, minimum entry distance 3 pips, stop 3 pips beyond the signal pivot, target 10 pips beyond the first pivot, 10,000 USD capital, 10,000 USD per trade, commission 0.005% per side, slippage 5 ticks, margin 5%.Results shown on the chart with these defaults (OANDA:USDJPY, 15 minutes, Jan 2026 to Nov 2026): 119 trades, about 43% winners, net about -3.0%, max drawdown about 4.4%, profit factor about 0.75, largest single loss about 40 USD (0.4% of starting equity). Longs were roughly flat and shorts lost. The strategy is not profitable with these defaults after costs. It is published as a framework for studying structure-based entries, not as a ready-made system. For reference, the previous 25/25 setting tested over Jan 2023 to Nov 2026 with Deep Backtesting gave about 275 trades and about -2.5% net. Past results do not predict future performance.