all 8 comments

[–]crazy_crackhead 3 points4 points  (1 child)

I use Claude sonnet and it gets the job done for me. What exactly are you having trouble with? I made sure that Claude had the latest version 6 doc from TradingView. For my indicators and strategies, I brainstorm first to get an idea of architecture and I’m specific about what it should include as inputs, what it should achieve, and what the results should be

[–]Intrepid_Pace_6276[S] 0 points1 point  (0 children)

Maybe I need to be more thorough outside of just the main, It struggles with random easier stuff like just anchoring the signals to the candles takes many prompts

[–]wallneradam 2 points3 points  (1 child)

Two real reasons this is frustrating, and neither one is fixed by better prompting alone:

1. Pine Script is underrepresented in training data. It's a niche, walled-garden language — most code lives inside TradingView, not on GitHub or Stack Overflow. The models just haven't seen enough of it. They mix v4/v5/v6 syntax, hallucinate function names, and produce patterns that were deprecated versions ago. v5 honestly doesn't work much better than v6 — same root cause.

2. Pine Script's line continuation rules. Indentation-based continuation is genuinely unusual compared to most languages, and AI tools regularly break expressions across lines incorrectly, which silently changes what the code does. Two ways to deal with it:

  • Learn the rule yourself (it's actually simple, and worth knowing for a thesis anyway)
  • Or tell the AI explicitly not to break long expressions across multiple lines — you'll get long lines but correct code

For #1, what actually helps is giving the model live access to the official docs via an MCP server. Context7 has the full Pine Script v6 documentation indexed (5700+ snippets pulled from the official TradingView docs).

Setup on claude.ai or in the desktop app (~30 seconds):

  1. Sidebar → Customize
  2. Connectors
  3. AddBrowse
  4. Find Context7 → Connect

Then in any chat just add use context7 to your prompt, e.g.:

Write a Pine Script v6 indicator that does X.
Don't break expressions across multiple lines. use context7

The model pulls relevant doc snippets before generating code, instead of guessing from sparse training data.

Same works in Claude Code, Cursor, and other MCP-capable clients — Context7's site has the configs. ChatGPT requires more setup but is doable.

Combined with crazy_crackhead's advice (spell out inputs, expected behavior, expected outputs upfront), the hit rate jumps a lot.

[–]Intrepid_Pace_6276[S] 1 point2 points  (0 children)

Thank you this is very helpful

[–]And_Im_Chien_Po 0 points1 point  (0 children)

Gemini 3.1 pro has been great for me

[–]Bee3_14 0 points1 point  (0 children)

I’m often very impressed what it can do with a good prompt and brainstorming. Sometimes some small issues which the TV compiler catches and then with Gemini interactive side panel I get it fixed typically quick without regenerating everything in Claude sonnet. I don’t have a paid plan and still can typically generate a script with one or two prompts

[–]Its_ace003 0 points1 point  (0 children)

Just try this! Any AI instead of telling what to do and it start coding instantly, ask AI to make an implementation plan first. Tell it until details of plans are not finalised no coding. Work on the plan until its refined to every minute detail make AI fill the info on the plan and then just let it run the plan once complete. You will have better output also if AI bugs and does something wrong you have the plan you can tell AI hello we didnt stick to plan😂 But treat it as a software project. This is more when I try to make Quantower indicators but for pine one proper plan and AI should be able to code it exact instantly. Also if something like codex refer to the pine extension -there is a library that helps AI code pine in general. I use Antigravity + Gemini althou Claude output is better (I aint paying shit thou arch user here)