Hi,
I work with monthly data (source metastock format) and I would need to convert the date (last trading day of the month) to last calendar day of the month . This is needed because all my spreadsheets use the same date format.
I guess this could be done manually e.g. if Month is = 1 or 3 etc or then day = 31, if month is = 4 or 6 etc then day = 30. But then I have the issue of February, which is tricky. I could also create a fake ticker with the desired dates in excel and import in AB and use is as reference or pad align to it.
Isn't there in AB anything simpler?
I searched in forum.amibroker but couldn't find anything.
Grazie beppe,
I was trying to avoid complex things. I thought I could create a date for 1st calendar day of next month and then date -1, and that would be the EOM.
Clearly I have limited skills
dd=01;
mth=IIf(Month()==12,1,Month()+1); // to set next month
yr=IIf(Month()==12,Year()+1,Year()); // to set next year in Decemnber
for ( i = 0; i < BarCount; i++ )
{ mydate= StrFormat( "%02.0f-%02.0f-%02.0f",yr[i], mth[i], 01 );
}
Filter = 1;
SetSortColumns(1);
SetOption( "NoDefaultColumns", True );
AddColumn( DateTime(), "Date", formatDateTime );
AddTextColumn( mydate, "mydate");
AddTextColumn( mydate, "EOM",formatDateTime );
If your requirement is only to Get values in your desired format in a Monthly exploration/Scan - then modifying just the following setting may serve your purpose:
Tools > Preferences > Intraday > END Time of interval
Make sure to NOT use:
SetOption( "NoDefaultColumns", True );
The Default Columns will be having what you seem to be looking for.
thank you very much.
Tools > Preferences > Intraday > END Time of interval was the solution.
Thought, not sure why, but with SetOption( "NoDefaultColumns", True ); works too.
Again, thank you very much for you help, that was a very simple solution!
best regards
J