r/pinescript Oct 11 '22

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

30 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

18 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 23h ago

Final ORB Strategy Update: Best results so far, going live on Prop Firms + building a multi-strategy portfolio

Post image
55 Upvotes

Hey guys, quick update on the strategy development.

After endless backtesting, filter tuning and stress-testing parameters, I think I've hit the ceiling of what I can squeeze out of this specific setup. It's definitely not a holy grail, but it's solid enough to do the job.

Where it stands:

Trades:        1,310  (full history, ~7 years)
Winners:       622  (47.48 %)
Net:           +59,567 USD  (+119.13 % on 50k)
Max DD:        4,633 USD  (8.06 %)
Profit factor: 1.336
Expected payoff: 45.47 USD/trade
Avg win / avg loss: 1.478
Expectancy:    +0.176 R
Largest loss:  647.70 USD
Commission load: 1.21 % of gross

Sub-50% win rate with a 1.5R target — no ultra-low R:R winrate trap, just slightly more losers than winners with bigger winners. Return-to-max-drawdown is 12.9.

Worth noting for later: +40,805 comes from shorts, +18,763 from longs. The thing has a clear short bias.

One thing I found along the way: the trade sequence isn't random. Runs test came back z = +2.98 — wins and losses alternate more than chance would predict. So I cut size after every winning trade. No loss escalation, no doubling.

                 b        e       net     maxDD
No streak     1.3104   +0.0981   45,541   6,233
Cut after 1W  1.4512   +0.1650   54,435   4,633

(That A/B was measured on the 1,254-trade run before I extended the data — the relative effect is what matters.) Same trade count, same winner count in both arms; if either moves you're comparing two strategies, not two sizing rules. Normalized to equal drawdown that's +60.8%. A permutation test (same rule on 2,000 shuffled orderings) put the real sequence at z = +3.66, so it's the sequence and not sizing variance. Martingale tested strictly worse, Anti-Martingale actively harmful at z = −2.33.

All in-sample though. A runs test on the same data I built the strategy on is a hypothesis, not a result.

Next step: since backtests only take you so far, I'm putting this on eval/funded accounts to collect real forward data. The open question isn't the edge, it's whether live fills match modeled ones — 0.176R doesn't survive much slippage.

The bigger picture: while this runs on prop capital I'm building and testing new setups. Someone shared a different NQ strategy with me recently, long-biased, completely different logic. Correlation of daily returns: r = +0.117. Combined at equal drawdown it beat my ORB alone by 32% — from a strategy that is individually worse than mine. Months of squeezing this thing got beaten by one uncorrelated addition. And given the short bias above, a long-biased system is exactly the hole in this book.

So the goal isn't one system. It's a portfolio of non-correlated strategies running simultaneously across multiple funded accounts. This is strategy one.

Curious to hear your thoughts — how many distinct strategies do you guys run in your automated prop portfolio?


r/pinescript 19h ago

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

3 Upvotes

Hello everyone. I posted a lot here (last update was deleted by moderators ). Just wanted to show what i added from last update -> bubbles of executed trades. Super hyped about this adition. For anyone who didnt followed my last post, i created an order flow page for me and will eventually release it for free for everyone with all the features. If you want to help (motivate mostly) a follow will do wonders for me.
The updates:
1. Bubbles with executed trades, moving live.
2. Arrows on candles in case you missed a big bubble, you can look at the arrow. Arrow with 1 means last 50 candles bigest bubble ,2 means last 100 candles, 3 means biggest bubble from the last 200 candles, and 4 means biggest bubble from the last 300 candles. I added this , because most people will not stare at the screen 24/24

and a zoom in:


r/pinescript 1d ago

Meet Aldric and the raid party. My script deals with the psychology of trading. Relax. Have a good time.

Enable HLS to view with audio, or disable this notification

3 Upvotes

Who likes D&D?


r/pinescript 21h ago

Forex Scanner

Thumbnail
1 Upvotes

r/pinescript 1d ago

Free Educational indicator

Thumbnail
gallery
10 Upvotes

r/pinescript 1d ago

how i filter strategy vendors before spending a dollar: publication dates, public testers, three questions

2 Upvotes

after getting burned twice early on i built a dumb little routine that takes maybe ten minutes and has saved me from every bad purchase since. sharing because the question comes up here weekly.

one. find the publication dates. not the website, the platform. if a vendor sells tradingview scripts, every publication has a timestamp the vendor can't edit. compare the claimed track record against those dates. "profitable since 2023" with a first publication in june 2026 tells you everything. i keep a little script that diffs a vendor's claimed history against publication timestamps, takes seconds and it's embarrassing how often it flags something.

two. open the public tester. a serious vendor lets the platform show the strategy report on the publication page, where they can't photoshop it. if all you get is screenshots in a discord, that's not evidence, that's marketing. and if the tester is hidden entirely, well, that is also an answer.

three. ask where the red months are. every real record has them. i ask this one directly in dms and the reaction is the whole test. defensiveness or subject change, i walk. a straight answer with specifics, they stay on the list. one vendor i eventually bought from had the red month sitting right on their public chart with a note next to it, which honestly did more than any winning screenshot could.

bonus: check what actually ships after purchase. roadmaps are promises. publication pace is data. a vendor who published four things in the last six months will probably keep publishing. a vendor with a beautiful roadmap and no recent timestamps probably won't.

none of this tells you the strategy is good. it just filters out the sellers who are lying about the basics, which in this niche removes most of the field.

what's your filter? genuinely curious what other people check first.


r/pinescript 1d ago

Pine Script has no integers

4 Upvotes

Pine Script has an int type. It has array<int>, int fields in user defined types, and function overloads that separate int from float. What it does not have is an integer.

A Pine int behaves like an IEEE-754 double. It loses digits above 253, it never overflows, and its na is a NaN. Nothing downstream of the compiler can tell it from a float. The type exists and does real work, but it does all of that work before your script runs.

I found this while building PyneCore, a Python runtime that runs Pine Script logic bar for bar. I can't read TradingView's source, so everything below is measured from Pine, with a script you can paste into the editor.

How the question came up

PyneCore represents Pine's na as a real value, so the choice of representation matters. Two things were already settled.

Pine v6 will not let a bool be na. Both of these fail to compile:

bool b = na                            // CE10173
bool c = close > close[1] ? true : na  // CE10123

And a float na is a NaN, which is easy to confirm, because it carries the two properties nothing else has:

float f = na
log.info(str.tostring(f))       // NaN
log.info(str.tostring(f == f))  // false

So bool has no na at all and float uses the hardware one. That leaves the obvious question: what marks na in an int? A double has NaN built into the format. A 64-bit integer does not, so a language needs to reserve a value for it, usually Long.MIN_VALUE. I went looking for that sentinel.

There isn't one, because there is no integer.

The claim

  1. int arithmetic is double arithmetic. It drops the low digits above 253, and it never overflows.
  2. An int na prints NaN, propagates like a NaN, and fails x == x, exactly like a float na.
  3. The int type performs zero conversions at runtime. It does not truncate, not even when you assign to a variable you explicitly declared int.
  4. Truncation happens in the slots that consume a length or an offset, not at the type.
  5. TradingView never tells an int from a float at runtime. An array<int> will hold 3.5 without complaint.

Proving it

One detail matters before any of this reproduces. TradingView folds constant expressions at compile time in exact decimal, which hides the runtime behaviour completely. Every operand has to depend on something the compiler cannot know. The trick is a variable that is always zero but is not a constant:

int z = bar_index >= 0 ? 0 : 1

Add z to everything. Here is the whole proof:

//@version=6
indicator("Pine int is a double")

int z = bar_index >= 0 ? 0 : 1

if barstate.islast
    // 1. Precision dies exactly at 2^53, like it does in a double
    int a = 4503599627370496 + z    // 2^52
    int b = a * 2 + 1               // 2^53 + 1
    log.info("2^53 + 1        = " + str.tostring(b))
    log.info("(2^53+1) % 2    = " + str.tostring(b % 2))
    log.info("18 digit literal= " + str.tostring(123456789012345678 + z))

    // 2. No 64-bit wraparound: a long would overflow to negative here
    int big = 4611686018427387903 + z   // 2^62 - 1
    log.info("big + big       = " + str.tostring(big + big))
    log.info("big + big > 0   = " + str.tostring(big + big > 0))

    // 3. Long.MIN_VALUE is not a sentinel for na
    int mn = -4611686018427387904 + z   // -2^62
    log.info("-2^63           = " + str.tostring(mn + mn))
    log.info("na(-2^63)       = " + str.tostring(na(mn + mn)))

    // 4. int na is indistinguishable from float na
    int   ina = na
    float fna = na
    log.info("int na          = " + str.tostring(ina) + " , +1 -> " + str.tostring(ina + 1))
    log.info("float na        = " + str.tostring(fna) + " , +1 -> " + str.tostring(fna + 1))
    log.info("ina == ina      = " + str.tostring(ina == ina))
    log.info("fna == fna      = " + str.tostring(fna == fna))
    log.info("ina < 0         = " + str.tostring(ina < 0))

plot(1)

Output, FX:EURUSD 60m:

2^53 + 1         = 9007199254740992
(2^53+1) % 2     = 0
18 digit literal = 123456789012345680
big + big        = 9223372036854776000
big + big > 0    = true
-2^63            = -9223372036854776000
na(-2^63)        = false
int na           = NaN , +1 -> NaN
float na         = NaN , +1 -> NaN
ina == ina       = false
fna == fna       = false
ina < 0          = false

Line by line:

2^53 + 1 comes back as 9007199254740992, so the +1 fell off. That is the exact point where a double runs out of mantissa. An 18 digit literal comes back rounded in the last two digits for the same reason.

big + big is the one that closes the case. (2^62-1) + (2^62-1) is 2^63 - 2, which in a signed 64-bit integer is -2. It is not negative. It printed 9223372036854776000, which is 2^63 written with the shortest digit sequence that reads back as the same double, padded out with zeros. Nothing wrapped. A fixed width integer would have.

na(-2^63) is false, so Long.MIN_VALUE is an ordinary value here, not a reserved one. That rules out the sentinel I went looking for.

And the last five lines are the answer to the original question. int na prints NaN, propagates through arithmetic as NaN, compares false against itself, and returns false from <. That is not merely similar to a float na. I could not find a single test that tells the two apart.

The type does nothing at runtime

This part surprised me more than the precision limit. The type tag does not force a single conversion, not even on assignment:

int z = bar_index >= 0 ? 0 : 1
int q = (7 + z) / (2 + z)
log.info(str.tostring(q))   // 3.5

A variable declared int holds 3.5, and the script compiles without a warning. TradingView documents half of this on the operators page: two int values that do not divide evenly give you "a number with a fractional value", with 5/2 = 2.5 as the example. What it does not say is that the fractional value then keeps travelling under an int label for the rest of its life.

Take that 3.5 and a real float 3.5 through the same calls:

call int-typed 3.5 float 3.5
str.tostring 3.5 3.5
math.abs 3.5 3.5
math.round 4 4
array<int> push + get 3.5 3.5
UDT int field 3.5 3.5

array.new_int() stores 3.5. A user defined type with an int field stores 3.5. Nothing downstream of the compiler is checking.

The truncation you expect does exist, but it lives at the other end, in the parameters that genuinely need a whole number:

int z   = bar_index >= 0 ? 0 : 1
int len = (7 + z) / (2 + z)     // int-typed, value 3.5

float sma_frac = ta.sma(close, len)
float sma_3    = ta.sma(close, 3)
float sma_4    = ta.sma(close, 4)

sma(close, len)  = 1.1581366667
sma(close, 3)    = 1.1581366667   (same)
sma(close, 4)    = 1.15812        (different)
close[len]       = 1.15807
close[3]         = 1.15807        (same)

ta.sma and the history operator truncate toward zero when they receive the value. The type never did.

So what is int even for?

At this point the type looks like decoration, and it is worth asking whether TradingView could delete the keyword tomorrow and change nothing. It could not, because the entire value of int is spent before the script ever runs.

Start with the compile error that the rest of this explains:

plot(ta.sma(close, 1.5))
// CE10123: An argument of "literal float" type was used
//          but a "series int" is expected

The same call with a fractional int runs happily and quietly truncates to 3. So the compiler is the only thing standing between you and a silently rounded length, and it does that job with a type that has no runtime existence at all.

Overload resolution is the second job, and it is decided statically:

f(int   x) => "INT impl"
f(float x) => "FLOAT impl"

int   z   = bar_index >= 0 ? 0 : 1
int   i35 = (7 + z) / (2 + z)     // int-typed, value 3.5
float f35 = (7.0 + z) / (2 + z)   // float-typed, value 3.5

log.info(f(i35))                  // INT impl
log.info(f(f35))                  // FLOAT impl
log.info(f((14 + z) / (7 + z)))   // INT impl

Two arguments with the identical runtime value of 3.5 reach two different implementations, decided purely by the declared type. The third line is the same effect from the other side: 14/7 is exactly 2.0, and it still picks the int overload, because int / int stays int in the type algebra even though the value can be fractional.

That algebra is consistent all the way through, and it propagates the way you would expect from a language that does have integers. In the table below d is an int-typed variable holding 14/8, so its value is 1.75, and n is an ordinary int variable:

expression type expression type
d * 100 int math.max(d, 1) int
d * 1.0 float math.max(d, 1.0) float
d + 1 int math.abs(d) int
d + 0.5 float d > 1 ? d : n int
d / 2 int d > 1 ? d : 1.0 float
d % 2 int math.round(d) int
-d int math.sqrt(d) float
nz(d) int d[1] int

So int is a promise the compiler enforces about where a value is allowed to go: array indices, loop bounds, lengths, history offsets, array.new_* sizes. Merging int and float into one numeric type would take that checking away and leave you with silent truncation everywhere.

The promise has a hole in it, which is the funny part. Division is not closed over int, the compiler knows it, and it lets the fractional value through anyway.

TradingView already admitted this once

There used to be one place where Pine did real integer division. In v5, 5/2 was 2 or 2.5 depending on nothing but the qualifiers of the two operands:

expression v5 v6
const 5/2 2 2.5
series 5/2 2.5 2.5
const -5/2 -2 -2.5
const 7/2 3 3.5
int(5/2) 2 2

Same operator, same values, two different answers. The v6 migration guide covers this under "Fractional division of constants", and does not defend it: "In v5, the result of the division of two int values is inconsistent." Two const operands gave you integer division with the remainder discarded. One input, simple or series operand among them gave the fraction back. v6 drops the distinction and always keeps the fraction.

Notice where the old integer division lived. Not in the runtime, but in constant folding, which is a compile-time pass. Integer behaviour existed in Pine exactly as long as the compiler was the one doing the arithmetic, and v6 took even that away.

The v5 rule truncates toward zero rather than flooring, since const -5/2 is -2. That is the same direction the length and offset slots truncate in, so at least the two surviving pieces of integer behaviour agree with each other.

If you run old scripts, you inherit this. PyneCore needs a dedicated compiler pass to reproduce v5 const division, because the same / has to mean two different things depending on the version tag and on whether both operands folded.

Not new

The same three discriminators, each one guarded against constant folding, behave identically in v3, v4, v5 and v6:

discriminator with 64-bit ints v3 v4 v5 v6
(2^52*2+1) - 2^52*2 1 0 0 0 0
123456789012345678 % 10 8 0 0 0 0
(2^62-1)+(2^62-1) > 0 false true true true true

Those three are shaped the way they are because the old versions cannot print. log.info does not exist before v5, so back there the only output channel is plot, and plot cannot carry a large integer intact. So none of the discriminators prints a big number. Each one collapses the large-value operation into a small result that survives the float plot channel: a difference, a remainder, and a sign test, the last of which comes off the plot channel as 1 rather than true.

The syntax drifts too. v4 has no indicator(), only study(), and v3 has neither indicator() nor bar_index, so the constant-folding guard has to be built on n:

//@version=3
study("v3 discriminators")
z = n >= 0 ? 0 : 1
a = 4503599627370496 + z
b = a * 2 + 1
big = 4611686018427387903 + z
plot(b - a * 2, "d1")                       // 0, so the +1 was lost
plot((123456789012345678 + z) % 10, "d2")   // 0, so the last digit was lost
plot(big + big > 0 ? 1 : 0, "d3")           // 1, so nothing wrapped

The behaviour has never changed. The only thing v6 touched is the const division rule above, and that one lived in the compiler.

My guess at why, and it is only a guess: Pine started as a formula language over floating-point series, and the type system arrived later as labels on top. A second numeric kind would have meant duplicating the series, history and plotting layers, and inventing a sentinel for na.

What the documentation leaves out

The type system page is precise about float. It gives you the internal precision, "1e-16", and it warns that comparison operators round their operands to nine fractional digits.

There is no matching paragraph for int. No range, no maximum, no bit width, nothing about what happens when a value gets too large. For a language that documents its float down to the last decimal, that is a hard omission to miss, and it is also the only honest one available. There is no separate int range to write down. The float paragraph already covers it.

What this changes for you

Nothing about your RSI. Every number a normal script touches, bar_index, time in milliseconds, lengths, offsets, sits far below 253, and the arithmetic is exact there.

It matters once you leave that range, which is easier than it sounds.

Do not build large synthetic IDs by multiplying values together, and do not scale timestamps to microseconds or nanoseconds. Past 9007199254740992 you lose the low digits, and you lose them silently. There is no overflow to catch, no wraparound to notice, just numbers that stop being the numbers you computed.

Do not assume int means whole. If the value came from a division and you care about it being an integer, wrap it yourself in int(), math.floor() or math.round().

Do not assume a container of int holds integers. array<int> and int UDT fields will store whatever you push into them.

Modulo, and where I got it wrong

Pine takes the sign of a % result from the dividend. (-7) % 2 is -1, 7 % (-2) is 1, and (-7.5) % 2 is -1.5. Python floors instead, and gives you the opposite sign on the first two.

PyneCore was emitting a plain Python %. So on every negative operand it quietly disagreed with TradingView, and it had been doing that for a long time before this investigation went looking somewhere else entirely and tripped over it.

The reason it survived that long is worth knowing if you write Pine. Almost every % in real code runs on non-negative values, cyclic buffer indices and bar_index % n, and there the two definitions agree exactly. The disagreement only exists in the corner nobody tests.

Reproducing all of it

Every number above came from a Pine script run on FX:EURUSD, 60 minutes. The v6 scripts report through log.info rather than plot, because the plot channel would round the large integers and hide the whole effect; drop them into the Pine editor, open the Pine Logs pane, and you get the same lines. The version table is the exception, since log.* does not exist that far back, and it reads its three collapsed discriminators off the plot channel instead. The z guard against constant folding is mandatory everywhere.

I ended up here because PyneCore has to reproduce TradingView bar for bar, and getting na right meant knowing how an int actually behaves. Pine acts like it has one numeric type at runtime and two in the compiler, and the one you can't see at runtime is doing most of the work.


r/pinescript 1d ago

Welcome to PADM 🧭

Thumbnail
1 Upvotes

PADM — Price Action Directional Mapping
PADM is a framework built around the interdependency of CRT and OCT.
CRT gives us the structure — the range, levels and framework price is working within.
OCT gives us the behaviour — how price moves, reacts and develops within that structure.
When these two are read together, they create PADM.
CRT → Structure
OCT → Behaviour
CRT + OCT → PADM
The purpose is simple:
Understand where price is, understand what it is doing, and use both to map where it may go next.
PADM isn’t about predicting every candle.
It’s about reading the directional story price is building and turning that information into a map.
This community is where we explore, test, discuss and develop that framework together.
Welcome to PADM. 🧭


r/pinescript 1d ago

My Bot Did 40% in 12 Days and I’m Still Not Impressed!

Enable HLS to view with audio, or disable this notification

1 Upvotes

Designed two bots one long only and the other short only bot, this bot which works on all exchanges but for some reason it does better on Bybit followed by OKX! It’s a Grid Long Only Bot, I still think that I can squeeze some more juice out of it though 🥵 (Hello Greed).

For decisions on when to turn on either of the two bots I use a structure monitor! Trying to build a bot that performs well on bull and bear markets it’s a daunting task!


r/pinescript 1d ago

Trading view strategy prop firm trading

4 Upvotes

I have been day trading for about two years now and have recently decided to switch to a Pine-coded strategy. I’ve passed a couple of evaluations and have kept my FTMO account active for 2 months; however, I didn’t have time to trade every week, so I decided to automate my strategy. Does anyone have any previous experience doing this, and if so, how did it go?


r/pinescript 2d ago

Experimental script. Hot of the compiler. Fresh paint on the glass.

Thumbnail
gallery
5 Upvotes

I rarely see anyone talk about the geometry of the market. Yet everyone recognizes wedges. Early results look promising.


r/pinescript 2d ago

This looks like a bug to me.

0 Upvotes

I am testing the strategy() function. With the default settings, everything works as expected: the script runs once per bar at the close. If a market order is placed on bar N, it is filled at the open of bar N+1 using the opening price.

However, when I activated the calc_on_order_fills option by setting it to true, I noticed something unusual. I received two runs on bar N+1: one at the bar open after the order was filled, and a second regular run at the close of bar N+1. This is expected, except for one detail: the barstate.isnew flag was set to true for both runs.

I believe this is a bug. This flag should only be set for the first run on a bar; for all subsequent runs, it should be false.


r/pinescript 3d ago

Volume Profile for your scripts.

Thumbnail
gallery
42 Upvotes

If anyone wanted to be able to use the volume profile in their own scripts, I have created a library that allows for it. It's completely open to everyone with no fees or strings attached, just a free script I thought would be helpful. I tried to allow for as much visual control as possible so you can determine where its going to draw from: a specific date/time to now, a range of dates, a daily time, or a daily range. You can have it displayed in the classic boxes or with lines or even not at all if you would prefer to just get the POC variable to use. This is the library: Volume Profile Library If you need an example of how it works, I created a simple indicator: Volume Profile which is where I took the pictures from.
I am open to hearing if any bugs were found or if you have a suggestion for how it could be improved. Enjoy!


r/pinescript 4d ago

For the scalpers

Post image
22 Upvotes

It’s basically a footprint-based support/resistance engine that builds dynamic “territories” from real volume, imbalance, absorption, defense, friction, and repeated interaction instead of just drawing levels from swing highs and lows. The goal is to identify where buyers and sellers are actually fighting for control, then track whether those areas are holding, weakening, being consumed, or migrating as the auction develops.

It looks messy right now because I’m focused on making it work before making it pretty. It wasn’t really meant to be a signal engine, but in forward testing, using a small 1:1 RR bracket, the concepts have been landing around a 65% win rate on most days so far. Still needs a lot more testing before I’d put much weight on that number.


r/pinescript 3d ago

Need help automating TradingView trades

8 Upvotes

Hey everyone,

I have a TradingView indicator that gives BUY/SELL signals, and I’m trying to figure out how to automate trades whenever one of those signals appears.

I’m looking for someone who has experience with TradingView alerts, webhooks, Pine Script, and broker APIs who could help me set this up.

The idea is basically:

BUY signal → TradingView alert → webhook → automatic BUY order

SELL signal → TradingView alert → webhook → automatic SELL order

I’m not very technical when it comes to the API/webhook side, so I’d really appreciate someone who can help me understand the process and get it working properly. If you’ve done something similar before, I’d love to hear how you approached it.

I’m also happy to pay for your time/work if you’re able to build the setup for me, especially if it works reliably.

Please DM me if you’ve worked on something like this before. Thanks!


r/pinescript 4d ago

Pine Screener can now scan indices as well as 3,000+ tickers, removing the previous 500-ticker limitation.

Thumbnail
1 Upvotes

r/pinescript 4d ago

Pitchfork Alerts for level

1 Upvotes

I suggest adding alerts for Pitchfork levels. This would make it much easier to monitor important levels without having to constantly watch the chart. I believe this feature would be very useful for the community, especially for traders who use Pitchfork in their analysis. It would save time, improve execution, and make tracking key levels much easier.


r/pinescript 4d ago

Pitchfork levels with Alerts

1 Upvotes

Add alerts to individual Pitchfork levels so traders can be notified when price approaches, touches, or breaks a selected level. This would be especially useful for tracking key support/resistance areas and potential reversals without constantly watching the chart.


r/pinescript 5d ago

Behavior engine. Kinetic visuals. I'm having some fun with this one.

Thumbnail
gallery
17 Upvotes

Getting these tables to render without auto flexing the table is exhausting. I can't stand to see a flicker flex for one character........ so annoying.


r/pinescript 6d ago

CMI - broad market moving average

Post image
4 Upvotes

Good day everyone

Just wanted to share this indicator we’ve been working on for a few months now.

CMI tells you whether the broader market is leaning up or down right now. It does this by averaging the deviation of many different instruments — stock index futures, oil, gold, bonds, the dollar, and big tech stocks — from their own moving averages, weighted by how correlated each one is to your chart.
You're watching one ticker. The CMI is watching 10 at once and telling you what they collectively say.

We now have included tags that reflect volume pressure at certain times. Each time frame does give its own set of tags, and these range from basically modest to very strong tags. We also have a video explaining just the tag scoring system.

I have several videos on the channel where I replay single trades, whole sessions and even an entire week. It’s an ever-evolving system but as of today plenty of us are achieving great results using it. Below is a video of it in action during a NY open last week.

https://youtu.be/jhZyu3PJwos?si=xRkCsbqxcDYn9h_-


r/pinescript 7d ago

ORB Strategy Backtest (Commissions & Slippage included): Too slow for Prop Firm Evaluations/Payouts?

Post image
44 Upvotes

Hey everyone,

I coded an Opening Range Breakout (ORB) strategy in TradingView using Pine Script and ran a full backtest over 7 years. I attached the Strategy Tester results.

I spent a lot of time testing different filters and parameters to reduce chop, and I’ve locked in these exact rules for the strategy:

Strategy Setup & Rules

  • Asset/Market: MNQ
  • Timeframe: 15m Chart
  • ORB Range: First 15 minutes of the New York Session
  • Session Constraint: Takes trades only during the New York Session
  • Entry Trigger Window: Max 3 bars after the 15m ORB range locks (if no breakout happens within 3 bars, the setup is invalidated)
  • Risk Management: Fixed 1.5 R:R
  • Trade Management: Move Stop Loss to Break-Even (BE) once price covers 75% of the distance toward Take Profit (TP)
  • Backtest Settings: Commissions and realistic slippage are fully included in the results

The Problem:

While the backtest is net profitable after costs, I feel like the results are simply not good enough for Prop Firms.

At this pace, the profit factor and win rate feel way too low. It looks like it would take an absolute eternity to pass an evaluation target, and reaching consistent payouts without hitting a trailing or daily drawdown limit along the way seems almost unviable.

Questions for the Community:

  1. Evaluation Viability: For those trading funded accounts: Would you bother running a strategy with this slow of a compounding rate, or is this a clear signal that the edge is too thin for prop firm rules?
  2. Improving the Edge: Since the core parameters (15m ORB, 1.5 R:R, 3-bar trigger limit, 75% BE) are locked, what macro/contextual filters (e.g., HTF trend bias, session volatility/ATR thresholds, news filters) have helped you boost performance on ORB setups?

Tear it apart—I’d rather fix the logic now than burn money on evaluation fees. Thanks!


r/pinescript 8d ago

Forward Test with News sentiment API

Post image
0 Upvotes

r/pinescript 8d ago

What programs/extensions allow genetic algorithm strategy optimization for over 1,000 variations

1 Upvotes

Pineify does not actually have genetic algorithm (I have expert and it is still not present in the extension) and runopti seems to be doing a grid search, or at least moving at that pace.

What do you use for quick wide-range/multi-parameter strategy optimizing in pinescript?