7,259 questions
Advice
1
vote
2
replies
43
views
ta.highest doesn't work inside conditional
Original code https://pl.tradingview.com/script/Cb5QhBAl/
The structure from code below ( ta.highest ) doesn't work inside conditional structure. RdX1dX2 = length of a line. The ta.highest doesn't ...
Advice
0
votes
0
replies
43
views
How to create alert for array and UDT
I don't know how to create an alert for data from an array an UDT. I created int IsCrossingAlert, when it == 1 alert appears, == 0, there is no alert.
And how to remove line and create new from start ...
1
vote
1
answer
48
views
array.push() causes "Index out of bounds" after slice and copy on a user-defined type array
I've encountered a runtime error when removing a prefix of an array.
What I am trying to do:
I have a Detector UDT that maintains a history of Thing objects in an array. In certain situations, I need ...
Advice
0
votes
4
replies
114
views
Zig Zag horizontal lines
How to write, horizontal lines from bottoms ( LL LH ), tops (HH HL) ?
It gives information when it crosses (down and next up) bar.
It draws horizontal line from bottoms to crossing bar and gives me ...
Advice
0
votes
0
replies
44
views
Tradingview Pine Script: Adding a condition to UI-based volume alerts (not code generated volume alerts)
I like to carefully line up my mouse in the Volume pane and then right click to add Volume alerts on a symbol, and when I do this, the exact location of my cursor pre-fills the alert threshold with ...
0
votes
1
answer
45
views
Accessing higher timeframe data in Pine Script arrays without na checks
I am trying to create an indicator on the current timeframe, but its calculations are based on M15 data. I want to load the last 2000 candles of a specific higher timeframe into arrays and access them ...
2
votes
1
answer
77
views
Set Stop Loss and multiple TPs automatically
I am searching for a way to automatically set a Stop Loss and multiple TPs for a trade (either Market Order or Limit/Stop-Orders).
Example:
I would like to enter a buy position (3 contracts) on Nasdaq ...
1
vote
1
answer
79
views
Label at the specific UNIX timestamp not on the same bar between different charts
This is my test script
//@version=6
indicator("Time Loc Test", overlay = true)
unix = 1769990400000
var lb = label(na)
if barstate.islast and na(lb)
lb := label.new(unix, 0, xloc = ...
0
votes
0
answers
62
views
TradingView Pine Script Renko Call to HTF Alerts 1 Bar Late?
I'm working on a pine script strategy that trades primarily on the 1S Renko charts, but I want to get the direction of the 5M Renko chart, I'm using the following code below to make the call and ...
0
votes
0
answers
51
views
Plot weighted average of two ETFs on TradingView Supercharts
I've just started using TradingView Supercharts to primarily visualise the performance of ETFs. I currently just view plots of these ETFs on the Percent scale, all overlaid over one another. All these ...
0
votes
0
answers
65
views
changing the TP and SL trade level indicator bar colors generated by using the trade panel in TradingView
Is there any possible way to alter the TP and SL trade level indicator bar colors generated by using trade panel. They are too faint on almost every canvas color. The SL bar, box, and text are in a ...
1
vote
1
answer
141
views
Creating two pole oscillator in cTrader to use on my charts
I'm trying to translate the pine-script code to BigBeluga's Two pole Trading View Oscillator to use on my cTrader charts. The Trading View code is here:
https://www.tradingview.com/script/2Ssn4yDZ-Two-...
0
votes
0
answers
86
views
Reversing positions on Pinescript
I am using Pine script and want some help.
When I am in trade and my strategy generates opposite signal, how to make how close the current trade and open in the opposite direction. I am executing with ...
0
votes
0
answers
61
views
Bars get squashed when linefill is enabled
I encountered a bug when filling the colour between two vertical lines.
As soon as I enable fill, candlesticks get squashed.
I made this short script to demonstrate the problem.
//@version=6
indicator(...
0
votes
0
answers
71
views
How to plot with offset in multi-timeframe script?
I am developing pinescript indicator with multi timeframe support
indicator("My indicator", timeframe = "")
I want to plot somevalue with offset
plot(somevalue, offset = 5)
This ...
0
votes
1
answer
84
views
Broker emulator triggers stop loss order even though price action should not trigger it
Entry price is at the blue rectangle, and exit ( stop loss ) price is at the purple rectangle.
This image exactly denotes what the broker emulator executed.
According to the documentation
https://www....
0
votes
1
answer
137
views
Other Time Frame values are strange
I am new in pine script and just tring to print the value of RSI of two different timeframes eg "D" (Daily) and "60" (Hourly) using the following code but whenever I change the ...
-1
votes
1
answer
169
views
Why do the values in the labels keep changing as the candle moves?
I have some signals that are generated through logic within my indicator. They are plotted as “dots, triangles, or arrows” or other shapes. What I wanted was a way to “monitor” the indicator signals. ...
0
votes
1
answer
107
views
Why are my Daily MA50/100/200 lines jagged instead of smooth even with smoothing turned off?
I’ve written a Pine Script to display the Daily 50/100/200 Moving Averages on lower timeframes (like 1H or 15m).
I’m pulling the data using request.security() to lock it to the 1D timeframe so it ...
1
vote
1
answer
137
views
TradingView Self-managing alerts delay
I use the alert in my code to send alerts, and I want to be alerted more often than once per bar. So I set the freq to All, but I also want to restrict the amount of alerts to not be blocked.
I ...
0
votes
1
answer
95
views
Pine Script request.security weird outcome (calculates future dividend to history)
When using request.security function in Pine Script, like in the script below, I find weird outcomes when there is dividend at play.
I used the function a lot for crypto... no dividends, so no problem ...
0
votes
1
answer
81
views
ta.dev is expecting a bool input?
Using Pine v6, I get an error on line 2 that I don't understand.
float bar_hh = ta.highest(2)
float bar_h1 = ta.dev(bar_hh, 2) ? na : bar_hh
bar_hh is float.
Still, the error I get is complaining ...
0
votes
0
answers
60
views
How to get security_lower_tf 1hr data from previous 1D candle, not current
My indicator is on the daily timeframe and I'm using the security_lower_tf to gather the 1hr volume data. The problem is that security_lower_tf only returns as many hours there are in the current/...
0
votes
1
answer
79
views
Weighted smoothing based on Pascal's triangle
This code causes an erroLir Line Cintinuation error. Some reason it does not recognize the colon at the end of the case statements
//@version=6
indicator("Smooth1 with Series Input", ...
0
votes
0
answers
112
views
Pine Script session indicator plotting different candles across timeframes and not resetting sessions properly
I am trying to write a Pine Script indicator that draws trading sessions as a single candle (based on user-defined start and end times).
The indicator should:
Plot session candles consistently across ...
0
votes
1
answer
79
views
Weird issue with request.security(syminfo.tickerid, "M", open[12]) statement
Bear with the length of this but it is confusing the heck out of me. When I run this statement in trading view on a Daily Chart:
open1 = request.security(syminfo.tickerid, "M", open[12])
and ...
0
votes
0
answers
105
views
Pine Script v6: How to make indicator legend background transparent to match pane background?
I've created a Pine Script indicator with a custom pane background colour using bgcolor(). The background displays correctly, but the indicator legend area (showing indicator name and values) has its ...
0
votes
0
answers
61
views
Plotting Higher timeframe Linear Regression Channel on current timeframe
I am trying to plot weekly timeframe Linear regression channel on my daily chart
the values look fine, only the starting point is not correct. I even tried using the lineStart variable in the function ...
0
votes
0
answers
98
views
Array does not keep his content via barstate.isnew in realtime
I wrote a simple indicator to test push/pop upon array.
//@version=6
indicator("My script test unshift array", overlay=true)
var t = array.new_int()
if barstate.isnew
if array.size(t) &...
2
votes
1
answer
118
views
Net Income year-over-year
TradingView has a Net Income indicator:
I'd like to show "Net Income year-over-year percent change".
Here's a pine script program that appears to implement this:
//@version=6
indicator(&...
0
votes
0
answers
142
views
How to read the previous day close with PineScript
I want to create an indicator and require the previous trading day close.
Currently I receive wrong values, which are closing prices from further in the past and not yesterday.
I am testing this ...
0
votes
1
answer
90
views
Labels duplicated at every level
I found a Manual Fib indicator on the Web. The indicator however duplicate the labels at every Fib level.
Can someone please help.
I tried label,delete but are to inexperienced to make it work.
My ...
0
votes
2
answers
99
views
How do I plot finalized candles only?
I have started on a project in pine script: trying to create the 10 minute chart as an indicator. For the first step, I have decided to plot all finalized/closed candles (for the most accurate data), ...
0
votes
0
answers
135
views
Logic Issue In Pine Script - On Trading View Strategy
I am working on a mean reversion strategy for bitcoin to automate trades on an Indian crypto Exchange. The pine script is supposed to generate buy, sell, buy side target hit, buy side sl alerts and ...
0
votes
1
answer
95
views
Removing overlapping levels / Zones in pine script lines.new
I have written a code to mark out pivot Zones.
I am able to plot the zones and remove the ones that are broken.
I want to remove the overlapping levels and keep the newer ones amongst the overlapping ...
-1
votes
1
answer
106
views
Pinescript exit order never filled with partial profits
I made a simple script that take a trade with an order bracket with Take profit and stop loss and when price go up to 50% of Take profit, i sell 70% of the contract and set the new stop loss at break ...
-1
votes
1
answer
170
views
How do I lock triangle in place even when dragging chart up and down in Pine script?
I know nothing about coding but I am creating an indicator in Pine Editor. I want a triangle to appear above or below a candle when certain criteria are met. I've got it to do this using chatgpt but ...
0
votes
0
answers
103
views
Profitable strat, draw triangle above candle break
I have a profitable indicator that displays market structue break when I candle breaks. I am tray to print a triangle about the actually breaking candle but it prints about 10-14 bars latter. I am ...
0
votes
1
answer
87
views
Mismatched input "end of line without line continuation" expecting ")"[pine] newSupBox := box.new(
Mismatched input "end of line without line continuation" expecting ")"[pine] newSupBox := box.new(----the error is on the line newSupBox := box.new(. the library says that box.new ...
0
votes
0
answers
236
views
Struggling with code that is tracking Highs and Lows
I wanted to make an indicator for my trading Group that detects and alerts a thing called " 2 Candle Rejection". its a concept used by a couple of traders to determine if a Fair Value gap ...
0
votes
1
answer
480
views
Pinescript input line style
I am new to pinescript and wrote this simple script to show me daily, weekly and monthly candle open lines by piecing together information I could find. This works well but I would like to add input ...
0
votes
1
answer
488
views
I get the error "historical offset beyond historical buffer" in replay mode
I get an error message at line 47 "historical offset beyond historical buffer" when in replay mode. Is there any easier way to show what I want to see and get this error worked?
I want to ...
0
votes
0
answers
52
views
Is there a way to make limit orders in pine script work?
When conditions are met this code places a limit order at sessionLowPrice. The order executes at a higher price at the end of the bar. Three bars later price actually hits my limit price. Any way ...
0
votes
1
answer
617
views
Pine Script v6: Syntax error at function definition 'input "("' - How to declare functions correctly?
I am trying to combine two Pine Script indicators (LuxAlgo Reversal Signals and VuManChu B Divergences) into a single script. I have recently migrated the script to Pine Script v6.
I am consistently ...
0
votes
1
answer
85
views
Moving a stop loss in TradingView PineScript API
I've got the entry and initial stop loss called 'initialStopLossShort'. After price moves below a certain price level (here it's below BR1 which is defined earlier) I'd like to change the stop loss ...
0
votes
0
answers
87
views
How to Reset Entry Conditions After Exit in Pine Script Strategy Generated by Pineify?
I'm developing a trading strategy using Pine Script on TradingView, and I've utilized Pineify to generate the initial code. The strategy is based on Supertrend indicators and includes specific entry ...
0
votes
0
answers
67
views
Why does `strategy.percent_of_equity` not consistently execute trades?
I'm having problems with Strategies created with strategy.percent_of_equity, default_qty_value=100. Some trades don't seem to be entered.
To demonstrate this, I have created a very simple Strategy in ...
1
vote
0
answers
99
views
Pine script: how can I add a "Standard deviation channel" to a polynomial regression?
I have found a script for generating a polynomial regression, which I have adapted to my needs and which basically works.
However, in order to be able to use the script the way I want to, I need a ...
0
votes
1
answer
217
views
linking a strategy script to paper trading
Hi I'm new to this forum and pine script but I would be very grateful if someone could help me with this problem or link me to a previous post about this.
I figured there is probably a simple way to ...
0
votes
1
answer
196
views
Creating a supply and demand EMA cloud on trading view. I keep having issues with "Undeclared identifier 'label'"
I'm having issues with supply and demand zone labels.
// === ENTRY SIGNAL LOGIC ===
bullish = close > open and close > emaFast
bearish = close < open and close < emaFast
inDemandZone = ...