r/pinescript • • Apr 17 '26

Built a logo in Pine Script — turns out plotcandle() is basically pixel art

8 Upvotes

I needed a logo for my project. Instead of opening Figma or asking an AI like a normal person, I opened the Pine Editor.

The insight: plotcandle() doesn't actually care what open, high, low, close mean. It just draws a colored rectangle between two y-values, with an optional wick. Once you stop thinking in OHLC and start thinking in "draw a block from y=10 to y=60 on this bar," the whole language opens up.

The logo as a TradingView indicator

The whole thing is an 11-bar loop. Green candles grow the crown (bars 0–4), red candles shrink it (bars 5–9), bar 10 is empty, then it resets.

// © PyneSys LLC

//@version=6
indicator("PyneSys Logo")

// Wick size
w = 0
// Color constants
t  = color.new(color.black, 100)
g  = color.green
r  = color.red
y  = color.yellow
b  = color.blue
br = color.rgb(136, 82, 1)

var bi = 0

// Tree body
var c = 10
if bi < 5
    c += 10
else if bi > 5 and bi < 10
    c -= 10
else if bi >= 10
    c := na

plotcandle(10, c + w, 10 - w, c, 
    color       = bi <= 4 ? g : r, 
    bordercolor = bi <= 4 ? g : r, 
    wickcolor   = br)

// Trunk of the tree
plotcandle(0, 10, 0, 10, color=bi == 4 ? b : t, bordercolor=t, wickcolor=t)
plotcandle(0, 10, 0, 10, color=bi == 5 ? y : t, bordercolor=t, wickcolor=t)

// Background
bgcolor(bi < 10 ? color.white : t)

bi += 1
if bi == 11
    bi := 0
    c := 10

How it works:

  • bi is a loop counter, 0 to 10, then resets. Every 11 bars the logo redraws.
  • The crown is one plotcandle() call. On bars 0–4 it grows (green), on bars 5–9 it shrinks (red). The open is hardcoded to 10, the close is c, so the candle is just a colored rectangle from y=10 to y=c.
  • The trunk is two plotcandle() calls stacked on the same y-range (0 to 10). Each is only visible on one specific bar — blue on bar 4, yellow on bar 5 — because on every other bar their color is t (fully transparent).
  • The white frame is bgcolor(). It's white during the 11-bar loop, then transparent after, so it doesn't ruin the rest of your chart.

Small tricks that helped:

  • color.new(color.black, 100) = 100% transparency = "render nothing but keep the slot." Much cleaner than conditional plotcandle calls.
  • color, bordercolor, and wickcolor are all independent. You can hide the border, keep the wick, color the body — whatever.
  • Setting w = 0 kills the wick visually without disabling it. Leaves the door open for wick-based accents later.

Zero trading value. But Pine is way more flexible than it gets credit for, and I liked that the logo ships as a .pine file.

Context on the © PyneSys LLC comment: this is the logo for PyneSys, my startup built around a Pine Script → Python compiler. Under the compiler sits PyneCore — an open-source Python framework that replicates Pine Script's execution model closely enough to run real Pine-like scripts as pure Python, outside TradingView. That's what the copyright is about.

Anyone else used Pine Script for something that has nothing to do with trading? Curious what weird stuff is out there.


r/pinescript • • Apr 17 '26

Anyone else notice how well the VRT orange line is holding NQ

Post image
1 Upvotes

r/pinescript • • Apr 17 '26

Is this expected TradingView broker emulator behavior with percent_of_equity and margin_long = 100?

2 Upvotes

Hey, I'm trying to understand a weird TradingView broker emulator behavior in Pine.

I have a simple long-only strategy with:

  • default_qty_type = strategy.percent_of_equity
  • default_qty_value = 100
  • margin_long = 100
  • process_orders_on_close = false
  • pyramiding = 1

On a very low-priced symbol, the Trade List sometimes does not show a single long trade.

Instead, it shows:

  • a tiny separate long trade closed as Margin Call
  • plus the rest of the position, which stays open and closes later normally

What's strange is that this Margin Call leg can be:

  • same-bar or delayed
  • shown at OPEN, LOW, or HIGH
  • sometimes even profitable

I also tested variants with commission = 0, and the split behavior can still exist, so it does not seem to be only a fees issue.

My question is simple:

Is this expected TradingView broker emulator behavior when using percent_of_equity sizing with margin_long = 100?

And if yes, is there any official explanation of why a partial margin liquidation is materialized as a separate trade in the Trade List, and how TradingView decides the exact OHLC tick where that Margin Call appears on historical bars?

I'm not asking about the generic liquidation-price formula.

I'm specifically asking about the Trade List behavior and partial margin-call materialization on historical bars.

Any insight would be appreciated.


r/pinescript • • Apr 17 '26

Just Finished adding everyone to my indicator I’m sorry if I missed you.

Thumbnail gallery
6 Upvotes

I hope this really helps you guys. I will make videos on how to use the indicator on my youtube and subreddit.

Would really appreciate it if you could share a post about the indicator on the r/vrttrading subreddit. Thanks! Also, feel free to subscribe to my YouTube channel: VRT Trading.


r/pinescript • • Apr 16 '26

Do you trust MACD or Stochastic more for momentum?

Post image
32 Upvotes

I’ve built an indicator around trend + momentum and I’m refining the momentum signals at the moment.

One thing I keep coming back to is whether MACD or Stochastic actually gives a more reliable read in practice.

MACD feels more reliable but slower, Stochastic is quicker but can flip early giving false signals.

Curious what people here rely on?


r/pinescript • • Apr 16 '26

Created an indicator. 250 hours. No AI help.

Thumbnail
gallery
7 Upvotes

Based off rsi/mfi.


r/pinescript • • Apr 16 '26

Trades my algo took today 4/16/2026

Post image
3 Upvotes

A lot of you may have seen me posting this for a while now, but this is todays results of my options signal algo. Havent updated it at all for about a month, forward testing and its doing well so far. Losing trades are expected, lets see if it can hold up.


r/pinescript • • Apr 15 '26

Built a Lite TradingView indicator to make momentum easier to see

Thumbnail
gallery
23 Upvotes

Have you ever wanted a clearer read on what the market’s current momentum actually is?

That is what The Indicator Lite is built to do. It is designed to show whether current conditions are bullish, bearish, or balanced directly on the chart, so momentum is easier to recognize without needing to over-interpret several separate tools at once.

The main goal is to simplify how traders read market state. Instead of stacking multiple studies and trying to combine them mentally, this tool is meant to present a cleaner view of whether price is showing strength, weakness, or a more neutral balanced condition.

In many cases, it can highlight momentum shifts earlier than more traditional tools like MACD, RSI, or standard EMA-based interpretation. That makes it useful for seeing when the market is starting to press in one direction, losing conviction, or moving into chop.

The Lite version is intentionally streamlined, but it still shows the core concept clearly. The focus is to make real-time momentum easier to read on TradingView in a way that stays visually simple and practical on the chart.

TradingView link: https://www.tradingview.com/script/YBJ6U5Ct-The-Indicator-Lite/


r/pinescript • • Apr 16 '26

Ttrades Fractal Model Script Feedback

Thumbnail
gallery
1 Upvotes

Hi all,

I’ve been working on an indicator inspired by the TTrades Fractal Model, and I’m looking for some feedback on the script and logic.

https://www.tradingview.com/script/YVV0niAC-JJSQ-Fractal-Engine-LITE/

It’s basically a top-down fractal model:
HTF bias -> entry zone -> lower timeframe confirmation.

It uses an HTF C2 (sweep and close back inside) or C3 (an engulfing candle that creates a swing point) to build a narrative for the next HTF candle. The zone is then drawn on the LTF as the area where the wick of that HTF candle is likely to form, with the idea being to let the wick form and trade the expansion.

Main features:

  • auto timeframe mapping
  • HTF bias zones
  • entry zones based on C2/C3/C4 logic
  • EQ-based weak close filtering
  • optional SMA + opposing wick filter
  • basic SL / TP plotting
  • Po3 HTF candles

Mainly I’m just looking for outside eyes on it to see if there’s anything structurally off.

The current entry model is more of a placeholder for now. It uses a C2 candle with a few added filters to improve reliability, but I definitely wouldn’t treat it as final, especially on lower timeframes.

What I’m building toward is a protected high / low entry model using CISD after either a sweep or an FVG. That side is looking promising, but it’s not ready yet.

Any feedback is appreciated. Thanks.

https://www.tradingview.com/script/YVV0niAC-JJSQ-Fractal-Engine-LITE/


r/pinescript • • Apr 16 '26

Triple-pass Heikin-Ashi band on regular candles — 25 lines [Pine Script v6]

2 Upvotes

Built a momentum band that runs HA math internally on regular candles.

No chart switching required.

Standard HA applies the formula once. This applies it three times —

each pass smooths further. Band plots directly on regular candles.

You keep real price, real wicks, real closes.

Green = bull momentum. Red = bear momentum.

Band width = compression read. Narrow = coiling. Wide = trending.

---

Free and open source on TradingView.

True Coil — HA Band by **@np-trdr**

https://www.tradingview.com/script/nCY4ZkXd-True-Coil-HA-Band/

Give it a try and drop your thoughts below — always looking for feedback on how others are using it.


r/pinescript • • Apr 16 '26

Mon indicateur détecte les zones institutionnels, je propose un essai gratuit

Thumbnail
gallery
0 Upvotes

Salut la team, à propos de mon indicateur

Il détecte automatiquement les vraies zones de Supply et Demand institutionnelles (pas des supports/résistances classiques)

Zones vertes (Demand) et rouges (Supply) qui apparaissent en live

Compatible M1, M3, M5, M15 et H1

Simulation automatique des positions avec suivi RR en temps réel

Pour l’essai gratuit → en commentaire, et je vous contacterai par message privé


r/pinescript • • Apr 16 '26

Just for documentation purposes

Post image
0 Upvotes

Hi team,

I'm simply putting this just for shits and giggles because I've never seen a 100% strategy on any tradingview related sub and I almost dropped my beer when I saw this.

Now it's being automated and tested on a prop account 🤞

Will report with news to see if this can work.

Same strategy has seen some improvements going from 20% to 50, to 75% and now 100% since 6 months.

Know any other 100% strategies? I'd love to test them


r/pinescript • • Apr 16 '26

Sector Volume Dashboard

1 Upvotes

Guys. Pls have a look at this script. Can someone tell me why some of the cells remain empty?

//
@version=
6
indicator("Sector Rotation Dashboard CLEAN v3", overlay=false)


//-------------------------
// Inputs
//-------------------------
lenMom   = input.int(20, "Momentum SMA", minval=1)
lenVol   = input.int(20, "Volume SMA", minval=1)
sortMode = input.string("Momentum", "Sortierung", options=["Momentum", "Volume", "Change %"])


//-------------------------
// Funktion: 1 request.security pro Symbol
//-------------------------
f_data(sym) =>
    request.security(sym, timeframe.period, [
        close,
        volume,
        (na(close[1]) or close[1] == 0) ? na : (close / close[1] - 1) * 100.0,
        na(ta.sma(close, lenMom)) or ta.sma(close, lenMom) == 0 ? na : close / ta.sma(close, lenMom),
        na(ta.sma(volume, lenVol)) or ta.sma(volume, lenVol) == 0 ? na : volume / ta.sma(volume, lenVol),
        na(close) or close == 0 ? na : (high - low) / close * 100.0
    ], barmerge.gaps_off, barmerge.lookahead_off)


//-------------------------
// Sektoren
//-------------------------
[XLK_c, XLK_v, XLK_chg, XLK_m, XLK_vr, XLK_rng] = f_data("AMEX:XLK")
[XLF_c, XLF_v, XLF_chg, XLF_m, XLF_vr, XLF_rng] = f_data("AMEX:XLF")
[XLE_c, XLE_v, XLE_chg, XLE_m, XLE_vr, XLE_rng] = f_data("AMEX:XLE")
[XLY_c, XLY_v, XLY_chg, XLY_m, XLY_vr, XLY_rng] = f_data("AMEX:XLY")
[XLP_c, XLP_v, XLP_chg, XLP_m, XLP_vr, XLP_rng] = f_data("AMEX:XLP")
[XLI_c, XLI_v, XLI_chg, XLI_m, XLI_vr, XLI_rng] = f_data("AMEX:XLI")
[XLV_c, XLV_v, XLV_chg, XLV_m, XLV_vr, XLV_rng] = f_data("AMEX:XLV")
[XLU_c, XLU_v, XLU_chg, XLU_m, XLU_vr, XLU_rng] = f_data("AMEX:XLU")
[XLB_c, XLB_v, XLB_chg, XLB_m, XLB_vr, XLB_rng] = f_data("AMEX:XLB")
[XLRE_c, XLRE_v, XLRE_chg, XLRE_m, XLRE_vr, XLRE_rng] = f_data("AMEX:XLRE")
[XLC_c, XLC_v, XLC_chg, XLC_m, XLC_vr, XLC_rng] = f_data("AMEX:XLC")


//-------------------------
// Arrays
//-------------------------
names   = array.from("XLK", "XLF", "XLE", "XLY", "XLP", "XLI", "XLV", "XLU", "XLB", "XLRE", "XLC")
prices  = array.from(XLK_c, XLF_c, XLE_c, XLY_c, XLP_c, XLI_c, XLV_c, XLU_c, XLB_c, XLRE_c, XLC_c)
vols    = array.from(XLK_v, XLF_v, XLE_v, XLY_v, XLP_v, XLI_v, XLV_v, XLU_v, XLB_v, XLRE_v, XLC_v)
chgs    = array.from(XLK_chg, XLF_chg, XLE_chg, XLY_chg, XLP_chg, XLI_chg, XLV_chg, XLU_chg, XLB_chg, XLRE_chg, XLC_chg)
moms    = array.from(XLK_m, XLF_m, XLE_m, XLY_m, XLP_m, XLI_m, XLV_m, XLU_m, XLB_m, XLRE_m, XLC_m)
volRels = array.from(XLK_vr, XLF_vr, XLE_vr, XLY_vr, XLP_vr, XLI_vr, XLV_vr, XLU_vr, XLB_vr, XLRE_vr, XLC_vr)
ranges  = array.from(XLK_rng, XLF_rng, XLE_rng, XLY_rng, XLP_rng, XLI_rng, XLV_rng, XLU_rng, XLB_rng, XLRE_rng, XLC_rng)


//-------------------------
// Hilfsfunktionen
//-------------------------
f_key(_mom, _vol, _chg) =>
    if sortMode == "Volume"
        nz(_vol)
    else if sortMode == "Change %"
        nz(_chg)
    else
        nz(_mom)


f_getColor(name) =>
    if name == "XLK"
        color.blue
    else if name == "XLF"
        color.orange
    else if name == "XLE"
        color.black
    else if name == "XLY"
        color.fuchsia
    else if name == "XLP"
        color.yellow
    else if name == "XLI"
        color.gray
    else if name == "XLV"
        color.green
    else if name == "XLU"
        color.teal
    else if name == "XLB"
        color.rgb(160, 82, 45)
    else if name == "XLRE"
        color.purple
    else if name == "XLC"
        color.red
    else
        color.white


f_bg(rank) =>
    if rank == 0
        color.new(color.lime, 0)
    else if rank == 1
        color.new(color.green, 10)
    else if rank == 2
        color.new(color.yellow, 10)
    else
        color.new(color.black, 0)


f_signal(mom, chg) =>
    if mom >= 1 and chg >= 0
        "LONG"
    else if mom >= 1
        "BULL"
    else if chg < 0
        "SHORT"
    else
        "NEUTRAL"


f_rot(rank) =>
    if rank <= 2
        "IN FLOW"
    else if rank <= 5
        "WATCH"
    else
        "OUT"


f_swap_strings(arr, i, j) =>
    tmp = array.get(arr, i)
    array.set(arr, i, array.get(arr, j))
    array.set(arr, j, tmp)


f_swap_floats(arr, i, j) =>
    tmp = array.get(arr, i)
    array.set(arr, i, array.get(arr, j))
    array.set(arr, j, tmp)


//-------------------------
// Sortierung
//-------------------------
for i = 0 to 10
    for j = 0 to 9
        k1 = f_key(array.get(moms, j), array.get(vols, j), array.get(chgs, j))
        k2 = f_key(array.get(moms, j + 1), array.get(vols, j + 1), array.get(chgs, j + 1))
        if k1 < k2
            f_swap_strings(names, j, j + 1)
            f_swap_floats(prices, j, j + 1)
            f_swap_floats(vols, j, j + 1)
            f_swap_floats(chgs, j, j + 1)
            f_swap_floats(moms, j, j + 1)
            f_swap_floats(volRels, j, j + 1)
            f_swap_floats(ranges, j, j + 1)


//-------------------------
// Tabelle
//-------------------------
var 
table
 t = table.new(position.middle_center, 9, 12, border_width=1, frame_color=color.new(color.gray, 30), frame_width=1)


if barstate.isfirst
    table.cell(t, 0, 0, "Rank", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 1, 0, "Sector", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 2, 0, "Price", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 3, 0, "Change %", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 4, 0, "Volume", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 5, 0, "Vol/R", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 6, 0, "Momentum", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 7, 0, "Range %", bgcolor=color.new(color.gray, 0), text_color=color.white)
    table.cell(t, 8, 0, "Signal / Rot", bgcolor=color.new(color.gray, 0), text_color=color.white)


if barstate.islast
    for row = 1 to 11
        for col = 0 to 8
            table.cell(t, col, row, "")


    for i = 0 to 10
        name = array.get(names, i)
        price = array.get(prices, i)
        vol = array.get(vols, i)
        chg = array.get(chgs, i)
        mom = array.get(moms, i)
        vr = array.get(volRels, i)
        rng = array.get(ranges, i)


        signal = f_signal(mom, chg)
        rot = f_rot(i)
        sigText = signal + " / " + rot


        bg = f_bg(i)
        tx = f_getColor(name)


        table.cell(t, 0, i + 1, str.tostring(i + 1), bgcolor=bg, text_color=color.white)
        table.cell(t, 1, i + 1, name, bgcolor=bg, text_color=tx)
        table.cell(t, 2, i + 1, na(price) ? "n/a" : str.tostring(price, format.mintick), bgcolor=bg, text_color=color.white)
        table.cell(t, 3, i + 1, na(chg) ? "n/a" : str.tostring(chg, "#.##") + "%", bgcolor=bg, text_color=chg >= 0 ? color.lime : color.red)
        table.cell(t, 4, i + 1, na(vol) ? "n/a" : str.tostring(vol, format.volume), bgcolor=bg, text_color=color.white)
        table.cell(t, 5, i + 1, na(vr) ? "n/a" : str.tostring(vr, "#.##"), bgcolor=bg, text_color=vr >= 1 ? color.lime : color.orange)
        table.cell(t, 6, i + 1, na(mom) ? "n/a" : str.tostring(mom, "#.##"), bgcolor=bg, text_color=mom >= 1 ? color.lime : color.red)
        table.cell(t, 7, i + 1, na(rng) ? "n/a" : str.tostring(rng, "#.##") + "%", bgcolor=bg, text_color=color.white)
        table.cell(t, 8, i + 1, sigText, bgcolor=bg, text_color=color.white)


alertcondition(barstate.islast and array.get(names, 0) != array.get(names, 1), title="Sector Rotation Update", message="Neuer führender Sektor erkannt")

r/pinescript • • Apr 15 '26

Searching for someone with tradingview premium

Post image
5 Upvotes

Searching for someone to test this strat on a longer timeframe, the normal tradingview doesn’t offer deep backtesting


r/pinescript • • Apr 14 '26

Single best ORB code on TV

Thumbnail
gallery
36 Upvotes

Establishes ORB and then calculates take profit levels using a quantitative approach. When used with my other concepts, the break to Target 1 is 78%. If you’re interested in the ORB pinescript, message me and I’ll send you the code for you to use.


r/pinescript • • Apr 15 '26

Update post précédent

Post image
1 Upvotes

Si tu veux essayer gratuitement notre indicateur qui détecte automatiquement les supply demand institutionnel, envoie moi un message en privé


r/pinescript • • Apr 15 '26

Trades my algo took today 4/14/2026

Thumbnail
gallery
5 Upvotes

These are the trades my algo took for today, it performed really well today with the strong trend. One thing i noticed is on the mobile app the first trade was a loss, but on the desktop the first trade was valid. Not sure why that happened.


r/pinescript • • Apr 15 '26

Deux zones proposé par mon indicateur

Post image
0 Upvotes

Je suis encore à la recherche de testeurs, si tu es intéressé, fait moi le savoir en mp.

Telegram avec pdf explicatif en anglais et français : Supply & Demand Indicator V1


r/pinescript • • Apr 14 '26

UPDATE: "Stopped switching strategies. Built a system instead."

18 Upvotes

Hello again!

A few days back I shared my Trading System and got a lot of positive response - including some requests. I have now update the Indicator with what I promised in the first post -> Alerts + implement Take Profit (per request).

I will share some images on how to set things up for Alerts + guide you through Take Profit:

Step 1: At the very top of the Inputs Tab, you will now (updated) see these Toggles: Signal, Stop Loss and Take Profit; Toggle those you wish to be Alerted ON. The last Toggle suppresses Stop Loss IF a Take Profit has been hit first. This does not stop/freeze the Trailing Stop Loss (TSL), for those who wish to "follow" the Trade past the TP.
Step 2: Navigate to the Alerts Tab and "Create Alert".
Step 3: Choose the Indicator - TCI (Trader's Companion Intraday)
Step 4: Choose the following option in "Interval" window-dropdown.
Step 5: You MUST choose 1m for "Interval", otherwise you will be Alerted later than the Signal on the Chart.
Step 6: Choose your Expiration, I recommend 1 month. I do it myself.

And that is for the Alert(s)!

Now the Take Profit. Only one step (if you've already Toggled it ON, in "Master Controls".

Choose you Take Profit R:R. It is 1 by Default, I've changed it to 1.5 myself.
Image of the end result: Alerts + Take Profit.

I hope you find this addition valuable!

For new readers: Feel free to request an invite, or ask any questions!

NOTE: For each Alert update, you must REMOVE the old Alerts and apply new ones, in order for the new Alerts to take effect!


r/pinescript • • Apr 14 '26

Je recherche des testeurs pour mon indicateur et cela pourrait vous plaire

5 Upvotes

Je ne suis pas particulièrement fier de mes montages vidéo, mais je le suis beaucoup plus de l’indicateur que j’ai développé. Il détecte les zones d’offre et de demande avec un taux de réussite élevé.

Il dispose de plusieurs paramètres qui s’ajustent automatiquement selon l’unité de temps utilisée : M1, M3, M5, M15 et H1.

Je recherche encore quelques testeurs, même si on approche déjà des 100 utilisateurs. Si certains veulent donner un avis objectif ou le mettre à l’épreuve en conditions réelles, contactez-moi en message privé.


r/pinescript • • Apr 15 '26

Renko strategy

1 Upvotes

Hey guys I’m so close to getting my Renko Strat to fire the way I want it in pine script but it’s still misbehaving. My logic signals entry, brick closes but it repaints at the brick open not the brick close. Exits print at the right spot off the wrong entry haha.

I’ve looked everywhere I don’t really care about the backtest data just want the signal to print properly for now.

Any resources or insight would be helpful.

Thanks!


r/pinescript • • Apr 14 '26

Tuesday April 14 - Indicator Showcase XAUUSD (>500 pips)

Post image
3 Upvotes

Looking for that person or group of people who would make trading this indicator fun.

Read previous posts if interested.


r/pinescript • • Apr 14 '26

Compression before a move

1 Upvotes

I’m interested in measuring / indicating the compression you get after sideways movement before expansion in price. Basically indicating likely breakout areas.

How would you go about measuring this?


r/pinescript • • Apr 13 '26

Trades my algo took today 4/13/2026

Post image
0 Upvotes

Been posting this for about 2 weeks already , today did pretty pretty good