Mysterious column arrangement

Good morning,
Thank you in advance if anyone can help me.
I don't understand what I'm doing wrong so the tickers aren't sorted by column 3 (by the date the symbol was first quoted in the database).
I've attached the AFL, the explorer image, and how I have the Analysis settings.
I'd like to point out that if I set the frequency to annual, it magically sorts them correctly (I've also attached an image of this), but the rest of the frequency ranges aren't sorted correctly.
Could it be something related to the NorgateData database?
Thank you very much.

_SECTION_BEGIN("Estudio Símbolos");

Filter = Status( "lastbarinrange" );

BegininDate = BeginValue ( DateTime() );
LastDataDate = lastValue( DateTime() );
SharesOut = GetFnData("SharesOut");
Market_Cap = SharesOut*Close; 
Vol_Promedio30d = MA(V,30);
Vol_Promedio90d = MA(V,90);

SetOption("NoDefaultColumns", True);
SetSortColumns(-3); 

AddtextColumn(Name(),"Ticker");
AddtextColumn(FullName(),"Nombre");
AddColumn(BegininDate,"BegininDate",formatDateTime);
AddColumn(LastDataDate,"LastDataDate",formatDateTime);
AddColumn( Close, "Close", 1.2 );
AddColumn(Volume,"Volume");
AddColumn(SharesOut,"SharesOut",1.0);
AddColumn(Market_Cap,"Market_Cap",1.0);
AddColumn(Vol_Promedio30d,"Vol_Promedio30d",1.0);
AddColumn(Vol_Promedio90d,"Vol_Promedio90d",1.0);

_SECTION_END();



Your dates are being sorted as strings. Try using formatDateTimeISO instead so that the year comes first.

There is a regression in 6.93 that is fixed in 6.94 (in development version) NewAnalysis: Fix regression - custom date/time column AddColumn( DateTime(), "DT", formatDateTime ) sorting is bad in 6.93 (regression from 6.90).
Just don't delete default columns - date time ordering in default column is OK.

If you want correct CUSTOM DATE column ordering in version 6.93 the only option is to change system date regional settings to use ISO date (YYYY-MM-DD)

Thank you very much for your prompt response.
Please excuse my ignorance. I've commented out the lines so they don't get deleted and sorted, but the initial quote date column still isn't sorting correctly.

You are looking at wrong column. I mean 2nd column with Date/Time header at the top. That is the default column and this column only sorts as date. The CUSTOM column (with "BegininDate" header) that you have added sorts as TEXT (string), not date.

But Dr. Tomasz, how can I use that second column to show the date the ticker listings start?
I don't understand. I'm sorry for being so clumsy

That is what he said, you can't for now, until the next version is released.

Try this as Matt wrote, if it works.

AddColumn(BegininDate,"BegininDate", formatDateTimeISO );

else as Tomasz wrote:
Go to start menu > type date and time settings

go to regional settings > Regional Format
use the ISO date


change long date format in the same way

3 Likes

Thank you all so much for the answers.
With nsm51's detailed, step-by-step explanation, I was finally able to understand and solve it.
It's very kind of you to take the time to help beginners like me with very little knowledge (both in Amibroker and in English, since I use Google Translate to communicate).
I truly appreciate it.