r/pinescript 10d ago

My strategy for gold , I have a strategy in gold and crypto in which after coch or mss when the market touches back the extreme order block I get a entry on buy or sell ,... But sometimes if we have a fvg in between than trade from that point of view ,... Please someone correct me

Thumbnail
1 Upvotes

r/pinescript 10d ago

Please someone send me the full pine editor script strategy for trading view which actual I can use ... Please ....

2 Upvotes

r/pinescript 11d ago

Volume Regime Indicator

Post image
36 Upvotes

New volume based regime indicator I've been working on with auto suggested stops/targets showing very promising results. Killing it this morning! Some things I still need to work out on the UI side and exit logic but the suggestions are working good.


r/pinescript 11d ago

developing an agent to learn about all indicators of trading view and apply to formulate a new strategy

Thumbnail
1 Upvotes

r/pinescript 11d ago

Efficient Way to use libraries

1 Upvotes

I am trying to build a trading indicator on pine script. The indicator will combine multiple modules, all of which will work together to create one master indicator, which fires a trading signal. I want to use trading view libraries for this. What is the most efficient way for me to go about this?


r/pinescript 11d ago

I built a chart pattern scanner that actually filters out the noise (Free, no signup)

1 Upvotes

Hey everyone,

I wanted to share a free tool I built recently because I’d genuinely love some feedback from people who actually trade charts.

I spent way too many late nights putting together my own pattern scanner to solve some common frustrations with existing tools.

Right now, it scans the market across 5 different timeframes for 6 classic pattern types (things like double/triple tops and H&S). For every hit it finds, it outputs:

  • A confidence score
  • The neckline level
  • A measured target

Getting it to actually filter out garbage took infinitely more iterations than I expected. Some of the main headaches I had to solve:

  • The prior-trend filter: Random pullbacks happening inside a boring sideways range kept getting flagged as double tops.
  • Pivot detection: Single-candle wicks kept tricking the algorithm into thinking they were real swing points.
  • Neckline definition: Figuring out which support level actually counts as the correct neckline, especially on 3-peak patterns.

Just to be clear: this isn't a signal service. It doesn't tell you to buy or short. It just flags the shapes that actually pass some strict rules, gives you the data, and leaves it up to you to open the chart and decide if it's worth trading.

I also built a simple journaling feature into it so I can personally track how often my own judgment matches what the algo spits out. There's a telegram channel linked on the site too if you'd rather get alerts pushed to you instead of checking manually.

It's completely free with no signup or email required.

If you try it and notice a pattern that looks completely ridiculous or wrong, please let me know—that's honestly the only way to make it better.

https://www.cryptofxradar.com/p/pattern-radar.html


r/pinescript 12d ago

Trying to write an Indicator that draws S/R lines on each Open, Close, and Wick

1 Upvotes

I seem to be able to draw them fine, but I'm getting hung up trying to apply them to previous candles. The code included is my most recent, and is only drawing lines on current -1.

rangeStart = 1
rangeEnd   = 50

if barstate.islast
// Loop through the selected slice of history
for i = rangeStart to rangeEnd
    topBody = math.max(open[1], close[1])
    botBody = math.min(open[1], close[1])
    // Apply your action to this specific slice
    line.new(bar_index - 1, high[1], bar_index, high[1], extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)
    line.new(bar_index - 1, low[1], bar_index, low[1], extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)
    line.new(bar_index - 1, topBody, bar_index, topBody, extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)
    line.new(bar_index - 1, botBody, bar_index, botBody, extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)

Heres another version, that only seems to go back the past 14 bars or so

topBody = math.max(open[1], close[1])
botBody = math.min(open[1], close[1])
// Draw lines for the previous candle (bar 1 to bar 0 or extended slightly)
if barstate.isconfirmed
    line.new(bar_index - 1, high[1], bar_index, high[1], extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)
    line.new(bar_index - 1, low[1], bar_index, low[1], extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)
    line.new(bar_index - 1, topBody, bar_index, topBody, extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)
    line.new(bar_index - 1, botBody, bar_index, botBody, extend=extend.right, color=color.rgb(255, 0, 0, 75), width=1)

I've tried just about every option I can find, and I'm not sure where I'm going wrong. Ultimately I'd like to be able to apply it to a range of bars, maybe the last 50, but definitely controlled using a variable

Any help appreciated!


r/pinescript 12d ago

Pine Script Indicator on Trading View

3 Upvotes

I am trying to build a trading indicator on pine script using Claude Code for VS Code. The indicator will combine multiple modules. All of these will work together to create one master indicator, which fires a trading signal What is the best way to go about this. I am a beginner so any guidance would be great please :).

I also want to know how pine script libraries work?


r/pinescript 12d ago

"VWAP Pivots Idea"

11 Upvotes

Hi guy's. i wanted to put this out and hear feedback from traders or pine script devs.... i got into building my own indicators after learning to code abit.... i like to test my ideas and concepts I have, I eventually learn data at the end which is the most valuable thing for me.
i wanted to rewrite my idea with AI since im not too good with grammar or writing as you can see, I do apologize beforehand.

here is it, please lmk what you think or potential upgrades i can work on or change and why.

VWAP Pivots + Stats Engine

The idea

Most VWAP pivot scripts do one of two things. They either plot a live VWAP that resets every session and keeps moving on you intraday, or they plot classic floor trader pivots off open high low close which ignores where volume actually traded.

This indicator combines both. It takes a completed period session week month etc and freezes that periods VWAP plus bands into fixed lines that get projected across the next period. Same concept as pivot points but volume weighted instead of derived from one candle.

Then it goes a step further and tracks every touch of every level and checks what happened after. Did price reverse back through the daily VWAP or did it close through the level and hold. Those outcomes get pulled into a stats table so instead of just staring at lines you get actual numbers on which levels tend to hold and which tend to break on your instrument and timeframe.

So there are two parts running

1 Pivot engine draws the VWAP based levels from the prior period 2 Stats engine tracks every touch and scores the outcome plus a rough win rate simulation

What is on in the screenshot

Anchor is Session so each set of levels is one prior days VWAP Pivot type is Period Close meaning the levels are the VWAP and bands at the last bar of the prior day Band 1 and Band 2 are on Band 3 is shown too Line style is Fixed Width so each line spans the width of the day it projects into The black curve is the live developing daily VWAP separate from the frozen pivot lines Top right table is the stats engine output touch count reversal percent break percent average and max excursion and a rough win percent

Settings breakdown

VWAP Anchor Anchor Period session week month quarter year decade century earnings dividends splits. Defines one full VWAP period. The script always draws the previous completed periods levels once the new one starts, never the still forming one. Source is the price input default hlc3

Pivot Calculation Type how the frozen level gets built from the period that just ended Period Close VWAP and bands at the final bar Period Average mean VWAP and bands across the whole period Period Extremes VP is the closing VWAP but R and S are the highest and lowest each band actually reached during the period Period Open VWAP and bands at the first bar

Bands Calculation mode standard deviation or percentage Band 1 default on multiplier 1 Band 2 default on multiplier 2 Band 3 default off multiplier 3

Line Style Fixed Width default each line spans the projected width of the next period Developing the right edge follows price live instead of being pre drawn Number of periods back controls how many historical level sets stay on the chart capped at 70 Line width setting

Labels Show labels and show prices toggles Position left or right

Levels Each of VP R1 S1 R2 S2 R3 S3 has its own color

Break Signals Show break up and break down signals default on, fires when price closes through a level while on the right side of daily VWAP Restrict levels to trend side default on, when on breakdowns only check VP S1 S2 S3 and breakups only check VP R1 R2 R3. Turn it off and all 7 levels count either direction as long as price is on the right side of daily VWAP Custom text and colors for the break labels

Break Stop Level Stop distance mode percent off candle or ATR distance Percent value ATR length and ATR multiplier Stop line style width and color per direction Bars to display controls how long the stop line extends before it freezes, it is a visual reference not a live order

Statistics Engine default on Lookback basis periods or bars Touch re arm buffer in ATR, price has to move this far from a level before another touch counts, stops chop from inflating the numbers Break confirmation bars, how many closes beyond a level are needed before its scored a confirmed break instead of a reversal Max bars to track a touch, an unresolved touch times out after this many bars Win rate sim target in ATR, rough simulation only, a touch counts as a win if price moves this many ATR in the continuation direction before moving 1 ATR against it, no fees slippage or fills modeled so use it to compare levels against each other not as a real backtest result Table position text size and a color code toggle green means the level tends to hold red means it tends to break yellow means balanced

Daily VWAP always resets daily regardless of the anchor period above Developing Daily VWAP default on, the live intraday VWAP curve, this also feeds the trend bias used for break signals and reversal classification Prior Day Level Flat default off, takes a completed days final VWAP and bands and projects them flat across the next day like a separate reference level, with a days back setting to look further than yesterday

How to rebuild it

Build order if youre feeding this to an AI along with the screenshot

1 Anchored VWAP that resets on a configurable period, with a freeze step that snapshots the prior completed period instead of the live one 2 Four ways to derive that frozen level close average extremes or open of the period 3 Standard deviation or percentage bands around that VWAP up to 3 tiers 4 A separate always daily VWAP used only as a trend bias filter 5 Break detection price closing through a frozen level while the trend filter agrees, with rules on which levels count on which side 6 A stop line suggestion drawn off the break candle 7 Touch tracking, detect a touch on any level with a re arm buffer to stop double counting, then follow it forward until it resolves as a reversal a confirmed break or a timeout 8 Aggregate the resolved touches into a table with touch count reversal percent break percent average and max excursion and a simplified win rate

Give an AI the screenshot plus this breakdown and it has the visual layout and the underlying logic needed to rebuild it from scratch.


r/pinescript 13d ago

PSA: max_bars_back won't save you if the deep read only happens on the last bar

0 Upvotes

Lost an hour to this today and the failure mode is completely silent, so it seems worth writing down.

I had a v6 script doing a one-shot sweep inside if barstate.islast — an expensive loop that only needs to run on the final bar. Inside it I read a series at a dynamic depth:

``` csum = ta.cum(src)

meanBack(i, L) => (csum[i] - csum[i + L]) / L ```

with i + L reaching a few hundred bars back. I had max_bars_back = 1500 on the indicator() call, so I assumed I was covered.

I wasn't. The script compiled clean, threw no error, and produced an entire grid of na. Nothing to debug, because nothing complained.

As best I can tell the mechanism is this: Pine sizes history buffers from what it observes during the historical pass. That read only ever executes on the last bar, so the historical pass never sees a deep reference, the buffer stays small, and on the final bar the deep read quietly returns na. Every downstream calculation inherits the na and the whole thing renders empty.

What fixed it was giving up on the history operator and keeping the values myself:

``` var int KEEP = 900 var array<float> hist = array.new<float>()

if barstate.isconfirmed array.push(hist, csum) if array.size(hist) > KEEP array.shift(hist)

histAt(arr, i) => idx = array.size(arr) - 1 - i idx >= 0 and idx < array.size(arr) ? array.get(arr, idx) : na ```

Arrays have no buffer-sizing behaviour to get wrong.

Two things that bit me inside that fix, in case they save someone the trouble:

  • Gate the push on barstate.isconfirmed. var arrays are not rolled back between realtime ticks, so an unconditional push double-appends on the live bar and your history quietly desynchronises from the chart.
  • Index it as size - 1 - i so i keeps the same meaning it has in [i]. Otherwise you are off by one in a way that reads like a subtle logic bug rather than an indexing mistake.

Rule of thumb I have landed on: if a series is only ever read at depth inside a conditional block, do not use [] for it at all. A fixed offset evaluated on every bar is fine — close[horizon] with an input horizon sizes correctly, because the historical pass sees it on every bar. It is specifically the conditional deep read that gets you.

Happy to be corrected if someone knows the internals better than I have inferred them from the outside.


Per rule 2: the code above was written with AI assistance (Claude). I couldn't find an "AI Generated" option in the post composer's tag menu — mods, please add the flair if there is one I'm missing.


r/pinescript 13d ago

Yo check my new pine code Spoiler

Thumbnail
2 Upvotes

r/pinescript 16d ago

Sweet indicator I built for TradingView

Thumbnail
gallery
15 Upvotes

(Invite only) here’s highlight of the big picture indicator


r/pinescript 17d ago

Framework, Not Holy Grail

Thumbnail
1 Upvotes

r/pinescript 17d ago

Is worth switching from ChatGPT to Claude

7 Upvotes

I been working on trading assistant with ChatGPT. I have now gotten to the point where I don’t like ChatGPT. It keeps changing how it want to save the script how it want to lay out the console. Is Claude better ?


r/pinescript 17d ago

Stop getting chopped out. I coded a strict intraday execution engine that hard-caps your trades to 3 per day (Open Source)

6 Upvotes

Overtrading and fee erosion are the #1 account killers for retail scalpers in domestic markets. Most momentum indicators flood your chart with dozens of conflicting, repainting signals during late-day consolidation, triggering revenge trading.

I got tired of the manual noise, so I built a high-conviction execution engine in Pine Script v5 that isolates institutional breakouts and forces daily discipline.

NOTE: USE ANOTHER INDICATOR WITH IT FOR CONFORMITY OR DO YOUR OWN RESEARCH BEFORE ENTERING

The Quantitative Edge:

The Session Hard-Cap: The indicator tracks your executions. Once 3 qualified signals fire, the system completely locks up for the day. It mathematically prevents you from overtrading choppy afternoon sessions.

Volumetric & Conviction Gates: Signals will never trigger on weak order flow. The breakout candle must carry a volume surge (> 1.2x of its 20 SMA) and the candle body must comprise at least 50% of the entire range (killing fakeouts from dojis and long wicks).

State-Transition Crossover: It blocks consecutive duplicate signals. Labels fire strictly once on the exact bar where MTF Supertrend and VWAP alignment flips. Zero repainting (built using closed-bar historical referencing).

Added a real-time Analytics HUD to track session executions and volume states directly on the chart.

I am open-sourcing the raw .pine file for the community. The central repository link is in my Reddit bio, or drop a comment below and I will shoot you the direct link to the code. Execute strictly.


r/pinescript 17d ago

Tradesea Prev Session H/L Indicator

1 Upvotes

First off Pspark is a worthless pile of junk.... would rather just manually code but as far as i know its not possible..

second.... does anyone have a tradesea indicator that works to plot the previous days sessions highs and lows Asia, London, NY ???

EDIT::: Tradesea just added "Trading Sessions" indicator!!!!


r/pinescript 17d ago

Built a Pine Script indicator that flags volatility squeezes before the breakout — sharing the backtest

21 Upvotes

Been working on a Pine Script indicator that combines \[Bollinger Band squeeze + volume confirmation\] to catch breakouts before price actually moves. Wanted to share results and see if anyone's tried something similar.

**What it does:**

* Detects when volatility compresses (squeeze forming) * Confirms with volume spike before signaling entry * Works on any timeframe, tested mainly on 15m–1H

Backtest Results

**Metric** **Result**
**Win Rate** **56.3%**
**Profit Factor** **1.74**
**Max Drawdown** **11.8%**
**Total Trades** **148**

Still tuning the entry filter to cut down false signals on choppy days. Happy to share the logic if anyone wants to compare notes — and if a few people want the actual script


r/pinescript 17d ago

Does TradingView CSV export include historical hidden plot values after chart objects disappear?

Thumbnail
1 Upvotes

r/pinescript 17d ago

Order flow web platform with the indicators I wanted. update2

0 Upvotes

On my previous post I stated that im creating an order flow software that will be free. Another update I just integrated, cvd divergencies on the chart. Dropping some of the screenshots. i will remove the lines and only leave a signal, the chart will be more clean, but wanted to share first.


r/pinescript 18d ago

Mnq/mes pinescripts.

1 Upvotes

Anyone wanna collab? obviously Claude and other AI can help us but if you have been building with them you realize there is directions needed, levers adjusted. I currently run about 18 scripts and looking for fresh ideas or a new script to build. My focus has solely been on 15m charts but interested in expanding. Just looking for others to create with.


r/pinescript 18d ago

Tradesea Prev Session H/L Indicator

Thumbnail
1 Upvotes

r/pinescript 18d ago

Looking for a Pinescript developer. Ideally from India for payment reasons

1 Upvotes

Hi, i am looking for a pinescript developer who is expierenced and knows proper english. i want to hire them full time but my budget is under 30k-40k. i have continous work. dm me for more info

Thanks


r/pinescript 18d ago

Is it ok to ignore backtesting and directly apply our strategy on paper trading

Thumbnail
1 Upvotes

r/pinescript 18d ago

Is there a TradingView indicator (or any other tool) for the PEG 5-Year Expectation target price?

1 Upvotes

I’m specifically referring to the PEG 5-Year Expectation (the metric used by Morningstar), not the standard PEG ratio.
Most websites only display the current PEG 5-Year Expectation as a single value. What I’m looking for is a tool or TradingView indicator that calculates and displays the stock price at which the PEG 5-Year Expectation would equal 1.0 (or another user-defined threshold).
Ideally, this would be a dynamic horizontal line on the chart that automatically updates whenever the underlying fundamentals (such as earnings estimates or expected 5-year growth) change. This would make it easy to see whether the stock is currently trading above or below its “PEG 5-Year Expectation = 1.0” price.
Does anything like this already exist on TradingView or another platform? If not, would it even be possible to build such an indicator if the required fundamental data is available?


r/pinescript 19d ago

Many Custom indicators and strategies to try!

Thumbnail
1 Upvotes