Indicator · Pine Script v5 · On the chart

Jinni v1

by Hurairahengg· code credited to jinni-main

Jinni v1 is a Pine Script indicator that plots buy and sell signals on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code98
Settings7inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago31 Aug 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

98 lines of Pine Script v5 from PineScripts/Indicator.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Indicator.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jinni-main

//@version=5
indicator(title = "Jinni v1", shorttitle="Jinni", overlay=true)
sesd_ses = input.session('2100-0600', 'Sydney Session')
sesd_css = input.color(#ffeb3b, 'Sydney Color')
bg_transp = input.float(90, 'Transparency')

ema1 = input.int(34, minval=1, maxval=300, title="EMA UpTrend")
shema = input.bool(true, title="Show EMA Trend is Based On?")

usedEma = ta.ema(close, ema1)

len = input.int(65, minval=1)
src = input(close)
emaValue = ta.ema(src, len)

tz = 'UTC+0'
is_sesd = time(timeframe.period, sesd_ses, tz) != 0
extended_sesd = time(timeframe.period, '2100-0655', tz) != 0 // Extended by 55 minutes
friday = (dayofweek == dayofweek.friday)
stratime = time(timeframe.period, '1830-2100', tz) != 0

var box bx = na
var label lbl = na
var t = 0
var max = high
var min = low

if not extended_sesd[1] and extended_sesd
    t := time
    max := high
    min := low
    bx := box.new(bar_index, max, bar_index, min, bgcolor = color.new(sesd_css, bg_transp), border_color = sesd_css)
    lbl := label.new(t, max, 'Sydney', xloc = xloc.bar_time, textcolor = sesd_css, style = label.style_label_down, color = color.new(color.white, 100), size = size.tiny)

if extended_sesd
    max := math.max(high, max)
    min := math.min(low, min)
    box.set_top(bx, max)
    box.set_rightbottom(bx, bar_index, min)
    label.set_xy(lbl, int(math.avg(t, time)), max)

plotshape(is_sesd and not extended_sesd[1], location = location.bottom, color = sesd_css, style = shape.square, size = size.tiny)
plotshape(not extended_sesd and extended_sesd[1], location = location.bottom, color = sesd_css, style = shape.square, size = size.tiny)
plotshape(friday, location = location.top, color = color.red, style = shape.labeldown, text = "")
syd = extended_sesd

bad = (extended_sesd)
badbadbad = stratime

var bool upC = na
var bool downC = na
var bool upf = na
var bool downf = na

uptrend = src >= emaValue
downtrend = src < emaValue

upull = (close - open) >= 0.0025
downpull = (open - close) >= 0.0025

cmaup = close >= usedEma and open >= usedEma 
cmadown = close < usedEma and open < usedEma 

Up = cmaup and not bad and not badbadbad and upull and uptrend
Down = cmadown and not bad and not badbadbad and downpull and downtrend

upClose = cmadown     
downClose = cmaup    

if Up
    upf := true
    downf := false 
if Down 
    downf := true
    upf := false

if (upClose and not downf)
    upC := true
    downC := false 
if (downClose and not upf)
    downC := true
    upC := false
if (Up or Down)
    upC := false
    downC := false 

plotshape(series=(Up), location=location.belowbar, color=#15ff00, style=shape.circle,size=size.tiny, title="Buy Signal")
plotshape(series=(Down), location=location.abovebar, color=color.new(#ff6600, 0), style=shape.circle,size=size.tiny, title="Sell Signal")
plotshape(series=upC and not badbadbad, location=location.belowbar, color=#0084ff, style=shape.circle,size=size.tiny, title="Buy Signal")
plotshape(series=downC and not badbadbad, location=location.abovebar, color=color.new(#ffe600, 0), style=shape.circle,size=size.tiny, title="Sell Signal")

alertcondition(Up, title="Buy Signal", message="Buy Signal")
alertcondition(Down, title="Sell Signal", message="Sell Signal")
alertcondition(upC and not badbadbad, title="Buy Signal Condition", message="Buy Signal Condition Met")
alertcondition(downC and not badbadbad, title="Sell Signal Condition", message="Sell Signal Condition Met")

Overview

Jinni v1 calculates two EMAs, one on close with length 34 and another on input source with length 65, to detect uptrend and downtrend. Additional checks include candle direction, CMA status, and filters for Sydney session and other times. Signals appear as circles on or near bars, with green for buys and orange for sells. The main settings allow changing EMA lengths, session time, and color transparency. It draws signals directly on the price chart and sends alerts. Notable limits include possible repainting on the live bar and no built-in exit rules or position sizing.

Details

Published by

Hurairahengg on GitHub

Code credit

jinni-main, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend, Oscillators & momentum, Moving averages, Sessions & time

Markets

Forex

Timeframes

M1-M5

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

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

SettingTypeDefaultVariable
Sydney Sessionsession2100-0600sesd_ses
Sydney Colorcolor#ffeb3bsesd_css
Transparencyfloat90bg_transp
EMA UpTrendint34ema1
Show EMA Trend is Based On?booltrueshema
lenint65len
srcsourceclosesrc
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

1 stars

This indicator plots three exponential moving averages and shades London and New York session hours on the price chart. It generates buy and sell signals when the fast EMA crosses the slow EMA in the direction of the 200 EMA trend filter. Entries require confi

Indicator v6 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Señales Intradía EMA + MACD
948 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average
257 stars

Donald SPX - Options Trading is an overlay indicator designed for intraday SPX analysis. It plots a 200-period Weighted Moving Average (WMA) on the price chart while evaluating multi-timeframe market structure across Daily, 15-minute, 5-minute, and 2-minute ba

Indicator v5 Moving averagesTrend Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald SPX - Options Trading
218 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of TradersPost Trading Checklist

Daily Trend Filter

by agutinbaigo28
147 stars

Calculates market regime conditions by combining RSI, MACD, and ADX/DMI indicators. It evaluates whether the market is in a strong bullish, strong bearish, neutral, or non-trending regime. The script plots a colored line overlaying the close price to reflect t

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Daily Trend Filter

AAPP

by capissimo
114 stars

This indicator plots an adaptive moving average or scaled RSI divergence line directly on the price chart. It calculates dual RSI series to measure momentum divergence, scales the values to the chart's price range, and constructs an adaptive average filtered b

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of AAPP

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