Use AI to write an MQL5 indicator: a practical code-review checklist

Use AI to write an MQL5 indicator: a practical code-review checklist

Ask for a defined indicator, not a winning system

A useful prompt specifies inputs, formula, buffer meanings, indexing direction, warm-up, empty values and signal timing. “Build the best non-repainting indicator” leaves the crucial definitions to the model and encourages unverifiable claims.

Start with an original, small calculation you can check by hand. Do not upload paid source code or private customer files merely to obtain a generic example.

Give the model an acceptance contract

A concrete brief might read: “Create an MT5 custom indicator that plots the close's position in the last N bars' high–low range. Use one documented data buffer, oldest-first indexing, EMPTY_VALUE before a full window and 50 for a flat window. Recalculate the current bar and rebuild after history resets. Do not place trades or use external services.”

Add the synthetic input arrays and expected outputs from the range-position tutorial. Ask the model to explain which bar each array index represents and why its incremental result matches a full pass.

Review the parts a compiler cannot judge

A compiler can catch syntax and type errors, but it does not prove the formula, timestamp alignment or business meaning. Inspect whether zero is wrongly used for missing data, whether the current bar is counted repeatedly, whether a pivot is used before confirmation, and whether a buffer reader checks the returned count.

Look for repeated handle creation, unbounded object growth and deletion of objects belonging to another chart tool. Check that the code's comments describe what it actually does; a comment saying “closed bar” does not make an index correct.

Use fixtures before market screenshots

Compile in your own MetaEditor and keep the compiler output. Then compare a full calculation with incremental updates on a small fixture. Include a flat window, too little history, a new bar, a changed current bar and a reset. Record observed results rather than calling the code tested because it looks plausible.

If you ask AI to fix a failure, provide the smallest reproducible input and expected result. Change one cause at a time. Re-run the earlier fixtures so a fix for one case does not silently break another.

Keep a reviewable version

Save the source, inputs, formula description and test record together. Label any uncompiled example as uncompiled; label a chart demonstration as a demonstration, not proof of profitable trading. Keep a known baseline before adding colours, alerts or multi-timeframe dependencies.

For editable chart tools, the source catalogue provides a separate learning route. Whatever code you study, a clear specification and reproducible evidence are more useful than a confident AI explanation.

Sources and further reading

Back to top

MQLume Bespoke

Built around your ambition.

Explore bespoke services →

Have something more specific in mind?

Ask us about advanced custom development. Share your requirements through private support or email; we will discuss the scope and quote separately.

100% committed to following up on your delivery and support requests.

Free downloads. Real source files.

FREE

Lizard [MQLume]

MQL5 / MT5Version v2.21

Free editable gold breakout project with six independently selectable cores, session filters and flexible position sizing.

US$149.00FREE
FREE

Scraper Gold [MQLume]

MQL5 / MT5Version v3.7

Free editable source with compiled EX5: four gold breakout engines with independent profiles, sizing, direction and exits.

US$95.00FREE
FREE

EA Black Dragon [MQLume]

MQL5 / MT5Version v13.0

Trend-based entries with optional grid additions, side controls and virtual exits.

US$30.00FREE
FREE

Hamster Scalping [MQLume]

MQL5 / MT5Version v21.0

RSI entries with two ATR filters, configurable sessions and optional grid management.

US$30.00FREE
MQLume

More to explore. A community to share it with.

Stay close to MQLume, wherever you like to learn.

YouTube

See our EAs in action. Explore backtests, walkthroughs and practical guides.

Watch on YouTube

Telegram

Meet other EA users, share ideas and keep up with what’s new.

Join the community Follow official updates

Cart

One personal-use licence per project. Each project can be added once.

Your cart is waiting for its first passenger.

Choose an EA or source edition to get started.

Continue shopping