Questions tagged [pine-script-v5]

This tag should be used for questions relating to scripts and code built specifically on version 5 of Trading View's Pine Script language.

2372 questions
2
votes
0 answers

Drawing lines from pivot points that meet a specific conditions

I have successfully created a script that draws a line from one pivot point to another based on some conditions. The conditions are: The next (or following next) pivot points must have a high that is lower than the original pivot point high The…
2
votes
1 answer

Getting historical values from higher timeframes

I've built a custom indicator and I've plotted them using dots on top of candles. When a dot meets a certain criteria with another dot, I draw a trend line connecting them. That works.. What I would like to do is augment these lines from higher…
bdoooh
  • 21
  • 1
2
votes
1 answer

Storing values in global array

I can't seem to get values to store in a global array. Code example below: strategy("Array Issue", overlay=true, margin_long=100, margin_short=100) var vars = array.new_int(5) var TRACK = 0 init() => if (barstate.isfirst) …
Sean Barnard
  • 59
  • 1
  • 1
  • 9
2
votes
0 answers

How to extend a Indicator COT Data Line

Unfortunately, the commodity trade market is closed at the weekend. The new COT data will come on Saturday. The script therefore only shows the old data until Monday when the markets open again. But I would like to analyze the markets at the…
sammyp
  • 21
  • 2
2
votes
1 answer

Study Error: Bar index value of the 'left' argument (-1.0000) in box.new() is too far from the current bar index. Try using 'time' instead

This code generates the very rare error mentioned above, in some charts only - seems more prevalent in charts with many bars. I cannot find any references or documentation that points to a possible issue. I've tried setting the left value of…
2
votes
1 answer

Can someone please explain how does function history actually work in pinescript?

In official article, TradingView explains that if you don't call function on every bar, it will return inconsistent values, because it isn't called on every…
2
votes
3 answers

Calculating position size and stop based on account value?

Going to be a slightly tricky one to explain. I'm in the process of writing my very first Pine script, its a very simple system using RSI, I'm not expecting it to be successful necessarily I'm just trying to get my head around writing a system using…
Matt
  • 21
  • 2
2
votes
1 answer

Pine script input menu

I'm making an indicator with a built in menu with long and short signals ( crossover, crossunder) how do i use different values for the crossover and crossunder for each crypto pair to change long and short signal for each coin when selected from…
trkk
  • 21
  • 1
2
votes
1 answer

Drawing horizontal rays on highest closing price of a group of consecutive Heikin ashi candles using pinescript

I'm trying to code an indicator using the heikin ashi open and close prices. I want the program to draw a horizontal ray on the highest close price of a group of consecutive green or red heikin ashi candles. For example, if the heikin ashi trend…
Mike
  • 23
  • 3
2
votes
1 answer

Pine Script: How to check if current time is 3:00 PM in GMT+5:30 timezone

In the PineScript v5, I am trying to develop a strategy where I don't intent to take any trade after 3:00 pm (in GMT+5:30 timezone). So if the current time is less than 3:00 pm, then only I will "entry"/"exit" the trades. Otherwise at 3:00 PM, I…
Pradip
  • 509
  • 1
  • 5
  • 22
2
votes
1 answer

Is there a way to hide the choice of color in the "Style" section?

I'm using this code to display a price line and a table. //@version=5 indicator('MyIndicator') ticker = input.symbol(defval='NSE:NIFTY', title='Ticker') ticker_col = input.color(color.new(color.blue, 0), title='Color') tickertext_col =…
Richard D.
  • 79
  • 5
2
votes
1 answer

Experiencing an error while creating Pine Script Library function

I am trying to create a new library in Pine Script-v5 with following function signature: **export TrendMeterBarsColors(float vclose, float vohlc4, float vhlc3, float vOpen) => ** But I keep getting the following error: " The 'vohlc4' argument is not…
Shudipto
  • 61
  • 1
  • 5
2
votes
1 answer

"Highest value offset for a given number of bars back" meaning?

I'm new to Pine script, please, anyone explain me exactly what this high[abs(highestbars(amplitude))] statement returns, specially in highestbars(2) definition what it mean Highest value offset?? FYI this statement is from Tradingview.com HalfTrend…
2
votes
2 answers

How to set up a Strategy properly? V5

Being a beginner, I'm still confused; too many questions, to many options, it's a labyrinth for me yet, sorry for perhaps blunt questions… Here's the header: strategy(title="Testing Strategy Testing", initial_capital = 100000, default_qty_type =…
Vendrel
  • 865
  • 9
  • 19
2
votes
1 answer

Why is barssince not working in pine script v5?

I'm trying to check the last time rsi was over sold, but when i put in barssince(rsi < 30) the code is not blue, it's just white. Then when i save it comes back as "Could not find function or function reference 'barssince'." I read the language…
menamejaff
  • 39
  • 1
  • 4