3 Best Practices for Coding with Artificial Intelligence Tools

I’ve coded and strategies and indicators with artificial intelligence that are incredible, costwise, some of these would’ve been approaching $50,000 - $100,000. And I say that because coding requires a lot of brain power that is focused on one thing, and the people I’ve worked with to code my software in the past, I paid them whatever they want because I understood how important their work is and I could appreciate it because I’ve tried it and it was just not my thing. I had no interest to sit there and write code. So if someone has some facility in it, I have literally no choice. And the back-and-forth ensuring that logic works testing, etc, all of that was time and cost..

But now this programatic intelligence is available to all of us. You simply have to think clearly about what you want, the intended behavior that you expect and communicate and objective to the artificial intelligence tool.

But here are some best practices that you can use to ensure that your code actually works as intended.

  1. Understand exactly what it is that you want. I.e. the behavior, what should happen, the sequence of conditions necessary for order entry. This takes time particularly screen time to know what you’re looking for, what behaviors, what condition should be true before you attempt an entry. Screen Time is simply sitting there and watching the markets and making observations, writing things down, etc. etc.

  2. Before you actually begin the simple process of asking, Claude, or anyone of the other artificial intelligence tools to code a strategy indicator or behavior for you, first of all engage in context building. Context building is whereby you communicate with the artificial intelligence about the nature of what you’re looking for, your objective, certain questions and concerns you might have about this or that regarding the behavior or conditions that you have in mind. With this process it could consist of a five minute conversation or a conversation that spans a week or more.. As you engage with the AI more, it learns. All of this i.e. context building, imbues the session with inference and information and contextual clues to ensure that your software is produced to behave correctly.

  3. The next step and perhaps one of the most important steps that I like to perform is asking the artificial intelligence to engage in user testing. So after the indicator strategy has been built. You probably have some parameters that requires you to enter some values or enable it or etc. So you want to ask the artificial intelligence to input random values and for it to run through that and for it to describe to you what is happening so that you can see if the behavior that the code creates is what you have in your mind as to what should happen. This is where you can learn if there’s a difference between the behavior of the code that you asked for, and what you have in your mind. And from here you can see how simple it is to simply close that gap. This whole process firstly imbues your AI with context to know what you want, and the process of having it perform a test and run it, saves your time so you don’t waste your time on testing you shouldn’t be doing if the code wasn’t working in the first place. Have it perform user testing as though it was the human activating and running this code, gives it additional clues to ensure and fix any errors.

The other things you could do as auxiliary is to ask it to perform performance optimizations and improvement while still ensuring that everything works. Its all relatively straightforward sometimes.

Good luck out there.

3 Likes

Some really good advice there Maverick. The points you mention about understanding what you want and context building really are critical. I’m curious what kind of tooling do you use? I currently have the standard paid grok and use it (via the basic web interface) a ton. It’s been hugely helpful in accelerating my pace of work. I’ve been considering upgrading to an API/token style subscription and starting to use the more integrated solutions (like cursor, opencode, etc.).

Hi Mark,

I’ve worked with GroK, Gemini, ChatGPT and they’re all pretty impressive.

Claude is currently my go to.. And I say that because I can describe fluid dynamics, basically how liquid moves through a container, and then through context building with Claude, we extrapolate it to Delta and using price as that container, and based on my creative construction, it writes the code that emulates liquid dynamics, using delta.

I’m of the mind that you really don’t need to go the API route and all of that because that’s just extra scaffolding, I use claude both the web interface and the application on my computer, and it’s incredible man.

That’s just an example, but you can see what this unlocks. If I were to have explained this to a software developer, they might have done it, but you can also imagine the incredible cost, the time going back-and-forth as they check what I want in relation to what their code is doing, etc. However with claude, if I am clear on my objective, what I want to happen, and the intended outcome, it one shots it. The gap from what I was able to do in 2022 with software developers and what I’m able to do in 2026, is, not to exaggerate, akin to having access to alien technology.

Tools that might’ve taking 6 week minimum, are built and running in 10 minutes. I’ve achieved a frightening step function and everyone access to it. The key thing is the individual being clear on what’s wanted.

The difficulty today is clarity. Being clear on what you want and that takes screentime in order to under the confluence of behaviors in the market that one wants to isolate and combine.

1 Like

You forgot something: “Make No Mistakes” :joy:

1 Like

its going to make mistakes, just as in any project management engagement. But the feedback loop is instantaneous as opposed to weeks or months with the alternative

[IMAGE DELETED]


This is an orderflow indicator with 8 different modes. I have 2 versions, and one does not require tick replay, the other does because I use it with special bar types.

The sky is the limit guys.

1 Like

Great thread guys! I’ve been using ChatGPT since 2023 while working on large globs of data to make sense of. From there, I found that you do need to know what you’re looking for. As a developer, the back and forth rule of thumb I’ve learned was no more than an hour. An instructor once told me, “Rick, if it’s past this one hour, then you don’t know what you’re looking for.” So, since then, I took a coding bootcamp. It has paid off tremendously! Now, I’m able to see the seven basics of programming for any programming language.
There’s some cool snapshots I see on this thread. Coding assistance has come so far; easy output from great ideas in seconds.
Regarding API’s, I would suggest using Proxmox to setup your own open source LLM like Ollama which is the base platform that will let you load any open sourced LLM for the hardware you have. This way, it wouldn’t keep costs down to a minimum. Then once you’ve got something developed sixty-five percent of the way, you can try it out on the commercial front for latest strides.
Peace,
Rick

Ever thought about building your own DOM that is STATIC, with a ton of features. Do it now. You can.

[IMAGE DELETED]

This is an Add-on build!

The design and visual interface was via Claude, the performance and optimization techniques is based on the best practices of CSharp and NinjaScript.

In building this, you learn as well, because any questions you have, you can just ask and have it break it down to you as simple as you want it.

Here’s a DOM i built and I’m not a coder, but I understand what I want. And, with that clarity I built an enterprise grade DOM with unique features.

Timeframe: less than a day, normally this would’be taken 2 years at a cost of $200,000

Take this as inspiration.

1 Like

Are you serious? That took one day to build? That is absolutely incredible and impressive. Major kudos to you. Is this an add-on (its own separate window), indicator or strategy?

Ever thought about building your own DOM that is STATIC

Yes, I have been building my own highly configurable static DOM and it has taken a few months of working on it off and on (more off than on). Mine is an indicator and loads on a chart, and it’s also static unless you scroll it up and down manually or set auto scrolling.

I’m mainly building it myself as I sometimes find it more frustrating to work with AI than to just type my own code. I like to organize/build my code the way I want, rather than having to constantly massage AI generated code to match my coding style (yes, I’ve been accused of being OCD before :joy:). Over time, I’ve built extensive libraries of reusable functions that I utilize in various aspects of my work which cuts down on dev time. I utilize AI for smaller well defined blocks, but build the top level and glue logic myself. AI definitely helps, but I still like to do some work myself, exercise my brain and do things my way.

Anyway, just wanted to say your DOM looks very nice. Excellent work.

3 Likes

I was fed up with dynamic dom that ninja offers, learned a bit about why that was the case with TT technologies old patents, did some context building with claude over an hour and we settled on an Add-on. The flexibility is incredible particularly for simulated conditional orders..

And yes, I was surprised at how quickly i could distill my ideas in to a viable tool. Started it Friday night.

Your tool looks good as well. I really like the MGI detail, I might have to build that in.

I’m not a coder, but I’m more inclined towards poetry, a code poet, so to speak, but its working.

1 Like

I initially wanted to implement my DOM as an add-on, but hit too many issues and it was new territory for me. I can do indicators and strategies with my eyes closed (so to speak), but never did an add-on before. So in the interest of time and getting things done, I switch to indicator as that’s the area I’m most familiar and comfortable with.

Maybe one of these days when I have some free time to kill, I’ll go through the exercise of building an add-on (with help from AI) to gain the experience.

1 Like

You’re a software person so, it’ll probably be more straightforward for you.

In your project instructions, inform the artificial intelligence tool, that it should always go online and research ninjatrader developer documentation and ninjascript best practices anytime it needs information. This allows it to peruse through the old forum at incredible rate, and the NT developer documentation.

The build isn’t a problem. its the new ideas that all of a sudden unlock. I’ve got a state detector in my DOM that does incredible things.

And if you really want to have fun. Go too google patents website, look up TT technologies and build everything they’ve pattented. (You can’t commercialize it or publize it, but those patents make for a good idea spark)

Anyway, I don’t think you’ll have any problem with Add-ons. I told the AI tool to go on online and review what is needed for us to build an add-on.

I’ve come to see NT as a clay that I can mold into whatever.

Take a look at this (I won’t mention what it is but, its something built from an idea, and the design and structure of the visual, is simply me speaking with the AI tool)
![Paste this image to Google Gemini to get an idea of what it’s doing

[IMAGE DELETED]

Basically, and this is what I said in my prior post, you can take domain knowledge from other disciplines, and apply them to trading which is very applicable. If you look at how steam expands within a container, you can extrapolate that to some of the physics in the market environment, define the variables, and by simply speaking it, you create. As a software person, you’re already a logical think and clear logical thinking seems to be a very good way to interact with this artifical intelligence tools.

You can probably tell from my message, but I’m quite excited.

Good luck man.

1 Like

Added some coloring after seeing your post.

1 Like

Actually, I come from a hardware engineering (chip design) background. But most of my career was in corporate IT architecture. Building software was never part of my main job, but in IT you end up writing a lot of scripts to streamline your work and automate tedious tasks. That slowly grew to building bigger and bigger apps over the years, but always as a secondary to my main tasks. But I get what you’re saying. It’s the engineering problem solving mindset.

Like you I realized that NT was very user friendly and programmable (clay that I can mold). So it was a natural fit. Learning C# after having programmed in other languages was very easy and came naturally.

I can totally sense the passion and excitement in you. Just like a kid in a candy store. :joy:

Good for you and more power to you. You’ve motivated me to maybe give the add-on another try after I get freed up from some of my current projects.

1 Like

I think also that the .md file is really useful to keep the AI on track and on song as it were. We all have ways we like things done, best practices, etc. I find now i upload a new memory about once a month as i find something that I want done in a certain way. Don’t think i am at the level of some of you guys but it has been a quantum leap in my own development. Great discussion.

2 Likes

And here is what NOT TO DO!!

Never ever use Co-Pilot, he is the worst AI for coding, he loves to promise you that ‘this is the final code’ but it is the worst coding ever.

I have experiences with Claude and Grok, both are doing really well. But never expect it to be the end result. The trick is not the coding, the trick is how to ask questions…so think before asking, the better you ask, the better it will code for you.

I am a programmer by profession, but the coding AI does, is way better and way cleaner than what I ever produced…

4 Likes

I just had an epiphany, but it’s really an obvious fact, re-presented to me in a way I’ve come to appreciate my understanding of it more.

Trading, the way that we are today on computers, is at its core about our ability to organize information. The people or team that can better organize information, that means that they can see better. And if you can see better and clearer, you can act better, faster, and more accurately.

And these artificial intelligence tools, really just help us to organize information, and then we need to decide how we want to see that information, what we want to see, when we want to see it, and then it’s a good idea to also communicate with these artificial intelligence tools, why we want to see it.

Strangely, communicating the ‘why’ aids to these AI tool, gives it an ability to infer about other things that may be crucially beneficial to our quality of life, as regard the tools that we’re building. It’s really very interesting.

2 Likes

Claude is currently managing 6800 lines of code on the Static DOM Add-on build!

Now, over the time I’ve been working with it, I routinely ask it to analyze the session and learn from it, and then (most importantly), to integrate learned point and best practices into its memory. Over a span time, this has allowed to me build sophisticated tools like Static DOM Add-ons, that work right that first time.

The memory capability in these AI tools is a secret weapon. Use it.

When you ask Claude to Analyze your day, how do you present the information. Do you send a log, PNL every trade?