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
how to generate alerts with array crossovers using if operator within a loop?
I've created an indicator in which there are multiple large arrays and crossovers between the values of those arrays. I want to generate alerts when such crossover takes place. I am trying to use for loop to trigger alerts for multiple crossovers of…

Sanket Kolte
- 5
- 3
0
votes
0 answers
How to structure a Trading View Alert in Pine Script V5?
I have a big brake with trying to make an Alert happen as I want since, I have not found a way to write that a series of conditions occur before a Cross. How to write that in Pine Script V5?
I know that with if it may be possible but it tells me…
0
votes
1 answer
I don't understand how the strategy.position_avg_price works in Pine script ( Tradingview )
I don't understand how the variable works.
In the example above, the result of the strategy.
The yellow line indicates the value of strategy.position_avg_price. We have opened 2 trades (L2 and L3), after that the average value is considered…

S.Znobihin
- 1
- 1
- 2
0
votes
0 answers
Can previous values be used in the TradingView Pinescript strategy to set up buy orders and stop losses?
While setting up a strategy with previous values, close and stop triggers are not working for short order, but they are working for long order.
I'm writing a script to trade if the previous price bar is fully above or below the 5 ema, with stop…

Sewatech
- 13
- 3
0
votes
1 answer
How do I get the simplest two line back testing strategy working?
The strategy is simply this.
Buy, 11/21/2022, 10.00
Sell, 11/23/2022, 11.00
So it simply buys on the 21st at $10, and sells on the 23rd at $11.
I will repeat this for other dates, but if I could just get that simple two-line strategy to work, I…

OahuRE
- 66
- 9
0
votes
0 answers
Plotting lines on unfilled doji lows and highs
I would welcome help with my code. I am beginner and dont know how to plot lines on filled dojis and unfilled dojis. In picture you can see what I would like to do with my script, unfilled dojis with green line and filled wont be seen (for purpose…
0
votes
1 answer
Strategy.orders not at the limit price
I have modified this to a strategy
https://www.tradingview.com/script/ZpONAzhm-ORB-with-Price-Targets/
And im trying to make strategy orders at specific time of day, with a triggerprice of the high and lows of the orbs, but they dont fill at the…

Yoshidk
- 459
- 1
- 5
- 16
0
votes
1 answer
Pine Script - Compare High / Low with Bollinger Band
I wanted to compare bollinger band top / bottom with high / low. How can I do so? I tried to compare with below
E=high[2]>=ta.bb(close[2],20,+2)
F=low[2]<=ta.bb(close[2],20,-2)
but it is not allowing. How do I rectify this?
Thanks

Avi Singh
- 5
- 6
0
votes
1 answer
I want to show the highest price in the past as a line every time the price advances by the specified parameter
I want to show the highest price in the past as a line every time the price advances by the specified parameter. For example, I want to draw the highest of the past 50 bars as a line every time the price advances by 50 bars, but these codes draw the…

aakcay
- 15
- 4
0
votes
1 answer
Remove previous Label Text/Style when bar not current
I am working thru my first script using Pine and came across a spot I have been struggling on for 2 hours.
All I am trying to do is show 'strValueBarAverage' above the current bar. After the bar has closed and moved onto the newest bar, I would…

John OConnor
- 21
- 5
0
votes
1 answer
Pinescript Highest / Lowest Comparision
indicator("India VIX Modified",overlay=true)
A=ta.lowest(low,15)
B=low
C=close>open
D=B==A
Sell=C and D
E=ta.highest(high,15)
F=high
G=close

Avi Singh
- 5
- 6
0
votes
1 answer
Pine Script - Exit when RSI is above 70
I have written my first pine script, the situation is:
when the RSI is below 30 --> buy
when the RSI is above 70 --> sell
The Problem is, that I correctly get into my buy position, but there is no sell position.
Code:
// This source code is…
0
votes
1 answer
When you put 3 of the same indicators and only have different parameters
I want to raise an alert when 3 indicators show the same point using 3 indicators with different parameters, how should I set the conditions?
Here are the 3 Bollinger Bands. Same indicator, but Each parameter is 20.40.60, which has a different…

김한수
- 15
- 3
0
votes
2 answers
pinescript Draw a horizontal line with the opening price at a specific hour
I would like to draw a horizontal line on the opening price of a bar at a certain hour, for example I draw a line on the opening price of the bar at 8 in the morning and it will be updated the next day at the same time.
Can anybody help me ??
Thank…
0
votes
1 answer
Donchian Channel Stop Loss
In Pine Script I'm coding a Donchian Channel trading system, where you go long on a 20-day high, and go short on a 20-day low.
I'm fine with coding the opening and closing of the positions, but I'm struggling with coding the initial Stop-Loss level,…

Dave_R_Pierce
- 27
- 4