Skip to content

How to Build an Indicator

What this Workflow Does

The Build a Technical Indicator workflow guides you through creating a custom trading indicator from scratch.

It is designed to help you:

  • Define indicator inputs and parameters
  • Implement calculation logic correctly
  • Produce visual outputs on a chart
  • Follow platform best practices for indicators

This workflow focuses on clarity, structure, and correctness, not speed.


When to Use This Workflow

Use this workflow when:

  • You want to create a new indicator
  • You have a clear calculation or idea to implement
  • You need clean, maintainable indicator code
  • You want a safe baseline before adding complexity

Do not use this workflow to automate trades.
For execution logic, use Build a Trading Robot instead.


What You Should Prepare

Before starting, make sure you have:

  1. A clear description of what the indicator measures
  2. Any formulas or logic involved
  3. Required inputs, periods, or thresholds
  4. How the indicator should be displayed:
  5. Lines
  6. Histograms
  7. Markers or shapes

Start with the minimum viable version of the indicator.


How to Interact with CodePilot

Describe the indicator in functional terms, not platform specific syntax.

Good examples:

  • “Create an indicator that calculates a moving average.”
  • “Plot two lines and highlight crossovers.”
  • “Add configurable input periods.”
  • “Update values once per bar.”

Avoid vague requests such as: - “Make a complex indicator.” - “Copy an existing one.” - “Add everything at once.”

Specific logic produces correct output.


How CodePilot Builds Indicators

CodePilot will:

  • Generate a clean baseline indicator structure
  • Separate inputs, calculations, and visuals
  • Follow correct indicator lifecycle rules
  • Add parameters for configuration
  • Return a complete, compile-ready file

CodePilot assumes the first version is a baseline and expects you to test it before extending.


Common Mistakes to Avoid

  • Requesting too many features in the first build
  • Skipping compilation and testing
  • Mixing indicator logic with trade execution
  • Modifying code manually without informing CodePilot

Build, test, then extend.


After building the indicator:

  • Compile and test it thoroughly
  • Confirm values match expectations
  • Extend visuals or add alerts incrementally

You may also want to explore: