Algorithmic Strategies

๐Ÿ“Š Complete Technical Indicators & Trading Strategies Guide

IndicatorTS (cinar/indicatorts) Reference Manual


  1. ๐Ÿ“‹ Strategy Framework
  2. ๐Ÿค– Built-in Trading Strategies
  3. ๐Ÿ“Š Signal Quick Reference

๐Ÿ“‹ Strategy Framework

The indicatorts library provides building blocks for building systematic trading strategies.

Core LLM + Trading Books

Chan, E. P. (2024). Generative AI for trading and asset management. Wiley. https://www.wiley.com/en-us/Generative+AI+for+Trading+and+Asset+Management-p-00421846

Noguer i Alonso, M. (2024). Large language models in finance: A hands-on guide to applying LLMs to trading, banking, and risk management. https://www.barnesandnoble.com/w/large-language-models-in-finance-miquel-noguer-i-alonso/1148475633

Applying LLM & generative AI in trading. (n.d.). Hands-On AI Trading. https://www.hands-on-ai-trading.com/chapters/09-applying-llm-generative-ai-in-trading

Essential ML + Quant Foundations

Lรณpez de Prado, M. (2018). Advances in financial machine learning. Wiley.

Hilpisch, Y. (2020). Python for algorithmic trading (2nd ed.). O'Reilly Media.

Chan, E. P. (2013). Algorithmic trading: Winning strategies and their rationale. Wiley.

๐Ÿ—๏ธ Core Components

๐Ÿ“Š Asset

The Asset interface represents price/volume data:

interface Asset {
  dates: Date[]           // Trading dates
  openings: number[]      // Opening prices
  closings: number[]      // Closing prices
  highs: number[]         // Period highs
  lows: number[]          // Period lows
  volumes: number[]       // Trading volumes
}

๐ŸŽฏ Action

Trading signals:

enum Action {
  SELL = -1              // Exit/short signal
  HOLD = 0               // No action
  BUY = 1                // Entry/long signal
}

๐Ÿ”„ Strategy Function

Converts indicators into actions:

type StrategyFunction = (asset: Asset) => Action[]

Takes price/volume data, applies indicators, returns buy/sell signals for each period.

๐Ÿ“ˆ Backtesting Metrics

  • Return: Total % gain/loss
  • Win Rate: % of profitable trades
  • Profit Factor: Gross profit / Gross loss
  • Sharpe Ratio: Risk-adjusted return (higher = better)
  • Max Drawdown: Largest peak-to-trough decline
  • Avg Trade: Average P&L per trade
  • Consecutive Losses: Largest losing streak

๐Ÿค– Built-in Trading Strategies

๐ŸŽฏ Trend-Following Strategies (10 strategies)

๐Ÿ“Š 1. MACD Strategy

  • Indicator: MACD (12/26/9 EMA)
  • Entry Rules:
    • ๐ŸŸข BUY: MACD crosses above Signal line OR above zero line
    • ๐Ÿ”ด SELL: MACD crosses below Signal line OR below zero line
  • Market conditions: Best in strong trending markets
  • Win rate typical: 40โ€“50% (longer winners)
  • Use case: Trend confirmation, momentum entry
  • Risk level: Medium

๐Ÿ“ˆ 2. Parabolic SAR Strategy

  • Indicator: PSAR (dots above/below price)
  • Entry Rules:
    • ๐ŸŸข BUY: SAR flips from above price to below (uptrend initiation)
    • ๐Ÿ”ด SELL: SAR flips from below price to above (downtrend initiation)
  • Market conditions: Excellent in trending, whipsaws in ranges
  • Win rate typical: 50โ€“60%
  • Use case: Trend following with mechanical stops
  • Risk level: Low (built-in trailing stop)

๐ŸŽช 3. APO Strategy

  • Indicator: Absolute Price Oscillator (14/30 EMA)
  • Entry Rules:
    • ๐ŸŸข BUY: APO crosses above zero
    • ๐Ÿ”ด SELL: APO crosses below zero
  • Market conditions: Trend-following, simpler than MACD
  • Win rate typical: 45โ€“55%
  • Use case: Momentum crossover without signal line lag
  • Risk level: Medium

๐Ÿ”ท 4. Aroon Strategy

  • Indicator: Aroon Up/Down oscillator
  • Entry Rules:
    • ๐ŸŸข BUY: Aroon Up crosses above Aroon Down, Aroon Up > 70
    • ๐Ÿ”ด SELL: Aroon Down crosses above Aroon Up, Aroon Down > 70
  • Market conditions: Trend strength identification
  • Win rate typical: 50โ€“60%
  • Use case: Trend reversal timing, strength confirmation
  • Risk level: Medium

โšซ 5. Vortex Strategy

  • Indicator: +VI / -VI (14 period)
  • Entry Rules:
    • ๐ŸŸข BUY: +VI crosses above -VI, +VI > 1.0
    • ๐Ÿ”ด SELL: -VI crosses above +VI, -VI > 1.0
  • Market conditions: Swing trading, trend confirmation
  • Win rate typical: 50โ€“65%
  • Use case: Trend direction clarity
  • Risk level: Low-Medium

๐ŸŽฏ 6. BOP Strategy - Balance of Power

  • Indicator: BOP ((C-O)/(H-L))
  • Entry Rules:
    • ๐ŸŸข BUY: BOP crosses above 0 or reaches +0.5
    • ๐Ÿ”ด SELL: BOP crosses below 0 or reaches -0.5
  • Market conditions: Short-term momentum
  • Win rate typical: 45โ€“55%
  • Use case: Quick momentum gauge
  • Risk level: Medium-High

๐ŸŸก 7. CFO Strategy - Chande Forecast Oscillator

  • Indicator: CFO (linear regression deviation)
  • Entry Rules:
    • ๐ŸŸข BUY: CFO crosses above 0 (price above forecast)
    • ๐Ÿ”ด SELL: CFO crosses below 0 (price below forecast)
  • Market conditions: Mean reversion tendency
  • Win rate typical: 50โ€“60%
  • Use case: Forecast-based reversal trading
  • Risk level: Medium

๐Ÿ”ถ 8. Typical Price Strategy

  • Indicator: Typical Price ((H+L+C)/3) + Moving Average
  • Entry Rules:
    • ๐ŸŸข BUY: Price crosses above Typical Price MA
    • ๐Ÿ”ด SELL: Price crosses below Typical Price MA
  • Market conditions: Smoothed price trading
  • Win rate typical: 50โ€“55%
  • Use case: Smooth trend following
  • Risk level: Medium

๐ŸŒŠ 9. VWMA Strategy - Volume Weighted MA

  • Indicator: VWMA (volume-weighted moving average)
  • Entry Rules:
    • ๐ŸŸข BUY: Price crosses above VWMA with volume confirmation
    • ๐Ÿ”ด SELL: Price crosses below VWMA on declining volume
  • Market conditions: Institutional trading flow
  • Win rate typical: 50โ€“60%
  • Use case: Volume-confirmed trends
  • Risk level: Medium

๐Ÿ“Š 10. KDJ Strategy - Random Index

  • Indicator: KDJ (K/D lines)
  • Entry Rules:
    • ๐ŸŸข BUY: K crosses above D from oversold (< 20), K < 20
    • ๐Ÿ”ด SELL: K crosses below D from overbought (> 80), K > 80
  • Market conditions: Mean reversion + momentum confirmation
  • Win rate typical: 55โ€“65%
  • Use case: Oversold/overbought with confirmation
  • Risk level: Medium

โšก Momentum Strategies (5 strategies)

๐Ÿ”ด 1. RSI-2 Strategy

  • Indicator: RSI (2 period) - extreme short-term momentum
  • Entry Rules:
    • ๐ŸŸข BUY: RSI2 < 5 (extreme oversold) bounces above 5
    • ๐Ÿ”ด SELL: RSI2 > 95 (extreme overbought) falls below 95
  • Market conditions: Mean reversion, intraday/daily bounces
  • Win rate typical: 80%+ (highest win rate indicator)
  • Use case: Quick bounce trading, scalping, tight stops
  • Risk level: Low (mean reversion has high % winners but small size)

๐ŸŸ  2. Stochastic Oscillator Strategy

  • Indicator: %K/%D (14/3/3)
  • Entry Rules:
    • ๐ŸŸข BUY: %K crosses above %D from oversold (< 20)
    • ๐Ÿ”ด SELL: %K crosses below %D from overbought (> 80)
  • Market conditions: Range-bound, mean reversion
  • Win rate typical: 60โ€“70%
  • Use case: Momentum bounce trading
  • Risk level: Medium

๐ŸŸก 3. Williams %R Strategy

  • Indicator: %R (-100 to 0)
  • Entry Rules:
    • ๐ŸŸข BUY: %R crosses above -80 (oversold)
    • ๐Ÿ”ด SELL: %R crosses below -20 (overbought)
  • Market conditions: Oscillator trading, mean reversion
  • Win rate typical: 60โ€“65%
  • Use case: Simple overbought/oversold trading
  • Risk level: Medium

๐Ÿ”ท 4. Awesome Oscillator Strategy

  • Indicator: AO (5-SMA vs 34-SMA of median price)
  • Entry Rules:
    • ๐ŸŸข BUY: AO crosses above zero, bars turn green and rising
    • ๐Ÿ”ด SELL: AO crosses below zero, bars turn red and falling
  • Market conditions: Intraday momentum, swing trading
  • Win rate typical: 55โ€“65%
  • Use case: Momentum divergence, bar color patterns
  • Risk level: Medium

๐ŸŒŠ 5. Ichimoku Cloud Strategy

  • Indicator: Multi-line cloud system (Tenkan/Kijun/Cloud)
  • Entry Rules:
    • ๐ŸŸข BUY: Price breaks above cloud + Tenkan > Kijun
    • ๐Ÿ”ด SELL: Price breaks below cloud + Tenkan < Kijun
  • Market conditions: Complete system for all conditions
  • Win rate typical: 50โ€“60% (but risk-reward often 1:2+)
  • Use case: Complete trading system, multi-timeframe
  • Risk level: Low-Medium (cloud = dynamic S/R)

๐Ÿ“Š Volatility Strategies (3 strategies)

๐ŸŸข 1. Bollinger Bands Strategy

  • Indicator: BB (20-SMA ยฑ 2 ฯƒ)
  • Entry Rules:
    • ๐ŸŸข BUY: Price closes above upper band on volume OR bounces off lower band
    • ๐Ÿ”ด SELL: Price closes below lower band on volume OR bounces off upper band
  • Market conditions: Breakouts AND mean reversion (context-dependent)
  • Win rate typical: 77.8% (one of most reliable)
  • Use case: Volatility extremes, band breakouts, squeeze/expansion
  • Risk level: Medium

๐Ÿ”ท 2. Acceleration Bands Strategy

  • Indicator: Acceleration Bands (dynamic volatility bands)
  • Entry Rules:
    • ๐ŸŸข BUY: Price breaks above upper band with volume
    • ๐Ÿ”ด SELL: Price breaks below lower band with volume
  • Market conditions: Volatility acceleration, breakout confirmation
  • Win rate typical: 55โ€“65%
  • Use case: Volatility-confirmed breakouts
  • Risk level: Medium

๐ŸŸ  3. Projection Oscillator Strategy

  • Indicator: PO (projection-based oscillator)
  • Entry Rules:
    • ๐ŸŸข BUY: PO crosses above zero or bounces from low
    • ๐Ÿ”ด SELL: PO crosses below zero or bounces from high
  • Market conditions: Advanced volatility analysis
  • Win rate typical: 50โ€“60%
  • Use case: Projection-based mean reversion
  • Risk level: Medium-High

๐Ÿ’ฐ Volume Strategies (6 strategies)

๐Ÿ“Š 1. CMF Strategy - Chaikin Money Flow

  • Indicator: CMF (14 period money flow index)
  • Entry Rules:
    • ๐ŸŸข BUY: CMF crosses above 0 (buying pressure > 50%)
    • ๐Ÿ”ด SELL: CMF crosses below 0 (selling pressure > 50%)
  • Market conditions: Volume-based confirmation
  • Win rate typical: 55โ€“65%
  • Use case: Volume trend confirmation, divergence trading
  • Risk level: Medium

๐Ÿ’ช 2. Force Index Strategy

  • Indicator: FI (raw volume ร— price change)
  • Entry Rules:
    • ๐ŸŸข BUY: FI crosses above 0 (volume supporting up)
    • ๐Ÿ”ด SELL: FI crosses below 0 (volume supporting down)
  • Market conditions: Raw volume momentum
  • Win rate typical: 55โ€“65%
  • Use case: Volume-driven momentum trading
  • Risk level: Medium

๐ŸŽฏ 3. Money Flow Index Strategy

  • Indicator: MFI (20 period, RSI using money flow)
  • Entry Rules:
    • ๐ŸŸข BUY: MFI < 20 and crosses back above 20
    • ๐Ÿ”ด SELL: MFI > 80 and crosses back below 80
  • Market conditions: Overbought/oversold with volume
  • Win rate typical: 60โ€“70%
  • Use case: Volume-weighted momentum extremes
  • Risk level: Medium

๐ŸŒŠ 4. Ease of Movement Strategy

  • Indicator: EMV (price movement / range / volume)
  • Entry Rules:
    • ๐ŸŸข BUY: EMV crosses above 0 (ease of upside movement)
    • ๐Ÿ”ด SELL: EMV crosses below 0 (ease of downside movement)
  • Market conditions: Relative ease of movement
  • Win rate typical: 50โ€“60%
  • Use case: Movement difficulty assessment
  • Risk level: Medium

๐Ÿ”ท 5. Negative Volume Index Strategy

  • Indicator: NVI (accumulation on down-volume)
  • Entry Rules:
    • ๐ŸŸข BUY: NVI rising above its moving average (smart money buying)
    • ๐Ÿ”ด SELL: NVI falling below MA (smart money selling)
  • Market conditions: Long-term accumulation/distribution
  • Win rate typical: 50โ€“60%
  • Use case: Smart money detection, long-term trends
  • Risk level: Low (position trading)

๐Ÿ“ˆ 6. VWAP Strategy - Volume Weighted Average Price

  • Indicator: VWAP (institutional fair price)
  • Entry Rules:
    • ๐ŸŸข BUY: Price bounces above VWAP with volume
    • ๐Ÿ”ด SELL: Price breaks below VWAP on volume
  • Market conditions: Intraday mean reversion, institutional trading
  • Win rate typical: 55โ€“65%
  • Use case: Intraday support/resistance, institutional levels
  • Risk level: Medium

๐Ÿ“Š Signal Quick Reference

โœ… Good Signal Examples by Category

CategoryIndicatorGood SignalExpected Setup
TrendMACDMACD > Signal + Histogram > 0Bullish momentum acceleration
TrendEMAPrice > EMA50 > EMA200Strong uptrend alignment
TrendPSARSAR flips below priceUptrend initiation
MomentumRSIRSI 40โ€“60 in trendHealthy momentum, not overbought
MomentumStoch%K bounces from < 20Oversold bounce setup
MomentumRSI-2RSI2 < 5 bouncingExtreme oversold mean reversion
VolatilityBBPrice breaks upper bandVolatility expansion breakout
VolatilityATRATR rising with breakoutLegitimate volatility increase
VolumeOBVOBV new high with priceVolume confirms uptrend
VolumeCMFCMF > 0.1Buying pressure > 50%
AdvancedIchimokuPrice > Cloud, Tenkan > KijunComplete bullish alignment

โŒ Bad Signal Examples by Category

CategoryIndicatorBad SignalWarning
TrendMACDMACD > Signal but decliningMomentum fading
TrendPrice vs MAPrice far above rising MAOverextension, mean reversion risk
MomentumRSIRSI stuck > 70 vs your positionOverbought against trade
MomentumDivergenceRSI higher high, price lower highBearish divergence, reversal risk
VolatilitySqueezeBB bands compress then spikeVolatile reversal probable
VolumeDivergencePrice new high, OBV flatWeak uptrend, distribution likely

๐ŸŽ“ Strategy Selection by Market Regime

Use Trend Strategies: MACD, Parabolic SAR, Aroon, Vortex

  • Focus on breakouts and continuation
  • Use ATR for volatility-adjusted stops
  • Ignore mean-reversion signals
  • Expect: 40โ€“50% win rate, large winners (risk/reward 1:2+)

๐Ÿ“Š Range-Bound/Ranging Market

Use Momentum Strategies: RSI-2, Stochastic, Williams %R

  • Focus on overbought/oversold fades
  • Use Bollinger Bands for support/resistance
  • Profit from bounces, not breakouts
  • Expect: 70%+ win rate, small winners (risk/reward 1:0.5โ€“1:1)

๐ŸŒŠ Volatile/Choppy Market

Use Volume Strategies: CMF, MFI, Force Index, VWAP

  • Focus on volume confirmation
  • Avoid large positions
  • Use tighter stops
  • Expect: 55โ€“65% win rate, medium risk/reward

๐Ÿ”„ Reversal/Transition Market

Use Oscillator + Divergence: CCI extremes, CMO divergence, Ichimoku cloud

  • Watch for indicators at extremes
  • Confirm with volume
  • Use multi-timeframe confirmation
  • Expect: 50โ€“60% win rate but high risk/reward 1:2โ€“1:3

๐Ÿ’ก Implementation Tips

  1. Combine Indicators: Don't rely on single indicator

    • Trend (MACD) + Momentum (RSI) + Volume (OBV)
    • Example: "MACD > 0 AND RSI 40โ€“70 AND OBV rising"
  2. Use Stops: Position size = Account Risk / (Stop Loss Distance)

    • ATR-based: Stop = Entry ยฑ (2 ร— ATR)
    • Support/Resistance-based: Stop = Recent swing low + buffer
    • Bollinger Bands: Stop = Outside band + ATR buffer
  3. Risk/Reward: Exit targets should exceed stop loss

    • Trend strategies: 1:2 or 1:3 (larger winners)
    • Mean reversion: 1:0.5 to 1:1 (small winners, high frequency)
  4. Timeframe Alignment: Confirm across multiple timeframes

    • Daily trend + 4H momentum + 1H entry
    • Weekly ADX > 25 (strong trend) filters out choppy daily
  5. Backtest: Always backtest before live trading

    • Use Strategy Stats and Compute Strategy Stats
    • Track: Win Rate, Profit Factor, Sharpe Ratio, Max Drawdown

On this page

๐Ÿ“Š Complete Technical Indicators & Trading Strategies Guide
IndicatorTS (cinar/indicatorts) Reference Manual
๐Ÿ“‹ Strategy Framework
Core LLM + Trading Books
Essential ML + Quant Foundations
๐Ÿ—๏ธ Core Components
๐Ÿ“Š Asset
๐ŸŽฏ Action
๐Ÿ”„ Strategy Function
๐Ÿ“ˆ Backtesting Metrics
๐Ÿค– Built-in Trading Strategies
๐ŸŽฏ Trend-Following Strategies (10 strategies)
๐Ÿ“Š 1. MACD Strategy
๐Ÿ“ˆ 2. Parabolic SAR Strategy
๐ŸŽช 3. APO Strategy
๐Ÿ”ท 4. Aroon Strategy
โšซ 5. Vortex Strategy
๐ŸŽฏ 6. BOP Strategy - Balance of Power
๐ŸŸก 7. CFO Strategy - Chande Forecast Oscillator
๐Ÿ”ถ 8. Typical Price Strategy
๐ŸŒŠ 9. VWMA Strategy - Volume Weighted MA
๐Ÿ“Š 10. KDJ Strategy - Random Index
โšก Momentum Strategies (5 strategies)
๐Ÿ”ด 1. RSI-2 Strategy
๐ŸŸ  2. Stochastic Oscillator Strategy
๐ŸŸก 3. Williams %R Strategy
๐Ÿ”ท 4. Awesome Oscillator Strategy
๐ŸŒŠ 5. Ichimoku Cloud Strategy
๐Ÿ“Š Volatility Strategies (3 strategies)
๐ŸŸข 1. Bollinger Bands Strategy
๐Ÿ”ท 2. Acceleration Bands Strategy
๐ŸŸ  3. Projection Oscillator Strategy
๐Ÿ’ฐ Volume Strategies (6 strategies)
๐Ÿ“Š 1. CMF Strategy - Chaikin Money Flow
๐Ÿ’ช 2. Force Index Strategy
๐ŸŽฏ 3. Money Flow Index Strategy
๐ŸŒŠ 4. Ease of Movement Strategy
๐Ÿ”ท 5. Negative Volume Index Strategy
๐Ÿ“ˆ 6. VWAP Strategy - Volume Weighted Average Price
๐Ÿ“Š Signal Quick Reference
โœ… Good Signal Examples by Category
โŒ Bad Signal Examples by Category
๐ŸŽ“ Strategy Selection by Market Regime
๐Ÿ“ˆ Strong Trending Market
๐Ÿ“Š Range-Bound/Ranging Market
๐ŸŒŠ Volatile/Choppy Market
๐Ÿ”„ Reversal/Transition Market
๐Ÿ’ก Implementation Tips
Algorithmic Strategies