Explore Custom Trading Strategies with Practical Code Examples
Browse example strategy implementations and reuse the patterns that fit your approach. Each page links to a runnable snippet that shows how the indicators are wired into entry and exit logic.
Code examples for custom strategies
📄️ Adx Ichimoku
This strategy uses the Average Directional Index (ADX) and Ichimoku Kinko Hyo to identify momentum-based entry and exit signals.
📄️ Chaikin
This mean reversion example builds moving average envelopes from a 20-period simple moving average with a 2.5% offset. It also computes a Chaikin-style oscillator by calculating ADL and two EMAs, then logs the current envelope values and oscillator reading.
📄️ Contrarian
This contrarian example calculates Stochastic K/D and Williams %R from the last 14 candles. It logs those values and only evaluates entries after an 8-second cooldown to avoid rapid repeat orders.
📄️ Detrended Choppiness
This strategy uses the Choppiness Index and the Detrended Price Oscillator (DPO) to generate entry and exit signals.
📄️ Elder Ray
This strategy uses two indicators, the Elder-Ray Index and the Zig Zag indicator, to generate entry and exit signals.
📄️ Ergodic
The Ergodic Oscillator identifies trend reversals by comparing fast and slow moving averages and smoothing the result.
📄️ Fibonacci
This day trading strategy combines Fibonacci retracements with the Stochastic oscillator to look for entry and exit points. It uses retracement levels as potential support/resistance and Stochastic thresholds for momentum signals. The script computes both indicators without built-in methods and logs the indicator values and trade conditions for review.
📄️ Gann Williams
This strategy uses the Gann Fan and Williams Fractal indicators for entry and exit signals to identify potential trends in the price movement of a security.
📄️ Keltner Channel
This breakout example calculates Keltner Channels from typical price and ATR, plus On-Balance Volume from candle close changes. It logs the current channel values, OBV, and recent candle data before evaluating entries.
📄️ Klinger
The Mass Index looks for trend reversals by analyzing the range between high and low prices and comparing moving averages of that range. The Klinger Oscillator is a volume-based indicator that compares money flow over time using short- and long-term volume averages. This strategy combines both indicators so the Klinger signal can confirm Mass Index reversal signals before entries or exits.
📄️ Macd Donchian
This strategy combines Moving Average Convergence Divergence (MACD) and Donchian Channels to identify trends and generate entry and exit signals.
📄️ Mccellan Aroon
This strategy uses two indicators, the McClellan Summation Index and the Aroon indicator, to generate entry and exit signals. The example calculates both indicators directly and logs the outputs and conditions.
📄️ Parabolic Sar
This strategy is a short-term scalping approach that aims to capture small price moves using the Parabolic SAR and Commodity Channel Index (CCI) for entry and exit signals.
📄️ Range Trading
This range trading strategy uses the Relative Strength Index (RSI) and Bollinger Bands to target price moves within a defined range. The RSI gauges momentum to flag overbought or oversold conditions, while Bollinger Bands define upper and lower range boundaries based on volatility.
📄️ Rsi
This strategy uses the Relative Strength Index (RSI) to time entries and exits. RSI is a momentum oscillator that gauges the speed and change of price movement; readings above 70 are commonly treated as overbought, while readings below 30 are commonly treated as oversold. The script focuses on custom indicator calculations to inform trading decisions.
📄️ Rsi Ma
This strategy uses technical analysis to identify entry and exit signals for a position trade. It relies on moving averages and the Relative Strength Index (RSI) to generate those signals.
📄️ Swing Trading Macd Bb
This swing trading strategy combines Bollinger Bands and MACD to generate entry and exit signals. Bollinger Bands gauge volatility for potential buy/sell zones, while MACD highlights momentum shifts. The script logs indicator values and trade conditions to make decisions traceable and easier to review.
📄️ Time Series Balance Of Power
This strategy uses two indicators, the Time Series Forecast (TSF) and the Balance of Power (BOP), to generate buy and sell signals.
📄️ Vwap Ad
This strategy combines Volume Weighted Average Price (VWAP) with Accumulation/Distribution (AD) to generate entry and exit signals. VWAP estimates a volume-weighted average price, while AD links price and volume to gauge accumulation or distribution pressure. The script uses both indicators together to decide when to buy or sell.
📄️ Willams
This contrarian example uses Stochastic K, a three-period average for D, and Williams %R from the last 14 candles. It logs the indicator values and current bag status, then evaluates entries after an 8-second cooldown to prevent rapid repeat orders.