r/pinescript • u/santanudas2002 • 5d ago
r/pinescript • u/Foreign_Canary_6391 • 5d ago
Script to put broker account summary on bottom bar instead so it can be visible at all times
r/pinescript • u/secondhalfsoftware • 6d ago
Indicator I use as an alarm clock
r/pinescript • u/Stunning_Extreme_343 • 7d ago
tradingview在错误的道路上越走越远了
作为一个运行了这么多年的专业交易平台,不去思考如何让更多专业交易员选择平台,相反,却将更多潜在的优质客户推的更远——我这里指的不仅仅是Basic用户,更多的是各类型的付费用户。
数据的及时性、指标数量和运行速度及对开发者的限制、UI的稀烂设计......太多问题了。我都怀疑他们目前的内部运营是不是出了问题?为什么让不做交易或者不懂交易的人,负责这些决策?
r/pinescript • u/QuePasa168 • 7d ago
Feature Request: Global Drawing Synchronization Groups Across Multiple Layouts
reddit.comr/pinescript • u/NickKofo • 9d ago
Free Pinescript backtester you can hand to AI agents to auto-tune your strategy
We got tired of changing one input, waiting, testing, changing another, so we built PineStorm. You paste your Pine strategy and it backtests it on the whole Binance history.
• Full history, from the first candle, 1m to 1w
• Fast: 2.5 million 1-minute candles in about a second
• Auto-tune: hand it to Claude Code or Codex and it tunes your inputs for you. One run did 1,344 backtests in 28 minutes.
It's free, and you can try it right in the browser. Crypto only for now. Would love to hear what you think and what you'd want added.
r/pinescript • u/evanbigfan • 9d ago
The 1-Hour EMA Pullback Strategy for Part- Time Traders: Rules, 3-Year Test Data on SPY/QQQ, and Pine Script v5 Code
Update 1: As pointed out in the comments, the code posted has a discrepancy with the initial text summary (it uses 1.5 ATR stops, 10% equity sizing, and no friction). When adjusted for commissions, slippage, and overnight hold risk, the numbers compress substantially. Appreciate the sharp eyes from NJ_Algo and others.
Update 2: As NJ_Algo noted, the code above is raw/frictionless. For anyone testing a live-style setup, set commission_value = 0.05 (or your broker's rate), slippage = 1, and anchor the stop to ta.lowest(low, 10) rather than ATR.
Original post: Hey everyone,
If you trade while working a standard 9-to-5, trying to scalp on 1-minute or 5-minute charts is usually a recipe for burnout and bad fills.
Over at StratOwl, we spend a lot of time running simulation data to find setups that fit working schedules. One of the most consistent setups we evaluate on index ETFs is a 1-Hour EMA Pullback + RSI Invalidation system.
With 1-hour candles on US equities (6.5 candles per session), you only need to check your charts or alerts a few times a day—or let an alert ping you when a bar closes.
Here is the complete setup breakdown, the simulated metrics across 3 years, and the full Pine Script v5 code.
---
1. The Strategy Concept
Most pullback strategies fail because they buy too early during a sharp drop. This setup requires three confirmations:
- Macro Trend (Higher Timeframe Filter): Price must be trading above the 200 EMA on the 1-hour chart.
- Dynamic Value Zone: The 20 EMA must be above the 50 EMA (bullish alignment), and price must pull back to touch the zone between the 20 and 50 EMA.
- Trigger: RSI(14) must cross back above 45 from oversold/neutral territory, confirming momentum is resuming rather than breaking down into a deeper reversal.
Exits:
* Target: 2.0x ATR(14) from entry (or close when RSI crosses above 70).
* Stop Loss: 1.5x ATR(14) below the recent 10-bar swing low.
* Max Hold: If neither TP nor SL is reached within 18 hourly bars (~3 trading sessions), exit at market close to free up capital.
---
2. 3-Year Simulation Results [SIM Data: 2023 – 2026]
Tested strictly on 1H regular trading hours (RTH) with simulated execution on next-bar open:
| Metric | SPY (1H) | QQQ (1H) | AAPL (1H) |
| :--- | :--- | :--- | :--- |
| Win / Strike Rate | 68.2% | 64.7% | 59.3% |
| Total Closed Setups | 66 | 71 | 54 |
| Profit Factor | 1.92 | 1.81 | 1.46 |
| **Max Drawdown [SIM]**| -6.8% | -9.4% | -11.2% |
| Avg Hold Duration | ~8.4 hours | ~7.9 hours | ~9.1 hours |
---
3. What Worked & What Didn't
* Why the 200 EMA filter matters: Without the 200 EMA filter, the win rate on QQQ dropped from 64.7% to 51.2%. Buying pullbacks in a macro downtrend gets you caught in "falling knife" rallies.
* The Time-Stop Advantage: The 18-bar time stop cut maximum drawdown by nearly 30% across all tickers. In trading, dead money in a non-moving setup is often followed by a volatility spike against your position.
* Gap Risk: Because this is an hourly swing setup, holding overnight exposes you to opening gaps. Using position sizing pegged to 1% account risk per ATR stop absorbed gap slippage without wrecking the equity curve.
---
4. Pine Script v5 Code
Here is the clean TradingView script if you want to inspect the candles or run it on your own watchlist:
//@version=5
strategy("1H EMA Pullback & Momentum [SIM]", overlay=true, margin_long=100, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Inputs
ema_fast_len = input.int(20, "Fast EMA")
ema_mid_len = input.int(50, "Mid EMA")
ema_slow_len = input.int(200, "Macro Trend EMA")
rsi_len = input.int(14, "RSI Length")
atr_len = input.int(14, "ATR Length")
tp_mult = input.float(2.0, "TP (ATR Multiplier)")
sl_mult = input.float(1.5, "SL (ATR Multiplier)")
max_bars = input.int(18, "Max Hold Bars")
// Indicators
ema20 = ta.ema(close, ema_fast_len)
ema50 = ta.ema(close, ema_mid_len)
ema200 = ta.ema(close, ema_slow_len)
rsi = ta.rsi(close, rsi_len)
atr = ta.atr(atr_len)
// Conditions
macro_bull = close > ema200 and ema20 > ema50
in_pullback_zone = low <= ema20 and low >= ema50 or (close <= ema20 and close >= ema50)
rsi_trigger = ta.crossover(rsi, 45)
long_entry = macro_bull and in_pullback_zone and rsi_trigger
// State tracking
var float entry_price = na
var float sl_level = na
var float tp_level = na
var int entry_bar = 0
if (long_entry and strategy.position_size == 0)
entry_price := close
sl_level := close - (atr * sl_mult)
tp_level := close + (atr * tp_mult)
entry_bar := bar_index
strategy.entry("Long", strategy.long)
if (strategy.position_size > 0)
// Dynamic Exit: TP, SL, or Time-based expiry
strategy.exit("Bracket Exit", "Long", stop=sl_level, limit=tp_level)
// Time-based exit
if (bar_index - entry_bar >= max_bars)
strategy.close("Long", comment="Time Stop")
// Plotting
plot(ema20, "20 EMA", color=color.new(color.blue, 0))
plot(ema50, "50 EMA", color=color.new(color.orange, 0))
plot(ema200, "200 EMA", color=color.new(color.white, 20), linewidth=2)
plot(strategy.position_size > 0 ? sl_level : na, "SL", color=color.red, style=plot.style_linebr)
plot(strategy.position_size > 0 ? tp_level : na, "TP", color=color.green, style=plot.style_linebr)
---
Questions & Ticker Requests
I build simulation engines and automated setup monitors at StratOwl so traders don't have to watch charts all day.
If you want to see how this 1-hour setup performs on a specific stock or crypto ticker you trade (e.g., TSLA, AMD, NVDA, SOL), drop the ticker in the comments and I'll run the 3-year numbers for you.
r/pinescript • u/Omega_Grinder • 9d ago
process_orders_on_close: next-open fills, signal-bar close fills, and the session last-bar gap
Default strategy fill timing is easy to miss until live results diverge from the report.
On historical bars a Pine strategy runs once, at bar close. So that historical and realtime stay consistent, strategies also run at the close of realtime bars by default. The next moment the broker emulator can fill a market entry is the open of the following bar. That is why a crossover at the close of bar N shows a fill on bar N+1 in the report.
process_orders_on_close = true (or "Fill orders / On bar close" in Properties) changes that model: the emulator treats the close of the signal bar as the fill price. strategy.close(..., immediately = true) does a similar thing for that one close only, without flipping the whole strategy.
Where it bites
- Session last bar: if a signal fires at the final close of the session, a real broker can usually act only on the next session open. The emulator with
process_orders_on_closecan still book a fill at that session's close. That gap is classic repaint between report and live. - Alerts vs fills: an alert at bar close is not the same as a guaranteed exchange fill at that printed close. Bid/ask, latency and the next tradable price sit in between.
- Mixing models: same-bar exits via stop/limit prices (broker emulator path assumptions) are a different mechanism from forcing market fills on the signal bar's close. Turning both knobs without separating them muddies what the backtest is actually testing.
A rough rule: leave process_orders_on_close, calc_on_every_tick and calc_on_order_fills at false unless the strategy is intentionally an intrabar or close-fill system, and then forward-test that model on purpose instead of treating the report as exchange truth.
Reference: TradingView Pine Script v6 FAQ, Strategies → "Why are my orders executed on the bar following my triggers?" and the repainting notes on strategy properties.
For those who run close-fill strategies in production: do you keep process_orders_on_close on for the whole script, or only use immediately = true on selected closes?
r/pinescript • u/evanbigfan • 10d ago
I backtested the MACD Momentum swing strategy across SPY, NVDA, and AAPL over 5 years. Here are the real win rates, drawdowns, and where it failed
reddit.comr/pinescript • u/Away-Ant7779 • 11d ago
Tradingview is now restricting free users from drawing on charts???
r/pinescript • u/ssawthelight • 11d ago
A TradingView response the Pine Script community may find interesting
reddit.comr/pinescript • u/forsakenbat1992 • 12d ago
TV is cooked
It isn’t listed on TradingView’s pricing page or in any of the free-plan guides published September–November 2026. All of those talk about the 2-indicators-per-chart limit, but none mention a saved-script cap.
r/pinescript • u/Kri77 • 12d ago
BUYER ALERT: Aston Gill Trading, I paid 499 USDT, still haven’t received everything promised, and remain blocked on Discord
galleryr/pinescript • u/Omega_Grinder • 12d ago
var vs varip on the realtime bar: rollback, intrabar persistence, and the repaint trap
A common source of "it worked on history, it acts weird live" is assuming var and varip differ only in name. On historical bars they usually behave the same. On realtime bars they do not, and the difference is rollback.
var: persists across bars, not across ticks
A var variable keeps its value from bar to bar. But on an open realtime bar, each new tick triggers a rollback before the script runs again: var variables are reverted to their committed state as of the previous bar's close. Only what the script assigns on the bar's closing tick is kept.
So something like var int ticks = 0 / ticks += 1 in an indicator still ends each realtime bar exactly one higher than the previous bar, no matter how many ticks arrived. A tick-by-tick counter or a "already did X this bar" flag in a var gets wiped before every new tick.
varip: escapes rollback
varip ("intrabar persist") is not rolled back. Every change on every tick sticks, and it carries into the following bars until you reassign it. It does not reset at bar close. If you want per-bar intrabar state (ticks seen this bar, intrabar high of some metric, a once-per-bar guard), you have to reset it yourself, for example when barstate.isnew is true.
Where it bites
- Repainting by design: after the script reloads, elapsed realtime bars become historical bars with no intrabar tick data. Anything derived from
varipcan produce different values, alerts or strategy results after a reload than it showed live. - Strategies: by default a strategy executes once per bar even in realtime, so
varipbehaves likevar. Enable "On realtime bar tick" or "On order fill" and it diverges, and with "On order fill" it can even diverge on historical bars, because the emulator executes again on fills. - UDT fields: a
varipvariable holding a user-defined type object does not make the fields intrabar-persistent. Each field needs its ownvaripin the type declaration. - Type support:
variponly works with fundamental types, enums, chart.point / footprint / volume_row, UDTs, and collections of those, so you can't use it to hold line or label IDs.
A rough rule: confirmed, cross-bar state goes in var and only means something at bar close; intrabar bookkeeping goes in varip with an explicit new-bar reset, and anything that feeds signals or alerts from varip should be treated as repainting unless proven otherwise.
Reference: TradingView Pine Script v6 docs, "Variable declarations → Declaration modes" and "Execution model → Realtime bars".
For those who use varip in production indicators: do you keep its output strictly out of alert conditions, or have you found a pattern that makes the intrabar state reproducible after a reload?
r/pinescript • u/AdJealous1004 • 13d ago
Free Trading Indicator - Achilles Simplified Trading
I have been developing a trading system (free). The entire trading system (all free) can be found on tradingview.
I am sharing it here: https://www.tradingview.com/script/0cUmz20G-Achilles-ST-Simplified-Trading/
Even better when used in combination with Achilles B (Momentum Oscillator): https://www.tradingview.com/script/Dfa5fNQt-Achilles-B/
There are a lot of complex systems behind the indicator, there is a guidebook for it for all those who are interested: https://achillestrading.com/guidebook/Achilles-Guidebook.pdf
All free

r/pinescript • u/TimNosi • 14d ago
Are the updated TradingView tick-based calculations available in pinescript?
Is the updated TradingView "Tick-based calculations are now available for Footprint, Volume Delta, and CVD" also available via the pinescript request.footprint call ?
https://www.tradingview.com/blog/en/tick-based-calculations-footprint-volume-delta-cvd-62523/
Thanks!
r/pinescript • u/LottieWinslow29 • 15d ago
pine is honestly the only thing still making it hard for me to leave tradingview
honestly candles are not why tradingview is hard to leave
its the random pine scripts i've accumulated over the last few years
and the annoying part is most of them aren't even impressive lol
one checks a basic EMA condition and throws an alert
one marks session levels the way i like
one has a VWAP + volume condition i changed probably 15 times
there's one modified public script where i genuinely don't remember what the original version looked like anymore
nothing groundbreaking
but i know how all of them behave
thats the problem
i can move drawings
i can rebuild a layout
i can learn where buttons are on another chart
rebuilding all the little logic i've slowly gotten used to is what makes me go “eh i'll just stay on TradingView”
this was basically the last thing i wanted to figure out before taking TradingCharts by Dhan seriously as an alternative for my setup
TradingCharts uses ChartScript, not Pine
Pine logic can be converted into ChartScript and deployed, so i've started with ONE script i actually use instead of trying to migrate my entire graveyard of saved indicators
and honestly thats probably the better test anyway
because i have like 30 scripts saved
i regularly use maybe 3
moved one of the simpler ones first
then sat with both charts and checked the boring stuff
same condition?
same lookback?
same bar-close behaviour?
signals showing roughly where i'd expect historically?
because if a converted script puts the same green arrows on the first screen that doesnt automatically mean i'm done
i'm not trusting conversion blindly
but this changed the question for me a bit
before it was
“i use Pine so obviously i cant move”
now its more
“can the 3 scripts i actually care about survive the move?”
because the rest of my Indian-market charting is already getting harder to justify paying separately for
and if i'm mainly keeping TradingView alive because 3 small scripts live there...
rebuilding/testing 3 scripts starts sounding less painful than paying forever just because i've always had them there
still think Pine's community side is a huge advantage btw
if your setup depends on 20 community scripts or some complicated custom stack, this is probably a completely different conversation
but curious about people here who have used Pine for years
how many of your saved scripts do you ACTUALLY use every week?
not how many are in favourites
actually use
r/pinescript • u/ahill3053 • 15d ago
best ai for writing pinescript?
been testing a few and keep getting scripts that repaint or throw errors on the first bar. curious what you all actually use for this, chatgpt or claude or something else
r/pinescript • u/Ulysses68 • 15d ago
Tilt Simulator psychology script.
https://www.tradingview.com/script/BV2XAJpU-Stealth-Umbrella-Tilt-Simulator/
This is designed to battle over trading. After a loss or a win it's a good idea to take a little break and let the euphoria settle down. Avoid the trap.
r/pinescript • u/d13wish • 15d ago
Looking for someone who is passionate about developing Pine Script indicators/strategies on TV
Hey everyone!
I'm looking for someone who genuinely enjoys coding and developing indicators or strategies in Pine Script.
The idea isn't anything crazy or overly complicated. I've been trying to build it myself with the help of AI, but honestly, I've reached a point where I'm just going in circles and not getting the exact result I'm looking for.
I figured it would be better to connect with someone who actually knows their way around Pine Script and enjoys this kind of stuff.
I'm not looking to hire someone for a big paid project. I'd rather find someone who's passionate about coding and interested in collaborating.
What do you get in return? A pretty useful confirmation indicator that I believe could be valuable for your own trading as well.
If this sounds interesting, feel free to drop a comment or shoot me a DM. I'd be happy to explain the idea in more detail.
Thanks!
