Indicator · Pine Script v5 · On the chart

Jinni v1

by Hurairahengg· code credited to jinni-main

Jinni v1 is an overlay indicator that highlights the Sydney trading session and plots buy or sell signals based on dual exponential moving average trends.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code68
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

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

closetrades.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-0720', tz) != 0 // Extended by 1 hour and 20 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) 
badbad = friday
badbadbad = stratime

uptrend = src >= emaValue
downtrend = src < emaValue

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

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

Up = cmaup and not bad and not badbad and not badbadbad and upull
Down = cmadown and not bad and not badbad and not badbadbad and downpull

plotshape(series=(Up and uptrend), location=location.belowbar, color=#00c3ff, style=shape.circle,size=size.tiny, title="Buy Signal")
plotshape(series=(Down and downtrend), location=location.abovebar, color=#cdcf3c, style=shape.circle,size=size.tiny, title="Sell Signal")

Overview

Jinni v1 draws a dynamic box around the Sydney session price range and applies time filters to exclude Fridays and restricted hours. Signal shapes appear above or below bars when price aligns with both the 34-period and 65-period EMAs and meets a minimum candle price change threshold outside excluded session times.

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

Sessions & time, Moving averages, Trend

Markets

Forex

Timeframes

M1-M5, M15-H1

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

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

Market Monitor - 15m

by chris-c-thomas
14 stars

Market Monitor - 15m is a directional bias chart overlay designed for 15-minute intraday chart analysis. It calculates a triple exponential moving average ribbon with EMA cloud shading, session VWAP with multiplier bands, prior day levels, a 30-minute opening

Indicator v6 TrendMoving averages
Updated 6 months ago · MIT GitHub repository of Market Monitor - 15m

Pivot Trendlines

by g-moe
3 stars

This indicator identifies pivot highs and lows using a swing lookback period and connects them with trendlines on the price chart. It generates long and short entry signals when price moves through predefined percentage thresholds in three steps for buy and se

Indicator v5 TrendSupport & resistance
Updated 5 months ago · None stated GitHub repository of Pivot Trendlines

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