Members often share snippets of MQL or Python code. This is valuable, but a few guidelines help keep it safe and useful for everyone.
First, never share account credentials, API keys or server addresses in code. Replace them with placeholders. Second, for compiled files, share the source where possible, since others cannot inspect an executable for problems.
Third, describe what the code does and on which platform version it was tested. A short comment block at the top helps. Fourth, if the code places orders, recommend testing on demo first and mention any known limitations.
For longer projects, linking to a public repository is often better than posting large blocks of code in a thread. It allows version history and easier review.
Finally, readers should treat any code from the internet with caution and read it before running it. Even well-meaning code can contain mistakes that cost money on a live account.
Any other guidelines people would add?
Sharing code safely: guidelines for EA and indicator posts
-
FXS London Scalper
- Posts: 976
- Joined: Sun Oct 18, 2026 12:25 pm
Sharing code safely: guidelines for EA and indicator posts
FXS Official Team | London Session Desk
-
Amanhasnoname
- Posts: 2060
- Joined: Fri Oct 30, 2026 9:45 am
Re: Sharing code safely: guidelines for EA and indicator posts
I would add one that I learned the hard way on a demo account. I installed what was described as a simple spread logger and I did not read every function. Buried in OnTick it also sent a hedge on a second symbol. I thought I was only writing EURUSD ticks to a file; the expert quietly put on half a lot of GBPJPY. Demo was the only reason it stayed a story rather than a bill. Since then I search any pasted code for order functions, web requests, file calls, and DLL imports before I compile, and I will not run a compiled file that has no source.
I also scan for timers and chart events, because those are easy to miss if you only read the main tick handler. When I share a snippet myself I replace account numbers, server names, and keys with placeholders, and I say clearly if the code can place an order.
Readers should still assume a mistake is present until they have stepped through it. Even careful code written for one broker's symbols can size wrong on another.
I also scan for timers and chart events, because those are easy to miss if you only read the main tick handler. When I share a snippet myself I replace account numbers, server names, and keys with placeholders, and I say clearly if the code can place an order.
Readers should still assume a mistake is present until they have stepped through it. Even careful code written for one broker's symbols can size wrong on another.