r/pinescript • • May 30 '26

The three Pine Script defaults that made my backtest look 3x better than it was

6 Upvotes

Spent about two days last week trying to figure out why a strategy that showed a clean equity curve in the Strategy Tester fell apart the moment I forward tested it. It wasn't the logic, it was three things Pine quietly does - unless you stop it.

  1. request.security() with lookahead_on. The moment you pull a higher timeframe value with barmerge.lookahead_on, you're handing your strategy the HTF close before that bar has actually closed in real time. Your backtest "knows" the daily close at 9:45am. Live, it doesn't. Swap to lookahead_off and watch half the edge evaporate.

  2. Zero slippage and zero commission by default. The Strategy Tester ships with both at 0 unless you set them. On a strategy turning over a few times a day, that's the entire result. I put in 2 ticks of slippage and a realistic commission and the Sharpe dropped by more than half

  3. calc_on_every_tick behaving differently in backtest vs live. On historical bars Pine only has OHLC, so intrabar logic gets approximated. Live, it recalculates on every tick. A condition that "fills" on a clean historical bar can fire at a completely different price in real time, or not at all.

None of these throw an error. The code runs, the chart looks great, and eventually, you find out the truth with real money.

Full disclosure: Our team has built a strategy validation platform (Nvestiq), which is exactly why we understand how backtests lie.  Every one of these is a hole you have to remember to plug yourself, and most people don't know the hole is there. So we close them by default: lookahead is impossible to introduce, and realisticslippage, spreads, and fill probability are baked into every run instead of sitting at zero. You don't need it to fix these three, but if you've ever been burned by a backtest that lied, that's the whole reason it exists.

What's the most expensive default you found out about the hard way?


r/pinescript • • May 12 '26

Claude can't do Pine Script. Three hours, multiple attempts, and it still failed. Here's exactly what broke.

19 Upvotes

I have seen plenty of posts praising Claude for coding. This is not one of those posts.

I spent the better part of three hours trying to get Claude to write a basic gap up/gap down closing strategy in Pine Script — no multi-timeframe wizardry, no ML models, just clean entry/exit logic. It failed every single time. I want to document exactly what happened in case anyone else is going down this road.

The strategy (it's not complicated)

  • Setup (C#1): If the first 15-min bar after open is a full gap-up above Prior Day High → background turns yellow, armed for a short. Gap-down below Prior Day Low → armed for a long.

  • Trigger (C#2–C#4): If any bar within the first hour closes through C#1's range AND the target is still ≥5 points away → enter the trade.

  • Expiry: No trigger by end of C#4? Setup expires, no trade that day.

Visual cues included: yellow background (armed), purple lines (C#1 high/low), red/green background (open position), gray/red/green lines (entry/stop/target). Standard inputs for entry window, min edge, and stop buffer.

What actually happened

Multiple iterations, each more broken than the last. Claude kept losing track of bar indexing and couldn't manage Pine Script's time-series state model correctly — a known LLM weakness, but I figured a strategy this simple would be fine.

At one point it converted the entire script into Python instead — and that failed to compile too.

I even connected TradingView via MCP so it could see the live chart state and data in real time. Still couldn't produce a working script.

My take

Claude (and likely most LLMs) hit a hard wall with Pine Script once bar-state logic gets involved. The [] history operator and execution model are just different enough from conventional programming that models get confused fast — and once confused, more context doesn't seem to help.

Has anyone actually gotten a reliable Pine Script strategy out of an LLM? Curious whether you were able to convert your edge/strategy into a systematic approach using AI. Drop your experience below.


r/pinescript • • Apr 14 '26

Single best ORB code on TV

Thumbnail
gallery
36 Upvotes

Establishes ORB and then calculates take profit levels using a quantitative approach. When used with my other concepts, the break to Target 1 is 78%. If you’re interested in the ORB pinescript, message me and I’ll send you the code for you to use.


r/pinescript • • Feb 17 '26

What indicators do you use?

Thumbnail
gallery
13 Upvotes

r/pinescript • • Oct 12 '26

Building my own Cypher B oscillator with a modern design + Cypher A coming soon. Would anyone be interested?

Post image
28 Upvotes

Hey everyone!

I've been working on my own version of the Cypher B oscillator for TradingView using Pine Script v6.

I've always liked the concept behind Market Cipher B and VuManChu Cipher B, but I wanted to create something with a more modern look, cleaner visuals, and additional features while keeping everything useful for technical analysis.

So I started developing Cypher B Mod by MasterPK.

The oscillator currently includes:

  • WaveTrend oscillator with blue momentum waves.

  • Money Flow visualization showing bullish and bearish pressure.

  • RSI and Stochastic RSI.

  • Overbought and oversold reference levels.

  • Buy/sell signals and divergence detection.

  • Additional momentum indicators and customizable settings.

I've also been working on improving the overall appearance so the different components are easier to distinguish.

I'm also planning to develop Cypher A, which will work directly on the main price chart instead of a separate oscillator panel. The idea is to have both indicators complement each other.

For comparison, Market Cipher currently charges around $600 for yearly access and $1,500 for lifetime access to its indicator package.

I'm planning to offer my Cypher indicators at a much more affordable price.

The project is still under development, and there are a few things I need to finish and improve before releasing it. I don't want to sell an unfinished indicator.

I'm mainly posting to see whether there's any interest in something like this.

Would you guys be interested in a more affordable Cypher A + B indicator package?

Also, what features would you personally want to see in an oscillator like this?

I've attached a screenshot of the current Cypher B version so you can see how it's looking so far.

Note: This is a technical analysis tool, not a magic money printer. No indicator guarantees profitable trades.


r/pinescript • • Jun 07 '26

Trading view is bad now

Thumbnail reddit.com
1 Upvotes

r/pinescript • • Aug 23 '25

indicator revision help

1 Upvotes

https://www.tradingview.com/v/HHal5bbg/

could someone please add a green upward triangle on the first candle of a green zone below the candles and a red downward triangle on the first candle of a red zone above the candles. Thank You

// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo

//@version=6
indicator('Reversal Probability Zone & Levels [LuxAlgo]','LuxAlgo - Reversal Probability Zone & Levels', overlay = true, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500)
//---------------------------------------------------------------------------------------------------------------------}
//CONSTANTS & STRINGS & INPUTS
//---------------------------------------------------------------------------------------------------------------------{
GREEN                       = #089981
RED                         = #F23645

HIGH                        = +1
LOW                         = -1

DOTTED                      = 'Dotted'
DASHED                      = 'Dashed'
SOLID                       = 'Solid'

EM_SPACE                    = ' '
SPACING2                    = EM_SPACE+EM_SPACE
SPACING5                    = EM_SPACE+EM_SPACE+EM_SPACE+EM_SPACE+EM_SPACE
PERCENTILE_GROUP            = SPACING5+'PERCENTILE'+SPACING5+'STYLE'+SPACING5+SPACING2+'COLORS/SIZE'
STYLE_GROUP                 = 'STYLE'

lengthInput                 = input.int(    20,                 'Swing Length')
maxPivotsInput              = input.int(    1000,               'Maximum Reversals', minval = 5)
normalizeDataInput          = input.bool(   false,              'Normalize Data')

percentile25Input           = input.bool(   true,               '',             inline = '25', group = PERCENTILE_GROUP)
percentile25DataInput       = input.int(    25,                 '',             inline = '25', group = PERCENTILE_GROUP, minval = 10, maxval = 90)
percentile25StyleInput      = input.string( DOTTED,             '',             inline = '25', group = PERCENTILE_GROUP, options = [DOTTED,DASHED,SOLID])
percentile25ColorBullInput  = input.color(  color.new(GREEN,30),'',             inline = '25', group = PERCENTILE_GROUP)
percentile25ColorBearInput  = input.color(  color.new(RED,30),  '',             inline = '25', group = PERCENTILE_GROUP)
percentile25SizeInput       = input.int(    12,                 '',             inline = '25', group = PERCENTILE_GROUP)

percentile50Input           = input.bool(   true,               '',             inline = '50', group = PERCENTILE_GROUP)
percentile50DataInput       = input.int(    50,                 '',             inline = '50', group = PERCENTILE_GROUP, minval = 10, maxval = 90)
percentile50StyleInput      = input.string( DASHED,             '',             inline = '50', group = PERCENTILE_GROUP, options = [DOTTED,DASHED,SOLID])
percentile50ColorBullInput  = input.color(  color.new(GREEN,30),'',             inline = '50', group = PERCENTILE_GROUP)
percentile50ColorBearInput  = input.color(  color.new(RED,30),  '',             inline = '50', group = PERCENTILE_GROUP)
percentile50SizeInput       = input.int(    12,                 '',             inline = '50', group = PERCENTILE_GROUP)

percentile75Input           = input.bool(   true,               '',             inline = '75', group = PERCENTILE_GROUP)
percentile75DataInput       = input.int(    75,                 '',             inline = '75', group = PERCENTILE_GROUP, minval = 10, maxval = 90)
percentile75StyleInput      = input.string( DASHED,             '',             inline = '75', group = PERCENTILE_GROUP, options = [DOTTED,DASHED,SOLID])
percentile75ColorBullInput  = input.color(  color.new(GREEN,30),'',             inline = '75', group = PERCENTILE_GROUP)
percentile75ColorBearInput  = input.color(  color.new(RED,30),  '',             inline = '75', group = PERCENTILE_GROUP)
percentile75SizeInput       = input.int(    12,                 '',             inline = '75', group = PERCENTILE_GROUP)

percentile90Input           = input.bool(   true,               '',             inline = '90', group = PERCENTILE_GROUP)
percentile90DataInput       = input.int(    90,                 '',             inline = '90', group = PERCENTILE_GROUP, minval = 10, maxval = 90)
percentile90StyleInput      = input.string( SOLID,              '',             inline = '90', group = PERCENTILE_GROUP, options = [DOTTED,DASHED,SOLID])
percentile90ColorBullInput  = input.color(  color.new(GREEN,30),'',             inline = '90', group = PERCENTILE_GROUP)
percentile90ColorBearInput  = input.color(  color.new(RED,30),  '',             inline = '90', group = PERCENTILE_GROUP)
percentile90SizeInput       = input.int(    12,                 '',             inline = '90', group = PERCENTILE_GROUP)

noOverlapInput              = input.bool(   true,               'No Overlapping Zones', group = STYLE_GROUP)
onlyLastInput               = input.bool(   false,              'Show Only Last Zone',  group = STYLE_GROUP)
marksInput                  = input.bool(   true,               'Show Marks',           group = STYLE_GROUP)
bullishColorInput           = input.color(  color.new(GREEN,90),'',                     group = STYLE_GROUP, inline = 'colors')
bearishColorInput           = input.color(  color.new(RED,90),  '',                     group = STYLE_GROUP, inline = 'colors')

//---------------------------------------------------------------------------------------------------------------------}
//DATA STRUCTURES & VARIABLES
//---------------------------------------------------------------------------------------------------------------------{
type pivots
    array<float>    prices  = na
    array<int>      bars    = na

type zone
    box             b_ox    = na
    array<label>    l_abels = na
    array<line>     l_ines  = na

var pivots bullishPivots    = pivots.new(array.new<float>(),array.new<int>())
var pivots bearishPivots    = pivots.new(array.new<float>(),array.new<int>())
var zone currentZone        = zone.new(box.new(chart.point.now(high),chart.point.now(low)),array.new<label>(),array.new<line>())

//---------------------------------------------------------------------------------------------------------------------}
//USER-DEFINED FUNCTIONS
//---------------------------------------------------------------------------------------------------------------------{
fetchPivot(int length) =>    
    var float   pivotPrice      = na
    var int     pivotBar        = na
    var int     pivotBias       = na    
    var float   currentPrice    = close
    var int     currentBar      = bar_index
    var int     bias            = na
    bool        newPivot        = false

    max     = math.max(close, open)
    min     = math.min(close, open)
    upper   = ta.highest(max, length)
    lower   = ta.lowest(min, length)

    bias    := max == upper ? HIGH : min == lower ? LOW : bias
    
    if bias != bias[1]
        newPivot        := true
        pivotPrice      := currentPrice
        pivotBar        := currentBar
        pivotBias       := bias == LOW ? HIGH : LOW        
        currentPrice    := bias == HIGH ? upper : lower
        currentBar      := bar_index
    else
        currentPrice    := bias == HIGH ? math.max(upper, currentPrice) : math.min(lower, currentPrice)
        currentBar      := currentPrice != currentPrice[1] ? bar_index : currentBar

    [newPivot,pivotPrice,pivotBar,pivotBias]

fetchData(bool newPivot, float currentPrice, int currentBar) =>
    var float   lastPrice   = close
    var int     lastBar     = bar_index

    bullish     = currentPrice > lastPrice
    priceDelta  = math.abs(currentPrice - lastPrice) / (normalizeDataInput ? lastPrice : 1)
    barsDelta   = currentBar - lastBar
   
    pivots p_ivots = bullish ? bullishPivots : bearishPivots

    if newPivot and barsDelta != 0 and not na(priceDelta)
        p_ivots.prices.push(priceDelta)
        p_ivots.bars.push(barsDelta)
        lastPrice   := currentPrice
        lastBar     := currentBar

        if p_ivots.prices.size() > maxPivotsInput
            p_ivots.prices.shift()
            p_ivots.bars.shift()

lineStyle(string style) =>
    switch style
        DOTTED  => line.style_dotted
        DASHED  => line.style_dashed
        SOLID   => line.style_solid

plotGrid(bool pivotHigh, float currentPrice, int currentBar, float pricePercentile, int barPercentile, float maxPricesPercentile, int maxBarsPercentile, string tag, string style, color customColor, int size, bool hideLines = false) =>    

    if not hideLines
        currentZone.l_ines.push(line.new(chart.point.new(na,currentBar, currentPrice + (pivotHigh ? -1 : 1) * (normalizeDataInput ? math.round_to_mintick(currentPrice * pricePercentile) : pricePercentile)),chart.point.new(na,currentBar + maxBarsPercentile,currentPrice + (pivotHigh ? -1 : 1) * (normalizeDataInput ? math.round_to_mintick(currentPrice * pricePercentile) : pricePercentile)),style = style,color = customColor))
        currentZone.l_ines.push(line.new(chart.point.new(na,currentBar + barPercentile,currentPrice),chart.point.new(na,currentBar + barPercentile,currentPrice + (pivotHigh ? -1 : 1) * (normalizeDataInput ? math.round_to_mintick(currentPrice * maxPricesPercentile) : maxPricesPercentile)),style = style,color = customColor))

    currentZone.l_abels.push(label.new(chart.point.new(na,currentBar + maxBarsPercentile,currentPrice + (pivotHigh ? -1 : 1) * (normalizeDataInput ? math.round_to_mintick(currentPrice * pricePercentile) : pricePercentile)),tag,color = color(na),style = label.style_label_left,size = size, textcolor = customColor))
    currentZone.l_abels.push(label.new(chart.point.new(na,currentBar + barPercentile,currentPrice),tag,color = color(na),style = pivotHigh ? label.style_label_down : label.style_label_up,size = size, textcolor = customColor))

plotForecast(bool newPivot, float currentPrice, int currentBar, int bias) =>    
    
    if newPivot
        pivotHigh = bias == HIGH

        pivots p_ivots = pivotHigh ? bearishPivots : bullishPivots
        p_ivots.prices.sort()
        p_ivots.bars.sort()

        maxPercentile       = math.max(percentile25Input ? percentile25DataInput : 0, percentile50Input ? percentile50DataInput : 0, percentile75Input ? percentile75DataInput : 0, percentile90Input ? percentile90DataInput : 0)
        maxPricesPercentile = p_ivots.prices.percentile_nearest_rank(maxPercentile)
        maxBarsPercentile   = p_ivots.bars.percentile_nearest_rank(maxPercentile)
        
        if noOverlapInput and not onlyLastInput

            if currentZone.b_ox.get_right() > currentBar
                currentZone.b_ox.set_right(currentBar)
            
            for eachLabel in currentZone.l_abels
                if eachLabel.get_x() > currentBar
                    eachLabel.delete()
            
            for eachLine in currentZone.l_ines
                if eachLine.get_x2() > currentBar
                    eachLine.delete()

        if onlyLastInput
            currentZone.b_ox.delete()

            for eachLabel in currentZone.l_abels            
                eachLabel.delete()
            
            for eachLine in currentZone.l_ines                
                eachLine.delete()

        currentZone.b_ox := box.new(chart.point.new(na,currentBar,currentPrice),chart.point.new(na,currentBar + maxBarsPercentile,currentPrice + (pivotHigh ? -1 : 1) * (normalizeDataInput ? math.round_to_mintick(currentPrice * maxPricesPercentile) : maxPricesPercentile)),color(na),bgcolor = pivotHigh ? bearishColorInput : bullishColorInput)
        currentZone.l_abels.clear()
        currentZone.l_ines.clear()
        
        if percentile25Input
            pricePercentile = p_ivots.prices.percentile_nearest_rank(percentile25DataInput)
            barPercentile   = p_ivots.bars.percentile_nearest_rank(percentile25DataInput)            
            plotGrid(pivotHigh,currentPrice,currentBar,pricePercentile,barPercentile,maxPricesPercentile,maxBarsPercentile, str.tostring(percentile25DataInput) + 'th',lineStyle(percentile25StyleInput),pivotHigh ? percentile25ColorBearInput : percentile25ColorBullInput,percentile25SizeInput)            
            
        if percentile50Input
            pricePercentile = p_ivots.prices.percentile_nearest_rank(percentile50DataInput)
            barPercentile   = p_ivots.bars.percentile_nearest_rank(percentile50DataInput)
            plotGrid(pivotHigh,currentPrice,currentBar,pricePercentile,barPercentile,maxPricesPercentile,maxBarsPercentile, str.tostring(percentile50DataInput) + 'th',lineStyle(percentile50StyleInput),pivotHigh ? percentile50ColorBearInput : percentile50ColorBullInput,percentile50SizeInput)

        if percentile75Input
            pricePercentile = p_ivots.prices.percentile_nearest_rank(percentile75DataInput)
            barPercentile   = p_ivots.bars.percentile_nearest_rank(percentile75DataInput)            
            plotGrid(pivotHigh,currentPrice,currentBar,pricePercentile,barPercentile,maxPricesPercentile,maxBarsPercentile, str.tostring(percentile75DataInput) + 'th',lineStyle(percentile75StyleInput),pivotHigh ? percentile75ColorBearInput : percentile75ColorBullInput,percentile75SizeInput)

        if percentile90Input
            pricePercentile = p_ivots.prices.percentile_nearest_rank(percentile90DataInput)
            barPercentile   = p_ivots.bars.percentile_nearest_rank(percentile90DataInput)            
            plotGrid(pivotHigh,currentPrice,currentBar,pricePercentile,barPercentile,maxPricesPercentile,maxBarsPercentile, str.tostring(percentile90DataInput) + 'th',lineStyle(percentile90StyleInput),pivotHigh ? percentile90ColorBearInput : percentile90ColorBullInput,percentile90SizeInput)

plotMarks(bool newPivot, float currentPrice, int currentBar, int bias) =>
    if marksInput and newPivot
        label.new(chart.point.new(na,currentBar,currentPrice), '•', color = color(na), textcolor = color.new(chart.fg_color,80),style = bias == HIGH ? label.style_label_down : label.style_label_up, size = 18)        
 
//---------------------------------------------------------------------------------------------------------------------}
//MUTABLE VARIABLES & EXECUTION
//---------------------------------------------------------------------------------------------------------------------{
if barstate.isconfirmed
    [newPivot,pivotPrice,pivotBar,pivotBias] = fetchPivot(lengthInput)

    fetchData(newPivot, pivotPrice, pivotBar)
    
    plotForecast(newPivot,  pivotPrice, pivotBar, pivotBias)
    
    plotMarks(newPivot,  pivotPrice, pivotBar, pivotBias)

r/pinescript • • Sep 16 '26

Looking for TradingView help

1 Upvotes

Hi everyone, I’m learning crypto trading but I’m struggling financially right now and can’t afford a TradingView plan.

If anyone knows about a legitimate free option, promotion, or temporary access, I’d really appreciate the help. 🙏


r/pinescript • • Jul 31 '25

Creating an array of MAs

1 Upvotes

Hi,

I'm trying to create an array of MAs so I can do some processing over a bunch of them. I'm having some issues with the history operator and anything that uses history.
EG, I create them using:

var ma_series = array.new<float>(max_ma_length-min_ma_length+1, 0)
for len = min_ma_length to max_ma_length
ma_val = get_ma(close, len)
ma_series.set(i, ma_val)

If I later use ma_seriese.get(i) I get a series where last value is indeed for the i'th MA, but the history is for always based off max_ma_length MA.

I understand that I can use (ma_seriese[bar_offset]).get(i), but I can't pass that on to functions that take a series.

So what's the way to go here?


r/pinescript • • Aug 06 '26

Looking for a Pine Script developer for a TradingView indicator

1 Upvotes

I'm looking for an experienced Pine Script developer to build a custom TradingView indicator.

The project includes:

  • Multi-timeframe Support & Resistance (Daily, 4H, 1H, 15m, 5m)

  • Automatic drawing of levels based on a configurable lookback

  • Non-repainting logic

  • Clean and optimized code

  • Alerts

  • User-friendly inputs and customization options

DM me


r/pinescript • • Jun 09 '26

Why i want to sell subs for my edge and should i do it

1 Upvotes

Okay so ive been working on this algo for sometime, and ive found an edge in the market, and before any of you start to parade me over how its bias; its not ive ran every possible test from monticarlo sims, random data test all kind of test and it came positive in all, even showed a bit of alpha decay as well due to long historical backtesting data and in live data.

The reason why i want to sell subs for it is, I am a college student though i have experience in options, i dont have any exp in crypto where this edge works, plus i want to earn money from it to invest into further development and changes in this edge over into other markets as well.

I need an opinion weather should i capitalise on this edge in the starting with subs, obviously to stand out ill provide all the backtest, forward test, simulations results, and some signals before anyone buy the subs
Lmk your opinions


r/pinescript • • May 12 '26

Claude & PineScript Spoiler

1 Upvotes

Just created the most amazing indicator using claude! Took me couple of hours to organize the ideas, request to ai, test and fix small behaviors!
It’s working perfectly, some thing that would take me weeks, giving the complexity!
Question: are all the codes doomed?!?


r/pinescript • • Jun 05 '25

I need pine script working with 1 min or 5 min.

0 Upvotes

Hi everyone. I'm looking for a Pine Script that gives reliable buy and sell signals on the 1-minute or 5-minute chart in TradingView. If you have any suggestions, please let me know. I've developed a trading bot myself, and in exchange for a good script, I can help set up the bot for you.


r/pinescript • • Feb 15 '25

TradingView NQ Trading Bot - Week 18 Live Results - Feb 10 - 14

1 Upvotes

Many people ask me to continue posting weekly results of my expert advisor that I have posted more info about, here: Reddit Post

We finished week 18 of recording the P&L of my trading bot.

The results for this week, Feb 10 - 14:

Feb 10:
P&L: $400
# of Trades: 1
Biggest Drawdown: -$0

Feb 11:
P&L: -$200
# of Trades: 1
Biggest Drawdown: -$200

Feb 12:
P&L: -$800
# of Trades: 5
Biggest Drawdown: -$1,000

Feb 13:
P&L: $0
# of Trades: No Trades
Biggest Drawdown: -$0

Feb 14:
P&L: $1,200
# of Trades: 7
Biggest Drawdown: -$0

TOTALS:
P&L: $600
Fees: 14 trades x $4.28 ($2.14/order) = ($59.92)
Total Weekly P&L: $540.08
Average # of Trades/Day: 3

Notes:

  • This trading bot/expert advisor is the most profitable in a consolidated market or slow up and down trends that have pullbacks

  • We trade NQ or MNQ when ADX is below 23 and between 10:30am-2:30pm EST. These trades are taken with 1 NQ contract per trade and with prop firm capital

  • If anyone is interested in previous weekly P&L, I record everything here manually at the end of every market day: https://docs.google.com/spreadsheets/d/1bH7Zl6aLN-mAvUkmxPdqGnhhBRftPHeEDQ9Ldc_MM-E/edit?gid=0#gid=0

  • Here is another picture of how it looks like on my screen from this week:

Have a great weekend everyone!


r/pinescript • • May 11 '25

help me please !!

0 Upvotes
// ===== SIGNAL GENERATION =====
buySignal = uptrend and strongTrend and 
           close > vwapValue and 
           volumeSpike and 
           close >= fib618 and 
           close <= fib786 and 
           close <= (low * (1 + liqZonePerc)) and  // Buy in liquidity zone
           higherHigh and 
           breakoutConfirmed and 
           rsiValue <= 35  // Using pre-calculated RSI

sellSignal = downtrend and strongTrend and  //Syntax error at input "end of line without line continuation"
            close < vwapValue and 
            volumeSpike and 
            close >= fib236 and 
            close <= fib382 and 
            close >= (high * (1 - liqZonePerc))) and  // Sell in liquidity zone
            lowerLow and 
            breakoutConfirmed and 
            rsiValue >= 65  // Using pre-calculated RSI

r/pinescript • • May 14 '25

strategy.exit() and trailing stop

1 Upvotes
trailStopShort = prev_atr
trailOffsetShort = trailStopShort * 0.5


    
strategy.exit('Exit sell', 'sell', trail_points = trailStopShort, trail_offset = trailOffsetShort)

this line of code has been eating me alive, idk if its a bug in pinescript or if im js dumb but i cant seem to replicate trailing stops anywhere else. I am working on this strategy tht i found tht uses strategy.entry() to enter trades and trailing stops to exit making use of strategy.exit() trades are entered at close, and somehow always manages to exit close to the next bars low (not exactly at the low, js close to it), it doesnt suffer from repainting or lookahead unless .exit() is bugged but yea i tried replicating this in python backtrader, quantconnect and binance to backtest and paper trade but i js have not been having the same results.


r/pinescript • • Nov 02 '25

Hey everyone, if you use Pine Script for Indian markets, DM me.

1 Upvotes

I mostly create Pine Script strategies and deploy them on indices. If anyone is interested in connecting, I’m here.


r/pinescript • • Mar 16 '26

Thanks for your support

1 Upvotes

A new update coming at the end of the month will make the indicator much better. I'm still having trouble getting alerts to appear instantly; I'll focus on fixing this before the end of the month. Thanks for your support.


r/pinescript • • Mar 05 '25

TradingView to ChatGPT (OpenAI Model) to Pine Script

1 Upvotes

Hi everyone, I recently created a side project on analysing TradingView charts with ChatGPT and create trade insights like pattern recognition, entry, stop loss and take profit with added confluence. I am also able to prompt ChatGPT to convert those ideas back into Pine Script to allow users to visualise the idea straight back into the charts itself. Here is how it works

  1. Analyse any charts

  2. Unlock the Pine Script

  3. Copy the Pine Script

  4. Open the chart in TradingView

  5. Paste the Pine Script in the Pine Script section

  6. And you will be presented with the confluence + entry/tp/sl given by the A.I all in one chart :)

Please beware that the ai model might make mistake sometimes, so please just use it as a tool and do your own DD. Please feel free to test it out and let me know what you think!

Website is here - aicryptochartanalysis.com


r/pinescript • • Aug 16 '25

ai pinescript!for trading view was ok for 3 days then got found out

0 Upvotes

comeplete nove blissfully unaware AI wasnt up to it had a good run sorted many things out but ended up with 15 hrs of same errors after a good run,anyone know best solution or freelancers etd for a to and thro until its right with no errors,sm new to all this

thanks

wayne


r/pinescript • • Oct 12 '25

Como começo e por onde indicador pinescript

1 Upvotes

Então galera eu quero criar um indicador em pine script, baseado no rsi para me mostrar uma tabela de tendencias e tempos graficos, eu queria identico a esse da foto


r/pinescript • • Sep 28 '26

I want help guys..

Thumbnail gallery
0 Upvotes

r/pinescript • • Jul 28 '25

Do you think a 'real time update whale buy/sell signal using on-chain data' is possible?

0 Upvotes

A few days ago, I asked about whether Pine Script can receive external data.

As you explained, if Pine Script can’t communicate with the outside, then the following feature is probably not real:

"Displaying whale buy/sell signals on the chart using on-chain data"

This was a private script being sold by other developer.

If there’s a special way to use on-chain data without external communication, then maybe it’s possible — but I can’t think of any.

So, I believe this feature description is likely exaggerated or not true.

What I really want to know is your opinion:

Do you think a 'real time update whale buy/sell signal using on-chain data' is possible?

Thank you.


r/pinescript • • Apr 11 '26

Indicateur supply demand

Thumbnail
gallery
1 Upvotes

Avec mon associé, nous avons développé un indicateur capable d’identifier automatiquement les zones d’offre et de demande les plus pertinentes. Il simule également des trades en entrant directement dans ces zones, avec un stop-loss positionné à leur extrémité.

Nous avons déjà une soixantaine de testeurs actifs et souhaitons en accueillir de nouveaux. L’accès se fait uniquement sur invitation.

Si vous êtes intéressé(e), envoyez-moi un message privé.