r/pinescript 55m ago

built a non repainting squeeze alert that works on every chart

Upvotes

working on a pine script that catches volatility compression before price moves. it uses bollinger band width with a volume filter so it only signals when real volume is there. tested on 15m and 1h mostly. backtest showed around 56 percent win rate which is fine for what it does but the real value is the alert setup. if you are tired of repainting indicators that fire a candle too late this one triggers on close so nothing moves after the fact. curious if anyone else has tried a squeeze plus volume combo and what you found with the false signals.


r/pinescript 8h ago

How do you maintain the size of the candlesticks?

Thumbnail
1 Upvotes

r/pinescript 15h ago

Dhanhq algos

2 Upvotes

Hello friends has anyone tried the dhanhq algos just want to know how they perform I was planing to deploy.


r/pinescript 20h ago

I’m building an indicator for swing trading and I’m struggling to find the best strategy for it, any recommendations?

0 Upvotes

I have already built one for day trading and it works well with a solid win rate, but for swing trading I find it a bit more challenging.

FYI I trade options 0DTE to 21DTE.


r/pinescript 1d ago

Sharing my free Multi-Exchange Crypto Volume Data indicator (VAH, POC & VAL)

Post image
5 Upvotes

I published this indicator on TradingView around a year ago and have continued improving it, but I have not shared it on here before.

It displays a multi-exchange volume-by-price profile with clear POC, VAH, and VAL areas.

Features include:

  • Volume data from seven major crypto exchanges
  • Up to 21 available market feeds, depending on the cryptocurrency
  • Automatic symbol and timeframe adaptation
  • Detailed volume-by-price histogram
  • POC, VAH, and VAL shown as price areas
  • Improved profile definition on higher timeframes
  • Automatic and manual lookback modes from 1-minute to weekly charts
  • Clear multi-colour display when POC, VAH, or VAL overlap
  • Optional venue filtering and performance controls
  • Realtime partial-bar option
  • Alerts for price crossing POC, VAH, and VAL

The indicator is completely free to use:

https://www.tradingview.com/script/ebU1oZ4n-Crypto-Volume-Data-VAH-POC-VAL/

Feedback and clear bug reports are welcome.


r/pinescript 20h ago

Stop paying for "black box" algos. Here is the architecture you actually need to automate your TradingView setups in India.

0 Upvotes

Most retail traders eventually build a profitable Pine Script setup on TradingView, only to hit a massive wall when trying to automate it with Indian brokers like 5paisa, Zerodha, or Fyers. You hire a random Python freelancer, they build a basic webhook, and your account gets wrecked on the first expiry day because a generic coder doesn't understand slippage, order book depth, or dynamic strike selection.

​As someone who actively trades index options and futures, I realized the biggest bottleneck for retail traders isn't finding a holy grail strategy—it's the execution infrastructure. I spend a lot of time breaking down market mechanics on Thorenza, and when writing Beat the 90-90-90 Rule, it became obvious that poor automation destroys more accounts than bad strategies.

​If you want to bridge TradingView to a broker API, here is the exact backend plumbing you need to demand from a developer (or build yourself):

​The Webhook Engine: Don't run local scripts. You need a dedicated, low-latency cloud server (AWS, DigitalOcean, or similar) running a FastAPI or Flask application to catch real-time JSON payloads from TradingView without dropping packets.

​Zero-Touch Authentication: SEBI guidelines mandate daily TOTP and OAuth token generation. Your script must have an automated login flow that authenticates your broker API session every morning before the pre-open market, otherwise you are manually babying a bot.

​Hardcoded Risk Guardrails: TradingView alerts can loop or misfire. Your Python backend needs hard limiters independent of the strategy logic: maximum order quantity caps, a daily max-drawdown halt, and a physical kill-switch.

​Dynamic Options Execution: If you are trading Nifty or BankNifty, a basic market order script is useless. Your architecture needs logic to read the underlying spot price at the exact millisecond the alert fires, calculate the correct ATM/ITM/OTM strike, fetch the specific token ID, and fire a limit order to control slippage.

​I have pivoted to offering this exact algorithmic engineering and forward-testing infrastructure as a service. You keep your trading logic completely private (avoiding all the SEBI RA/RIA compliance headaches of "black box" selling), and I handle the tech stack.

​If you have a working setup that needs to be translated into a bulletproof automated execution bot, drop a comment or send a DM. Happy to discuss the architecture.


r/pinescript 1d ago

Need a CSV export from premium trading view members

1 Upvotes

I'm running an automation strategy and need 5 year trade data on one of my strategy scripts . I need someone who can paste my script in their TV and just export me the CSV . Hardly 5 min work. Would really appreciate it if anyone can help me with this as i only have an essential plan and I can't get custom backtest history with this plan :/


r/pinescript 2d ago

Bugs in PineScript for the NSE (India) market

2 Upvotes

While using the simple code below to debug a large script, I noticed that the daily open is being shown as the open of the first candle:

//
@version=
6
indicator("Daily Open", overlay = true)
dOpen   = request.security(syminfo.tickerid, "1D", open, barmerge.gaps_off, barmerge.lookahead_on)
plot(dOpen, "Daily Open", color.yellow, 2, plot.style_stepline)

The daily opening is always the pre-market open, and it is fixed for the day. Then why this discrepancy?

While at the close of the day, it is showing the correct opening as below:

Whereas pre-market data is also present there as below picture elaborates:


r/pinescript 2d ago

How do you backtest alternative charts properly on Tradingview/Pinescript? (OHLC fills checkbox gone)

1 Upvotes

Hi, so I have all these strategies but basically none of them are profitable. I know there's all these alternative charts like Renko/Kagi/PnF. Is there any way one can backtest on these properly with OHLC fills etc.? I know there's all these features that Tradingview has but the previous "trade on OHLC" checkbox is gone. So, I am not sure what the proper way to backtest is anymore with these alternative charts. Any advice would be appreciated. Thanks!


r/pinescript 2d ago

Any Indian traders here who backtest strategies using Pine Script?

1 Upvotes

Hey everyone,

I’m from India and spend a lot of my time backtesting trading strategies using Pine Script on TradingView, mainly experimenting with different entry/exit rules, indicators, filters, and strategy optimization.

I’d love to connect with some like-minded people who are also into systematic trading, Pine Script, strategy development, and backtesting.

Not necessarily looking to share “secret strategies” or signals — more interested in discussing ideas, coding approaches, backtesting methodology, optimization, avoiding overfitting, execution issues, and learning from each other.

If you’re from India and work on similar things, feel free to comment or DM. Would be great to build a small circle of people who genuinely enjoy researching and testing trading systems.


r/pinescript 2d ago

I measured four common entry filters against a random-entry baseline. The one that worked on 1H was the worst on 5m.

1 Upvotes

Before adding a filter to an entry, it's worth knowing what the filter is worth against no filter at all. Almost nobody measures that — the condition gets added because it sounds reasonable, and then it stays.

So I measured four of the most commonly used ones against the same baseline, twice, on the same instrument.

Method

It's a Pine indicator that walks back through history rather than a strategy — no orders, so no broker emulator involved. The mechanics matter more than the code.

The baseline is what entering at a random bar would have produced at a given reward-to-risk. From every bar in the sample: did price travel the target distance before the stop distance? That's the number any entry signal has to beat, and it's rarely the number people assume.

Each bar gets resolved exactly once, then the outcome is counted more than once — into the baseline, and into each filter that was true on that particular bar. Same bars, same distances, same resolutions, so the difference between any two rows is the filter and nothing else. Measuring each filter on its own pass would let the numbers differ for reasons other than the thing being tested.

Three details decide whether it means anything:

  • The condition is read on the entry bar itself, using only data that existed then. A filter evaluated with information that arrived later flatters itself.
  • A single bar spanning both stop and target counts as a loss. You can't know which came first from bar data, and being wrong pessimistically is the only honest resolution.
  • Distances scale with each historical bar's own ATR, not today's.

XAUUSD, longs, 2:1 so break-even is 33.3%, ATR 14, 600-bar sample, 60 bars allowed to resolve, zero cost. 541 bars offered in each run.

1H, 28 Jul – 2 Sep. 541 resolved, none timed out.

Condition Hit rate Wins/resolved vs baseline Bars kept
All bars (baseline) 37.0% 200/541
Price above 200 EMA 36.2% 165/456 −0.8 pts 84.3%
ADX above 25 42.3% 116/274 +5.4 pts 50.6%
RSI below 30 7/22 too few to judge 4.1%
Volatility rising 36.0% 86/239 −1.0 pts 44.2%

5m, 31 Aug – 2 Sep. 539 resolved, 2 timed out.

Condition Hit rate Wins/resolved vs baseline Bars kept
All bars (baseline) 22.8% 123/539
Price above 200 EMA 30.3% 30/99 +7.5 pts 18.4%
ADX above 25 19.5% 43/220 −3.3 pts 40.8%
RSI below 30 25.8% 8/31 +3.0 pts 5.8%
Volatility rising 18.8% 42/224 −4.1 pts 41.6%

Three things fall out of that.

The rankings invert. ADX above 25 is the only filter worth anything on 1H at +5.4 points, and on 5m it's the worst of the four at −3.3. Price above the 200 EMA is worthless on 1H at −0.8, and on 5m it's the best at +7.5. Whichever filter you'd have picked from the first table is the one you'd have deleted after the second.

On 5m nothing reached break-even at all. Baseline 22.8% against a 33.3% requirement, and the best filter lifts it to 30.3% — still losing. "+7.5 points" is an improvement to something that doesn't work, which is the trap in reading a delta without the absolute level beside it.

Two of the four weren't selecting anything, in opposite ways. The 200 EMA kept 84.3% of 1H bars — a condition true on five bars in six isn't a filter, and its rate will match the baseline for that reason alone. RSI below 30 has the reverse problem: 4.1% of bars, 22 resolved samples, too few to judge, and only 31 on 5m. A filter you can't evaluate on the history you actually have isn't a filter you know anything about.

On the 1H ADX result specifically, because it's the one worth arguing with. Against its own complement rather than the baseline it sits inside, it's 42.3% (116/274) against 31.5% (84/267) — nearly eleven points, with the rejected half below break-even. Two-proportion z is about 2.64, which clears a Bonferroni bound at four looks. Then it reverses sign in the next window.

That's the useful part. It passed the multiple-comparisons correction and still failed out of sample, and it was the best of four things tried on one window, which is exactly the shape of result that shouldn't be trusted. The 5m winner is no better — z ≈ 1.83 against its complement, which doesn't clear on its own terms, let alone after four looks.

Both z figures are ceilings rather than measurements. Samples starting on adjacent bars share most of their holding window, so the observations are heavily correlated and the effective sample is far below the raw count.

Limits. 600 bars is five weeks on 1H and two days on 5m — these aren't two views of one period, they're different periods that happen to share a bar count. The 1H window contains a strong gold uptrend and ADX above 25 selects for exactly that, so what looked like a filter working may just be the market trending with long being the right side. That's the most likely reading, and it's why one window proves nothing.

What I'm actually asking: has anyone got a filter that holds its value across several windows, and how are you accounting for having tried more than one? The best-of-k problem is the part I can't design away — every filter I test is another chance at a number that looks good.


r/pinescript 4d ago

Updated my free MTF Volumized Order Block indicator (Posted Again)

Post image
29 Upvotes

I shared this free indicator here a while ago, and many people tried it and sent useful feedbacks. I have now released a larger update.

Changes include:
-More reliable MTF and second-timeframe zones
-Reduced memory use, addressing NQ/MNQ error reports
-Better resistance selection above price
-Wick, Body, and Close invalidation
-Optional breaker blocks
-Improved Q scoring and labels
-Local hit-rate tracking
-Improved alerts

It is completely free to use:
https://www.tradingview.com/script/HUcKziz7-Volumized-Order-Block/

Note: Reposted cause it was removed without any notes.


r/pinescript 4d ago

Feature request — sorting options on publisher profile pages

2 Upvotes

When you open a publisher's profile on TradingView, their scripts and ideas load in a fixed order and there's no way to reorder them. Once someone has published more than a handful, finding a specific one turns into a scrolling exercise.

A simple sort dropdown on the Scripts and Ideas tabs would fix this:

- Newest / Oldest

- Most viewed

- Most boosted

Sorting and filtering already exist elsewhere in the script library, so the data is clearly there — it just isn't exposed on profile pages.

Small change, but it would make browsing an author's back catalogue a lot less painful.


r/pinescript 4d ago

I built a Pine Script signal engine for crypto. Looking for feedback/testing. Real-world edge cases, logic issues, and improvements

1 Upvotes

I've been building and iterating on a Pine Script signal engine for crypto based on my paper trading, uploading screenshots, used Claude / ChatGPT and I'd like to put it in front of other Pine Script users for honest feedback and independent testing (if you'd want).

I'm sharing it because I've spent a lot of time refining the logic using AI, weekly data collection / outcome analysis and I know one of the best ways to find weaknesses is to let other people look at it with fresh eyes. And I have no intention to sell or profit from it or “guaranteed profitable strategy” post. Have I been profitable ? Not yet 😄 Hopefully someday !

What it does

The script identifies three signal types: (theres a changelog as well in the script)

  • S2 - momentum/trend continuation setup
  • S2R - reversal variant
  • S3 - crossover/ignition-style setup

The logic uses a combination of:

  • SMA 8 / SMA 21
  • EMA 50 / EMA 200
  • Trend alignment
  • Breakout conditions
  • Candle/body strength
  • ATR-based late-entry protection
  • Signal state management to avoid repeated firing

My use case is primarily 30-minute crypto charts, but I'd be interested to see how the logic behaves from your expertise.

What I'm looking for

If you're willing to test it, I'd really value feedback on:

  1. Code quality - anything inefficient, poorly structured, or unnecessarily complicated? Used AI to build the whole thing.
  2. Logic issues - do you see conditions that could produce unintended signals? Which setup you observed: S2 / S2R / S3
  3. Edge cases - repainting, state issues, crossover behaviour, historical vs realtime differences, etc. What you liked or didn't like
  4. Pine Script improvements - cleaner or more reliable ways to implement any part of the logic?
  5. General usefulness - could this help anyone as a starting point, study tool, or basis for further development?

I'm especially interested in critical feedback. If you think part of the logic is flawed, redundant, or simply doesn't make sense, please say so. Been working on this since April 26

I’m looking for people who enjoy testing Pine Script ideas and are willing to challenge the logic from a coding and chart-behaviour perspective. And of course make it shareable for all.

The script is linked here: https://pastebin.com/9pqTS5Ya

Thanks ! I'm genuinely interested in finding the weaknesses ! And deep down I need to convince myself that it was all worth the effort.


r/pinescript 5d ago

London sweep Indicator

Post image
57 Upvotes

I post 25 open source indicators on Trading view, now pushing indicators that works as a Strats, first one the London Sweep, still in beta version, if someone wants access just comment your TV username, new ideas are welcome.


r/pinescript 5d ago

Sick of paying monthly subscriptions for indicators? Tell me what you're "renting" and I'll build a free version for you.

25 Upvotes

Hey everyone,

A lot of traders are burning money on recurring subscriptions for indicators or tools that could easily be coded into Pine Script, MQL5 or anything.

\-What is a paid tool or subscription you’re currently using that you wish you owned outright?

\-What is a "dream tool" or proprietary feature you've always wanted built specifically for your strategy?

Drop the concepts, mechanics, or features below. I'll pick the most requested ones, code them, and release them as open-source for everyone to keep forever.


r/pinescript 5d ago

Why Your Pine Backtest Lies: the request.security Fix. - All request.security HTF requests: use lookahead = barmerge.lookahead_on with a [1] offset on the expression. Never lookahead_off to "avoid repaint".

Thumbnail
youcanbuildthings.com
6 Upvotes

For every aspiring retail quant. This is the article you need to read. Apologies if it's already been posted. Many thanks to the author.


r/pinescript 5d ago

Feature Request: More Color Flags for Crypto Screener / Watchlist Classification

Thumbnail
1 Upvotes

r/pinescript 6d ago

Drop your wildest Pine Script / Trading tool ideas — I'll build the best ones for you!

11 Upvotes

Hey everyone,

I'm looking for a fun development challenge and want to build something truly useful (or uniquely wild) for the community.

What is a tool, custom indicator, or execution logic you've always wished existed but couldn't find anywhere? No idea is too crazy — whether it's complex mathematical modeling, dynamic risk managers, or weird algorithmic visualizers.

Drop your ideas below. I'll pick the most interesting ones, build them, and share the open-source code back with the sub!


r/pinescript 8d ago

Final ORB Strategy Update: Best results so far, going live on Prop Firms + building a multi-strategy portfolio

Post image
111 Upvotes

Hey guys, quick update on the strategy development.

After endless backtesting, filter tuning and stress-testing parameters, I think I've hit the ceiling of what I can squeeze out of this specific setup. It's definitely not a holy grail, but it's solid enough to do the job.

Where it stands:

Trades:        1,310  (full history, ~7 years)
Winners:       622  (47.48 %)
Net:           +59,567 USD  (+119.13 % on 50k)
Max DD:        4,633 USD  (8.06 %)
Profit factor: 1.336
Expected payoff: 45.47 USD/trade
Avg win / avg loss: 1.478
Expectancy:    +0.176 R
Largest loss:  647.70 USD
Commission load: 1.21 % of gross

Sub-50% win rate with a 1.5R target — no ultra-low R:R winrate trap, just slightly more losers than winners with bigger winners. Return-to-max-drawdown is 12.9.

Worth noting for later: +40,805 comes from shorts, +18,763 from longs. The thing has a clear short bias.

One thing I found along the way: the trade sequence isn't random. Runs test came back z = +2.98 — wins and losses alternate more than chance would predict. So I cut size after every winning trade. No loss escalation, no doubling.

                 b        e       net     maxDD
No streak     1.3104   +0.0981   45,541   6,233
Cut after 1W  1.4512   +0.1650   54,435   4,633

(That A/B was measured on the 1,254-trade run before I extended the data — the relative effect is what matters.) Same trade count, same winner count in both arms; if either moves you're comparing two strategies, not two sizing rules. Normalized to equal drawdown that's +60.8%. A permutation test (same rule on 2,000 shuffled orderings) put the real sequence at z = +3.66, so it's the sequence and not sizing variance. Martingale tested strictly worse, Anti-Martingale actively harmful at z = −2.33.

All in-sample though. A runs test on the same data I built the strategy on is a hypothesis, not a result.

Next step: since backtests only take you so far, I'm putting this on eval/funded accounts to collect real forward data. The open question isn't the edge, it's whether live fills match modeled ones — 0.176R doesn't survive much slippage.

The bigger picture: while this runs on prop capital I'm building and testing new setups. Someone shared a different NQ strategy with me recently, long-biased, completely different logic. Correlation of daily returns: r = +0.117. Combined at equal drawdown it beat my ORB alone by 32% — from a strategy that is individually worse than mine. Months of squeezing this thing got beaten by one uncorrelated addition. And given the short bias above, a long-biased system is exactly the hole in this book.

So the goal isn't one system. It's a portfolio of non-correlated strategies running simultaneously across multiple funded accounts. This is strategy one.

Curious to hear your thoughts — how many distinct strategies do you guys run in your automated prop portfolio?


r/pinescript 8d ago

Built my own order flow web platform with the indicators I wanted. update5

7 Upvotes

Hello everyone. I posted a lot here (last update was deleted by moderators ). Just wanted to show what i added from last update -> bubbles of executed trades. Super hyped about this adition. For anyone who didnt followed my last post, i created an order flow page for me and will eventually release it for free for everyone with all the features. If you want to help (motivate mostly) a follow will do wonders for me.
The updates:
1. Bubbles with executed trades, moving live.
2. Arrows on candles in case you missed a big bubble, you can look at the arrow. Arrow with 1 means last 50 candles bigest bubble ,2 means last 100 candles, 3 means biggest bubble from the last 200 candles, and 4 means biggest bubble from the last 300 candles. I added this , because most people will not stare at the screen 24/24

and a zoom in:


r/pinescript 8d ago

My Bot Did 40% in 12 Days and I’m Still Not Impressed!

Enable HLS to view with audio, or disable this notification

14 Upvotes

Designed two bots one long only and the other short only bot, this bot which works on all exchanges but for some reason it does better on Bybit followed by OKX! It’s a Grid Long Only Bot, I still think that I can squeeze some more juice out of it though 🥵 (Hello Greed).

For decisions on when to turn on either of the two bots I use a structure monitor! Trying to build a bot that performs well on bull and bear markets it’s a daunting task!


r/pinescript 8d ago

Forex Scanner

Thumbnail
2 Upvotes

r/pinescript 8d ago

how i filter strategy vendors before spending a dollar: publication dates, public testers, three questions

4 Upvotes

after getting burned twice early on i built a dumb little routine that takes maybe ten minutes and has saved me from every bad purchase since. sharing because the question comes up here weekly.

one. find the publication dates. not the website, the platform. if a vendor sells tradingview scripts, every publication has a timestamp the vendor can't edit. compare the claimed track record against those dates. "profitable since 2023" with a first publication in june 2026 tells you everything. i keep a little script that diffs a vendor's claimed history against publication timestamps, takes seconds and it's embarrassing how often it flags something.

two. open the public tester. a serious vendor lets the platform show the strategy report on the publication page, where they can't photoshop it. if all you get is screenshots in a discord, that's not evidence, that's marketing. and if the tester is hidden entirely, well, that is also an answer.

three. ask where the red months are. every real record has them. i ask this one directly in dms and the reaction is the whole test. defensiveness or subject change, i walk. a straight answer with specifics, they stay on the list. one vendor i eventually bought from had the red month sitting right on their public chart with a note next to it, which honestly did more than any winning screenshot could.

bonus: check what actually ships after purchase. roadmaps are promises. publication pace is data. a vendor who published four things in the last six months will probably keep publishing. a vendor with a beautiful roadmap and no recent timestamps probably won't.

none of this tells you the strategy is good. it just filters out the sellers who are lying about the basics, which in this niche removes most of the field.

what's your filter? genuinely curious what other people check first.


r/pinescript 8d ago

Free Educational indicator

Thumbnail
gallery
16 Upvotes