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 apply array operations on an object array?
Given the new object type that is introduced in PS.
I was wondering how I can apply array operations on the objects with array type?
given
// Define the `pivotPoint` UDT containing the time and price of pivots.
type pivotPoint
int openTime
…

sey eeet
- 229
- 2
- 8
1
vote
0 answers
I'm trying to set a strategy with CE indicator
I want to add this:
When CE (Chandelier Exit) indicator in buy --> Only Long Signals
When CE (Chandelier Exit) indicator in sell --> Only Short Signals
At my script:
longcondition = rsi>80 and macd>0
shortcondition = rsi<20 and macd<0
In addition…

mustafa kağan bal
- 11
- 2
1
vote
1 answer
reshape the elements of array based on the custom indexes
I have array A=[1,2,3,4,5] we know that the indexes are [0,1,2,3,4] now I want to reshape the array based on my_ind = [4,0,2,3,1], what would be the fastest way to do it?
the reshape is basically (A[index] as if we are in python) so that I have…

sey eeet
- 229
- 2
- 8
1
vote
1 answer
How to enter a trade in an opposite direction after stoploss is triggered?
let's say that you enter a long position but the price goes down and the stoploss gets triggered, instead of just closing the long trade i want the script to open a short trade. How do i do that? I tried doing it myself, but i'm too dumb, so this is…

Kristen
- 23
- 6
1
vote
1 answer
Pinescript check if MACD signal line above 0
I am trying to only send BUY signal if signal line < 0 and MACD line crosses over signal line, and SELL signal when signal line > 0 and MACD crosses under signal line. My condition that I added doesn't seem to…

Ruslan Ali-zade
- 65
- 6
1
vote
0 answers
request.security function cause repaint eventhough the timeframe is same with the chart?
The tradingview help center says that request.security function can cause repaint issue
if the timeframe argument is not the same as the chart timeframe.
Then, vice versa, if the timeframe argument is the same as the chart time frame, It never…

vwy089
- 11
- 2
1
vote
0 answers
Is there any way to lock custom volume profile to right side of chart?
Is there any anything I can do in pine script to lock volume profile to right or left side like built-in one, so it won0t move with scrolling or scaling?
Something like like this https://www.tradingview.com/x/vsSBmGRz/
if barstate.isfirst
…

helanom
- 11
- 2
1
vote
1 answer
Get the last trading day of the month (in Pine Script)
On a daily timeframe, how can I know whether the current bar is the last one for the current month?
I wrote a small script that uses the month[1] != month condition to find out this (see below). But the problem is that it will only indicate me the…

Alex
- 85
- 7
1
vote
1 answer
problems plotting a line with 3 colors
I am having trouble with the logic of forming an ema line for RSI with at least 3 different colors to filter signals.
This is my latest attempt. So far the if statements I have written are not working. I looked at another script and hypothesized…

james wagner
- 13
- 3
1
vote
1 answer
In Pinescript I want to show the highest price level every 50 bars
In Pinescript I want to show the highest price level every 50 bars, but no matter what I do I can only show the current high.
//@version=5
indicator(title='Deneme', shorttitle='Deneme', overlay=true, timeframe='')
barLength =…

aakcay
- 15
- 4
1
vote
1 answer
How to replace the line with the label in pine script version 5
I am trying to create an indicator in tradingview that plot the high of the day and low of the day. The below mentioned pine code is working and indicator is plotting the line expected.
//@version=5
indicator(title="HOD-LOD", shorttitle="Current Day…

Iamlearner
- 13
- 3
1
vote
2 answers
In TradingView pinescript, how do I get a number of 3 or any other consecutive win or loss trade?
I'm attempting to determine the number of consecutive wins and losses. I get the number with my current code, but when I test its reliability with the total number of wins and losses, it doesn't match the total number of wins and losses shown by the…

Sewatech
- 13
- 3
1
vote
1 answer
How to highlight the price when a candle crosses the previous candle which is closed above EMA100 line?
I'm new to pine script and I am trying to figure out how to make an indicator highlighting:
Price when the current candle cross below the wick low of previous candle + previous candle should be completely detached (even the wick) above the EMA100…

user20537640
- 15
- 2
1
vote
1 answer
pine script : how to add and display text on a horizontal line / hline?
I want to include a text input feature to add text onto horizontal lines / Hlines that I am plotting onto a rate-of-change indicar. These lines are essentially like 70/30 RSI overbought and oversold lines, but I am using them instead for probability…

lvbx9
- 39
- 1
- 8
1
vote
1 answer
Tradingview Pine-Script: how to use show_last with if im frustraed
I try to make a simple indicator for each timframe and I did it only that in inputs something like this and I must reduce them with conditional if
I want the show last as the offset to change at different times 4h 2h 1h 30m 15m but the code is long…

Fernando
- 11
- 2