Using K&R style for AFL code

Is it possible to use Kernighan-Ritchie coding style with Amibroker's AFL Editor?

If yes, please, describe how.

Thanks in advance.

If you mean curly braces examples such as these

if ( ... ) {
else {
for ( i = 0; i < BarCount; i++ ) {

Then yes, you can ....

1 Like

Very nice! Thanks!

Now it's a next logical question: how? I wasn't able to find any configuration options.

If you want to create custom if-else snippets then use code snippet feature.

Otherwise if you refer to features such as "Prettify" function of formula editor...

It does not provide creation of style templates but for example it places curly braces to separate line and applies indentation of code lines within curly braces.



Thanks, but this info is well known from the official documentation.

I don't need snippets fof basic code elements but "Prettify" or "Re-Format" is a VERY convenient future and it is very sad if it isn't configurable like practically all other MS based code editors.

I was wondering if, may be, some non-documented possibilities to tune the "Prettify" function like some key in the config or in the Windows' registry are exist.

If not - what is the plan for the future development to add this possibility?

@tcbyer this is the kind of feature request that should be submitted to the Feedback Center (requires access to the Member's Zone reserved to registered users):

While it would be a nice feature to have (I too personally would like to see something done a bit differently) honestly I think it is a low priority item, but you may try to post it anyway and see if anyone else will support your request.

1 Like

It is not customizable to promote one standard for formatting in AmiBroker. One standard is better than dozens of different non-standards when posting to forum.


Hello, Tomasz!

First of all, thank you for the answer.

I'm 100% agree with the second part of the answer and agree that this rule should be stricly enforced when the code is published on the forum.

But, from other side, I'm 100% disagree when we are talking about the code for a private use. My "programming roots" are in Unix & C where K&R style is dominant. You are using "Allman" style enforced by Microsoft. This is not a “kinda-religious" question. Just a quite different "rythm" to read and work with the code. It is very time consuming to re-format all scripts manually. Even Microsoft do not enforce "Allman" style make it just default. For .Net, for example, you can have “.editorconfig" file where you can "fine tune" how your code will look like. Your's amazing system is one of beautiful examples of how to use / re-use Microsoft Windows' objects (it is really amazing and I'm taking off my hat!). But why not to make a half step ahead and not to allow what is already here?

Thanks again.