Export Exploration To File Issue

I couldn't see if anyone has come across this issue before?

When I 'Export to File' via Batch the exported CSV file in Excel has some data spread into the wrong column. The actual AB Exploration Report is fine.

AB Exploration
image

Excel
image

Does anyone know why this is occurring and how to rectify.

AmiBroker 6.3.1 32bit
Excel 2016 64bit
Windows 7 64bit

Thanks.

It is because there is a comma in EMUCA symbol name.

Remove it in information window.

1 Like

I have a few of those in the report so I will exclude them via the Filter.

Thanks @fxshrat.

@TrendSurfer,

In AmiBroker everything (99%) can be coded avoiding manual intervention of repetitive tasks.

So if you have multiple symbols with comma in company name then you just need to write some OLE code iterating through symbol list searching for comma in company name and replacing/removing comma of those symbols in one go.

Hints can be found here:
https://www.amibroker.com/kb/2006/09/01/how-to-change-property-for-multiple-symbols-at-once/
https://www.amibroker.com/guide/objects.html#Stock
https://www.amibroker.com/guide/afl/strreplace.html

Also you do not need to iterate though entire DB but just watchlist of symbols having comma in company name.

/// Replace comma in fullname for multiple symbols
/// What is it about:
/// @link https://forum.amibroker.com/t/export-exploration-to-file-issue/15228/4
///
/// disable multi threading
#pragma maxthreads 1

wlnumber = 60;// set watchlist number

SetOption( "RefreshWhenCompleted", True );

/// First apply Exploration #######################################
/// find symbols with comma within company name
/// and add them to defined watchlist
if ( Status( "action" ) == actionExplore ) {
	Filter = 0;
	if ( StrFind(FullName(), ",") ) // if there is comma then..
		CategoryAddSymbol( "", categoryWatchlist, wlnumber );
}

/// Then do Scan ##################################################
/// remove/replace comma by something else 
/// while scanning defined watchlist
if ( Status( "action" ) == actionScan ) {
	Buy = 0;    
	if ( InWatchList( wlnumber ) ) {
		fn_replaced = StrReplace(FullName(), ",", ";");
		AB = CreateObject( "Broker.Application" );
		st = AB.Stocks( Name() );
		st.FullName = fn_replaced; // set new fullname
	}
}

Try code on DB copy first as it is untested.

2 Likes

If you don't want to modify your database, you could also just remove the commas before you output the company name:

fname = StrReplace(FullName(), ",", "");
AddTextColumn(fname, "Company Name");
3 Likes

Thanks @fxshrat and @mradtke - appreciate your help.

Sorry, I should have been more clear. This is what I meant by excluding by Filter.

Filter = Status("LastBarInRange") AND NOT StrFind(FullName(), ",");