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
0 answers

What is the best way to add text when a condition is met

I'm looking for the best way to add text to a table cell when a certain condition is met. These are the conditions: When current close is above or below vwap by 10% The cell changes color to Green and the text 'Up' appears with no vwap data The…
0
votes
3 answers

Why does the first alert trigger multiple times after the alert conditions have been met with a reset in it

Why does it trigger multiple times after the alert conditions have been met for the alertcondition(confirmed_signal, title="Price crosses upper range with confirmation", message="Price has crossed the upper range with confirmation") ? I am using the…
0
votes
1 answer

Pine Script for comparing values of same indicator (example: EMA) on multiple timeframes for the same ticker id

I am trying to build a script which compares the value of an indicator with previous value of the same indicator but in different time frames and then create a signal based on the comparison. For example I want to get the value of EMA for 1Day,…
0
votes
1 answer

How to workaround ta.highest() or ta.lowest() functions' error?

I am investigating those crossings, see red/green dots. The goal is to validate them if a dot is preceded by a big movement but dropping crossing events when its too calm. Just call the distance between the two plots 'X_hist'. I'd like to watch its…
Vendrel
  • 865
  • 9
  • 19
0
votes
1 answer

i have a PineScript indicator , works well relatively well in higher Timeframes, but as soon i change the timeframe doesnt show the plotted lines

Example Chart In the picture above, the left windows is in D timeframe, the right is in 4H timeframe, on the Daily chart only plot the previous 12 days, doesnt plot the vertical lines more than thoses days,on the right chart allow me to plot box…
0
votes
1 answer

Conditional security request in Pinescript?

struggling to fix this. I want avgDailyRange to be displayed on ALL timeframes. Idea is to show ADRD for daily and lower timeframes, and replace ADRD with ADR on higher timeframes. Currently I get an error on lower than Daily timeframes (see…
geleone
  • 1
  • 1
0
votes
0 answers

Pine Script Strategy Tester: winning trades coming up as losses

I apologize, I know this would be a super simple fix but I am new to coding/pine script and have no idea what I'm doing but trying to learn. I am trying to make a script that takes a trade at a specific time of the day (everyday), on a specific TF,…
Sam
  • 1
  • 1
0
votes
1 answer

Why does this code NOT add values to the array?

I try to collect Support/Resistance levels into an array but my code bele never adds data to the array so its size always remains 0. What do I do wrong? (Of course, there is another similar code for lowest values, with different length sizes, the…
Vendrel
  • 865
  • 9
  • 19
0
votes
0 answers

Display Futures From the Leftmost Bar at Zero to the Current Bar

I want to display the ES futures price as an orange line that starts at 0 at the leftmost part of the visible range and stops with the most current bar. If the visible range changes, so does the zero point with it, it's always located at the…
0
votes
0 answers

Pine-Script : Multi Price-Triggered Alert Error

I'm working on the multi price triggered alert script, but the script has the error. I'm doing the alert for the stop-loss triggered and 3 take profit triggered. Once the first take-profit is triggered, and no alert for stop-loss. Here is the…
0
votes
1 answer

Writing custom data into an array and reading back them with direct addressing. How to do it?

I know it's not the most elegant way to handle Support and Resistance values but it's good enough for me, for now. Here's my code (based on this working answer): var SupportResistance = array.new_float() array.push(SupportResistance,…
Vendrel
  • 865
  • 9
  • 19
0
votes
1 answer

TradingView - pine script to exit with different total deal of Take profit and Stop Loss

I wrote a pine script with trail exit and wanted to exit TP with 50% of the total deal for the first TP and exit SL with 100% of the total deal for the SL. then, let the trade continue and exit with the remaining total deal with the 2nd TP. I'm…
0
votes
1 answer

Label when reaching the highest high

I am trying to make a change to the Zigzag indicator below. In this indicator, the label with the structure of the line is displayed again and again with each new candle. I want to make the label only show when the higst is high and the end of the…
0
votes
0 answers

Slippage not factored in for exits

In my script, I have both SL and TP calculations. When I change the slippage parameter in the strategy settings, the SL and TP levels are adapted accordingly. So far, so good. But looking at the list of trades in the backtesting engine, I find that…
0
votes
2 answers

How to add bar overlays

edit: Used the code from vgladkov. Thankyou. Seems to be working just how I wanted. Thanks again. This indicator will place a bar overlay on the candlesticks if the volume meets with the criteria. Volume at 30,000 or less, no overlay just default…