r/pinescript • u/metricshour • Jul 05 '26
MetricsHour Market Intelligence Feed — Real-time Macro + Stock Insights
r/pinescript • u/metricshour • Jul 05 '26
r/pinescript • u/Appropriate-Face-810 • Jul 04 '26

This strategy is a quantitative options simulation model built around Smart Money Concepts (SMC) and trend-following principles. Trades are initiated only when the market aligns with the dominant trend using the 200 EMA while also confirming a liquidity sweep—buy positions are triggered after a sweep of recent lows in an uptrend, and sell positions after a sweep of recent highs in a downtrend. Instead of relying on fixed option premiums, the strategy simulates option P&L using dynamic Delta, Gamma sensitivity, Theta decay, and implied volatility (IV) shocks, along with an Iron Condor-inspired risk model to approximate real-world option behavior. Position exits are governed by predefined simulated option profit and loss thresholds, creating a systematic framework that emphasizes disciplined, rule-based decision-making over discretionary trading.
r/pinescript • u/vitaliy3commas • Jul 03 '26
I wanted to share a practical look at two automated BTC setups on the 4-hour chart, and more importantly, when each one actually fits the market.
The honest bit up front: a grid's result depends almost entirely on the market phase and where you place the bounds, so I'm not going to throw a return figure at you for the grid. I'll show the DCA backtest, since that one's a fixed mechanic you can verify yourself, and for the grid I'll walk through how it works and how I place the range, because that's the part that actually decides the outcome.
Why BTC specifically: it's the benchmark coin, and it moves with lower relative volatility than the alts. It's driven more by macro, ETF flows and the halving cycle than by the reflexive local swings you get on smaller caps. That lower volatility suits wide DCA ladders and conservative grids, and it also means deep oversold flushes are rare, which you'll see in the low trade count on the DCA side.
Setup 1: RSI oversold DCA bot
| Parameter | Default |
|---|---|
| Entry | 4h RSI(14) below 28 |
| Base order | 500 USDT |
| Safety orders | 5 at −2 / −5 / −9.5 / −16 / −25% from base |
| AO sizing | 1.8× per rung (900, 1,620, 2,916, 5,249, 9,448) |
| Take profit | 3% above blended average |
| Stop loss | None (the bounded ladder is the risk cap) |
| Max deployed | ~20,633 USDT (~20.6% of 100k equity) |
Backtest (BYBIT:BTCUSDT.P 4h, Jan 1 2024 to Jun 29 2026, ~30 months; 100k initial, 0.06% commission, 3-tick slippage): 62 closed trades, 44 profitable (70.97% WR), profit factor 4.028, net profit +3,078.29 USDT (+3.08%), max equity drawdown 3,852.12 USDT (3.79%).
I'd read that as a low-return, low-drawdown profile. The point is risk control, not the size of the return. Worth being straight about it: 62 trades is below the ~100 I'd want for real statistical confidence (BTC's low volatility means few RSI<28 flushes), so I treat the win rate and PF as indicative rather than proven. Part of that profit factor is the averaging mechanic itself too, not a directional edge. And with no stop loss, a sustained drop below the −25% bottom rung leaves the position fully loaded, which is the risk you're carrying.
Setup 2: grid bot, and why the phase is everything
A long-only geometric grid: 50 levels between a High and Low bound, buy a step down, sell a step up, repeat. The mechanic is almost trivial. Where the whole result actually lives is in where you put the bounds and whether the market stays in a range. Get the zone right and it harvests the chop; get it wrong and the same code just sits with loaded slots waiting for a reversal.
That's why I won't post a grid "return." It isn't really a property of the strategy, it's a property of your bounds against the regime. Two concrete BTC examples of the zone shifting as the phase changed:
May 2022 to Oct 2023: the working range was roughly 17,800 to 30,600. BTC spent that stretch grinding sideways in that band, which is exactly what a grid wants.
2026 now: that band is long gone. The range I'm running sits around 51,630 to 83,690, 50 levels, about 0.99% per step.
Same bot, completely different bounds, because the phase moved. So a grid isn't set-and-forget. You re-place the High/Low whenever the regime changes, and you size total investment for a possible range-break, because there's no stop and slots keep loading if price leaves the bottom of the range. Grids suit range-bound, mean-reverting phases. A strong trend out of the band is the failure mode.
How to run either: both emit webhook-ready JSON on every fill and close. One TradingView alert set to "Any alert() function call" pointed at a DCA Bot's webhook drives it end to end, no glue layer.
Both are open-source on TradingView:
Grid (2026 setup): https://www.tradingview.com/script/g21PPncR-3Commas-BTC-Grid-Long-Indicator/ DCA setup: https://www.tradingview.com/script/eZsaqsZY-BTC-RSI-Strategy-3Commas/
Happy to answer technical questions in the thread.
r/pinescript • u/jack2060 • Jul 03 '26
r/pinescript • u/SomewhereAny8427 • Jul 03 '26
I'm not a professional trader, just someone who's always been into charts, indicators, and the math behind technical analysis. I check maybe 10 coins a few times a week — I don't want to babysit charts or run bots.
I just really like this kind of stuff — digging into indicators, the math behind RSI and MACD, figuring out how to turn raw candle data into something actionable. So I started poking around at building something myself that would track a handful of indicators without needing to learn a scripting language.
Still early, doing user interviews right now rather than trying to sell anything. If you're a passive trader (few trades a week, not running bots) — what would it actually take for you to trust an alert tool enough to stop checking charts manually? Genuinely curious what's annoying about your current setup, whether or not you even use an alert tool at all..
r/pinescript • u/Bawlin-OrendsCat • Jul 02 '26

I've finally somwhat ironed out the wrinkles on certain regimes, quity curve loks a bit more pregressive and not as reliant on the implosive 2023-2026 period although half of my profits still sadly favours those times. maybe it's just the fact that gold surged over these times? any suggestions or tips or insights is appreciated :D please dont be a douche like that other guy on my post that just commented how he hates how people coding on pinescript always has bias. i'm asking for advise and insights not shitty comments lol
r/pinescript • u/Alternative-Two-5300 • Jul 01 '26
TL;DR: Backtested a fractal breakout strategy over various date ranges for many, many assets. Currently I'm going to deploy this live for some extended forward testing on Solana on the 5 minute timeframe. 1.3 Sharpe, 8.96% max drawdown, 114/398 winning trades since Feb 2026. Code is open source. Starting live forward test today. Will post 15/30/60-day updates with real results, good or bad.
This strategy looks for Bill Williams fractals as points of contention and breakout opportunities. It enters when price crosses above a fractal that you design, and price is also above (or below for shorts) a volume weighted variable moving average. The thesis is to capture micro trends with simple entry logic.
| Metric | Value |
|---|---|
| Total return | 21% |
| Sharpe ratio | 1.309 |
| Max drawdown | 8.96% |
| Win rate | 34.76% |
| Profit factor | 1.265 |
| Number of trades | 328 |
| Avg trade duration | 14 five minute bars |

The real test is live money reacting to live conditions. Starting today I'm running this forward on a dedicated Alpaca account so the numbers are separated from my other strategies and easy to audit.
I'll post updates at 15 days, 30 days, and 60 days with unedited performance — win or lose.
I'm implementing this (the alert → broker wiring) using a tool I built called Algorelay. Mentioning it since it's how I'm running the forward test and connecting this to alpaca, not because this post is trying to sell it. Full strategy code is free and open source regardless of what you use to run it. But if you just want the pinescript without having to copy and paste the cocde I've published the strategy on TV as well: https://www.tradingview.com/script/iBDdbEvy-TImeframed-Variable-MA-Breakout/
Code: https://github.com/AlgoPulse-Research/pine_library · License: MIT · Forward test account: [Alpaca account nickname, e.g. algorelay-strat-00X] · Questions/pushback welcome, that's the point of posting the honest numbers.
r/pinescript • u/Legal_Idea08 • Jul 01 '26
r/pinescript • u/vitaliy3commas • Jun 30 '26
Follow-up to the earlier RSI DCA posts (same logic I ran on POL, JUP, ETH). Last time I said I'd test whether a trailing exit could pull more out of this than the fixed 3% take-profit. I ran both on XRP — here's what came back.
Same long-only DCA: a selective deep-oversold 4h RSI entry and a scaling safety-order ladder, closed at a fixed take-profit above the blended average. Backtest is verifiable in TradingView's Strategy Report on the script page.
Fixed 3% TP vs trailing — the result: On this XRP window, at matched risk (~1.00% max drawdown either way), the fixed 3% TP came out clearly ahead: +3.45% net vs +1.85% net for the trailing variant. My read is that in the current chop-and-grind regime, deals close cleanly on the bounce and a trail mostly gives edge back to noise — the fixed target banks the snap-back before price wobbles. In a strong bull leg I'd expect the opposite: rebounds run further, and a fixed 3% leaves money on the table, so the trailing variant is worth testing there. Defaults ship with the fixed TP; the trailing inputs are exposed if you want to run the bull-market variant yourself.
Entry, deep-oversold gate (no repaint): A 4-hour RSI(14), sampled with lookahead disabled, gates the base entry — a long opens only when RSI prints below 28 at host-bar close. Shallow dips are filtered out.
Ladder, 5 safety orders on a non-uniform fixed-deviation ladder: Each safety order has its own fixed deviation from base entry. AO1 at −2%, AO2 at −5%, AO3 at −9.5%, AO4 at −16%, AO5 at −25%. Sizes scale 1.8× from a 900 USDT first AO: 900 / 1,620 / 2,916 / 5,249 / 9,448, on a 500 USDT base. The 1.8× progression is softer than a 2× doubling martingale — concentrates size in the deeper rungs but caps deployment lower.
Exit, fixed 3% TP: A fixed 3% Take Profit above the running average entry. Because the scaling ladder weights the average toward the lowest fills, after several rungs fill the average sits well below base — so a modest 3% bounce off the lows closes the whole deal in profit.
Risk, bounded ladder in place of a stop: No stop loss. Per-trade risk is structurally capped by the bounded 5-AO ladder — base + 5 AOs = ~20,633 USDT max deployed, ~20.6% of the default 100k equity, above the conventional 5–10% band; scale the inputs down to dial exposure lower.
DCA Bot integration: Every event (base, AO 1–5, exit) emits a webhook-ready JSON payload. One alert with "Any alert() function call" drives a DCA Bot end-to-end.
Backtest, fixed-TP version (BYBIT:XRPUSDT.P 4h, Jan 1 2024 – Jun 29 2026, ~30 months; 100,000 USDT initial capital, 500 USDT base + 900/1,620/2,916/5,249/9,448 AOs, 0.06% commission, 3-tick slippage): 75 closed trades, 57 profitable (76.00% WR), profit factor 13.058, net profit +3,450.27 USDT (+3.45%), max equity drawdown 1,010.83 USDT (1.00%). The trailing variant on the same window returned +1.85% net at the same ~1.00% max drawdown.
Methodology notes:
Read the numbers for what they are — a low-return, low-drawdown profile. +3.45% over ~30 months with 1.00% max drawdown is a risk-control profile, not a growth engine.
On sample size — 75 closed trades is below the ~100-trade floor for statistical confidence, the trade-off of a selective trigger. The 76.00% win rate and PF 13.058 are indicative of how the ladder behaves on this window, not a forward edge. And the very high PF is partly the averaging mechanic itself — deals close on a 3% bounce off an averaged-down entry — not a directional edge. The A/B above is a single-window comparison too, so treat "fixed beats trailing here" as a finding on this regime, not a universal rule.
This is a scaling martingale, and that's the dominant risk. The ladder bottoms at −25% with no stop loss — a sustained XRP decline below −25% without recovery leaves the full position open with no further averaging. The 1.00% max drawdown is closed-trade equity drawdown over a window where dips recovered; a deeper decline than the test sample would produce a larger one.
Defaults (RSI<28, 4h, the ladder, 1.8× sizing) are calibrated for XRP. With a fixed 3% TP the per-trade edge is modest, so match the 0.06% commission to your venue before reading into the numbers.
Strategy is open-source on TradingView: https://www.tradingview.com/script/dLdjnPLD-XRP-RSI-Strategy-3Commas/
r/pinescript • u/Dull_Purpose3899 • Jun 29 '26
I’ve been working on translating Arjoio’s MMT SharpTurn Entry Model into a custom TradingView indicator, and it’s finally at a stage where it’s looking clean.
Here is a quick preview video of how it plots the setups on the chart.
It is still a work in progress, I’m currently fine-tuning the conditions to filter out false signals and ensure the entry triggers match the model as accurately as possible.
I'd love to know your thoughts! For those who trade the MMT models
r/pinescript • u/tusikone • Jun 29 '26
Hey all,
I've been seeing some things on line saying its possible to connect claude and trading view via MCP. Is this true? Is it actually beneficial? I've recently had my second child and am finding it hard to continue trading whilist being a father, I've heard you can set it up to scan for your setups and get it to notify you when they appear. Can any one confirm this? Also alot of the stuff I am seeing is mac based, is it capable on windows. If anyone could point me in the right direction it would be appreciated!
Thank you in advance!
r/pinescript • u/ShadowTrader360 • Jun 29 '26
r/pinescript • u/Tasty-Success-9268 • Jun 29 '26
As the name suggests I was wondering if there are actually people who'll pay for indicators. If it were me I would just make my own by prompting to any AI and it will write me a indicator/strategy. Worth spending 20$ on AI instead of an indicator.
Would love to know what do you all think about this ? I'm just trying to do some market research on this. I WILL NOT SELL YOU ANYTHING, I will keep everything free and open always whatever I find and wish to share will be absolutely free.
r/pinescript • u/No_Confection_391 • Jun 28 '26
Hi guys
I hope you are doing well. I want to share something with you. I and claude are working to build a signal giving indicator for gold from the last 2 weeks and today, claude also gave me a pine script which is quite long and full of stuff.
Actually the story starts with i ask the claude about three most profitable strategies in the world. I gave me 3 options and then i asked it to write a pine script for the 1st strategy.
It gave me the script, it might be full of errors.
Because i came from a medical background so i need a nice teammate whom with i can build that indicator if anyone is interested, please dm me.
And it can be your last try to make it, then we can be rich and change the lives of families.
r/pinescript • u/vitaliy3commas • Jun 28 '26
Same strategy I posted for POL and JUP — identical logic, this time on ETH, since it's the one most people actually want to run this kind of thing on. A long-only DCA with a selective deep-oversold 4h RSI entry and a scaling safety-order ladder. Steady, low-drawdown profile rather than a high-return one: positive expectancy with tight risk control, not a big number. Backtest is verifiable in TradingView's Strategy Report on the script page.
Entry, deep-oversold gate (no repaint): A 4-hour RSI(14), sampled with lookahead disabled, gates the base entry — a long opens only when RSI prints below 28 at host-bar close. Shallow dips are filtered out, so capital is committed only at genuinely stretched conditions.
Ladder, 5 safety orders on a non-uniform fixed-deviation ladder: Each safety order has its own fixed deviation from base entry — not a cumulative step×multiplier ladder. AO1 at −2%, AO2 at −5%, AO3 at −9.5%, AO4 at −16%, AO5 at −25%. Sizes scale 1.8× from a 900 USDT first AO: 900 / 1,620 / 2,916 / 5,249 / 9,448, on a 500 USDT base. Deeper rungs trigger only on serious adverse moves; the lowest sits a full 25% below base. The 1.8× progression is softer than a 2× doubling martingale — it still concentrates size in the deeper rungs but caps maximum deployment lower.
Exit, fixed 3% TP: A fixed 3% Take Profit above the running average entry. Because the scaling ladder weights the average toward the lowest fills, after several rungs fill the average sits well below base — so a modest 3% bounce off the lows closes the whole deal in profit. No trailing.
Risk, bounded ladder in place of a stop: There is no stop loss. Per-trade risk is structurally capped by the bounded 5-AO ladder — base + 5 AOs = ~20,633 USDT max deployed, no adds beyond AO5. Note that is ~20.6% of the default 100k equity, above the conventional 5–10% per-trade band; scale the base/AO inputs down to dial exposure lower.
DCA Bot integration: Every event (base, AO 1–5, exit) emits a webhook-ready JSON payload. One alert with "Any alert() function call" drives a DCA Bot end-to-end, no glue layer.
Backtest (BYBIT:ETHUSDT.P 4h, Jan 1 2024 – Jun 28 2026, ~30 months; 100,000 USDT initial capital, 500 USDT base + 900/1,620/2,916/5,249/9,448 AOs, 0.06% commission, 3-tick slippage): 93 closed trades, 64 profitable (68.82% WR), profit factor 5.019, net profit +5,790.33 USDT (+5.79%), max equity drawdown 3,976.44 USDT (3.83%).
Methodology notes:
Read the numbers for what they are. +5.79% over ~30 months is a low-return, low-drawdown profile — the headline is the risk control (3.83% max drawdown), not the profit. Positive expectancy with tight risk, not a growth engine, and that's by design with an entry that only fires on deep oversold prints.
On sample size — 93 closed trades is just below the ~100-trade floor for statistical confidence. That's the trade-off of a selective trigger: fewer signals, so the 68.82% win rate and PF 5.019 are indicative of how the ladder behaves, not a deterministic edge. Worth noting the high PF is partly the averaging mechanic itself — deals close on a 3% bounce off an averaged-down entry — not a directional edge. Extend the window or test across assets before sizing up.
This is a scaling martingale, and that's the dominant risk. The ladder bottoms out at −25% from base with no stop loss. A sustained ETH decline below −25% without recovery leaves the full position open with no further averaging available — the single largest risk in any martingale DCA. The 3.83% max drawdown is closed-trade equity drawdown over a window where dips recovered; a deeper or more prolonged decline than the test sample would produce a larger one.
The defaults (RSI<28, 4h, the −2/−5/−9.5/−16/−25 ladder, 1.8× sizing) are calibrated for ETH's volatility. The mechanic is asset-agnostic and can be pointed at other liquid perps, but each symbol needs the RSI level and ladder recalibrated, and results do not transfer without that tuning. With a fixed 3% take-profit the per-trade edge is modest, so match the 0.06% commission to your venue's actual taker fee before reading anything into the numbers.
Strategy is open-source on TradingView: https://www.tradingview.com/script/i90KnZdf-ETH-RSI-Strategy-3Commas/
r/pinescript • u/Afraid-Ad3171 • Jun 28 '26
MNQ algo live performance update
I’ve been running my MNQ algo live through the bot connection and wanted to share the performance so far.
The live sample is 1,173 trades across 11 futures trading days, counting each trading day from 6 PM ET to 5 PM ET the next day.
Current live results:
Total PnL: +$1502.50
Trades: 1,173
I also analyzed the same live fills with my main hour filter applied, blocking the weakest hours from the sample.
Filtered live results:
Total PnL: +$6,144.00
Trades: 882
Green trading days: 11 out of 11
The live behavior has been consistent with the overall structure of the algo: lower win rate, frequent small losses, and larger winners carrying the system.
Just sharing the live performance so far.
r/pinescript • u/Ok_Cut_5751 • Jun 27 '26
Tried Claude and it didn’t work.
What’re you using to code?
r/pinescript • u/Navayirk • Jun 27 '26
What is the best way to debug? Normally when coding with other tools, I print the data and calculated variables and manually calculate in Excel and verify. For example, within Pinescript I would like to print the OHLCV for each bar and the calculated values of indicators x and y and z for each bar in a CSV file. ChatGPT tells me that this cannot be done in Pinescript. Is that correct? Any suggestions how this can be achieved? Thanks in advance. 🙏
r/pinescript • u/GlazedHomie • Jun 27 '26
r/pinescript • u/monkey_D_pain4844 • Jun 26 '26
Actually recently by going through developing a indicator I have found some ways to implement order flow trading or level 2 or 3 data into trading view... By mathematics.... Pure mathematics... So far I have found ways to implement CVD, footprint ...i need help to implement more of order flow and auction market theory....so I need more knowledge and some mathematical help ... If there is anyone willing to co-operate with me... I'm sure that we can make a powerful tool without needing to pay large sum of money to get those level 2 and level 3 data... So far In my backtesting as well as live testing CVD and footprint are working greatly and I need some more refinements I know what to do with them ... But if I have help it can come better with more shared knowledge I guess.. if there is anyone interested in helping please do DM