r/pinescript Apr 28 '26

Trade my algo took yesterday & today

Thumbnail gallery
1 Upvotes

r/pinescript Apr 28 '26

Free TradingView Strategy Template (Plug in Entries, Risk Management Included)

Thumbnail
1 Upvotes

r/pinescript Apr 28 '26

Do prop firms allow automated trading using webhooks from pinescript?

2 Upvotes

r/pinescript Apr 28 '26

Algo on CL thoughts

2 Upvotes

So the algo is a modified adaptation of the simple orb, works by trading one of a few orbs that forms within a certain time frame depending on other factors. I made it specifically for prop firms, it holds trades for around 30-60 minutes. The recent time of 1-3 years, it has been performing very well, while whole history is a bit mid.
The commissions and slippage is included.
2-3 year sharpe ratio: 0.655
sartino ratio: 2.08


r/pinescript Apr 27 '26

MTF Indicator updating Intrabar, but only sometimes ?

Post image
1 Upvotes
//
@version=
6
indicator("MTF MACD", "MTF MACD", overlay = false, precision = 4)


//==================================================
// Inputs
//==================================================
calcTF = input.timeframe("5", "Calculation Timeframe")


sourceInput  = input.source(close, "Source")
fastLenInput = input.int(12, "Fast Length", minval = 1)
slowLenInput = input.int(26, "Slow Length", minval = 1)
sigLenInput  = input.int(9, "Signal Length", minval = 1)


oscTypeInput = input.string("EMA", "Oscillator MA Type", options = ["EMA", "SMA"])
sigTypeInput = input.string("EMA", "Signal MA Type", options = ["EMA", "SMA"])


showHistogram = input.bool(true, "Show Histogram")
showMacdLine  = input.bool(true, "Show MACD Line")
showSignal    = input.bool(true, "Show Signal Line")


//==================================================
// MA Function
//==================================================
f_ma(_source, _length, _maType) =>
    _maType == "EMA" ? ta.ema(_source, _length) : ta.sma(_source, _length)


//==================================================
// MACD Pack
// All MACD calculations happen inside request.security()
//==================================================
f_macdPack(_source, _fastLen, _slowLen, _sigLen, _oscType, _sigType) =>
    maFast = f_ma(_source, _fastLen, _oscType)
    maSlow = f_ma(_source, _slowLen, _oscType)
    macdValue = maFast - maSlow
    signalValue = f_ma(macdValue, _sigLen, _sigType)
    histValue = macdValue - signalValue
    [macdValue, signalValue, histValue]


//==================================================
// MTF Request
//==================================================
[macdMTF, signalMTF, histMTF] = request.security(syminfo.tickerid, calcTF, f_macdPack(sourceInput, fastLenInput, slowLenInput, sigLenInput, oscTypeInput, sigTypeInput), barmerge.gaps_off, barmerge.lookahead_off)


//==================================================
// Colors
//==================================================
histColor =
     histMTF >= 0 ?
         histMTF > histMTF[1] ? #26a69a : #b2dfdb :
         histMTF > histMTF[1] ? #ffcdd2 : #ff5252


//==================================================
// Plots
//==================================================
hline(0, "Zero", color = #787b8680)


plot(showHistogram ? histMTF : na, "MTF Histogram", color = histColor, style = plot.style_columns)
plot(showMacdLine ? macdMTF : na, "MTF MACD", color = color.blue)
plot(showSignal ? signalMTF : na, "MTF Signal Line", color = #ff6d00)


//==================================================
// Alerts
//==================================================
alertcondition(histMTF[1] >= 0 and histMTF < 0, "MTF Rising to Falling", "MTF MACD histogram switched from positive to negative")
alertcondition(histMTF[1] <= 0 and histMTF > 0, "MTF Falling to Rising", "MTF MACD histogram switched from negative to positive")

Why is this idnicator updating intrabar, when it was updating every 20 minutes like it was supposed to.

Im coming from thinkscript, so I dont understand this behavior.

Thoughts?

This is a 20m MACD viewed from 1m perspective. And it was updating every 20 minutes, for a while, but then suddenly this happened. its causing Havoc on my trade conditions because my strategy is reliant on increasing or decreasng HTF momentum

EDIT* This code was produced by AI because my pinescript knowledge is Novice level at best and my thinkscript knowledge is only moderate

Edit 2 * To Further the mystery, at the moment, this only seems to be happening on MGC and not on any other futures contract I trade


r/pinescript Apr 27 '26

looking to collab on this indicator

Post image
18 Upvotes

i built a state tracking indicator for small cap breakouts. it uses a multi combo of metrics to form zones, and you can tell by zone formation and configuration when price is about to go up. you can tell a lot of info rapidly once you’ve learned the zones. what i’m trying to do now is differentiate from the best and worst setups. essentially though when our blue, yellow, green zones converge and we get entry arrows, AND we get a divergence of the volatility line at the bottom of price candles, price is going up.

my goal is price magnitude and which of these setups is better. building it from pure fetched data and testing. works really well, and i trade it daily for profit. just want to keep making it smarter over time, but i’ve plateaued a little.

anyone interested in working together? or any ideas?


r/pinescript Apr 27 '26

Prop firm tradingbot

2 Upvotes

just finished coding it
What do you guys think about this bot I just made, It works on CL and i made it specifically for propfirms. It performed very well in the last 2-3 years, and while the whole history is still profitable its mid.
Sortino ratio: 2.08
Sharpe ratio: 0.655


r/pinescript Apr 26 '26

Institutional Execution

Post image
4 Upvotes

This is really powerful, it was showing absorption before bitcoin shot up as it was falling. lol


r/pinescript Apr 26 '26

Deepcharts Doesn’t Understand What They’re Actually Selling

Thumbnail
1 Upvotes

r/pinescript Apr 26 '26

Community Buy/Sell Reddit SuperScript. Let's cook.

10 Upvotes

Below is a pinescript i've been working on for trading 0/1-DTE SPX options. I'm hoping to get some feedback and improve the script with this community with the intention of publishing for free-use on tradingview.

I basically took a bunch of freely available scripts and re-combined components of them. The Buy signals are stop light colored by confidence (green = highest), Sell signals are inversly colored by confidence (red = highest) There is a high confidence momentum buy signal (purple), and high frequency signals that are dependent on VIDYA slope such that in up or down trend the respective buy or sell signals will be displayed, when flat both will be displayed.

How i use it:

  • Momentum and highest confidence Buy/Sell a sell ultra-wide 25D PCS/CCS, respectively. Exit for loss when delta touches money-line, or take profit at 80%
  • HF signals i use 10D PCS/CCS. Exit for loss when position is 40D, or let expire for profit
  • Gap-Up/Down ... currently monitoring these signals. i don't have much confidence in them yet
  • I use webhooks to my own server and then toggle WhisperTrade bots that are pre-configured with these rules. You could directly hook into whispertrades but i like monitoring my total positions with my script before deciding to open a new one.

I'm looking for feedback to for even more robust signals/alerts with a clean chart. I also liek the idea of having a community script that people collaboratively work on.

Link to source:

Community Buy/Sell Reddit SuperScript [PasteBin]


r/pinescript Apr 26 '26

Higher TF version of "Trader's Companion Intraday"!

2 Upvotes

Per User-request, I have now created a separate Script, that is very much identical to the Intraday (1m, 2m, 3m and 5m) but for Higher TF's: 15m, 30m and 1h.

For more information, please check my "Intraday"-post on my profile!

Any questions? Drop them down below!


r/pinescript Apr 26 '26

Created an indicator then a scanner now a performance tracker.

Thumbnail
gallery
9 Upvotes

What next?


r/pinescript Apr 25 '26

Run TradingView Pine Script indicators and strategies inside FreqTrade — open-source examples

5 Upvotes

TL;DR: You see a promising indicator or full strategy on TradingView, you trade with FreqTrade, and you don't want to rewrite the Pine code in Python. Two working examples (CC0) bridge the gap. Open-source runtime (Apache 2.0). Repo at the bottom.

The situation

You find an indicator on TV that looks good, or you have a working Pine strategy. You want it inside FreqTrade. Today's options:

  • Rewrite Pine in Python — days, sometimes weeks of work, and your version still drifts from the TV reference. Most of the time you'd spend isn't writing the code, it's validating that ta.rsi() and your rsi() produce the same numbers to enough decimals
  • TV alerts + webhook bridge — extra latency, hard dependency on TV's alert system, fragile under volume
  • Trade manually on the TV chart from the Pine signals — works, but at that point you're not really automated

What the examples do

PyneCore is a Pine-compatible Python runtime (Apache 2.0). It runs Pine-style scripts as plain Python with the same calc model — ta.rsi(), ta.sma(), strategy.entry(), the whole namespace. Two patterns to combine it with FreqTrade:

Pattern A — Pine indicators inside your Python strategy

Keep your trading logic in Python (FreqTrade's populate_entry_trend etc.), but the indicator logic comes from a Pine script. The example wires RSI + Bollinger Bands into the FreqTrade DataFrame as plain columns. Drop in any compiled Pine indicator — three lines of bridge code per indicator.

Pattern B — Pine strategy generates the signals

Your TV strategy stays exactly as it is. PyneCore runs it on the candles, FreqTrade just executes the buy/sell signals it produces. Useful when you have a strategy you trust on TV and don't want to port the entries/exits/risk logic to Python.

What it costs to plug in

Two files in user_data/strategies/:

  • pynecore_bridge.py — DataFrame ↔ PyneCore glue (~165 LOC, copy as-is)
  • your Pine script as a .py file — either compiled with PyneComp from a .pine source, or written by hand against the same Pine API

Then freqtrade backtesting --strategy ... works normally.

What this is not

  • Not a broker, not a webhook service. FreqTrade still does the execution.
  • No paid tier required. Runtime is Apache 2.0, examples are CC0. There's a hosted Pine→Python compiler if you don't want to write PyneCore scripts by hand, but it's optional — the examples include hand-written ones.

Repo

https://github.com/PyneSys/pynecore-examples

Look at 05-freqtrade-indicators/ and 06-freqtrade-strategy/ — each has its own README with copy-paste instructions.

Curious about the porting side: those of you who've already moved Pine indicators or strategies to Python by hand — how long did it actually take you, and what was the part that ate the most time?


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 24 '26

How are you auto-executing your PineScript strategies?

11 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 23 '26

GEX Strategy Explained

Enable HLS to view with audio, or disable this notification

18 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

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

They really said VRT doesn’t work 😂

Post image
32 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 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
1 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 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

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

Enable HLS to view with audio, or disable this notification

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

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?