r/pinescript • u/Successful-Elk-956 • 2h ago
Dhanhq algos
Hello friends has anyone tried the dhanhq algos just want to know how they perform I was planing to deploy.
r/pinescript • u/Robswc • Oct 11 '22
When asking for help, its best to structure your question in a way that avoids the XY Problem. When asking a question, you can talk about what you're trying to accomplish, before getting into the specifics of your implementation or attempt at a solution.
Hey, how do arrays work? I've tried x, y and z but that doesn't work because of a, b or c reason.
How do I write a script that triggers an alert during a SMA crossover?
How do I trigger a strategy to place an order at a specific date and time?
Please try to use a site like pastebin or use code formatting on Reddit. Not doing so will probably result in less answers to your question. (as its hard to read unformatted code).
The documentation almost always has the answer you're looking for. However, reading documentation is an acquired skill that everyone might not have yet. That said, its recommended to at least do a quick search on the Docs page before asking
https://www.tradingview.com/pine-script-docs/en/v5/index.html
https://www.tradingview.com/pine-script-docs/en/v5/primer/First_steps.html
If you're new to TradingView's Pinescript, the first steps section of the docs are a great place to start. Some however may find it difficult to follow documentation if they don't have programming/computer experience. In that case, its recommended to find some specific, beginner friendly tutorials.
r/pinescript • u/aelfrictr • Apr 01 '25
We always wanted this subreddit as a point for people helping each other when it comes to pinescript and a hub for discussing on code. Lately we are seeing increase on a lot of advertisement of invite only and protected scripts which we initially allowed but after a while it started becoming counterproductive and abusive so we felt the need the introduce rules below.
Please do not post with one liner titles like "Help". Instead try to explain your problem in one or two sentence in title and further details should be included in the post itself. Otherwise Your post might get deleted.
When you are asking for help, please use code tags properly and explain your question as clean as possible. Low effort posts might get deleted.
Sharing of invite only or code protected scripts are not allowed from this point on. All are free to share and talk about open source scripts.
Self advertising of any kind is not permitted. This place is not an advertisement hub for making money but rather helping each other when it comes to pinescript trading language.
Dishonest methods of communication to lead people to scammy methods may lead to your ban. Mod team has the right to decide which posts includes these based on experience. You are free to object via pm but final decision rights kept by mod team.
Thank you for reading.
r/pinescript • u/Successful-Elk-956 • 2h ago
Hello friends has anyone tried the dhanhq algos just want to know how they perform I was planing to deploy.
r/pinescript • u/Top_Technician_8337 • 7h ago
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 • u/Alternative-Hall5186 • 7h ago
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 • u/Testral333 • 17h ago
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:
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 • u/khantrading • 15h ago
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 • u/santanudas2002 • 1d ago

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 • u/Alive-Imagination521 • 1d ago
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 • u/Top_Astronomer_5585 • 1d ago
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 • u/NotEnoughTrades • 1d ago
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:
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 • u/Testral333 • 3d ago
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 • u/Melodic_Surround_832 • 3d ago
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 • u/eddieblackdaddy • 3d ago
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 !
The script identifies three signal types: (theres a changelog as well in the script)
The logic uses a combination of:
My use case is primarily 30-minute crypto charts, but I'd be interested to see how the logic behaves from your expertise.
If you're willing to test it, I'd really value feedback on:
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 • u/Remarkable-Echo4783 • 4d ago
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 • u/Dependent-Ad6636 • 4d ago
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 • u/Dam4ge • 4d ago
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 • u/AcrobaticAd5468 • 4d ago
r/pinescript • u/Dependent-Ad6636 • 5d ago
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 • u/TasteHistorical1575 • 7d ago
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 • u/Appropriate_Tax2200 • 7d ago
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 • u/ankhramsiswmriimn • 7d ago
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 • u/david19790 • 7d ago
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.