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
1
vote
1 answer

Get hour in UTC timezone and not exchange's timezone in pinescript

The built-in variable hour in pine script refers to the hour in the exchange's timezone. I would like to have a variable called UTC_hour to refer to UTC timezone. I am using pinescript v5.
user3848207
  • 3,737
  • 17
  • 59
  • 104
1
vote
1 answer

Why can I use this webhook in Postman and not in TradingView alerts?

When I send this POST using POSTMAN the text 'Hello World' is added to a Google Sheet. https://script.google.com/macros/s/AKfycbwXdAoAnggrOL2NXhyIi7L2uQKKv4bmZjg_Z67VYi6jUuNp5HmiTw78ARGVZWSHYaM7/exec?gid=2061&Message=Hello World I have tried to…
1
vote
1 answer

Plot Vertical Line from custom data

I'm trying to plot a vertical line using custom date from array. What I'm trying to code is iterate all values using a for loop, and then plotting a vertical line, with a span of 1 futures day. That's the main target. The code looks like…
1
vote
1 answer

Where should I make changes in the code to solve the error in Pine script v5 for tradingview

I am using this code to plot a horizontal line from 9:42 AM candle close each day in tradinview Pinescript verson 5 but getting errors...please help :( The code The erroryour text
1
vote
2 answers

How do I use both stop loss and take profit in pinescript v5 ? (Three methods)

I'd like to get the stop loss and take profit to trigger and print on the chart. The stop loss and take profit should both be set to 1% from the entry for both long and short positions. Method 1: Initiate the take profit order immediately after…
Dan J
  • 33
  • 5
1
vote
1 answer

Pinescript V5 Multi Timeframe Strategy vs Indicator

I have an indicator working the way I want, but I'm trying to convert it to a strategy for backtesting. I have bollinger bands plotted on the 15 minute timeframe, and on the one hour. This works in the indicator, but it does not work properly in the…
Dan J
  • 33
  • 5
1
vote
1 answer

How can I place labels at the end of a vertical seperator line?

I wrote an Indicator in Pinescript, which shows seperator lines for the weekdays and also for the weekend. Additional to that, its possible to show the weekday names. What I'm having problems with, is the positioning of the Weekday-labels. I want to…
Luca
  • 17
  • 5
1
vote
1 answer

How to make table dynamic (displaying based on mouse position)?

Whenever I normally create an indicator it will display a value dependent on which candle the mouse is positioned at, however when I've created a table it seems to be static only displaying current / last value. How can I make it display dependent…
Ghan
  • 19
  • 4
1
vote
1 answer

Is it possible to code the strategy.exit such that it will run at the lowest possible timeframe no matter what timeframe I am currently in?

I am using premium subscription in tradingview, and developed a tradingview strategy for daily timeframe and it will place order after bar close when certain conditions are met, and once the order is placed, strategy.exit will only execute once…
jguy
  • 161
  • 1
  • 11
1
vote
2 answers

How to remove the error from Pinescript code

I need some help. TIME FRAME = 5 mins. I want an indicator to plot the open and high till the first opposite color candle. Basically: First candle positive and second candle negative, then plot high and low for the first 10 mins (price range of…
1
vote
1 answer

Plot Line from One Time to Another Time

I'm trying to figure out how to plot a line from one specific time to another specific time in Pine Script / TradingView. I'd like to plot from the close price at 14:00 to the close price at 15:30 (exchange time). - If it isn't 15:30 yet, then plot…
1
vote
1 answer

Why am i getting compilation error in this pinescript.....?

//@dztrctstar //@version=5 indicator("My script") coinToss = math.random(0, 1) if (coinToss > 0.5) arrowSeries = 1 else arrowSeries = 0 shapeType = if arrowSeries == 1 shape.arrowup else shape.arrowdown plotshape( shapeType, …
1
vote
1 answer

How to store values into an Array while ignoring nan values

Im trying to identify highest high candles and save the difference between the open and close for the last 10 occurrences of these candles into an array, and then get the average of the array. However, I'm having some problems since nan values are…
user2334436
  • 949
  • 5
  • 13
  • 34
1
vote
1 answer

Tradingview Pine Script Import Based on Conditions

What's the proper way to use import based on different conditions in Tradingview Pine Script? I tried: if (condition) import name/library/version as alias But it generated a compilation error. It seems like the import statement can't be nested.
Thomas
  • 349
  • 3
  • 11
1
vote
2 answers

Pine Script - Not Displaying input.int options data, it worked yesterday?

is anyone else finding problems with their input.int(... , options=[1,2,3,4,5]) not displaying any data within the drop down list? You can still drop the menu down and select an "option", it all works fine, except there is no visible text/data…