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

Place an order before candle close in tradingview pinescript

# I am creating a 5EMA indicator where i will be place a sell order when previouscandle is above 5ema and current candle price is less than previous low. As soon as this condition is true i need to place a sell order. However the code is placing…
0
votes
0 answers

pinescript - Query the point where 2 lines meet

I would like to query the meeting of 2 lines on a candlestick. The way I see it, the two lines that are formed via line.new should have the same values at this point. Unfortunately, I was not able to create a query for this case. Hence the question…
0
votes
1 answer

How to compare the closing price to a lookback period and plot a shape based on a condition

I am working on a fairly simple thing but cannot make it work. The current bar close should be compared to the highest or the lowest price of a lookback period and a shape should be plotted if the closing price exceeds that price. lookbackPeriod =…
0
votes
1 answer

What kind of pine code statements can be used to test the following specific time frames on trading view charts

With Pine code, How do i test to see if the current chart time frame is between 4Hrs and 11Hrs or if the time frame is between 12Hrs and 4days? What i tried: IsHourlyTF2() => timeframe.isminutes and (timeframe.multiplier >= 240 or…
dawid
  • 3
  • 3
0
votes
1 answer

How to use ZigZag Lib in Pinescript

Tradingviews documentation didn't bring me further. I am struggling to use the ZigZag Library. I have found a even better library, I would like to apply. How do I access the last and previous last high and low values? This is what I tried…
Sebastian
  • 13
  • 3
0
votes
1 answer

draw box of 2:00 PM candle between any 2 dates and extend it left & right

enter image description hereTrying to box for every 2:00 PM candle candle generated in trading view between any 2 dates and extend it left & right. Have written a code but it draws for last 2 days only not for all the specified dates and extended it…
0
votes
2 answers

How to properly save values into an array when using for loop

I'm trying to push cumDistance into cumDistances array for every iteration of the for loop but I am having trouble. var inTrade = false var entry = 0. var exit = 0. distance = 0. entryCon = ta.crossover(ta.rsi(close, 10), 20) and not…
bbnm
  • 1,034
  • 1
  • 4
  • 14
0
votes
1 answer

Pinescript conditions query. Why the condition is failing in few scenarios?

I have created a code where i create a sell order if previous candle is above 5ema and do not touch 5ema and current candle price is less than low of previous candle. However in few candles i see that the sell order is triggered even when the…
0
votes
1 answer

I want to show only the first candle label as soon the condition satifies

enter image description here As shown in the image you can see 6 buy signals when the candle high crosses the green ( target line /entry). I only need the one buy signal when the first candle crosses the entry line. but as you can see I am getting…
0
votes
1 answer

Why are ta.change and request.security functions not synchronising to a fixed candle?

I'm trying to work with ta.change and request.security but I am confused by some of the unpredictable behaviours! I assumed ta.change and request.security would synchronise smoothly when they use the same length of time but I have had problems: _I…
PPP
  • 7
  • 2
0
votes
0 answers

Pinescript - How to change the division and step size of an indicator

I have a zigzag indicator that actually works well. Unfortunately, the division of the Zigzag line is not optimal. Zigzag changes are not placed at the correct high and low points. Is it possible to give the script a different and better…
0
votes
0 answers

pinescript to create a zone of a particular candle in a given range

I want a pinescript to mark zone of a 9:15 am & 10:30 candle every day in a given range, should be able to choose whether to select 9:15 candle or 10:30 candle Wrote this code but it is not working //@version=4 study("9:15-10:30 AM IST Zone",…
0
votes
1 answer

Find Nth highest/lowest values in Pine

I'm trying to find the Nth highest/lowest value of a ratio within Pine v5. This is ultimately part of a process to try and determine the top/bottom 1% values of a ratio to find extreme outliers. My current thought process is to store all ratio…
Oxelo
  • 7
  • 2
0
votes
1 answer

Multiple alerts on same bar when indicator repaints

I have an indicator which sends alerts when buy and sell signals appear. The indicator itself is not repainting when the bar has closed, but it repaint on the current bar. My problem is that I need my indicator to send alerts every time the signal…
N00b
  • 1
  • 3
0
votes
1 answer

Pine Script create alert using Heikin Ashi but alert trigger normal candle as well

this is my entry condition if buyConditionB and testPeriod strategy.entry("Long", strategy.long, qty=buyQty) alert('{"CustomId": "456","BuySide": "Long"}',freq=alert.freq_all) if buyConditionS and testPeriod strategy.entry("Short",…
Top Mix
  • 3
  • 1
1 2 3
99
100