Built-in Strategies Catalogue

Built-in Strategies Catalogue

The following strategies are included with Algolang. Use algo strategies -l -i to see descriptions and inputs for each.

Trend Following

StrategyDescription
macrossoverSimple moving average crossover
goldencrossGolden cross (50/200 day MA crossover)
trendfollowTrend following system
momoMomentum strategy
highenergyHigh Energy: long-only triple confirmation for energy futures (momentum + consecutive higher highs + Hurst persistence filter)

highenergy — High Energy

High Energy is a long-only daily strategy for energy futures (@CL, @HO, @RB) designed to capitalise on energy bull runs. It requires all three conditions to align before entering:

  1. Medium-term momentum: close must be above the close from XLength bars ago
  2. Consecutive higher highs: at least ConsecHighs consecutive bars where high > previous high
  3. Hurst persistence: the Hurst exponent (single-scale R/S at HurstPeriod) must be in the persistent zone (above HurstMin, at or below HurstMax)

There are two exit mechanisms. The signal exit fires when the close breaks above the highest high of the previous ExitLookback bars, signaling that the momentum extension has played out. The time-based exit (MaxHoldBars) cuts positions that haven’t triggered the signal exit within a set number of bars — winning trades typically resolve in ~11 bars, while losers that linger rarely recover. Both exits allow immediate re-entry on the same bar if entry conditions are met.

InputTypeDefaultDescription
XLengthint20Lookback for medium-term momentum comparison (close > close[XLength])
ConsecHighsint3Minimum consecutive higher highs required for micro-momentum confirmation
HurstPeriodint24Window size for Hurst exponent calculation (single-scale R/S, approximates CompositeHurst)
HurstMinfloat640.50Lower bound for Hurst persistent zone (exclusive); at or below = random walk
HurstMaxfloat640.65Upper bound for Hurst persistent zone (inclusive); above = overextended
ExitLookbackint35Number of prior bars for highest-high exit (shifted by 1 to exclude current bar)
MaxHoldBarsint50Exit after this many bars. Winning trades resolve in ~11 bars; losers held 50+ bars rarely recover. Set to 0 to disable (better for equity indices)

Breakout

StrategyDescription
breakoutChannel breakout
keybreakKey bar breakout
kbtKey Breakout Triangle (Dow theory symmetrical triangles)
kbt2Key Breakout Triangle 2 (symmetrical triangles with swing-based ratcheting stops)
triTriangle formation detection and swing point diagnostics
corebreakCore breakout strategy

kbt2 Inputs

InputTypeDefaultDescription
Levelint1SwingPoints hierarchical level
IsPartialbooltrueAllow partial triangles
MaxBarsNoPivotint5Exit if pivot not reached within N bars
MinRatchetATRfloat641.0Minimum stop distance in ATR multiples
MinRewardRiskfloat641.0Minimum reward/risk ratio (pivot distance vs ATR)
TrendAlignedbooltrueRequire trade direction to match MA50 slope
MinADXfloat6425Minimum ADX for trend strength (0=disabled)
ADXPeriodint14ADX lookback period (5–50)
VolContractMinfloat640.5Minimum ATR4/ATR20 ratio (0=disabled)
VolContractMaxfloat641.3Maximum ATR4/ATR20 ratio (0=disabled)
IndexLongOnlybooltrueOnly allow long trades on index futures
IsDynamicSizebooltrueEnable risk-parity position sizing based on equity and point value (floor 1, ceiling 4 contracts)
RiskPipsint25Risk per trade in basis points (25 = 0.25%); only used when IsDynamicSize is true
WaitBarsAfterLoserint00–20
IsDebugboolfalseEnable debug output

kbt Inputs

InputTypeDefaultDescription
SwingModestringSSCSwing chart mode: SSC (Simple) or NSC (Normal)
IsPartialbooltrueAllow partial triangles
IsDynamicSizebooltrueEnable risk-parity position sizing based on equity and point value (floor 1, ceiling 4 contracts)
RiskPipsint25Risk per trade in basis points (25 = 0.25%); only used when IsDynamicSize is true
WaitBarsAfterLoserint00–20
IsDebugboolfalseEnable debug output

keybreak Inputs

InputTypeDefaultDescription
ModestringnotsetSwing chart mode: KBD (daily) or KBW (weekly)
ExitstringnotsetExit mode: 1 (immediate-term), 5 (short-term), M (medium-term)
DisasterStopPctfloat640.0Disaster stop as percentage of current close (0=disabled)
IsDynamicSizebooltrueEnable risk-parity position sizing based on equity and point value (floor 1, ceiling 4 contracts)
RiskPipsint25Risk per trade in basis points (25 = 0.25%); only used when IsDynamicSize is true
WaitBarsAfterLoserint00–20

tri Inputs

InputTypeDefaultDescription
SwingModestringSSCSwing chart mode: SSC (Simple) or NSC (Normal)
IsDebugboolfalsePrint swing highs/lows with dates as they are detected

Mean Reversion

StrategyDescription
viperLog-return z-score mean reversion: fades abnormally large moves
ratchetKaufman Efficiency Ratio mean reversion
whiplash2-day runs long/short with VIX-based volatility filter (Yang 2013)
blackbirdLong convexity tail-risk hedge: frequent small losses, large gains during crashes
slowcrashLong convexity for grinding selloffs: persistent VIX elevation + price weakness
meanrevertRSI and Bollinger-based mean reversion
rsi22-period RSI mean reversion
rangerRange trading

viper Inputs

A mean reversion strategy that uses z-scores of logarithmic returns to detect and fade abnormally large price moves. Instead of simple returns, it computes ln(close/close[n]) which is additive over time and symmetric for gains and losses. The current log return is normalized into a z-score against a rolling window, and when the z-score is extreme (e.g., below -2.0 standard deviations), the strategy enters long expecting a snap-back to the mean.

The strategy operates purely on price data (no VIX dependency) and is applicable to any instrument. Optional filters include a trend SMA filter, RSI confirmation, and limit entries. Exits include z-score reversion (the primary exit), RSI reversion, time stops, and ATR-based risk management.

InputTypeDefaultDescription
LogReturnLenint1Lookback for log return: ln(close/close[n]). 1 = single-bar shocks, 5-10 = multi-day moves
ZScoreLookbackint60Rolling window for computing mean and standard deviation of log returns
ZScoreEntryLongfloat64-2.0Z-score threshold for long entry (negative = sharp drop)
ZScoreEntryShortfloat642.0Z-score threshold for short entry (positive = sharp rally)
UseTrendFilterboolfalseRestrict longs to uptrends and shorts to downtrends
UseShortTrendFilterbooltrueRestrict shorts to downtrends only (close < SMA). Suppresses unprofitable short entries during bull markets
TrendSMALengthint200SMA period for trend filter
UseRSIConfirmboolfalseRequire extreme RSI before entry
RSILengthint2RSI lookback period
RSIEntryLongfloat6415Enter long only when RSI below this level
RSIEntryShortfloat6485Enter short only when RSI above this level
UseLimitEntryboolfalseUse limit orders at ATR offset instead of market orders
LimitOffsetATRfloat640.5ATR offset from close for limit entry price
CooldownBarsint3Minimum bars between entries
UseVolRegimeFilterboolfalseSuppress entries when ATR > VolRegimeATRMult * rolling ATR average. Caution: also cuts the biggest winners
VolRegimeATRAvgLenint60Lookback for the ATR’s rolling average
VolRegimeATRMultfloat641.8ATR multiplier threshold for suppression
ZScoreExitLongfloat640.0Exit long when z-score reverts above this level
ZScoreExitShortfloat640.0Exit short when z-score reverts below this level
RSIExitLongfloat6470Exit long when RSI rises above this level
RSIExitShortfloat6430Exit short when RSI drops below this level
MaxHoldBarsint5Maximum bars to hold a position (0 = disable). Mean-reversion edge decays fast — 82% of trades resolve within 3 bars
ATRStopLengthint14ATR lookback for stop loss calculation
ATRStopMultiplierfloat641.5ATR multiplier for stop loss distance. Caps individual losses while time stop handles non-reverting trades
UseBreakEvenboolfalseActivate break-even stop after profit reaches BreakEvenATR * ATR
BreakEvenATRfloat641.0ATR multiple for break-even activation
UseProfitTargetboolfalseExit at a fixed profit target. Disabled by default — z-score reversion is the primary profit-taking exit
ProfitTargetATRfloat642.0ATR multiple for profit target
UseDollarTrailingboolfalseTrail stop from peak profit
TrailingATRfloat641.5ATR multiple for trailing stop distance
UseStopTighteningbooltrueTighten stop after N bars. If the trade hasn’t reverted by bar 3, the thesis is weakening
StopTightenAfterint3Tighten stop after this many bars
TightenedStopATRfloat640.75ATR multiple for tightened stop
IsDynamicSizeboolfalsePosition sizing by risk pips and point value
RiskPipsint25Equity risk per trade in basis points (25 = 0.25%)

ratchet Inputs

InputTypeDefaultDescription
ERLengthint5Kaufman Efficiency Ratio lookback period
ERThresholdfloat640.618Minimum ER to qualify as a sharp move (0..1)
MomentumLengthint5Momentum lookback for move direction
RSILengthint2RSI period for entry/exit timing
RSIEntryLongfloat6420Enter long when RSI below this level
RSIEntryShortfloat6480Enter short when RSI above this level
UseTrendFilterbooltrueRequire trend alignment (close vs SMA)
TrendLengthint200SMA period for trend filter
RSIExitLongfloat6470Exit long when RSI above this level
RSIExitShortfloat6430Exit short when RSI below this level
MaxHoldBarsint10Maximum bars to hold a position
ATRStopLengthint20ATR lookback for stop loss calculation
ATRStopMultiplierfloat643ATR multiplier for stop loss distance
IsDynamicSizebooltruePosition sizing by risk pips and point value (1-4 contracts)
RiskPipsint25Equity risk per trade in basis points (25 = 0.25%)
UseBreakEvenboolfalseMove stop to breakeven after profit reaches BreakEvenATR * ATR (caution: creates friction drag on mean reversion)
BreakEvenATRfloat641.5ATR multiple of profit required to arm break-even stop
UseProfitTargetbooltrueExit at a fixed profit target of ProfitTargetATR * ATR
ProfitTargetATRfloat641.5ATR multiple for profit target
UseLimitEntrybooltrueUse limit orders instead of market orders for entry
LimitOffsetATRfloat640.5ATR offset from close for limit entry price
UseDollarTrailingboolfalseTrail stop from peak profit by TrailingATR * ATR
TrailingATRfloat641.5ATR multiple for dollar trailing stop distance
UseStopTighteningboolfalseEnable progressive stop tightening after N bars
StopTightenAfterint3Tighten stop after this many bars in a trade
TightenedStopATRfloat641.5ATR multiple for tightened stop (replaces ATRStopMultiplier after StopTightenAfter bars)

whiplash Inputs

Based on the paper “Filtered Market Statistics and Technical Trading Rules” by Z. George Yang (SSRN 2260609, 2013). The strategy filters out “nearly flat” days using a VIX-derived threshold, then counts consecutive “essential” up or down days. After RunsLength consecutive essential down days the strategy goes long (mean reversion); after RunsLength consecutive essential up days it goes short.

The strategy automatically loads VIX index data ($VIXCLS from FRED) as a secondary series and requires the primary symbol to use daily bars.

InputTypeDefaultDescription
RunsLengthint2Number of consecutive essential days in the same direction required to trigger a position switch
VixFilterPctfloat640.22Filter threshold as a fraction of daily implied volatility from VIX. Threshold d = VixFilterPct × VIX / (100 × √252)
MaxHoldBarsint7Exit all positions after this many bars since the most recent entry. Mean reversion edge decays rapidly; trades held beyond ~10 bars have a >70% loss rate. Set to 0 to disable
VixCeilingfloat640Suppress new entries when VIX exceeds this level. Disabled by default (0). Caution: also blocks profitable recovery bounces during high-VIX regimes
WaitBarsAfterLoserint5Suppress new entries for N bars after a losing trade closes. Prevents repeated entries into a sustained selloff. Set to 0 to disable
TrendSMALengthint0SMA period for trend filter (long only when close > SMA, short only when close < SMA). Disabled by default; testing shows it hurts mean reversion strategies
NoPyramidWhenLosingboolfalseSuppress pyramiding when the open position is underwater. Disabled by default
VixSpikeLookbackint0Bars over which to measure VIX rate of change. Suppresses entries during rapid VIX spikes. Set to 0 to disable
VixSpikeThresholdfloat640.60Block entries when VIX has risen by more than this fraction (0.60 = 60%) over VixSpikeLookback bars
ATRStopMultiplierfloat640ATR-based stop loss multiplier. Set to 0 to disable. Caution: tight stops hurt mean reversion trades which naturally have large adverse excursion before recovering
ATRStopLengthint20ATR lookback period for stop loss calculation

blackbird Inputs

A long convexity tail-risk hedging strategy designed to run alongside mean-reversion strategies like whiplash. It manufactures an options-like payoff from linear futures: frequent small losses (the “insurance premium”) punctuated by large gains during sudden market crashes.

The strategy requires two conditions to enter short: (1) VIX must have accelerated recently (risen by VixROCThreshold over VixROCLen bars), and (2) confirming signals must fire — by default BOTH a Donchian channel breakdown AND a momentum collapse (price ROC exceeding MomoThreshold standard deviations below its mean) must trigger simultaneously. This dual-confirmation approach dramatically reduces false signals.

All exits use close prices only (no intrabar stops). During crash-period volatility, intraday swings are extreme and would trigger conventional stops even on directionally correct trades. Instead, the strategy uses a close-price adverse-move stop, a time-based stop for unprofitable trades, and an ATR-based trailing stop that activates once the trade is significantly profitable.

The strategy automatically loads VIX index data ($VIXCLS from FRED) as a secondary series and requires the primary symbol to use daily bars.

InputTypeDefaultDescription
VixROCLenint3Lookback in bars for measuring VIX rate of change
VixROCThresholdfloat640.30Fractional VIX rise required (0.30 = 30% over VixROCLen bars)
VixAccelMemoryint3Bars that a VIX acceleration signal remains valid for confirmation
DonchianLenint20Donchian low channel lookback for the price breakdown trigger
MomoROCLenint5Price rate-of-change lookback for momentum collapse trigger
MomoStdDevLenint60Lookback for ROC mean/stddev used to compute the z-score
MomoThresholdfloat643.5Z-score threshold: entry when price ROC is this many standard deviations below mean
ATRLenint14ATR lookback period
StopATRMultfloat642.0Close-price stop distance in ATR multiples. Evaluated on close only (not intrabar)
TimeStopBarsint1Exit after this many bars if trade is not profitable
TrailActivateATRfloat643.0Profit in ATR multiples required to activate the trailing stop
TrailATRMultfloat643.0Trailing stop width in ATR multiples above the lowest close since entry
MaxHoldBarsint15Maximum bars to hold any position
CooldownBarsint12Minimum bars between entries
VixMinForEntryfloat6422Suppress entries when VIX is below this level
MaxPriorDropPctfloat640.07Suppress entry when price has already dropped more than this percentage over the last MaxPriorDropBars bars. Avoids entering short after a fast crash has already played out and a bounce is imminent
RequireBothConfirmationsbooltrueWhen true, requires BOTH Donchian breakdown AND momentum collapse. When false, either one suffices
MaxPriorDropBarsint10Lookback period for the prior-drop filter

slowcrash Inputs

A long convexity strategy that complements blackbird by targeting grinding, multi-week selloffs rather than sharp 1-3 day crashes. The key insight: by the time lagging indicators confirm a grinding selloff, it’s often near its bottom. Instead, this strategy enters early when persistent fear first appears, accepts a fixed insurance premium if wrong, and rides the trend if the selloff develops.

Entry requires five simultaneous conditions:

  1. Persistent VIX elevation — VIX must have been above VixThreshold for at least VixPersistBars consecutive bars, signalling structural fear rather than a transient spike.
  2. VIX still rising — VIX must be higher than it was VixRisingLen bars ago, filtering out post-crisis periods where VIX is elevated but declining (normalizing).
  3. Price below SMA — Close must be below its PriceSMALen-bar simple moving average, confirming the market is in a downtrend.
  4. Trend still active — Close must be lower than it was SlopeLen bars ago, confirming the trend hasn’t stalled or reversed.
  5. Not bouncing — Close must not have risen more than BounceMaxPct from its recent low, preventing entry after a V-bounce when VIX is still residually elevated.

All exits use close prices only (no intrabar stops). The strategy uses a wide ATR-based stop (the “insurance premium”), a trailing stop that activates after significant profit, and a maximum hold period. Unlike blackbird, there is no time stop — grinding selloffs produce daily bounces that would trigger time-based exits prematurely.

The strategy automatically loads VIX index data ($VIXCLS from FRED) as a secondary series and requires the primary symbol to use daily bars.

InputTypeDefaultDescription
VixThresholdfloat6425VIX level that must be sustained for entry
VixPersistBarsint7Consecutive bars VIX must remain above VixThreshold
VixRisingLenint15Lookback for VIX rising check. VIX must be higher than this many bars ago. Set to 0 to disable
PriceSMALenint40SMA period. Close must be below this SMA
SlopeLenint10Trend direction lookback. Close must be lower than SlopeLen bars ago
BounceMaxPctfloat640.05Maximum bounce from recent low (5% = 0.05). Set to 0 to disable
ATRLenint14ATR lookback period
StopATRMultfloat643.0Close-price stop distance in ATR multiples (the insurance premium)
TrailActivateATRfloat643.5Profit in ATR multiples required to activate trailing stop
TrailATRMultfloat642.0Trailing stop width in ATR multiples above lowest close since entry
MaxHoldBarsint30Maximum bars to hold any position
CooldownBarsint60Minimum bars between entries. Long cooldown prevents repeated losses during the same volatile period

Turtle Trading

StrategyDescription
turtle-original-1Original Turtle System 1
turtle-original-2Original Turtle System 2
turtle-kmgModified Turtle system

Multi-Timeframe

StrategyDescription
mrftMulti-resolution framework trading
lookawayMulti-timeframe analysis
weeklyWeekly timeframe strategy

mrft Inputs

InputTypeDefaultDescription
ExitPriceLookBackBarsint1Lookback bars for exit price reference
IsDynamicSizebooltrueEnable risk-parity position sizing based on equity and point value (floor 1, ceiling 4 contracts)
RiskPipsint25Risk per trade in basis points (25 = 0.25%); only used when IsDynamicSize is true
WaitBarsAfterLoserint00–20

Utility and Analysis

StrategyDescription
buyholdBuy and hold baseline
barsBar analysis
randomiseRandom signal generator (for baseline comparison)
edgefinderEdge detection
contindexContinuous contract index

Regime and Volatility

StrategyDescription
regimeRegime filter
regimefilterAdditional regime filtering
volatilityVolatility-based strategy

Use algo strategies -i <name> to see the inputs for any strategy.