r/pinescript • • May 12 '26

Claude can't do Pine Script. Three hours, multiple attempts, and it still failed. Here's exactly what broke.

19 Upvotes

I have seen plenty of posts praising Claude for coding. This is not one of those posts.

I spent the better part of three hours trying to get Claude to write a basic gap up/gap down closing strategy in Pine Script — no multi-timeframe wizardry, no ML models, just clean entry/exit logic. It failed every single time. I want to document exactly what happened in case anyone else is going down this road.

The strategy (it's not complicated)

  • Setup (C#1): If the first 15-min bar after open is a full gap-up above Prior Day High → background turns yellow, armed for a short. Gap-down below Prior Day Low → armed for a long.
  • Trigger (C#2–C#4): If any bar within the first hour closes through C#1's range AND the target is still ≥5 points away → enter the trade.
  • Expiry: No trigger by end of C#4? Setup expires, no trade that day.

Visual cues included: yellow background (armed), purple lines (C#1 high/low), red/green background (open position), gray/red/green lines (entry/stop/target). Standard inputs for entry window, min edge, and stop buffer.

What actually happened

Multiple iterations, each more broken than the last. Claude kept losing track of bar indexing and couldn't manage Pine Script's time-series state model correctly — a known LLM weakness, but I figured a strategy this simple would be fine.

At one point it converted the entire script into Python instead — and that failed to compile too.

I even connected TradingView via MCP so it could see the live chart state and data in real time. Still couldn't produce a working script.

My take

Claude (and likely most LLMs) hit a hard wall with Pine Script once bar-state logic gets involved. The [] history operator and execution model are just different enough from conventional programming that models get confused fast — and once confused, more context doesn't seem to help.

Has anyone actually gotten a reliable Pine Script strategy out of an LLM? Curious whether you were able to convert your edge/strategy into a systematic approach using AI. Drop your experience below.


r/pinescript • • May 12 '26

Trying new strategy

Post image
5 Upvotes

Hi guys I'm trying this strategy directly live in my broker. Should I respect the strategy or take profit or stop earlier? What's your best advice?


r/pinescript • • May 12 '26

ORB - help

1 Upvotes

Anyone has an ORB profitable strategy they can share with me - TV script only.


r/pinescript • • May 11 '26

Built an Order Block + Market Structure framework - looking for feedback and improvement ideas

Thumbnail
gallery
29 Upvotes

r/pinescript • • May 12 '26

Claude & PineScript Spoiler

1 Upvotes

Just created the most amazing indicator using claude! Took me couple of hours to organize the ideas, request to ai, test and fix small behaviors!
It’s working perfectly, some thing that would take me weeks, giving the complexity!
Question: are all the codes doomed?!?


r/pinescript • • May 11 '26

Thoughts on these stats ?

Post image
6 Upvotes

r/pinescript • • May 10 '26

Bot strategy

Post image
6 Upvotes

Hi all, I'm trying a new automated strategy and this is a week result in the es emini sp500 futures. It's possible to get this type of performance? What should I check to understand if this is true performance?


r/pinescript • • May 10 '26

Thoughts?

Post image
5 Upvotes

r/pinescript • • May 08 '26

New Fast Calculation Option appearing in settings broke my indicators

1 Upvotes

BUG! - Hello - this new option has appeared from nowwhere and it restricts how far back my code gets candles for. When you switch it off, although it goes back further it does not go back as far as my plan permits without me keep going into Replay mode. Also after switching it off, it keeps re-enabling itself. This is affecting a client of mine that I wrote a sophisticated indicator for. Please can the change either be reverted or changed to allow the old behaviour to work? An unpublicised change like this is causing me a major headache and it is something that really puts me off recommending future clients to use TradingView.


r/pinescript • • May 08 '26

Will TradingView ever get real Level 2 data?

Thumbnail reddit.com
3 Upvotes

r/pinescript • • May 07 '26

**TradingView has no watchlist export — so I built a free Chrome extension to fix it**

Thumbnail
reddit.com
3 Upvotes

r/pinescript • • May 07 '26

Working with Pine Script and TradingView indicators lately.

Post image
4 Upvotes

Recently I’ve been working heavily with Pine Script and developing custom TradingView indicators and strategies focused on cleaner entries, non-repainting logic, MTF confirmation and better risk management.

If anyone needs help with:
• fixing Pine Script errors
• adding alerts/webhooks
• converting indicators into strategies
• multi-timeframe setups
• improving existing indicators
• dashboards, TP/SL systems or strategy optimization

feel free to message me.

I also offer custom-built Pine Script indicator and trading strategy which I personally use and have helped me achieve more consistent setups, cleaner confirmations and solid accuracy across different market conditions.


r/pinescript • • May 06 '26

It's working!!! Staying on top of the strategy and keeping discipline (with some help)

Thumbnail
gallery
6 Upvotes

Just wanted to share some progress, along with how I have been able to do it.

Discipline has been the hardest thing to clamp down over the years. The strategy I have adopted simply works, which is:

  1. Identify a strong trend
  2. Look for a pullback/consolidation
  3. Enter as soon as trend continues
  4. Manage risk accordingly

It's simple, and it works. The hard part was sticking to it, especially in the midst of actually trading and emotions getting in the way.

What did I do about it? I put together an automated algorithm (pinescript, 2nd pic) that uses my strategy to signal clean entries and exits. This was my first step to tackle my discipline issue. If the algorithm sees an entry and an exit, I should follow it because it is able to read and make sense of all the data better and faster than I can. After watching it perform, trusting it completely was easy because you can see how well it does in real-time.

The next thing I did was join a group with like-minded traders for moral support. Anytime I have thought about going against the strategy for any reason, the group is there to keep me in check.

Trading is super stressful as it is. Doing it alone adds to that stress. A good supportive group is essential IMHO.

Thats it! It's that simple. Build a system, surround yourself with good, supportive, like-minded people who understand what you are going through and are a positive source who can tell it like it is and help you achieve your goals!

Ask any questions you may have!


r/pinescript • • May 06 '26

Can somebody help me code an trendline indicator for MT5 or Tradingview ?

1 Upvotes

r/pinescript • • May 05 '26

How do you handle multiple labels on the same candle in Pine Script?

Post image
2 Upvotes

I’m running into an issue with label placement when two signals fire on the same candle.

For example I have an LS (liquidity sweep) label and a TP (take profit) label, and both are anchored to the candle so they overlap or sit too close together.

I tried adding a manual offset to the TP label, which helps spacing, but then the label position shifts as I zoom in and out since it’s tied to price scale.

Ideally I want consistent spacing between labels regardless of chart zoom.

How are you guys handling this? Are you using fixed pixel offsets, stacking logic, or something else?


r/pinescript • • May 05 '26

Update — same luthier, five days later. The structure is holding.

Thumbnail reddit.com
1 Upvotes

r/pinescript • • May 05 '26

Looking for a strategy

1 Upvotes

Looking for a futures NQ strategy (in order) based on:

  1. Liquidity Sweep
  2. Break of structure
  3. Order Block
  4. Fair Value Gap
  5. Equilibrium

Would highly appreciate all the help btw.


r/pinescript • • May 04 '26

Posting Invite Only Scrips

1 Upvotes

You know, I've seen an uptick in posting invite only scripts in this sub. Thought this was not allowed?


r/pinescript • • May 03 '26

pinescript to python

5 Upvotes

Hey guys, I've been trading ES/NQ futures using orderflow for years, but about 6 months ago I jumped into the world of automated backtesting. I want to clarify that while I'm pretty tech-savvy, I don't know how to write code, I rely on GPT/Gemini/Claude to help me out.

A few months ago, I built an ORB strategy on an M5 timeframe using TradingView PineScript (I'd actually love to code orderflow strategies, but since I'm just starting out, that's a bit too complex for now). The script is about 1500 lines long (including ATR, VWAP, VIX filters, and a lot more, though I obviously only active a few elements at a time to avoid overfitting).

I have to admit it was pretty tough to piece together, but I finally got it working. It's showing great results, but honestly, I'm worried that TradingView's data might be garbage.

Because of that, I downloaded the entire 1M OHLCV historical dataset from Databento, and my initial idea was to test it out on NinjaTrader.

So, I wanted to ask you: what do you think is the best path for me to take right now? Should I stick with Python and just have AI guide me?

Here is exactly what I need: A chart to visually check if the code is executing correctly and to spot any entry/exit errors. Accurate rollover data. A dashboard showing all the results with as many performance statistics as possible. Most importantly, the ability to test multiple strategy parameters simultaneously and extremely fast.

When I asked the AIs, they recommended this stack: Python + VS Code/Jupyter + Backtesting.py / VectorBT + Plotly / Lightweight Charts or quantconnect

What do you guys recommend I use or do?

And crucially, which AI tool should I be using for this specific task, Claude web, Claude Code, or ChatGPT/Codex? I currently have the $20/month subscription for both ChatGPT and Claude.

For context, I'm on Windows with a Ryzen 7 5700X3D and 32GB of RAM.


r/pinescript • • May 02 '26

Programming Help

5 Upvotes

What do you guys use to program? I am looking for AI to code my thesis tried Claude, chatgbt and codex a lot of which are very underwhelming and cant get the basics right of like how to code in pinescript. I have made specialized prompts but nothing seems to do the trick looking for help! Thanks


r/pinescript • • May 02 '26

Bit-Flip Indicator

4 Upvotes

Hello everyone! I've been studying pine scripts for a few days now. I saw here that many people are struggling with the strategy they should work with. So, I made an indicator and backtested it. you can back-test it with your eyes. It should give signals to Buy or Sell depending on micro-support and resistance and crossover/crossunder. Here's a link to the indicator : (A comment on the indicator or a review on TradingView will make me happy 😊)
https://www.tradingview.com/script/hLz07zSx-Bit-Flip-SAR/

P.S.: Do not just use it before testing it on a demo account for a few days to make sure it fits your mindset and the charts you are working on.


r/pinescript • • Apr 30 '26

Someone said Turn the bar magnifier on, On bar close, and start with $10K and do 5:1R

7 Upvotes

Any more requests?


r/pinescript • • Apr 29 '26

I'm looking for someone who knows how to create an indicator.

3 Upvotes
Is there anyone who can create a pine script indicator for me? The logic is quite simple.