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

How to write custom data into an Array then read them from it?

I would like to write individual numbers in an array, for example 9, 10, 11. Then read the numbers in a for cycle and work with the number? I have tried to understand this from the documentation, but have not been able to relate the examples there…
Vendrel
  • 865
  • 9
  • 19
0
votes
0 answers

Could not find function or function reference 'request.security' error in Code

I created a simple script to draw a Fibonacci retracement from the opening price of a current daily candle to the opening price of the previous daily candle. Script will not run..... Error message is **Could not find function or function reference…
Feniks
  • 1
  • 1
0
votes
1 answer

How do I optimize my Pinescript script (make it faster and simpler to read)?

I have a complex Pine Script v5 code that displays a screener for buy/sell signals across different timeframes and pairs. I am concerned about its performance and resource usage, as it currently loads slowly and consumes significant memory…
Samaara
  • 27
  • 7
0
votes
0 answers

Is it possible to get the ATR value of Point and figure charts?

I programmed an indicator that compute the goals of price of a point and figure chart. I use a point and figure chart with the size of the box computed using the ATR with a length of 14. I would like to know if I can get the value of the ATR…
0
votes
0 answers

How to check that two lines are running in sync?

I have an indicator written in Pine Script where I measure volume flow with two lines with different length. I noticed when two lines run in sync and go through the middle, it's the position where I can potentially open longs/shorts (please, check…
0
votes
0 answers

Show 50% mark line only only for today

enter image description here As seen in the screenshot, the green line is plotted to show the 50% mark from the close which usually is a resistance. I would like this to show this line just for today and doesn't extend backward because I don't care…
0
votes
0 answers

Pine Script | Forecasting Indicators

I am looking into modifying my indicators to include the ability of forecast. We arbitrarily set a future price (for example in 10 candles from now), and our indicator calculates upon this new set of modified data, and plots accordingly. First of…
akikostas
  • 1
  • 2
0
votes
1 answer

Strategy(margin_long, margin_short) attributes are ignored in trading. How to make them used?

Here's my simplified strategy code (wrapped for better readability): strategy("Strategy Test", overlay=true, margin_long=0.2, // 500x leverage, if I'm right. margin_short=0.2, initial_capital = 1000, default_qty_type =…
Vendrel
  • 865
  • 9
  • 19
0
votes
1 answer

what is historical value for series that define in user-build function in pine script5?

I have code below. this is a user-built function. we pass "close" to "src" as an input. i know "src" and "atr" are series. so "up" is series too. after that "upper" is series too. myfunc(src,length,mult)=> atr = ta.atr(length)*mult up = hl2 +…
0
votes
1 answer

How to get the highest Volume value of 1 minute Time frame of the present day

I want a function that can identify the Highest volume bar of the present day in a 1-minute time frame. For that 1 minute candle, I want to change the candle stick color to say WHITE. If, later in the day again, a candle with higher volume forms…
Anuj
  • 1
0
votes
1 answer

How to know when daily sessions change on any chart?

I am trying to build out an indicator that uses previous sessions to give levels. But some tickers start the new day at "0000" and some start at "2100" or "2200" and I need to figure out the best way to identify this so my script can calculate when…
0
votes
1 answer

Stochastics peaks plateauing

When plotting the Stochastics K line, Pine chops off my peaks and valleys at 100 and 0. Is there a way to stretch beyond this scale and get true peaks and valleys? (How would I modify the 0 to 100?) My code: rsiLength = input(title="RSI Length",…
0
votes
1 answer

Cross with the top line of a box

I would like to trigger a signal when the open of a candle crosses the top line of a box. It's not entirely clear to me which parameter in this script I can address. My attempts to implement the box in a cross tag are always acknowledged with an…
0
votes
0 answers

How to convert this complex logic indicator in pinescript to python?

Details of my query: I'm trying to make an automated trading bot (personal use). I found this indicator on TradingView to be quite accurate. Unfortunately it is not a strategy, so I cannot automate trades using pre-built interfaces. It is called…
0
votes
0 answers

Question about zones arrays and peak/trough detection

Apologies if the format is wrong, this is my first question here. I have a question about my script that I have been creating - the zones I have saved don't seem to be saving properly and the peak and trough detection doesn't seem to be finding the…