OPEN-SOURCE SCRIPT

Median Kijun-Sen [InvestorUnknown]

The Median Kijun-Sen is a versatile technical indicator designed for both trend-following strategies and long-term market valuation. It incorporates various display modes and includes a backtest mode to simulate its performance on historical price action.

Key Features:

1. Trend-Following and Long-Term Valuation:
  • The indicator is ideal for trend-following strategies, helping traders identify entry and exit points based on the relationship between price and the Kijun-Sen calculated from median price (customizable price source).
  • With longer-term settings, it can also serve as a valuation tool (in oscillator display mode), assisting in identifying potential overbought or oversold conditions over extended timeframes.


snapshot

2. Display Modes:
The indicator can be displayed in three main modes, each serving a different purpose:
  • Overlay Mode: Plots the Median Kijun-Sen directly over the price chart, useful for visualizing trends relative to price action.
  • Oscillator Mode: Displays the oscillator that compares the current price to the Median Kijun-Sen, providing a clearer signal of trend strength and direction


snapshot

  • Backtest Mode: Simulates the performance of the indicator with different settings on historical data, offering traders a way to evaluate its reliability and effectiveness without needing TradingView's built-in strategy tool


snapshot

3. Backtest Functionality:
  • The inbuilt backtest mode enables users to evaluate the indicator's performance across historical data by simulating long and short trades. Users can customize the start and end dates for the backtest, as well as specify whether to allow long & short, long only, or short only signals.
  • This backtest functionality mimics TradingView's strategy feature, allowing users to test the effectiveness of their chosen settings before applying them to live markets.




snapshot

4. Hint Table for Pane Suggestions:
An inbuilt hint table guides users on how to best visualize the indicator in different display modes:
  • For Overlay Mode, it is recommended to use the same pane as the price action.
  • For Oscillator and Backtest Modes, it is advised to plot them in a separate pane for better clarity.

This table also provides step-by-step instructions on how to move the indicator to a different pane and adjust scaling, making it user-friendly.

snapshot


Potential Weakness
  • One of the key drawbacks is the indicator’s tendency to produce false signals during price consolidations, where price action lacks clear direction and may trigger unnecessary trades. This is particularly noticeable in markets with low volatility.


Alerts
  • The indicator includes alert conditions for when it crosses above or below key levels, enabling traders to receive notifications of LONG or SHORT signals.



Summary
  • The Median Kijun-Sen is a highly adaptable tool that serves multiple purposes, from trend-following to long-term valuation. With its customizable settings, backtest functionality, and built-in hints, it provides traders with valuable insights into market trends while allowing them to optimize the indicator to their specific strategy.
  • This versatility, however, comes with the potential weakness of false signals during consolidation phases, so it's most effective in trending markets.
educationalOscillatorsTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer