List of Calls That Must Be Called Unconditionally

Hi @Tomasz ,

Is there a list anywhere that states what AB functions/calls must be called unconditionally?

I think a lot of people would find that very useful.

In previous posts you have given valuable 'correct usage' instructions such as;

You see in many instances 'AddColumn/AddTextColumn' being used conditionally (including by experts) - see examples below.

So an available reference list would be great or even better would it be possible to have the 'AFL Editor Checker' to detect AB functions/calls used incorrectly?

// Incorrect use of 'AddColumn/AddTextColumn' - should be used unconditionally

if (Status("ActionEx") == actionExplore)
	Filter = 1;

	AddTextColumn(FullName(), "Company Name");
	AddColumn(BarIndex(), "Bar Index", 1.0);
	AddColumn(BarCount, "Bar Count", 1.0);
	AddColumn(Close, "Close Price", 1.3);
	AddColumn(Volume, "Volume", 1.0);

for ( i = 0; i < BarCount; i++ ) {
	if ( last_day[i] /*&& n <= 20*/ ) {
		AddColumn(prev_HTF_Vol[i], DateTimeFormat("%H:%M", dt[i]));	

Well, this is actually a simplification. It is easier to say don't call that conditionally than to provide long winded explanations as when / why / etc. The exploration code that you posted that takes Status("ActionEx") == actionExplore
as condition is actually correct because in modes other than exploration those calls are ignored anyway. So the if clause is redundant but not harmful.

As for automatic checks - they are tricky. As I wrote not every conditional call is bad.

I may provide extra "notes" in syntax editor that will be just information, not warnings or errors.


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.