Skip to content
Dave Mabe
Close menu

Make Your Amibroker Code Pretty - Automatically

By Dave Mabe

If you're an Amibroker user, you might be tempted to use an external editor other than the built-in AFL Formula Editor for editing AFL files.

I've tried using Vim (my favorite text editor by far) to edit AFL files over the years.

And I always find myself returning to the built-in editor in Amibroker.

Why?

Because it's so carefully thought through, and the workflow is seamless.

Here's yet another example of that.

In the AFL editor on the Edit menu, there's an unassuming item called Prettify Selection.

When selected, it will automatically format all your code to the AFL standard style:

All your extra spaces, parentheses scattered about, etc, are standardized across the entire file in one fell swoop.

Standardization like this is important. More important than you might think.

When you see something in code that technically works, but stands out as non-standard (extra spaces, say), there's a background thread in your brain that notices it and obsesses about it.

Having these non-standard annoyances automatically handled (the technical term is "linting your code") will streamline your routine and eliminate the background threads.

-Dave

P.S. The code in the screenshot is the Amibroker template I use for each strategy I create. This is included with the Amibroker Course I'm working on, which will be released publicly soon. Add yourself to the waiting list to be notified the moment it's released.