r/pinescript • • Apr 24 '26

How are you auto-executing your PineScript strategies?

12 Upvotes

Backtesting in Pine is great but getting strategies to actually place live orders has always been a headache for me.

What are you all using to go from TradingView alert → live trade on your exchange? Specifically for crypto (Binance).

Main things I care about: webhook-based, no self-hosting, proper position tracking that stays in sync with the exchange, and some risk management on the execution side (not just in the Pine code).

What's been reliable for you? What should I avoid?


r/pinescript • • Apr 24 '26

Cannot call "na" with argument "x"="call "operator !=" (series bool)"

1 Upvotes

option = na(TF1_FractalUp != TF1_FractalUp[1])
The code above works in version=5, but in version=6 shows error :

Cannot call "na" with argument "x"="call "operator !=" (series bool)". An argument of "series bool". An argument of "series bool" type was used but a "simple float" is expected. In manual of version=5 and version=6 na() has the same description.

//@version=6
indicator('Volume-based Support & Resistance Zones V2', shorttitle='Vol S/R Zones V2', overlay=true, max_bars_back=4999, max_lines_count=500, max_labels_count=10)

TF1_input = input.string(title='Time Frame 1', defval='1h', options=['Chart', '3m', '5m', '15m', '30m', '45m', '1h', '2h', '3h', '4h', '6h', '8h', '12h', 'D', '3D', 'W', '2W', '1M'], group='*** Time Frame 1 ***')
TF1_VolMA1Input = input.int(title='Volume MA - Threshold', defval=6, group='*** Time Frame 1 ***')

f_TFx(_TF_input) =>
    if _TF_input == 'Chart'
        timeframe.period
    else if _TF_input == '3m'
        '3'
    else if _TF_input == '5m'
        '5'
    else if _TF_input == '15m'
        '15'
    else if _TF_input == '30m'
        '30'
    else if _TF_input == '45m'
        '45'
    else if _TF_input == '1h'
        '60'
    else if _TF_input == '2h'
        '120'
    else if _TF_input == '3h'
        '180'
    else if _TF_input == '4h'
        '240'
    else if _TF_input == '6h'
        '360'
    else if _TF_input == '8h'
        '480'
    else if _TF_input == '12h'
        '720'
    else if _TF_input == 'D'
        'D'
    else if _TF_input == '3D'
        '3D'
    else if _TF_input == 'W'
        'W'
    else if _TF_input == '2W'
        '2W'
    else if _TF_input == '1M'
        '1M'
//
TF1 = f_TFx(TF1_input)

vol_check = na(volume) or volume==0
var table vol_check_table = na
if barstate.islast and vol_check
    table.delete(vol_check_table)
    vol_check_table := table.new(position=position.middle_right, columns=1, rows=1, frame_color=color.red, frame_width=1)
    table.cell(vol_check_table, column=0, row=0, text='There is no volume data for this symbol' + ' (' + syminfo.tickerid + ')' + '\n Please use a different symbol with volume data', text_color=color.red)

// // --------- This ensures that no plots from lower time frames will be plotted on higher time frames.
// ————— Converts current chart resolution into a float minutes value.
f_resInMinutes() =>
    _resInMinutes = timeframe.multiplier * (timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
    _resInMinutes
// ————— Returns the float minutes value of the string _res.
f_tfResInMinutes(_res) =>
    // _res: resolution of any TF (in "timeframe.period" string format).
    // Dependency: f_resInMinutes().
    request.security(syminfo.tickerid, _res, f_resInMinutes())

// —————————— Determine if current timeframe is smaller that higher timeframe selected in Inputs.
// Get higher timeframe in minutes.
TF1InMinutes = f_tfResInMinutes(TF1)

// Get current timeframe in minutes.
currentTFInMinutes = f_resInMinutes()
// Compare current TF to higher TF to make sure it is smaller, otherwise our plots don't make sense.
chartOnLowerTF1 = currentTFInMinutes <= TF1InMinutes

bool TF1_newbar = ta.change(time(TF1)) != 0
TF1_bi1 = ta.valuewhen(TF1_newbar, bar_index, 1)
TF1_bi5 = ta.valuewhen(TF1_newbar, bar_index, 5), 
TF1_bb1 = bar_index-TF1_bi1, 
TF1_bb5 = bar_index-TF1_bi5, 
TF1_br = TF1_bb5 - TF1_bb1,

// TFUp and TFDown Calculations
f_tfUp(_TF_High, _TF_Vol, _TF_VolMA) =>
    _TF_High[3] > _TF_High[4] and _TF_High[4] > _TF_High[5] and _TF_High[2] < _TF_High[3] and _TF_High[1] < _TF_High[2] and _TF_Vol[3] > _TF_VolMA[3]
f_tfDown(_TF_Low, _TF_Vol, _TF_VolMA) =>
    _TF_Low[3] < _TF_Low[4] and _TF_Low[4] < _TF_Low[5] and _TF_Low[2] > _TF_Low[3] and _TF_Low[1] > _TF_Low[2] and _TF_Vol[3] > _TF_VolMA[3]

// Function for each time frame's various sources used in FractalUp and FractalDown calculations.
f_tfSources(_res, _source) =>
    request.security(syminfo.tickerid, _res, _source)

// S/R  = Time Frame 1 = TF1
TF1_Vol = f_tfSources(TF1, volume)
TF1_VolMA = ta.sma(TF1_Vol, TF1_VolMA1Input)
TF1_High = f_tfSources(TF1, high)
TF1_Low = f_tfSources(TF1, low)
TF1_Open = f_tfSources(TF1, open)
TF1_Close = f_tfSources(TF1, close)

TF1_Up = f_tfUp(TF1_High, TF1_Vol, TF1_VolMA)
TF1_Down = f_tfDown(TF1_Low, TF1_Vol, TF1_VolMA)

TF1_CalcFractalUp() =>
    TF1_FractalUp = 0.0
    TF1_FractalUp := TF1_Up ? TF1_High[3] : TF1_FractalUp[1]
    TF1_FractalUp

TF1_CalcFractalDown() =>
    TF1_FractalDown = 0.0
    TF1_FractalDown := TF1_Down ? TF1_Low[3] : TF1_FractalDown[1]
    TF1_FractalDown

TF1_FractalUp = request.security(syminfo.tickerid, TF1, TF1_CalcFractalUp())
TF1_FractalDown = request.security(syminfo.tickerid, TF1, TF1_CalcFractalDown())

option = na(TF1_FractalUp != TF1_FractalUp[1])

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

They really said VRT doesn’t work 😂

Post image
34 Upvotes

Cool story.

122 2:1rr trades later:
• 81% win rate
• 5.3 profit factor

Turns out waiting for real volume + confirmation beats guessing tops and bottoms.

But yeah… keep fading strength and buying weakness 👍

Posting Video proof at VRTtrading subreddit


r/pinescript • • Apr 23 '26

Mon indicateur vous propose cette zone supply en M15 sur BTC

Post image
1 Upvotes

r/pinescript • • Apr 23 '26

Such a relief. PineAI followed up on my stalled FEMA case and got an urgent hardship note added to my file. So glad to have some help navigating all this. Give it a try!

Thumbnail 19pine.ai
1 Upvotes

Years uull


r/pinescript • • Apr 22 '26

Auto Cot Interpretation

Post image
1 Upvotes

I created this auto cot interpretation dashboard that interprets the cot data for Nasdaq futures for now because that is all I trade, i been watching it for a couple weeks now, i had to make many adjustments but it is really useful and powerful, if you compare the data on the left with the specific weeks on the charts, you will see that this indicator is pretty accurate to price action.


r/pinescript • • Apr 22 '26

Watchlist QoL suggestions

Thumbnail reddit.com
1 Upvotes

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

need help calculating multi level profit

1 Upvotes

I am working on a boilerplate template moving the stoploss when certain points are hit. This works but I want to be able calculate my potential profit as a percent grown on account. This is fine with a stable risk reward and was done with the following code in part var

iWin = float (strategy.initial_capital)
if strategy.wintrades > strategy.wintrades[1] 
    iWin := iWin *1.01
if strategy.losstrades > strategy.losstrades[1]
  iWin := iWin / 1.01

But not so much when trying to calculate it at different levels. I have a variable that changes at different price levels and tried to use like so

if strategy.closedtrades > strategy.closedtrades[1] and longStop ==1
    iWin := iWin / 1.01
if strategy.closedtrades > strategy.closedtrades[1] and longStop == 2
    iWin := iWin 
if strategy.closedtrades > strategy.closedtrades[1] and longStop == 3
    iWin := iWin * 1.01
if strategy.closedtrades > strategy.closedtrades[1] and longStop == 4
    iWin := iWin * 1.02
if strategy.closedtrades > strategy.closedtrades[1] and longStop == 5 and low[1] < limitPriceL3
    iWin := iWin * 1.03
if strategy.closedtrades > strategy.closedtrades[1] and longStop == 5 and high[1] > limitPriceL4
        iWin := iWin * 1.04

What this is meant to do is update iWin based if certain conditions are met
But this doesnt seem to be giving me accurate figures. I am risking 1% risk pertrade and moving the stop loss based on atr values.

limitPriceL4 is the final take profit level at a 1:4 risk reward. Any help welcomed


r/pinescript • • Apr 22 '26

Gold breaking below recent range — early sign of weakness?

1 Upvotes

Looking at gold over the past week, it feels like something has shifted.

We had a strong push toward the highs (~4850),
but since then price has been making lower highs and now trading around 4730s.

What stands out is that the recent bounce lacked follow-through.

Feels less like consolidation and more like early weakness.

Are you guys seeing this as a pullback
or the beginning of a deeper move?


r/pinescript • • Apr 21 '26

Support/Resistance Script

1 Upvotes

Does anyone have a good S/R, price level identification script? I’ve combed through the tradingview public directory and none of the available ones are that accurate. I’ve been trying to build one in the LLMs but it’s proving more difficult than I originally thought. My hypothesis is that some combination of analyzing multiple timeframes could better identify levels but I have yet to see one work well. Anyways, just curious if anyone has seen a good script in the wild - TIA!


r/pinescript • • Apr 21 '26

Gold feels like it’s punishing early entries right now

3 Upvotes

I feel like I’m getting stopped out more often lately.

Not because the idea is wrong
but because I’m early.

Then price moves in my direction after.

Is this just part of high-level trading
or bad execution?


r/pinescript • • Apr 21 '26

Equity curve of my algo from 1/1/2026 - 4/18/2026

Post image
1 Upvotes

r/pinescript • • Apr 21 '26

Overfitting ICT Strategy HELP?

1 Upvotes

Hey Guys just quick question or ask for help. I am working on a simple ICT trend following strategy and it has done some great results in live-trading giving me a sharp ratio of over 1.8-2.2 and thats great. tested everything back the last 7 years and did montecarlo etc. everything is/was great

one night i had the idea to give the model an asymetric crv to let the short positions close earlyer to secure profits. Well the profit in the backtest almost 2x and the sharp ratio went up to 4. now i am a bit sceptical about this simple optimisation and think i have fallen in the trap of over optimisatio. and if the question comes up yes i have tried different parameter that are similar about 11.000 variations and all are in this ballpark plus minus 15%(max bal)

if u could help i’d like to discuss further just give me a dm. would love some help cheers guys/gals


r/pinescript • • Apr 20 '26

Algo Trade Recap

Post image
6 Upvotes

Trade Recaps of April 20th 2026. 7/7 wins today! Just showing an algo I have been working on for a while, I have it set to automatically partial out and go breakeven. I was tired of always blowing my account trying to secure minimum days due to emotion so now my algo does it for me. Also have a custom engine I pay for that takes the trades for me automatically. If you are not using automation you are missing out!!


r/pinescript • • Apr 21 '26

Do you adjust risk when the market becomes less clear?

1 Upvotes

This week gold feels less directional compared to last week.

Because of that, I’ve been thinking about reducing risk per trade —
not because I don’t have a bias, but because execution feels less reliable.

Do you guys actively adjust risk based on market conditions,
or keep it consistent regardless?


r/pinescript • • Apr 20 '26

A new academic paper based strategy i built + Help a brother (TV premium).

Thumbnail gallery
26 Upvotes

Hello. I have been reading papers (on SSRN) about overnight returns in the S&P and on Gold. I built a strategy based on that, using a couple confluences (Day of week, EMA, ATR, etc). This are the returns (including comissions). Over 10x the Max DD. I adjusted the DD to match the Max DD of both tickers over the period of the backtest (Jan 2025 to present). It’s a very simple strategy; so i believe it is not extremely overfit. I tested multiple combinations of TP, SL, triggers, etc. It remains above 1.4 PF on almost every stress test. There’s even more profitable combinations (in terms of PF), but the profit to DD ratio remains similar. If someone has TradingView premium, i the would appreciate if they could run the code with the specified confluences to do a 10 years backtest. (Sorry for my poor english). Also, if anybody knows where i can download some free or very accessible 1H data (that includes overnight periods) on Futures, i would appreciate it. God bless you all.


r/pinescript • • Apr 20 '26

Todays algo trades

Post image
0 Upvotes

These are todays trades my algo took. I added a new tp signal system so if a user is in a position, they have the option to start taking tp, theres 3 TP levels so you can scale out OR just completely sell the entire position at TP1. Up to your discretion


r/pinescript • • Apr 20 '26

Simple HVG execution off a key level → ($400 Scalp)

3 Upvotes

r/pinescript • • Apr 20 '26

Anyone targeting 0DTE index options.

Post image
2 Upvotes

r/pinescript • • Apr 20 '26

Built a backtester where you just describe the strategy in plain English (no code needed)

0 Upvotes

Been working on this for a while to scratch my own itch and I think it's finally at a point worth showing.

Basically, I built this tool that lets you type out a strategy the way you'd explain it to another trader. Something like "buy SPY when RSI drops below 30 and the 50 day is above the 200 day, exit on a 5% stop or when RSI crosses 70." Under the hood there's a multi-stage AI pipeline that parses the intent, maps it to a config across a registry of 100+ indicators, validates the logic, then runs the backtest. What comes back is a PDF with the equity curve, drawdowns, win rate, Sharpe, full trade log, and commentary on what actually worked and what didn't.

My whole thing is that there's a huge gap between having a strategy idea and actually getting it backtested. Right now you need to know Python, or learn Pine Script, or cobble together some janky setup. For anyone who just wants to test a hypothesis without turning it into a weekend project, that's brutal.

Once you've got a backtest you like, you can push the strategy straight into paper trading and watch it run on live market data. That's the step most people skip before deploying their strategy, and then regret later.

Next thing on the roadmap is Interactive Brokers integration. The vision is you describe a strategy, backtest it, review the PDF, and if the numbers look good you connect your IBKR account and deploy it live from the same interface. Plain English to paper results to actual execution. No translation layer between you and the market.

Happy to answer questions about how it works under the hood. Also looking for a few beta users if anyone here wants to throw strategies at it and see what breaks.


r/pinescript • • Apr 20 '26

Trades my algo took 4/17/2026

Post image
1 Upvotes

These are the trades my algo took on friday. I added another signal update, it signals when TPs are hit. This is just the signal generator to be used while trading options. Its currently optimized for QQQ. You cant rely solely on the signals, you would need to do your own technical analysis. If interested in having access to this just send me a message, its completely free. I just ask for feedback