Indicator · Pine Script v5 · On the chart

Jens Rabe Academy - Indicator 1

by klevler

Jens Rabe Academy - Indicator 1 combines multiple trend and market condition tools directly on the main price chart.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code121
Settings10inputs
LicenceMIT
Last update2 years ago27 Apr 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

121 lines of Pine Script v5 from indicators/JR/jra.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

jra.pine
//@version=5
indicator("Jens Rabe Academy - Indicator 1", overlay=true, shorttitle="JRA 1")

// Common Inputs
showDDayAndLabel = input(true, "Show D-Day Marker and Label")
showClimaxes = input(true, "Show Buying/Selling Climaxes")
show52WeekHighLow = input(true, "Show 52-Week High/Low")
showEma10 = input(true, "Show 10 EMA")
showEma21 = input(true, "Show 21 EMA")
showSma30 = input(true, "Show 30 SMA")
showSma40 = input(true, "Show 40 SMA")
showSma50 = input(true, "Show 50 SMA")
showSma150 = input(true, "Show 150 SMA")
showSma200 = input(true, "Show 200 SMA")

var float weekly_ema21 = na
var float prev_weekly_close = na
var bool allowDDays = true
var float dday_count = 0.0
var float dday_count_temp = 0.0  // Neue Zeile hier

weekly_ema21 := request.security(syminfo.tickerid, "W", ta.ema(close, 21), lookahead=barmerge.lookahead_on)
prev_weekly_close := request.security(syminfo.tickerid, "W", close[1], lookahead=barmerge.lookahead_on)

if (ta.change(time("W")) != 0)
    allowDDays := prev_weekly_close > weekly_ema21

// D-Day Logik
is_dday = close < close[1] * 0.998 and volume > volume[1] and timeframe.isdaily and allowDDays

// Zustand aktualisieren und math.sum aufrufen
dday_count_temp := math.sum(is_dday ? 1 : 0, 25)  // Aktualisierung hier
if (allowDDays)
    dday_count := dday_count_temp
else
    dday_count := 0


// Zeichnet den D-Day Marker, wenn D-Days erlaubt sind
plotchar(is_dday and showDDayAndLabel, title="D-Day Marker", char="D", location=location.abovebar, color=color.black, size=size.tiny)


// EMA Logic
length21 = 21
ema21 = ta.ema(close, length21)
var float counterAbove = 0.0
var float counterBelow = 0.0

if (barstate.isconfirmed)
    if (close > ema21)
        counterAbove := counterAbove + 1
        counterBelow := 0
    else
        counterBelow := counterBelow + 1
        counterAbove := 0

// Additional MAs
ema10 = ta.ema(close, 10)
sma30 = ta.sma(close, 30)
sma40 = ta.sma(close, 40)
sma50 = ta.sma(close, 50)
sma150 = ta.sma(close, 150)
sma200 = ta.sma(close, 200)

// Climax Logic
length52 = 52
highestHigh = ta.highest(high, length52)
lowestLow = ta.lowest(low, length52)
highestHighPrev = ta.highest(high[1], length52)
lowestLowPrev = ta.lowest(low[1], length52)

buyingClimax = high > highestHighPrev and close < open and timeframe.isweekly
sellingClimax = low < lowestLowPrev and close > open and timeframe.isweekly


// 52-Week High/Low Logic für den Tageschart
length52Weeks = 260 // 52 Wochen * 5 Tage
highestHigh52 = ta.highest(high, length52Weeks)
lowestLow52 = ta.lowest(low, length52Weeks)
short_length = 40


// Hole die Werte vom Tageschart
highestHigh52_daily = request.security(syminfo.tickerid, "D", highestHigh52)
lowestLow52_daily = request.security(syminfo.tickerid, "D", lowestLow52)

// Zeichnet kürzere Linien für das 52-Wochen-Hoch und -Tief auf dem aktuellen Chart
if (barstate.islast and show52WeekHighLow)
    line.new(x1=bar_index-short_length, y1=highestHigh52_daily, x2=bar_index, y2=highestHigh52_daily, color=color.red, width=2)
    line.new(x1=bar_index-short_length, y1=lowestLow52_daily, x2=bar_index, y2=lowestLow52_daily, color=color.green, width=2)

// Combined Label
var label labelID = na
if (na(labelID) == false)
    label.delete(labelID)

labelText = ""
if (counterAbove > 0)
    labelText := "über EMA: +" + str.tostring(counterAbove)
if (counterBelow > 0)
    labelText := "unter EMA: -" + str.tostring(counterBelow)
if (timeframe.isdaily)
    labelText := labelText + "\nD-Days: " + str.tostring(dday_count)

var color labelColor = na
labelColor := counterAbove > 0 ? color.green : (counterBelow > 0 ? color.red : na)

if (showDDayAndLabel and labelText != "")
    labelID := label.new(x=bar_index +1, y=close, text=labelText, color=labelColor, textcolor=color.white, xloc=xloc.bar_index, yloc=yloc.price, size=size.normal, style=label.style_label_left)

// Plotting
plot(showEma10 ? ema10 : na, color=color.black, title="10 EMA", linewidth=2)
plot(showEma21 ? ema21 : na, color=color.green, title="21 EMA", linewidth=2)
plot(showSma30 ? sma30 : na, color=color.blue, title="30 SMA", linewidth=2)
plot(showSma40 ? sma40 : na, color=color.yellow, title="40 SMA", linewidth=2)
plot(showSma50 ? sma50 : na, color=color.orange, title="50 SMA", linewidth=2)
plot(showSma150 ? sma150 : na, color=color.purple, title="150 SMA", linewidth=2)
plot(showSma200 ? sma200 : na, color=color.red, title="200 SMA", linewidth=2)
plotchar(is_dday and showDDayAndLabel, title="D-Day Marker", char="D", location=location.abovebar, color=color.black, size=size.tiny)
plotchar(buyingClimax and showClimaxes, title="Buying Climax", char="B", location=location.abovebar, color=color.red, size=size.tiny)
plotchar(sellingClimax and showClimaxes, title="Selling Climax", char="S", location=location.belowbar, color=color.green, size=size.tiny)

Overview

Jens Rabe Academy - Indicator 1 calculates exponential moving averages (10, 21) and simple moving averages (30, 40, 50, 150, 200), identifies distribution days (D-Days) based on volume and price drops, detects buying and selling climaxes, and plots current 52-week high and low lines. A dynamic chart label tracks consecutive bars trading above or below the 21 EMA. Note that the script uses lookahead in higher-timeframe security calls.

Details

Published by

klevler on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Moving averages, Trend, Volume, Support & resistance

Markets

Stocks

Timeframes

M15-H1, H4 and above

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show D-Day Marker and LabelbooltrueshowDDayAndLabel
Show Buying/Selling ClimaxesbooltrueshowClimaxes
Show 52-Week High/Lowbooltrueshow52WeekHighLow
Show 10 EMAbooltrueshowEma10
Show 21 EMAbooltrueshowEma21
Show 30 SMAbooltrueshowSma30
Show 40 SMAbooltrueshowSma40
Show 50 SMAbooltrueshowSma50
Show 150 SMAbooltrueshowSma150
Show 200 SMAbooltrueshowSma200
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

IFA-VP Context

by eddiebelaval
7 stars

This indicator plots a fixed lookback Volume Profile alongside 20, 50, and 200 Simple Moving Averages directly on the price chart. It highlights trend changes via moving average crosses and marks Point of Control reactions, High Volume Nodes, and Value Area bo

Indicator v6 VolumeSupport & resistance
Updated 3 months ago · None stated GitHub repository of IFA-VP Context

This indicator overlays multiple technical analysis tools onto the main price chart to establish multi-filter trend confluence. It calculates dual anchored VWAPs, dual Supertrend indicators, moving averages, Kijun-sen Donchian midlines, and weekly pivot points

Indicator v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of Ichimoku Cloud with Donchian Channels

EMA & PVSR Master MP

by midngtpickle
2 stars

This indicator unifies Price Volume Spread Analysis (PVSRA) with a suite of moving averages and VWAP. It calculates volume classifications—flagging climax, above-average, and regular bars—and projects synchronized candle coloring, six customizable EMAs, three

Indicator v6 Moving averagesVolume
Updated 4 weeks ago · Custom licence GitHub repository of EMA & PVSR Master MP

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers