Strategy · Pine Script v4 · On the chart

ARR-Pivote-India-Stategy

by hasnocool· code credited to arameshraju

An intraday trading strategy that calculates daily pivot points, support and resistance levels, previous day high/low, and typical price.

View on GitHub

Repaints

GitHub stars106on the repository
Pine versionv4older, still runs
Lines of code101
Settings11inputs
LicenceGPL-3.0
Last update2 years ago18 Sep 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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

101 lines of Pine Script v4 from ARR-Pivote-India-Stategy.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

ARR-Pivote-India-Stategy.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © arameshraju
//Reference credit goes to All
//@version=4
strategy("ARR-Pivote-India-Stategy",shorttitle="ARR-PP-Ind", overlay=true)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © arameshraju
//User Input
showPrevDayHighLow = input(false, title="Show previous day's High & Low(PDH/PDL)", type=input.bool)
showPivoteLine = input(true, title="Show Pivot Point(PP)", type=input.bool)
showPivoteR1Line = input(false, title="Show Pivot Point Resistance (R1)", type=input.bool)
showPivoteS1Line = input(false, title="Show Pivot Point Support (S1)", type=input.bool)
showTypicalPriceLine = input(true, title="Show True Price", type=input.bool)
tradeLong = input(true, title="Trade on Long Entry", type=input.bool)
tradeShort = input(false, title="Trade on Short Entry", type=input.bool)
maxLoss = input(0.5, title="Max Loss on one Trade", type=input.float)
tradeOn=input(title="Trade base Level", type=input.string,
     options=["PP", "PDH", "PDL","R1","S1"], defval="PP")
closeHrs = input(13, title="Close all trade @ Hours", type=input.integer)
sessSpec = input("0915-1530", title="Session time", type=input.session)
// Defaults
// Colors
cColor = color.black
rColor = color.red
sColor = color.green
// Line style & Transparency
lStyle = plot.style_line
lTransp = 35
// Get High & Low
getSeries(_e, _timeFrame) => security(syminfo.tickerid, _timeFrame, _e, lookahead=barmerge.lookahead_on) 
is_newbar(res, sess) =>
    t = time(res, sess)
    na(t[1]) and not na(t) or t[1] < t
newbar = is_newbar("375", sessSpec)
// Today's Session Start timestamp
y = year(timenow)
m = month(timenow)
d = dayofmonth(timenow)
// Start & End time for Today
start = timestamp(y, m, d, 09, 15)
end = start + 86400000
PrevDayHigh = getSeries(high[1], 'D')
PrevDayLow = getSeries(low[1], 'D')
PrevDayClose = getSeries(close[1], 'D')
PivoteLine=(PrevDayHigh+PrevDayLow+PrevDayClose) /3
PivoteR1=(PivoteLine*2) -PrevDayLow
PivoteS1=(PivoteLine*2) -PrevDayHigh
orbPrevDayOpen = getSeries(open[1], 'D')
orbPrevDayClose = getSeries(close[1], 'D')
//** True Price
TypicalPrice=(high[1]+low[1]+close[1])/3
//Preview Day High line
_pdh = line.new(start, PrevDayHigh, end, PrevDayHigh, xloc.bar_time, color=color.red, style=line.style_solid, width=2)
line.delete(_pdh[1])
_pdl = line.new(start, PrevDayLow, end, PrevDayLow, xloc.bar_time, color=color.green, style=line.style_solid, width=2)
line.delete(_pdl[1])
_Pp = line.new(start, PrevDayLow, end, PrevDayLow, xloc.bar_time, color=color.green, style=line.style_dashed, width=2)
line.delete(_Pp[1])
//Previous Day Low Line
l_pdh = label.new(start, PrevDayHigh, text="PD", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none)
label.delete(l_pdh[1])
l_pdl = label.new(start, PrevDayLow, text="PD", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none)
label.delete(l_pdl[1])
//Pivote Line
l_pp = label.new(start, PivoteLine, text="PP", xloc=xloc.bar_time, textcolor=color.black, style=label.style_none)
label.delete(l_pp[1])
l_R1 = label.new(start, PivoteR1, text="R1", xloc=xloc.bar_time, textcolor=color.fuchsia, style=label.style_none)
label.delete(l_pp[1])
l_SR = label.new(start, PivoteS1, text="S2", xloc=xloc.bar_time, textcolor=color.navy, style=label.style_none)
label.delete(l_pp[1])
plot(showTypicalPriceLine?TypicalPrice:na , title='TP', color=rColor)
plot(showPrevDayHighLow?PrevDayHigh:na , title=' PDH', color=rColor)
plot(showPrevDayHighLow?PrevDayLow:na, title=' PDL', color=sColor)
plot(showPivoteLine?PivoteLine:na, title=' PP', color=color.black)
plot(showPivoteR1Line?PivoteR1:na, title=' R1', color=color.fuchsia)
plot(showPivoteS1Line?PivoteS1:na, title=' S1', color=color.navy)
// Today's Session Start timestamp
// Start & End time for Today
//endTime = timestamp(t, m, d, 15, 00)
tradeEventPrice= if string("PDH")==tradeOn 
    PrevDayHigh
else if string("PDL")==tradeOn
    PrevDayLow
else if string("R1")==tradeOn
    PivoteR1
else if string("S1")==tradeOn
    PivoteS1
else if string("TR")==tradeOn
    TypicalPrice    
else
    PivoteLine
//tradeEventPrice=PrevDayHigh
if (open < tradeEventPrice) and ( close >tradeEventPrice ) and ( hour < (closeHrs-2)  ) and tradeLong
    strategy.entry("buy", strategy.long, 1, when=strategy.position_size <= 0)
if (open > tradeEventPrice) and ( close <tradeEventPrice ) and ( hour < (closeHrs-2)  ) and  tradeShort
    strategy.entry("Sell", strategy.short, 1, when=strategy.position_size <= 0)
mxloss=orbPrevDayClose*maxLoss
strategy.exit("exit", "buy",  loss = mxloss) 
strategy.exit("exit", "Sell",  loss = mxloss) 
strategy.close_all(when =   hour == closeHrs   , comment = "close all entries")
Expand (137 lines)

Overview

Designed around specific trading sessions like Indian market hours (09:15 to 15:30), it draws key reference levels directly on the main price chart. Users can select directional bias for long or short entries based on selected pivot levels, and automatically close open positions at a specified hour. Historical calculations utilize higher-timeframe data with lookahead enabled.

Details

Published by

hasnocool on GitHub

Code credit

arameshraju, as written in the script's header

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Support & resistance, Sessions & time

Markets

Stocks, Indices

Timeframes

M15-H1

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Topics

analysisbtcusdtcryptocurrencydatapandaspythonsimulationtradingtradingview

Settings

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

SettingTypeDefaultVariable
Show previous day's High & Low(PDH/PDL)boolfalseshowPrevDayHighLow
Show Pivot Point(PP)booltrueshowPivoteLine
Show Pivot Point Resistance (R1)boolfalseshowPivoteR1Line
Show Pivot Point Support (S1)boolfalseshowPivoteS1Line
Show True PricebooltrueshowTypicalPriceLine
Trade on Long EntrybooltruetradeLong
Trade on Short EntryboolfalsetradeShort
Max Loss on one Tradefloat0.5maxLoss
Trade base LevelstringPPtradeOn
Close all trade @ Hoursint13closeHrs
Session timesession0915-1530sessSpec
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

Daily Bias + FVG Strategy

by TradersPost
218 stars

This overlay strategy plots previous-day high and low, the daily open, and fair value gap zones on the price chart. It takes entries on a selectable timeframe when the FVG requirement and an optional session window allow them, then uses an ATR or fixed pip sto

Strategy v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Daily Bias + FVG Strategy

ATOM 1m scalp HK

by dearvn
43 stars

This overlay strategy targets one-minute ATOM scalps. It tracks pivot highs and lows as resistance and support, compares a three-period EMA with a multi-stage smoothed close, and flags long or short when price crosses that curve in the matching direction. Dail

Strategy v5 ScalpingSupport & resistance Repaints
Updated 2 years ago · None stated GitHub repository of ATOM 1m scalp HK

P404 Smoke

by Musyimi97
16 stars

P404 Smoke is a price-chart strategy that sequences an optional higher-timeframe EMA bias, a liquidity range from recent pivots, a sweep of buy-side or sell-side liquidity, and a market structure shift within a set bar window. Comments state it then looks for

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 6 months ago · MIT GitHub repository of P404 Smoke

Fibonacci strategy

by JoelPasapera
11 stars

This strategy plots a Fibonacci retracement of the previous day's high-low range on the price chart. It places a single long limit order at that level when the bar hour matches the chosen entry hour and the close is below the level. Position size follows the l

Strategy v6 Support & resistanceSessions & time
Updated 5 months ago · Apache-2.0 GitHub repository of Fibonacci strategy

1-Min Gold Taylor Technique

by eddiebelaval
7 stars

This intraday strategy implements session-based trading rules tailored for gold on short timeframes. It tracks the Asian session price range, VWAP, 20-period EMA, and previous day high and low levels to identify liquidity sweeps during London and New York trad

Strategy v6 Sessions & timeSupport & resistance
Updated 3 months ago · None stated GitHub repository of 1-Min Gold Taylor Technique
6 stars

This strategy combines Opening Range Breakout (ORB) mechanics with Inner Circle Trader (ICT) concepts like Fair Value Gaps, Order Blocks, and liquidity grabs. It identifies session opening ranges and generates signals when price breaks out with supporting rela

Strategy v5 BreakoutSMC / ICT / price action
Updated 7 months ago · None stated GitHub repository of Advanced ORB + ICT Strategy

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers