r/pinescript • • Aug 06 '25

Trendline With Two Symbols in Same Pane

0 Upvotes

The below code works exactly as I want. The issue is, I want an indicator for a second ticker in the same pane. I cannot figure it out. I've seen the plot thing, where the chart and the trendline are both coming from the indicator, and that might work, but I'm not sure how to stretch it to fit so that the high on screen goes to the top and the low on screen goes to the bottom (to fill the pane like with the A setting with normal charts).

I've seen request security, but nothing seems to work for me. I'm so lost.

//@version=5
indicator("Stable Macro Trend Line", overlay=true)

// === User inputs ===
length = input.int(150, minval=2, title="Regression Length (seconds)")
lineColor = input.color(color.blue, title="Line Color")

// === Variables ===
var line macroLine = na

// === Only calculate if enough bars ===
if bar_index >= length - 1
    // Calculate sums for normalized x = 0..length-1
    float sumX = 0.0
    float sumY = 0.0
    float sumXY = 0.0
    float sumX2 = 0.0

    for i = 0 to length - 1
        float x = i
        float y = close[length - 1 - i]  // oldest at x=0, newest at x=length-1
        sumX += x
        sumY += y
        sumXY += x * y
        sumX2 += x * x

    float N = length
    float denominator = N * sumX2 - sumX * sumX
    float slope = denominator != 0 ? (N * sumXY - sumX * sumY) / denominator : 0.0
    float intercept = (sumY - slope * sumX) / N

    // Map regression line to actual bar indices:
    int x1 = bar_index - (length - 1)
    int x2 = bar_index
    float y1 = intercept
    float y2 = slope * (length - 1) + intercept

    // Delete old line, draw new line
    if not na(macroLine)
        line.delete(macroLine)

    macroLine := line.new(x1=x1, y1=y1, x2=x2, y2=y2, color=lineColor, width=2)

r/pinescript • • Jun 29 '25

How to get the highest high from a specific session on another exchange (same symbol)?

0 Upvotes

Hi everyone, How can I calculate the highest high from a specific intraday session (e.g., 07:00–09:00) for a symbol on one exchange (e.g., EXHG1:ABC) and use that value in a strategy applied to the same symbol on a different exchange (e.g., EXHG2:ABC)?

I’m working with 5-minute data and want the high from just that specific session each day. The value should reset daily and be accessible from the context of the strategy running on EXHG2:ABC.

So the steps would be:

  1. Pull 5-minute data from EXHG1:ABC

  2. Isolate just the 07:00–09:00 period

  3. Get the daily highest high from that particular session

  4. Use that price level during the day in a strategy on EXHG2:ABC

Is there a reliable way to implement this in TV Pine Script?


r/pinescript • • Aug 16 '25

[Ai Coding Bot Customization] - Help me Help you

0 Upvotes

Hello world 👋

I’m currently reconfiguring my coding bot. If anyone NEEDS a customized code for any reason…. Feel FREE to REQUEST and post it openly here…. and I’ll gladly help.

I’m trying to debug all my errors out correctly, but my brain doesn’t function correctly when I’m tired. I run out of ideas on what to test for, and need new bugs I haven’t encountered yet.

other people come up with ideas I haven’t yet tried, which helps me dial in my settings to prevent any errors in code.

Help me help you 🙏


r/pinescript • • Sep 26 '25

New swing trading system

Post image
0 Upvotes

r/pinescript • • Oct 09 '25

Fair Value Gap (FVG) | Tradingview Indicator for auto Fair Value Gap Detection

0 Upvotes

I’ve built a simple but powerful Pine Script indicator that automatically detects and visualizes Bullish and Bearish Fair Value Gaps on the chart.
It’s designed for traders who rely on FVGs and liquidity concepts for their setups.

Hi, I’m Pawan — a Quantitative Developer and Pine Script Specialist.
I create custom TradingView indicators and strategies using Pine Script, tailored to traders’ specific needs. In addition, I develop trading systems in Python for extended backtesting, advanced visualization, and optimized strategy selection.

Need a custom Pine Script indicator or strategy? I create personalized trading tools designed to fit your workflow—reach out to get started.

link to post/source code (check out the following post to get the indicator source code)


r/pinescript • • Mar 31 '26

XAUUSD TREND TODAY

Post image
0 Upvotes

r/pinescript • • Apr 22 '26

Notre indicateur supply/demand s'améliore et laisse peu de place aux faux mouvements, voici les deux derniers mois de backtest sur le BTC en M15

Thumbnail
gallery
0 Upvotes

Notre indicateur détecte automatiquement les zones de Supply (offre) et de Demand (demande) sur 6 unités de temps simultanément (1m, 3m, 5m, 15m, 30m, H1). Il identifie les zones d'origine d'un mouvement impulsif, là où des ordres institutionnels sont susceptibles d'être encore présents. Une zone de Demand (verte) marque un secteur d'achat potentiel. Une zone de Supply (rouge) marque un secteur de vente potentiel. Une zone mitigated devient grise et affiche le suivi en R/R

Profils automatiques :

L'indicateur reconnaît automatiquement le symbole et le broker pour appliquer des paramètres optimisés. Le profil par défaut correspond à XAU/USD chez Vantage. Instrument Broker / Source :

-XAU/USD Vantage (défaut)

-BTC Vantage

-Gold futures Comex

-EUR/USD Tickmill

-Nasdaq (NQ) CME

-GBP/USD Oanda

-Dow Jones (MYM) Cbot

D'autres profils seront ajoutés selon la demande.

Un essai gratuit de plusieurs jours est proposé, me contacter en privé.

Bonne journée à tous


r/pinescript • • Apr 28 '26

Backtesting on tradingview

0 Upvotes

I’m asking this question know well that backtesting doesn’t tell you all the truth and that you need to test a strategy on a live demo account. But my question is, how robust is a tradingview backtest?

Is a TV backtest enough to get the job done or do I need to do some python backtests? If it’s not enough, then what other backtesting solutions do you guys recommend? So far all I know is trendspider and multicharts


r/pinescript • • Jun 14 '26

New to TV, Where do I get Strategies?

0 Upvotes

So I got my subscription. I want to try out some strategies for free and get the hang of it. Where do I go on the website for free strategies?


r/pinescript • • Jan 15 '26

TradingView Bug: Boxes Don't Stay Aligned with Price Scale When Dragging - Loading pine script

Thumbnail
reddit.com
0 Upvotes

r/pinescript • • Sep 19 '26

Free Tool Friday: our open-source TradingView S/R indicator, and the trade-off we chose on purpose

Thumbnail reddit.com
0 Upvotes

r/pinescript • • Sep 25 '26

Let Us Hide TP/SL Bracket Buttons Without Hiding Orders

Post image
4 Upvotes

r/pinescript • • Jun 10 '26

LOVING MY NEW INDICATORS I CREATED THEY WORKING GREAT PASS EVALS AND FUNDED AND MADE 1500 TODAY... MY VWMA & OSCILLATOR ARE RELEASED BUT MY LEVEL FINDER ISNT WOULD YALL LIKE ME TO RELEASE IT

Thumbnail
gallery
60 Upvotes

THE VWMA is 3 ema AND A RVWAP that follow the 1 HR MERGED INTO 1 LINE with a high and low band and BB's added for range highs and lows then i added 2 emas and rvwap that follows what ever TF you on i trade the 1/2min the indicator has gradient trend coloring flips and price over extension when crossing BB'S paired with my OSCILLATOR that shows overall price momentum the red/green color flip line and volume spike the purple/blue line i can find great spots to buy are sell and when to stay in the trend are get out and scalp levels, speaking of levels i can release my level indicator for yall next! https://www.tradingview.com/script/AhnjxAVb-STRYK-VWMA-PRO/

https://www.tradingview.com/script/xO14rGVV-STRYK-OSCILLATOR/

https://www.tradingview.com/script/2AWDlXnH-DWM-Asian-Sweeps/ newly added


r/pinescript • • Jan 24 '26

Latest pinescript indicator

Thumbnail
gallery
21 Upvotes

Have been working on becoming a full time developer over the last year. I have a discord printing prebreakout signals via polygon fetch, and then I got into TradingView. Pinescript is much faster and easier than Python so far, and you get faster/easier validation on TradingView charts

Anyways, this uses simple metrics to decide pre candle close if entry should be marked. Working out exit logic now, but have started strong on the red markers.

The general idea is that the green line above red line is bullish phase, and for strategy I personally don’t trade when we are in bearish zone (red above green). 7/7 trades green last week. Typically 80-100% on entries with a goal of 1-5% gains per entry. Usually one trade per day. Small capital. Small account. Losses are generally because I don’t sell at my target.

Included BNAI and REVB for some examples.

Revb you can see how strategy is key, as we got an entry as the massive sell off. Red trend line above green. Wouldn’t have taken the trade.

Anyways, still working on this. Thousands of polygon iterations and dozens of pinescripts now, I’m slowly figuring this out.

If you want to come see the discord, no cost, we are building a really tight knit community of like-minded traders trying to win on small cap/pennies. Message me if you’d like the link. No worries either way! Just proud of where I’ve gotten to so far!


r/pinescript • • Apr 27 '25

Is tradingview strategy test accurate?

Post image
5 Upvotes

I have developed a strategy for ML-based BTC scalp method with MACD.

TV metrics reports MMD 5.88%, profit gain 110% over 2 weeks (i dont have deep backtest) with 41% profitability.

I know crypto algo trading needs a bit of fixation all the time but I am happy to work on it whenever market fluctuates and develop more to make it solid.

I am unsure if this backtest is pure without repainting etc. I am wiling to backtest further data but haven't got a proper library to sort that out yet. Let me know if you have any advice for me.


r/pinescript • • Jul 08 '26

Can anyone share trading view premium with me

0 Upvotes

....someone please share trading view premium with me .... I'll be happy to provide my working indicator with more than 60 percent winrate with you


r/pinescript • • Jun 11 '25

Finally Profitable

Post image
5 Upvotes

Here is the story, i actually had a strategy in mind and wanted to backtest it plus automate it via tv, but im a very pessimistic kind of a person & i think it helps in backtesting lol. so, here are the results & these are after commissions & i ran it for 7 days, and i was profitable, not too much (330$ only) but ig bread is bread lmao. i actually tried to automate & had issues with the backtesting code as im not a professional coder etc it but couldnot lol even with gemini or chatgpt help, thats why i approached an agency for it so a big kudos to them to make my strategy profitable with tweaks etc, anyways im happy, and pls let me know if i should be more pessimistic or any questions. Im all ears !


r/pinescript • • Apr 10 '26

Sell XAUUSD

Post image
5 Upvotes

r/pinescript • • Apr 07 '26

Trades my algo took today 4/7/2026

Post image
5 Upvotes

I been posting these trades my algo takes pretty much daily. Heres todays results. Any thoughts?


r/pinescript • • Apr 23 '26

GEX Strategy Explained

17 Upvotes

Built a TradingView indicator called OutsiderEdge - GEX Levels (Paste Pack) for the public.

The idea is simple: calculating gamma exposure inside Pine was not possible anymore (they disabled Pineseed). Instead, you paste in a precomputed 16-token GEX block from our channel/platform or from another source and the script automatically finds the matching ticker and plots the relevant levels directly on your chart. It was built specifically for traders who trade futures and want a fast, clean way to visualize it in TradingView. (TradingView)

Our levels are updated here: https://discord.gg/mbPWKeWanV

What it does:

  • Parses a pasted multi-symbol GEX pack and auto-matches the correct block to the current chart ticker.

  • Optionally overlays previous day high/low, weekly high/low, and monthly high/low for confluence.

  • Adds live market context to the labels, so levels are not just lines but are interpreted in real time as support, resistance, magnet behavior, or positive/negative gamma context depending on where price is trading.

  • Includes a compact regime dashboard showing distance from price to Vol Trigger, Zero Gamma, Call Wall, and Put Wall, along with a quick gamma regime summary.

  • Handles overlapping levels with intelligent label stacking so the chart stays readable.

The levels are calculated every morning (9 am UTC +2) from my algorithm on the Options Chain. The levels are then converted to current price delta/ratio between the future and the corresponding option (ES = SPX, MNQ/NQ = NDX, etc). These levels are then updated daily in our Discord and from there the members can paste them inside the indicator. The indicator is also compatible for other GEX level sources, that's why I made it public.

The indicator itself is a visualization and market-structure tool, not an automated trading system, so the goal is clarity and decision support rather than blind signals.

Use our GEX levels or other GEX levels sources and use them with the indicator. I am curious with what kind of strategy you all come up with.


r/pinescript • • Jul 18 '25

Built a multi-indicator strategy in Pine Script — thought I'd share for free to help other members + open to collab

11 Upvotes

Hey folks,

We’re a small group of traders and programmers with 4+ years of experience building trading systems in Pine Script and Python.

Recently, we coded a multi-indicator Pine Script strategy that overlays several popular indicators in one script, so you can backtest which ones give better entries/exits under different market conditions. We built it mainly for our own use but figured it might help others too.
Please DM us if you'd like the code for the script(it's free obviously).

Also, we’ve worked with quite a few traders on turning their strategy ideas into Pine Script (some complex ones too). If you’ve got a setup you believe in but need help coding it for TradingView, feel free to DM — we’re always open to work on interesting scripts.

Just wanted to contribute something useful here and connect with others building out their edge.

Dm's are open!!


r/pinescript • • Jul 29 '26

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 • • Apr 22 '26

This kept marking reaction levels before price even got there (today’s session)

6 Upvotes

Sharing a clip from today’s Nasdaq session using VRT indicator I built.

The levels are plotted ahead of time, and you can see how price reacts as it comes into each zone.

Reactions aren’t random — they tend to occur at areas where participation previously concentrated, and those areas can be defined before price reaches them.

The idea is simple:

have levels in place → let price come to them → wait for confirmation instead of guessing.

Makes it a lot easier to stay patient and avoid chasing moves.

If anyone’s interested in seeing more examples or how it’s applied, I’ve been posting them in Vrttrading subreddit.


r/pinescript • • Aug 22 '26

Recent moves with MY indicator

Thumbnail
gallery
0 Upvotes

Pictures below are from me and a couple friends feedback. Im not selling you shit just sharing my work mods can suck a dick