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
1
vote
1 answer
How to compute RSI on lower timeframe than the current timeframe?
I would like to plot the RSI for the lowertime frame compare to the timeframe that I am currently on. I then want to plot the current timeframe rsi and lower timeframe rsi in plots together.
For the current rsi I have
rsi = ta.rsi(close,…

sey eeet
- 229
- 2
- 8
1
vote
1 answer
EMA cross over within a certain time frame not working
Trying to write a pine script for showing the 10ema crossing above the 21ema within the past 3 days. If a script already exist for this or is close to this please provide links.
Below is the script I wrote which did not…

GeorgeIII
- 11
- 1
1
vote
1 answer
How can I flag the first bar of the second last session with pinescript 5?
I'm trying to plot something from the first bar of the second last session that is loaded on the graph.
Since the bar count per session varies and for example a monday can be preceded by a sunday, friday or thursday, and not every session covers the…

frik
- 11
- 1
1
vote
1 answer
ta.supertrend is not recognised as a function, importing trading view is not possible
import TradingView/ta/5
s21 = supertrend(21,1)
s14 = supertrend(14,2)
s7 = supertrend(17,3)
long = color(s21)=color(s14)=color(s7)=color.green
short = color(s21)=color(s14)=color(s7)=color.red
start = timestamp(IST,2020,1,1,0,0,0)
end =…

devatala manikantah
- 11
- 1
1
vote
1 answer
Pinescript - Query whether a line is present
Is there a way to query the existence of a line.new?
I have an indicator where I want to query whether a line has been drawn and if so what color the line has.
Unfortunately I only found the query line.get_price in the documentation. The question is…

Max
- 19
- 1
1
vote
2 answers
How to define a default input value based on the market cap in pine
I am trying to set the default value in the input field to be a certain starting value based on the marketcap of the security. I can't get it to work. There is a problem with the series and it's keeping the first constant definition fixed. Defining…

AndiAna
- 854
- 6
- 26
1
vote
1 answer
Syntax error at input 'end of line without line continuation' when trying to run pine-script in Tradingview
New to pine-scripting, trying to create a custom indicator in Tradingview and I'm getting this error message:
Syntax error at input 'end of line without line continuation'
from this code:
//@version=5
indicator("Session Liquidity", overlay=true)
//…

Mike_rem
- 11
- 4
1
vote
0 answers
How can I draw boxes based on candle volume in PineScript for different timeframes?
There is a script ( Vector Candle Zones/Cloud MTF X4 ) which can plot imbalanced candle zones at MTF.
This is the 4hr timeframe:
This is the 1hr timeframe:
This code is hidden and to elaborate for what I want.
I only need the vector (imbalanced…

J Lo
- 11
- 2
1
vote
1 answer
I can only see the colors of the indicator I coded when I hover over it
I created a script to color the candles displayed, with a different color depending on a condition, and to plot 2 MA's, but the candles show that color coded condition, only when I either hover over the MA's, or when I select the indicator at the…

Rafa
- 13
- 2
1
vote
1 answer
why are these dates and times adding vertical lines in the future on tradingview?
i am trying to a add these dates and times on to a Tradingview chart - it appears that they are on the chart but not at correct times and dates, they are after May 24th, which is the future!
Any ideas or fixes would be very…

Jeremiah Freeman
- 13
- 2
1
vote
1 answer
Draw Horizontal Line with Pine Script and Set Text to always stick to right
//@version=5
indicator("Horizontal Line with Text", overlay=true)
var label label1 = na
value = 42800
hline(value, title="HR Line", color=color.blue, linestyle = hline.style_solid, linewidth = 2)
if(barstate.islast)
label1:=…

tsvsdev
- 121
- 1
- 1
- 7
1
vote
1 answer
I have a question about ATR Bands in FineScript
I have a question about ATR Bands in FineScript.
Find out the value of the upper closing price of the atr band and the value of the /lower closing price when entering the strategy, and then TP and stop-loss from that value...Is that possible?

STH
- 27
- 4
1
vote
1 answer
Working in 1 min / 5 min / 15 min but giving error in hourly time frame
In Pine V5, I have used array in one indicator.
array.get() , array.set(), mattrix.get() these kind of functions are used in that code.
I am capturing values of different indicators, across different time frames, inside this array.
This indicator…

KalC
- 11
- 2
1
vote
1 answer
Saving a variable for later
I'm working on something in Pine Script v5, but I'm stuck with something.
I would like to store a value once, if conditions are met, and use this value later.
But the value is still recalculated at each candle.
For example:
// initiate value
int…

EyFFix
- 13
- 2
1
vote
0 answers
Want to add trading hours in "Enter trade when price close above 20 + 200 EMA, close when price close below 20 EMA or close above bb high"
In the script "Enter trade when price close above 20 + 200 EMA, close when price close below 20 EMA or close above bb high" I want to initiate trade 10 minutes once the NSE opens (i.e., at 0925) and closes all open positions (Universal exit 10…

Anand
- 21
- 5