0bps

Strategy vault / Momentum

Momentum 20

Momentum 2.0 is a normalized Momentum oscillator with a moving base-level. The oscillator value is normalized by its standard deviation, similar to the z-score technique. Instead of the zero level, the indicator uses…

Author
ChaoZhang
Complexity
Starter · 36 lines
Parameters
2
Backtest bar
30m · intraday
Tested on
BTC/USDT · futures

Momentum 2.0 is a normalized Momentum oscillator with a moving base-level. The oscillator value is normalized by its standard deviation, similar to the z-score technique. Instead of the zero level, the indicator uses the base-level calculated as the inverted long-term average value of the oscillator. Similar to the zero-level crossing signal used for the Momentum oscillator, our oscillator calculates the base level crossing signal. The moving base-level helps to reduce the number of false signals. In an uptrend the base-level is below zero, in a downtrend it is above it. This allows us to take into account the trend stability effect. In this case, to form a reversal signal, the oscillator must cross a lower value in an uptrend and a higher value in a downtrend.

HOW TO USE When the oscillator crosses above the base-level, it gives a bullish signal, when below it gives a bearish signal. The signals are displayed as green and red labels, respectively. The color of the histogram shows the current direction of the price momentum. Green indicates an upward move and red indicates a downward move. The blue line represents the base-level.

SETTINGS Oscillator Period - determines the period of the Momentum oscillator Base Level Period - determines the period used for long-term averaging when calculating the base-level and normalizing the oscillator

backtest

IMG

Parameters

NameDefaultWhat it controls
v_input_115Oscillator Period
v_input_int_1450Base Level Period

Source Pine Script

/*backtest
start: 2022-04-09 00:00:00
end: 2022-05-08 23:59:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © AstrideUnicorn

//@version=5
indicator("Momentum 2.0", overlay = false)

source = close

// Script Inputs 
window = input(defval=15, title="Oscillator Period")
base_level_window = input.int(defval=450, title="Base Level Period", minval=300)

// Calculate normalized and smoothed momentum oscillator
momentum = ta.mom(source, window) 
momentum_normalized = ( momentum ) / ta.stdev(momentum, base_level_window)
momentum_smoothed = ta.linreg(momentum_normalized, 30,0)

// Calculated the base-level
momentum_base = -ta.ema(momentum_normalized,base_level_window)

// Calculate base-level cross signals
bullish = ta.crossover(momentum_smoothed, momentum_base)  
bearish = ta.crossunder(momentum_smoothed, momentum_base) 

if bullish
    strategy.entry("Enter Long", strategy.long)
else if bearish
    strategy.entry("Enter Short", strategy.short)

Published by ChaoZhang on the FMZ strategy square · last modified 2022-05-10. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Momentum-20.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open