Questions tagged [pine-script]

Pine Script is a domain-specific language for coding custom technical indicators and strategies on TradingView. Use this tag for questions related to programming in Pine Script. Please do not use the [tradingview-api] tag for Pine-related questions.

Pine Script is a domain-specific language for coding custom technical indicators and strategies on TradingView. Use this tag for questions related to programming in Pine Script.

6637 questions
0
votes
1 answer

Improve Pinescript Efficiency - Array calculation and plotting?

I have the following code to try and count the number of occurences of a certain indicator value before plotting relevant lines, however it's very inefficient and slow with my current method - leading it to break frequently. I imagine it would be…
Oxelo
  • 7
  • 2
0
votes
1 answer

Strategy Alert, alertcondition() or alert()?

Right now, I'm trying out Strategy Alert but it's a hit or miss. One trade, it performs fine according to my strategy. Then it starts randomly entering and exiting no matter what my strategy says. //@version=5 strategy("Entry Price",…
Nishi
  • 1
  • 2
0
votes
1 answer

Pinescript: Why does the "on-chart" close work in Mansfield but request.security() does not?

I got a script to calculate the Mansfield Relative Strength (MRS) and it works like a charm. However, I am trying to build a more complex indicator that uses the MRS in conjunction with other indicators to limit the number of times it prints. …
Andrew Steitz
  • 1,856
  • 15
  • 29
0
votes
0 answers

Plotting low in tradingview giving wrong output

I am trying to plot the low price ein trading view but the plots are very counterintuitive and confusing. can someone please help. In the 15m chart the blue line created at low at 82.9990 however i can clearly see bar closing lower than that in the…
0
votes
0 answers

Incorrect data in the Tradingview Strategy Tester

I noticed that the data in the strategy tester is different from the information on the chart. Here is an example and its screenshot. Entry to "Long" 2023-07-13 15:00, exit 2023-07-15 07:00. The List of Deals shows the result +2.47%, while the chart…
Ofdm
  • 1
  • 1
0
votes
1 answer

How to remove consecutive candle highlight in the following indicator?

I have created an indicator in pinescript as following which will highlight a candle that is closed above 9EMA and stok %k above 80. //@version=5 indicator("ASK - Algo Short", overlay=true) // Define inputs length = input(9, "EMA…
0
votes
1 answer

How to plot a label under block if in tradingview

I'm doing a backtest in tradingview and I waould like to export the data for more detail. However, I could not see the label with the exported data. How do I plot the label and show it in the exported data? I've put plot(lastConfirmedPivotBar) to…
0
votes
0 answers

How to plot highest high & lowest low within a conditional timeframe

My indicator plots buy/sell conditions (denoted by the vertical red/green bars). I'm trying to figure out how to plot the highest/lowest value when the condition is active. IMAGE I've been trying using this code, however I think I am going about it…
surface9
  • 1
  • 1
0
votes
0 answers

how to add multiple variations of long condition in a single strategy

as you can see I have here two variations of long condition in a single strategy //sqzmom and //variationone and as you can see I have duplicated the whole thing and changed variables a bit in order to make that variation, it is working fine but I…
0
votes
1 answer

Error at 15:19 no viable alternative at character ';' In Pine script

I have the following code in pine which looks like this: strategy("My script", overlay = true) input high = close; input low = close; input period = 20; input standardDeviation = 2; This is producing the following error: Error at 15:19 no viable…
Slartibartfast
  • 1,058
  • 4
  • 26
  • 60
0
votes
1 answer

How to make the indicator work only on a formed candle?

I found such an indicator on Pine Script on the Internet. I have a question: this indicator is recalculated every time the candle is updated (that is, when the candle has not yet formed) is it possible to do something so that the indicator is…
stas stas
  • 95
  • 10
0
votes
0 answers

How do I send Tradingview chart snapshots to twitter using python/pinescript?

I want to send tradingview chart snapshots to twitter. I have a screener i made (using pinescript) which shows buy/sell signals on different pairs. Whenever there's a new signal on a pair, I want it to take a snapshot of that particular pair and…
0
votes
1 answer

Pine Script - request.security_lower_tf

looking to see the stochastic of a lower TF to get a better entry < with a view to creating an alert to telegram>. Have used the pine script v5 manual for guidance . When I use a chart on a daily and place the code to…
0
votes
1 answer

Pine Script: Plot horizontal line everyday, from beginning of day to end of day

On a 1 minute chart (or any timeframe), I'm using the request.security function to get the open price, open time and closing time from the daily timeframe. What I'm looking to do is draw a horizontal line where y=day's open price, x1 = day's open…
broncomz1
  • 23
  • 3
0
votes
1 answer

Pine Script v5 - How to format indicator's Status Line

I have built an indicator that renders a status line without any formatting. For example, 100M is displayed as "100000000". How can I format the status line so it is displayed as "100.0M"? I tried entering it into ChatGPT and the answers caused…
Chris
  • 3
  • 1