This tag should be used for questions relating to scripts and code built specifically on version 5 of Trading View's Pine Script language.
Questions tagged [pine-script-v5]
2372 questions
0
votes
1 answer
I want to change this indicator from version 4 to 5 pinescript
I want to change this indicator from version 4 to 5 this indicator
"Divergence for Many Indicators v4 by LonesomeTheBlue"
0
votes
0 answers
How to plot Buy/Sell symbols on user defined datetime on 5 min candle chart in tradingview
For the purpose of reverse engineering a trading strategy I have a list of datetime of Buy and Sell signals on 5 min candle data. For the purpose of developing strategy from those signals have to plot those long & short signals on chart on 5 min…

ProgR
- 155
- 1
- 11
0
votes
0 answers
When a new pivot point is found, how can i compare the value with the previous one?
If a pivothigh is calculated using "ta.pviothigh" in pinescript_v5
Can we use pH[1] to indicate the previous pivot high or how can I get the value of the previous one when a new pivot high is found? As I want to check whether the close price of the…

C_4_Cc
- 1
0
votes
2 answers
How to specify getting local variable from a specific time frame
im trying to work out how to specify a local variable from a specific timeframe so i can use it later to trigger and alert
If possible without using request security
The normal macd and signal variables are working fine
here is what i have tried but…

Juz
- 17
- 3
0
votes
0 answers
Plot a BOX in Day High and Low in Tradingview
[do_1, dh, dl] = request.security(syminfo.ticker, 'D', [open, high, low], lookahead=barmerge.lookahead_on)
plot(dh, title='H', style=plot.style_stepline, color=color. New(color.red, 0), linewidth=2, trackprice=true)
plot(do_1, title='O', …

sreeraj PV
- 1
- 1
0
votes
1 answer
Pinescript - I'm plotting 2 chars (using plotchar()) on an oscillator type indicator- How do I maintain their position relative to one another?
I'm using plotchar() to draw characters onto an oscillator type indicator. I need these characters to maintain their position relative to one another when the user scales the indicator vertically. I've signed an NDA, so I'm trying to ask the…

ATHBuys
- 1
- 2
0
votes
1 answer
exit not happening in strategy even when condition is satisfied
i have made the below codes to exit a strategy. however the strategy is not exiting even when conditions are met.
the entry point of long is correct based on the entry conditions specified. however exit is not happening inspite of all 4 conditions…

RAGHU RAM G
- 31
- 6
0
votes
0 answers
how to create a ratio of short / lower timeframe bar (1m, 5m, 30m ) to it's longer / higher timeframe bar ( hourly, daily) as a volatility indicator
I am trying to create a stock indicator that will calculate lower timeframe bars as a % of their total Higher time bar. The idea is that this is a type of volatility indicator to gauge how large the % change/ROC of any single lower stockchart…

lvbx9
- 39
- 1
- 8
0
votes
0 answers
Stop loss V5 pine script
Hi need help on my code I don't know why my stop loss on short position is not triggering when the price level reached
Can anyone explain me why and help me to fix it
`
//short position
var float ssellPrice = 0
ssellCondition = close < s1 and close…
0
votes
1 answer
Mismatched Input-Ternary Operator (PineScript)
On using ternary operator in Plotchar() , the true condition is not fully recognized (in spite of placing it in "()" brackets). Mismatched inpur error is given(refer image).
How to resolve this ?
Code:
k = ta.sma(...)
plotchar((k < 20) ? (xUp , "Go…

srt111
- 1,079
- 11
- 20
0
votes
1 answer
Real-time value in alert message
This is how TradingView sends a webhook to Telegram.
As shown in the photo, the close used as an alert message in the opening strategy informed the entry price of the position well.
However, in the case of a strategy exit, the close used as an…

김한수
- 15
- 3
0
votes
1 answer
Moving average value at the time when HL was formed
Struggling to get the Moving average value displayed correctly from the HL candle. Want to see the moving average value @ HL candle
Script output Screenshot-Please see this also
//@version=5
indicator("My script", overlay = true)
Period =…
0
votes
1 answer
SuperTrend has different results when viewing history than when calculated real-time
I'm very confused as to what could be causing this behavior, as I created as SuperTrend strategy which looks amazing when plotted on chart but breaks down horribly when tried on a live chart or when using the replay tool.
It is a very simple…

Zathrus Writer
- 4,311
- 5
- 27
- 50
0
votes
1 answer
conditional input in Pine script
I am not an expert. I wrote an simple code that plots ema based on condition. If intraday is true then value of ema is 9 or value of ema is 21. But there is error on "out = ta.ema(src, len)" there is a red line below len and says that "Undeclared…

NITIN PATEL
- 1
- 1
0
votes
1 answer
Making Dropdown Menu User Inputs Mutually Exclusive In Pine
I have a set of user inputs as follows:
//Entry Indicator Selection
tog_entry1 = input.string(title="Entry Indicator 1", defval="KST", group="Entry Indicators", options=["KRI", "KST", "Supertrend", "None"])
tog_entry2 = input.string(title="Entry…

Matt
- 48
- 4