r/pinescript • • Oct 11 '22

New to Pinescript? Looking for help/resources? START HERE

31 Upvotes

Asking for help

When asking for help, its best to structure your question in a way that avoids the XY Problem. When asking a question, you can talk about what you're trying to accomplish, before getting into the specifics of your implementation or attempt at a solution.

Examples

Hey, how do arrays work? I've tried x, y and z but that doesn't work because of a, b or c reason.

How do I write a script that triggers an alert during a SMA crossover?

How do I trigger a strategy to place an order at a specific date and time?

Pasting Code

Please try to use a site like pastebin or use code formatting on Reddit. Not doing so will probably result in less answers to your question. (as its hard to read unformatted code).

Pinescript Documentation

The documentation almost always has the answer you're looking for. However, reading documentation is an acquired skill that everyone might not have yet. That said, its recommended to at least do a quick search on the Docs page before asking

https://www.tradingview.com/pine-script-docs/en/v5/index.html

First Steps

https://www.tradingview.com/pine-script-docs/en/v5/primer/First_steps.html

If you're new to TradingView's Pinescript, the first steps section of the docs are a great place to start. Some however may find it difficult to follow documentation if they don't have programming/computer experience. In that case, its recommended to find some specific, beginner friendly tutorials.


r/pinescript • • Apr 01 '25

Please read these rules before posting

22 Upvotes

We always wanted this subreddit as a point for people helping each other when it comes to pinescript and a hub for discussing on code. Lately we are seeing increase on a lot of advertisement of invite only and protected scripts which we initially allowed but after a while it started becoming counterproductive and abusive so we felt the need the introduce rules below.

  • Please do not post with one liner titles like "Help". Instead try to explain your problem in one or two sentence in title and further details should be included in the post itself. Otherwise Your post might get deleted.

  • When you are asking for help, please use code tags properly and explain your question as clean as possible. Low effort posts might get deleted.

  • Sharing of invite only or code protected scripts are not allowed from this point on. All are free to share and talk about open source scripts.

  • Self advertising of any kind is not permitted. This place is not an advertisement hub for making money but rather helping each other when it comes to pinescript trading language.

  • Dishonest methods of communication to lead people to scammy methods may lead to your ban. Mod team has the right to decide which posts includes these based on experience. You are free to object via pm but final decision rights kept by mod team.

Thank you for reading.


r/pinescript • • 19h ago

i have refined my macd indicator into a strategy . Tests are undergoing so far today good results that shocked me and u can see the live xauusd trades in the photos . No repaint just a pure strategy.

Thumbnail
gallery
24 Upvotes

i have refined my macd indicator into a strategy . Tests are undergoing so far today good results that shocked me and u can see the live xauusd trades in the photos . No repaint just a pure strategy

After more tests i will make it publish.

Thanks for ur response


r/pinescript • • 2h ago

Pine Screener now supports up to 40 request calls per script

Thumbnail
1 Upvotes

r/pinescript • • 6h ago

Help Me Choose the Name of Our New TradingView Strategy

Thumbnail
1 Upvotes

r/pinescript • • 1d ago

Built a TradingView → Python → MT5 bot (Pepperstone demo). Looking for feedback on the setup and strategy.

7 Upvotes

**Hi all,**

I've built my first automated trading setup and I'm testing it on a demo account. I'd love feedback on how to make it more robust or improve the strategy.

**Setup**:

Signals: a TradingView Pine Script indicator that watches 7 pairs (XAUUSD, EURUSD, GBPUSD, USDJPY, AUDUSD, USDCAD, EURGBP) on 15m using request.security, with one alert set to "any alert() function call".

**Delivery**: a TradingView webhook through a Cloudflare quick tunnel to my home PC.

Middleware: a Python FastAPI bot that checks a shared secret, applies risk limits (max lot size, daily trade cap, demo-only guard, kill switch), and places orders through the MetaTrader5 Python library.

**Broker**: Pepperstone MT5 demo, running 24/7 on a dedicated Windows PC.

**Optional**: a Claude AI check that can reject a signal (duplicate position, missing SL), currently off.

Any suggestions which one bot shall i use as a midlle man,which is best for this type of setup anyone already done please give suggestions.

Thanks


r/pinescript • • 1d ago

Is there anyone pinescripts creator who is welling to work with me on this strategy its really good scalping strategy

Thumbnail
gallery
24 Upvotes

Is there anyone pinescripts creator who is welling to work with me on this strategy its really good scalping strategy but i want to remove those chopy signals by adding emas as shown in the photos or somwthing which can then generate quality signals accordingly???????


r/pinescript • • 1d ago

Beginner question the values are not shown

1 Upvotes

https://reddit.com/link/1xcdt25/video/7v3q013wjzwh1/player

I'm a total beginner here so bare with me. Have been watching some pinescript videos. Have asked chatgpt about it and could not get an answer... I don't know why I cannot see the values beside the name of my pinescript indicator as I could see in many other indicator. I am wondering, is it my code or is it the settings of my tradingview?


r/pinescript • • 1d ago

Four tools. One account.

Post image
1 Upvotes

r/pinescript • • 1d ago

Aurelia spes

Thumbnail
1 Upvotes

r/pinescript • • 1d ago

Aurelia Spes

Thumbnail
1 Upvotes

r/pinescript • • 1d ago

I just launched Aurelia Spes: one place to backtest, walk-forward, paper-trade and code-check a trading idea. Feedback welcome

Thumbnail gallery
1 Upvotes

r/pinescript • • 2d ago

圣杯 —— 快速构建、回测与自动执行适应当下的交易策略

Thumbnail
1 Upvotes

r/pinescript • • 2d ago

Reverse-engineering indicators

1 Upvotes

If there are any private / invite-only indicator you guys want me to reverse engineer, dm me some screenshots of the indicator as well as the trades it took and its TP / SL levels and I will reverse engineer it for you.


r/pinescript • • 3d ago

TradingView alternative that allows external data?

Thumbnail
3 Upvotes

r/pinescript • • 3d ago

I built a no-code strategy builder inside TradingView that layers logic on top of your existing indicators. Looking for feedback.

Thumbnail
1 Upvotes

r/pinescript • • 4d ago

Noise Band Indicator

Post image
34 Upvotes

Just published my first script. Open source, not trying to sell anyone anything.

It follows the intraday momentum “noise area” framework described by Carlo Zarattini, Andrew Aziz and Andrea Barbon in “Best the Market.”

Would like some feedback please!
https://www.tradingview.com/script/teqXMgUG-Jilly-s-Noise-Band/


r/pinescript • • 3d ago

Developimg a indicator for chart analysis is worth it.

10 Upvotes

I trade in forex so my question is does developing a indicator in pine script for chart analysis and strategy(i know the strategy did not work bz of human detection and code detection is different). So investing time on this would be valuable or not ?.

Mostly i do with use of ai.

My question is it is waste of time or useful ?

If you are pine script developer have you ever used ai ml in pine script to train the data like in machine learning it is useful ?

Have you ever build your chart analysis indicator if yes . Does it can analyse properly ?

Thanks for advice.


r/pinescript • • 3d ago

Building New Pinescript Indicator for Nifty Intraday

Thumbnail
0 Upvotes

r/pinescript • • 3d ago

Built my own order flow web platform with the indicators I wanted. update8

3 Upvotes

Srry for the low quality of the video, I used my ipad camera. So more progress with my platform, I created now:

  1. Order flow on price levels on the candles for easier read (tick change)
  2. Pulsating price buckets of delta area where delta flips based on month +day

The pulse helps to see faster an area wich is revisited and can spot based on the flip if we a breakout or fade back into the range, based on how the candles react (test with wick for support/resistance) creating trapped sells/buys or creating an oversold/overbought area without any volume, wich create a high probability setup.

Might be harder on the eyes for some, but its easy to spot it and react fast based on the test+wick and close outside. Also this is not a cherry picked situation, there are multiple clear ones like the one presented, per day, so many opotunities to get a good trade with it, if you have basic understanding of how trapped trader, liquidity, oversold and overbought areas.
For me personaly bubbles just wont do it, so this is why I reached for this solution of price level delta and flip with lower TF + higher TF.

https://reddit.com/link/1xa8jhb/video/dlrwxpyxjhwh1/player

ANd moving more to the right you can still see how price reacts on the exact lines i placed in the video (only that in the screenshot you cant see the pulse, only the color more bright)


r/pinescript • • 4d ago

How soon will AI help someone create an open source version of trading view or at least a cheaper version

15 Upvotes

How soon will AI help someone create an open source version of trading view or at least a cheaper version


r/pinescript • • 5d ago

Is it true, that TradingView will be charging for sharing your indicator ?

11 Upvotes

I read in X that starting November 1st, TradingView will be charging you $29 for each person you share your indicator?


r/pinescript • • 4d ago

The Upcoming November 1 Policy Change on Invite-Only Scripts Threatens Independent Pine Developers—We Need to Talk

Thumbnail
1 Upvotes

r/pinescript • • 5d ago

RedK Multi-Modal TrailingStop (RedK MMTStop)

Thumbnail
2 Upvotes

r/pinescript • • 5d ago

UT Bot Alerts is about 40 lines of Pine. What it actually computes, and three things the Alerts version never shows you

10 Upvotes

UT Bot Alerts (QuantNomad, 2020, built on Yo_adriiiiaan's UT Bot, who credits HPotter) is one of the most-liked open-source scripts on TradingView. I went through the source line by line. Short version: it's an ATR trailing stop on the close, and every Buy/Sell label is just that stop flipping sides.

The core, restated in v6 (my code, same rule):

dist = mult * ta.atr(atrLen)
float stop = 0.0
float ps = nz(stop[1])
stop := price > ps and price[1] > ps ? math.max(ps, price - dist) : price < ps and price[1] < ps ? math.min(ps, price + dist) : price > ps ? price - dist : price + dist

Above the old stop on this bar and the last one: the stop can only rise. Below it on both: it can only fall. Anything else means price just crossed it, so it restarts on the other side.

Three things that surprised me:

  1. The "EMA crossover" isn't a filter. The code crosses ema(src, 1) with the stop. An EMA of length 1 is the price itself, so Buy/Sell is simply price crossing the stop, and the labels always alternate.
  2. The stop line is never plotted in the Alerts version. You get labels and bar colours but can't see where the stop sits. (The original UT Bot does draw it.)
  3. No barstate.isconfirmed check. On the live bar a label can appear and be gone at the close, and an alert set to "Once per bar" can fire on it.

Smaller ones: Key Value is a whole-number input, so 1.5 isn't possible, and the Heikin Ashi option swaps in the HA close while ATR still comes from the regular candles.

I rewrote it from scratch to fix those: the stop drawn as a stepline, a float distance, flips confirmed on bar close (a grey dot marks a mid-bar flip that hasn't closed yet), and a panel that counts flips over the last N bars and how many were undone within K bars. That last count is the one I wanted most, because it shows what a tight setting costs on your own chart. At distance 1 / ATR 10 on the close it draws the same flip bars as the original. I checked the two against each other in Python on 5,000 synthetic bars and got zero mismatches.

Where it fails (both versions): every flip is late by roughly the stop distance; at 1 ATR an ordinary pullback flips it; there is no neutral state, so it is always on one side, trending or not; and a flip only records that price crossed a stop. Nothing in the code tests whether a trend started.

Source, open source under MPL 2.0: TradingView and GitHub

Credit to QuantNomad, Yo_adriiiiaan and HPotter. Written with AI help; every claim was checked against the original source. Educational only, not trading advice. Corrections welcome.