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
2
votes
1 answer
How do I plot a horizontal line on the high and low of a specific time in Pinescript?
My question is really two parts.
How do I plot a horizontal line (that extends to the right but not the left) starting at a specific time of the day, outside of trading hours. I want to plot two horizontal lines actually, one on the high and one on…

Deebes
- 23
- 1
- 1
- 3
2
votes
1 answer
Per chart indicators created using pine-script in trading view (like the drawings)
I created a custom indicator in trading view using pine-script. The inputs to the indicator depend on the chart that is open. Also I do not want the indicator visible in all charts.
Basically what I want is to indicator behave like the drawing…

Shashank Singhal
- 170
- 1
- 2
- 9
2
votes
1 answer
Ichimoku Cloud Alert Setup (PineScript)
I'm setting up an alarm system on ichimoku.
I need four parameters for it to alarm but I was able to run three parameters.
[OK] when the cloud on the right changes color,
[OK] if the candle close is above the cloud,
[OK] Tenkan-Kijun lines (blue,…

herijuana
- 21
- 2
2
votes
1 answer
How to get the proportion of time that has passed on current candle as a fraction?
I'm trying to get the proportion of time already passed at the current chart resolution of the current candle. For example, in the hourly timeframe, if the current remaining time on the candle is 45minutes, then I'd like to calculate "0.25" because…

Dan Rayson
- 1,315
- 1
- 14
- 37
2
votes
2 answers
Pine script: ist it possible to evaluate next candle values? to get relative lowest
I'm trying to detect the if each candle is the lowest value, checking 5 previous candles lows and 5 next candles lows
I found no problem with previous:
if ta.lowest(low, 5) == low
line.new(bar_index - 1, low, bar_index + 1, low, color =…

Juanan
- 23
- 5
2
votes
1 answer
(Tradingview - Pine Script) Convert iff Function to v5 error
I tried to convert pine v2 iff function to v5 but I kept getting this error:
line 32: Undeclared identifier 'vwapsum';
line 33: Undeclared identifier 'volumesum';
line 34: Undeclared identifier 'v2sum'
this one is original v2 script:
newSession =…

podolkerod
- 95
- 2
- 8
2
votes
1 answer
Show/Hide Barcolor from Input Settings
how to make checkbox option to Show/Hide in Input Settings (so we don't need go to input style tab to show/hide it) for bar coloring with conditional below?
//Conditions
L_adx = DIPlus > DIMinus and ADX > th
S_adx = DIPlus < DIMinus and ADX >…

podolkerod
- 95
- 2
- 8
2
votes
1 answer
How to use barstate.islastconfirmedhistory
Can you please explain how to use barstate.islastconfirmedhistory ?
Can anyone create a sample program where the below built-in variable is used?
barstate.islastconfirmedhistory

rohan sawant
- 121
- 1
- 14
2
votes
1 answer
Problem to convert to pinescript V4 or V5
I have this code in my account and it works fine but I can not publish it. I'm having a very hard time converting this script to the version 4 or 5.
study(title="Wolf Trade", overlay = true)
adverupgrade = input(defval=true, …

Payam Mazkouri
- 25
- 4
2
votes
1 answer
How to request data from another security to show correctly with request.security() - Pine Script v5 - TradingView
Does anyone know if it's possible to request string data using request.security() to get information on multiple symbols at the same time? The script I have compiles with no errors, but the problem is some of the data coming through in the alert…

Josiah
- 53
- 1
- 2
- 6
2
votes
2 answers
Pine Script - Buy/Sell indicator for TradingView that meets multiple conditions
I am trying to build a BUY/SELL Indicator for TradingView by using three indicators, EMA, MACD and Supertrend.
Condition 1: The Fast EMA crosses up the Slow EMA.
Condition 2: The MACD line is above the Signal Line.
Condition 3: Supertrend is in…

Amlan Dutta
- 372
- 3
- 7
- 17
2
votes
2 answers
Pine-script How to calculate on close when calc_on_every_tick=true
var line _lpLine = line.new(0, 0, 0, 0, extend=extend.left, style=line.style_dashed, color=color.yellow)
_lastTradedPrice = close
line.set_xy1(_lpLine, bar_index-1, _lastTradedPrice)
line.set_xy2(_lpLine, bar_index, _lastTradedPrice)
The code…

bbnm
- 1,034
- 1
- 4
- 14
1
vote
1 answer
How to get the countdown to bar close in pinescript?
how to get the time for "countdown to bar close" in pinescript?
I want to show the countdown to bar close in my code for the current timeframe that I am using, is there a way to do it?

sey eeet
- 229
- 2
- 8
1
vote
0 answers
Pine script error: Error on bar 0, loops takes too long to execute (> 500ms)
Am getting an error on this code,it sucessfully compiled but on the indicator window,.it gives an error which reads
error on bar 0, loops takes too long to execute (>500ms).
I don't know how to go about it. Thanks in advance.
// This source code…

felix Chidubem
- 9
- 3
1
vote
0 answers
The 'symbol' and 'timeframe' arguments are incompatible with functions that have side effects for MTF indicator
I modified stochastic indicator to multi-timeframe with ability to plot last 3 stochastic D values as table on top right of the chart but I am getting error of The 'symbol' and 'timeframe' arguments are incompatible with functions that have side…

Swoosh
- 11
- 1