This is a mobile optimized page that loads fast, if you want to load the real page, click this text.

Amibroker FAQ

Dear Amibrokers
is anyone using the Account in amibroker?
I found it awkward to populate/update and then what can we do with it?
I expected the ability to graph the perf of the account, etc
but I gave up last week and went back to my spreadsheet for my account management.
Am I missing something there?
 
Hey,

I have just purchased amibroker and am going through howard bandy's 'introduction to amibroker'. I am stuck with an issue in chapter 2 unfortunately. I downloaded data through amiquote and am trying to direct that specific data to a certain database in amibroker. I downloaded the nasdaq 100 and it went into my NYSE section. Does anyone know how I can direct data into a specific section?

cheers
 
thanks superglue i will have a play with that. I have imported the nasdaq 100 already and for some reason they go straight to the NYSE "markets" group. I may have to delete them all because i obviously only want NYSE stocks in that file.
 

You can also do it automatically.

For example using Finviz.com (it uses Morningstar Industry Classification system just like Yahoo)

For example to download
Nasdaq use this link http://finviz.com/export.ashx?v=111&f=exch_nasd
NYSE use this one http://finviz.com/export.ashx?v=111&f=exch_nyse
AMEX use this one http://finviz.com/export.ashx?v=111&f=exch_amex

There are some other finviz lists possible. Just use the filter options there on their website.

( Of course there are some other websites where you can get symbol lists from including category assignments like from here http://www.nasdaq.com/screening/company-list.aspx )

Move that downloaded Finviz files to C:\\. Name them AMEX.csv, NASDAQ.csv and NYSE.csv.

Then you could create format files for each of the three markets ( the format file codes below work in most recent AB 5.60 only!)

like

for Nasdaq

Code:
$FORMAT Skip,Ticker,FullName,SectorName,IndustryName,Country,Skip,Skip,Skip,Skip,Skip
$SKIPLINES 1
$SEPARATOR ,
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SORTSECTORS 1
$GROUP 1
$MARKET 1

for NYSE

Code:
$FORMAT Skip,Ticker,FullName,SectorName,IndustryName,Country,Skip,Skip,Skip,Skip,Skip
$SKIPLINES 1
$SEPARATOR ,
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SORTSECTORS 1
$GROUP 1
$MARKET 0

for AMEX

Code:
$FORMAT Skip,Ticker,FullName,SectorName,IndustryName,Country,Skip,Skip,Skip,Skip,Skip
$SKIPLINES 1
$SEPARATOR ,
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SORTSECTORS 1
$GROUP 1
$MARKET 2

Before importing the separately downloaded Finviz files the old sector and industry names (if there are any) better needs to be cleaned. The content of the format file that cleans the sectors after creating a data base or if using an already in use data base would be just one line

Code:
$CLEANSECTORS 1

We call that format file e.g. CLEANSECTORS.format
So since we add three independent Finviz csv files we would need to create an empty dummy file named CleanSectors.csv. Otherwise we could add $CLEANSECTORS 1 to the symbols format file.

In regards to Ascii formats see here www.amibroker.com/guide/d_ascii.html

Then we create a jscript file that automates all that

Code:
var Amibroker, Mydatabase, Shell;

AmiBroker  = new ActiveXObject("Broker.Application");

// save current Database before open the new one
AmiBroker.SaveDatabase();

// Amibroker database
//Mydatabase = "C:\\Program Files\\AmiBroker\\Data\\";   //your Amibroker database

// Open database 
//AmiBroker.LoadDatabase(Mydatabase);

// Import 
if (!AmiBroker.Import(0, "C:\\CLEANSECTORS.csv", "CLEANSECTORS.format"));
if (!AmiBroker.Import(0, "C:\\AMEX.csv", "FinVizAMEX.format"));
if (!AmiBroker.Import(0, "C:\\NYSE.csv", "FinVizNYSE.format"));
if (!AmiBroker.Import(0, "C:\\NASDAQ.csv", "FinVizNASDAQ.format"));
//if (!AmiBroker.Import(0, "C:\\SP500.csv", "FinVizSP500.format"));
//if (!AmiBroker.Import(0, "C:\\\DJ30.csv", "FinVizDJ30.format"));
//if (!AmiBroker.Import(0, "C:\\Other.csv", "FinVizOther.format"));

AmiBroker.RefreshAll();
AmiBroker.SaveDatabase();
//AmiBroker.Visible = true;  // Opens Amibroker if is closed

//notify user when import is finished 
Shell = new ActiveXObject("WScript.Shell");
Shell.Popup("Symbols Import Completed", 1.5);

I have uploaded all files to here http://www.datafilehost.com/download-552f71e0.html You just need to move the files to the according Amibroker folder on your PC.

Create a new data base. Then download the files of the three Finviz links. Download them to C:\\. Name them AMEX.csv, NASDAQ.csv and NYSE.csv. Then start Amibroker and excecute the jscript file of my uploaded zip archive.

I have made a comfortable AFL (it's not in the zip file) that does all that half-automatically without any manual user interference (except for clicking GFX buttons). See here http://www.youtube.com/watch?v=FDqnqN2z7I0&hd=1 The video is just supposed to show what you can do and what AB is capable of. So actually you can do anything that comes into your mind. That AFL of the video is an older version that I have recently updated to use the new ASCII capabilities provided in AB 5.60. See changes for 5.58 here http://www.amibroker.com/devlog/2012/09/29/amibroker-5-60-1-release-candidate-1/

My AFL programmatically creates folders to download the files to. It uses Urlget to download the files from Finviz or any other website providing symbol lists with category assignments (you can additionally choose individual Markets to download via Parameters dialog). It moves the files to the created folders, of course. It creates names for categories and moves the imported symbols to market, group, sector, industry, watchlist

In regards to setting category names it's all there in AFL, e.g.

Code:
                            CategorySetName( "NYSE", categoryMarket, 0 );
                            CategorySetName( "Nasdaq", categoryMarket, 1 );
                            CategorySetName( "Amex", categoryMarket, 2 );
                            CategorySetName( "World Indices", categoryGroup, 0 );
                            CategorySetName( "US Stocks", categoryGroup, 1 );
                            CategorySetName( "European Stocks", categoryGroup, 2 );
                            CategorySetName( "DJ INDU 30", categoryWatchlist, 0 );
                            CategorySetName( "S&P 500", categoryWatchlist, 1 );
                            CategorySetName( "NASDAQ 100", categoryWatchlist, 2 );
                            CategorySetName( "Symbols not updated", categoryWatchlist, 62 );
                            CategorySetName( "Symbols probably dead", categoryWatchlist, 63 );
 
Issue with NumToStr function:


// The NumToStr function appears to be changing the number

num1 = 77244687 ;
num1_str = NumToStr( num1, 1.0, False );

GfxTextOut( num1_str, 100, 100 ); // displays 77244688

num2 = StrToNum( num1_str );
Plot(num2,"num2",colorRed ); // plots 77244688


??any ideas??
 


It's not a bug.





Go to the AB Yahoo message board http://finance.groups.yahoo.com/group/amibroker/msearch_adv and search for more using digit accuracy or digit precision as key words
 
Hi Trash,

I did not mean to suggest the presence of a bug......TJ does not have such in his work.

If I've got an eight-digit number that needs to be represented as a string, what are my options?

Thanks,
RutheezKey
 
Hi Trash,

I did not mean to suggest the presence of a bug......TJ does not have such in his work.

If I've got an eight-digit number that needs to be represented as a string, what are my options?

Thanks,
RutheezKey

Greetings --

Where did the eight digits come from? Not a calculation done in traditional fashion, because only seven are available.

If they come from an outside source, can you capture them as they are read from their source?

If they come from a calculation, you can use numerical analysis techniques to do double precision calculation using single precision storage. It will require sophisticated coding. Refer to numerical analysis texts.

Or you can do the calculations that produce your result in a different order that retains significance more efficiently.

How will the result be used? Financial prices are seldom more precise than five or six digits. If the eight digit number will be used in a subsequent calculation, is the eighth digit necessary?

If the most significant digits are known, store them separately, adjust the operands, then compute the least significant digits. Do the subsequent arithmetic in two pieces -- the first using the most significant digits, the second using the least significant digits, then combine the results (which are still limited to seven digits).

Regards,
Howard
 
Hi Trash,

I did not mean to suggest the presence of a bug......TJ does not have such in his work.

If I've got an eight-digit number that needs to be represented as a string, what are my options?

Thanks,
RutheezKey

Try this one

Code:
EnableScript("jscript");
<%
x1 = 77244687;
x = x1.toString();
AFL.Var("num1") = x;
%>

GfxTextOut( num1, 100, 100 );

or

Code:
EnableScript("jscript");
<%
x1 = 77244687;
x = x1 + '';
AFL.Var("num1") = x;
%>

GfxTextOut( num1, 100, 100 );

or using vbscript

Code:
EnableScript("vbscript");
<%
x1 = 77244687
x = CStr(x1)
AFL.Var("num1") = x
%>

GfxTextOut( num1, 100, 100 );
 
Many thanks to both Howard and trash,

The number that I was using, when this issue first became known to me, was an "order-ID#". Not unlike a zip code, I typically handle such items as a string. With a string, I can include some flow-control----I do like to have that option. This is kinda new to me, so bear with me going forward. I greatly appreciate the help that I receive at this site. Hopefully, one day I'll be able to return the favor.

Later,
RutheezKey
 
Hi,

I have a composite indicator that looks reasonably promising as a way of trading the Aus index with a cfd.

How would I go about assigning buy and sell signals based upon the turning of the composite squiggle, and thereby back testing it?

Thanks.
 
Hi GB,

Does one treat the one-bar "turn" equally to the swing where the indicator does not reverse polarity for several more bars? Plus, does one consider the usage of a numerical-horizontal (such as the famous zero-line), before considering the movement of the indicator line as significant?

Just thinking out loud,
RutheezKey
 

Yes, every upturn is counted rather than using a zero line or similar. Well it looks best that way - which is why i want to test it. Any thoughts?
 
Hi GB,

See if this will work.

IV = your indicator-value ;

xx = IIf( IV > Ref( IV, -1 ), 1, IIf( IV < Ref( IV, -1 ), -1, IIf( IV == Ref( IV, -1 ), 0, 0 )));
yy = ValueWhen( ( xx == 0 ) AND ( Ref( xx, -1 ) != 0 ), Ref( xx, -1), 1 );
zz = ValueWhen( ( xx != 0 ) AND ( Ref( xx,-1) == 0 ), Ref( yy, -1 ), 1 );

TurnDN = ( ( xx < 0 ) AND ( Ref( xx, -1 ) > 0 ) ) OR ( ( xx < 0 ) AND ( Ref( xx, -1 ) == 0 ) AND ( zz != xx ) );
TurnUP = ( ( xx > 0 ) AND ( Ref( xx, -1 ) < 0 ) ) OR ( ( xx > 0 ) AND ( Ref( xx, -1 ) == 0 ) AND ( zz != xx ) );
 
Thanks for your coding there Ruth. Appreciated.

My difficulty is that in order to generate the composite, Buy = 0;

So I can't later re-define the buy signal to trigger when the squiggle turns.
 
Hi GB,

Can you first run the scan----saving the indicator array as a static. Then change the formula (with the new formula "getting" the static) and run the backtest.

Later,
RutheezKey
 
Hi GB,

Can you first run the scan----saving the indicator array as a static. Then change the formula (with the new formula "getting" the static) and run the backtest.

Later,
RutheezKey

RK, I ran the scan, which creates a symbol called "~MyComposite". Then I tried the following as a backtest on ^AORD, but no cigar.

SetForeign("~MyComposite",True,True);
y = C>Ref(C,-1) AND Ref(C,-1)<Ref(C,-2);
RestorePriceArrays( True );
Buy = y ;
Sell = !y;

Any further ideas appreciated.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more...