[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AmiBroker 4.07.0 beta released



PureBytes Links

Trading Reference Links



Hello,
 
A new beta version of AmiBroker has just been 
released.
 
You can download it from the following 
locations:
<FONT face="Arial CE" 
size=2>http://www.amibroker.com/bin/ab4070beta.exe
<FONT face="Arial CE" 
size=2>http://www.amibroker.net/bin/ab4070beta.exe<A 
href=""><FONT face="Arial CE" 
size=2>ftp://ftp.amibroker.com/pub/ab4070beta.exe<A 
href=""><FONT face="Arial CE" 
size=2>ftp://ftp.amibroker.net/pub/ab4070beta.exe
(390KB self-extracting archive)
 
Please read the following read-me document for 
the list of new features and changes.
Best regards,Tomasz 
Janeczkoamibroker.com
 

AmiBroker 4.07.0 Beta
July 24, 2002 13:58 
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT BUGS. 
Backup your data files and entire AmiBroker folder 
first!
INSTALLATION INSTRUCTIONS
IMPORTANT: This archive is update-only. You have to install full 
version 4.00 first. 
Just run the installer and follow the instructions. 
Then run AmiBroker. You should see "AmiBroker 4.07 beta" written in the About 
box.
IMPORTANT NOTE for users who modifed built-in indicators or 
interpretations: please backup broker.bcharts file BEFORE installing this update 
and restore this file in order to save your modifications from being overwritten 
by the file that comes with this package.
COMMENTS and USAGE HINTS:
Charting engine improvements
Now built-in charts are drawn using even more optimized routines that results 
in significant speed up of chart drawing when you display charts for symbols 
with more than 30000 quotes. Also QuickAFL is enabled again (and hopefully 
bug-free) that gives similar speed up for custom indicators. In addition tothat 
selection bar updates caption in all chart panes (displaying current valuesof 
all indicators). You can move selection-bar with <- and -> cursor arrows 
on keyboard as before but now when you reach left most or right most bar - the 
chart starts to scroll automatically. Quote selection and caption display works 
different now:
- if selection-bar is NOT visible then the last VISIBLE bar data are 
displayed (not the LAST available)- if selection-bar visible then selected 
bar data are displayed
Drawing date/time axis works also better now.
New constants and bitwise operators
AmiBroker now includes many pre-defined constants that can make your AFLcode 
easier to read. For example you can use the following statements using constants 
instead of just numbers:
Plot( MACD()-Signal(), "Histogram", colorRed, styleThick | 
styleHistogram );ApplyStop( stopTypeTrailing, stopModePercent, 10, True 
); 
Using for example colorRed constant will give red color always (regardless of 
what palette settings are). Also note that now you can combine chart styleswith 
a bitwise-or operator |. Although you can also combine styles with just + 
(addition) it is better to use | operator because when you combine the same 
style twice by mistake (styleHistogram | styleHistogram) it still works 
correctly showing histogram chart ( 2 | 2 = 2 ). Using + in that case will give 
2 + 2 = 4 and this is the code for thick style. Complete list of constants is 
included later in this document.
In addition to bitwise-or operator | AmiBroker has now also bitwise-and 
operator: &. These operators work on binary representation of numbers. Note 
that floating point number are converted (truncated) to integers before applying 
bitwise operators. Each bit is and-ed or or-ed accordingly. For example 9 is 
represented by 1001 binary code and 5 is represented by 0101. Bitwise-or is1101 
(13 in decimal) and bitwise-and is 0001 (1 in decimal). Here come a few samples 
showing how it works:
255 & 64 gives 64255 | 64 gives 2551 | 2 | 4 | 8 gives 1515 | 
7 gives 15
New P&F-like graph style
AmiBroker now features new graph style - 8192 (stylePointAndFigure) that 
enables to write formulas that "emulate" point and figure charts. A sample code 
is included later in this document. Now just a few comments. New style usesall 
open, high, low and close arrays. (OHL indirectly). High array should be set to 
bar's highest point, Low array should be set to bar's lowest point. The 
Close-Open distance defines box size. If Close > Open then X symbols are 
drawn, otherwise O symbols are drawn. Both Close and Open arrays should be 
inside H-L range but only the difference between Open and Close really matters 
for drawing P&F bars. Please note also that for proper looking P&F 
charts the H-L distance should be divisible by box size (C-O distance) without 
remainder.
AFL new functions and improvements
Status() function features new fields:"rangefromdate", "rangetodate"- 
return current auto-analysis From-To range as DateNums "rangefromtime", 
"rangetotime" - return current auto-analysis From-To range as DateNums 
"barinrange" - returns 1 when current bar is within current auto-analysis 
From-To range"barvisible" - (custom indicators only) returns 1 when current 
bar is visible in current view note: this should be used only if you really 
have to, indicator should be written without need to know how it is 
displayed
For example the system that buys today and sells tommorrow can now be 
universally coded as follows:
buy = Status("barinrange");sell = Ref( buy, -1 );
(previously one needed to modify such formula depending on range 
settings)
LastValue( array, forcelastbar = 0 ) function has one additional (optional) 
parameter: forcelastbar - changes the behaviour of LastValue when used in 
Commentary or Interpretation windows. By default it uses selected value, but if 
you use LastValue( array, True ) then it always use last bar instead of selected 
one. A new function called SelectedValue( array ) gives selected bar value in 
Commentary, Interpretation and custom Indicators.
A new RMI( periods = 20, momentum = 5 ) function implements Altman'sRelative 
Momentum Index (S&C Feb 1993)
A new Interval() function returns bar interval in secondstick bars = 
05 sec bars = 51 min bars = 60hourly bars = 3600dailybars = 
86400weekly bars = 430000 (43e4)monthly bars = 2160000 
(216e4)
Alerts enhanced
Now "E-mail" page in Tools->Preferences has been renamed to "Alerts" and 
allows to define e-mail account settings, test sound output and define which 
parts of AmiBroker can generate alerts via AlertIF function. 
E-mail setting page now allows to choose among most popular authorization 
schemes like: AUTH LOGIN (most popular), POP3-before-SMPT (popular), CRAM-MD5, 
LOGIN PLAIN.
"Enable alerts from" checkboxes allow you to selectively enable/disable 
alerts generated by Automatic analysis, Commentary/Interpretation and custom 
indicators. 
Alert output window now has an additional column that shows the source of 
alert - if this is Automatic Analysis, Commentary or one of your custom 
indicators. This makes it easier to find out which part of AmiBroker generates 
alerts.
AlertIF function
AlertIF function is similar to WriteIF. But instead of just writing the text 
to the output window (commentary/interpretation) it allows to:
direct the customized text to "alert output" window, 
make a sound (just by computer beeper or from .WAV file) 
send an e-mail 
The syntax is as follows:
AlertIf( BOOLEAN_EXPRESSION, command, text, type 
= 0, flags = 1+2+4+8, lookback = 1 );
1. BOOLEAN_EXPRESSION is the expression that if evaluates to True(non 
zero value) triggers the alert. If it evaluates to False (zero value) no alert 
is triggered. Please note that only lookback most recent bars are 
considered.
2. The command string defines the action taken when alert is 
triggered. If it is empty the alert text is simply displayed in the Alert 
output window (View->Alert Output). Other supported values of command 
string are:
SOUND the-path-to-the-WAV-fileEMAILEXEC 
the-path-to-the-file-or-URL <optional args>
SOUND command plays the WAV file once. 
EMAIL command sends the e-mail to the account defined in the settings 
(Tools->Preferences->E-mail). The format of the e-mail is as follows:
Subject: Alert type_name (type) Ticker on Date/TimeBody: 
text
EXEC command launches external application or file or URL specified after 
EXEC command. <optional args> are attached after file name and text 
is attached at the end
3. Text defines the text that will be printed in the output window or 
sent via e-mail or added as argument to the application specified by EXEC 
command
4. Type defines type of the alert. Pre-defined types are 0 - default, 
1 - buy, 2 - sell, 3 - short, 4- cover. YOu may specify higher values and they 
will get name "other"
5. Flags control behaviour of AlertIF function. This fieldis a 
combination (sum) of the following values:( 1 - display text in the output 
window, 2 - make a beep (via computer speaker), 4 - don't display repeated 
alerts having the same type, 8 - don't display repeated alerts having the same 
date/time) By default all these options are turned ON.
6. lookback parameter controls how many recent bars are checked
Examples:
Buy = Cross( MACD(), Signal() );Sell = Cross( Signal(), MACD() 
);Short = Sell;Cover = Buy;
AlertIF( Buy, "EMAIL", "A sample alert on "+FullName(), 1 );
AlertIF( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
AlertIF( Short, "EXEC Calc.exe", "Launching external application", 3 );
AlertIF( Cover, "", "Simple text alert", 4 );
Note EXEC command uses ShellExecute function and allows not only EXE files 
but URLs too.
Interpretation window
Interpretation window (View->Interpretation) shows chart-sensitive 
commentaries. To add a interpretation just use Indicator builder and add 
commentary code after the code for the indicator. Please note that to get the 
best performance you should use the following optimization hint: after your 
indicator code and before commentary code you should add the following line://--Indicator-End-- 
( two slashes (comment start), two dashes, Indicator-End and two dashes ). 
When the parser is evaluating the formula in the "indicator" mode it stops 
there, so commentary code is not executed and it saves time. When parser isin 
other modes - entire formula is parsed/executed.
Example:Plot( Close, "Price", -1, 64 ); Plot( SAR( Prefs( 50 ), Prefs( 51 ) ), "SAR",-17, 8+16 ); //--Indicator-End--"The Parabolic SAR provides excellent exit points. ";
"You should Close long positions when the price falls below 
the SAR AND Close Short positions when the price rises above the SAR.";
WriteIF( graph1 > Close, "SAR is above close", "SAR is below close" );

Data tips
Data tips now show the values of indicators. Just hover your mouse over the 
chart wait a while and data tip will show indicator values at point beneaththe 
mouse.
QuickAFL
The QuickAFL technology can give 10x or more speed up when plotting custom 
indicators for symbols with more than 1000 bars of data. The exact speed-up 
depends on various factors. When evaluating the formula AmiBroker performs a 
heuristic guess how many bars of past and future data are required to evaluate 
the formula. Then only this required amount is used so when you have a lot of 
data (say >50000 data bars) and view only recent 500 bars AFL (if it is 
possible) evaluates your formula only for the last few hundreds of bars which is 
much faster. Please note that if you are using the following functions: Cum(), 
AccDist(), OBV(), Chaikin(), NVI(), Highest(), Lowest(), PVI(), ADLine(), 
AddToComposite(), Equity() AmiBroker can not use this optimization technique 
because these function perform calculations that require all previous bars. 
Please note that AFL can not currently guess the number of bars required by 
JScript/VBScript parts of your code nor code included in plugin DLLs. If you are 
using any you should take a look at SetBarsRequired function that allows to 
instruct AmiBroker how many bars are really needed. Use SetBarsRequired( 
1000000, 1000000 ) - if you want all previous and all future bars (old 
behaviour).
Please also note that this techniques is currently enabled ONLY for custom 
indicators and new Interpretation window. All other AFL tools (Automatic 
Analysis, Commentary) are NOT affected.
"Check" feature in Automatic Analysis
As a side effect of the technique of finding out the number of bars required 
to calculate given formula, I have added a "Check" feature that parses the 
formula in AA window and displays the message telling you what is AmiBroker 
guess. It warns you if your formula references future quotes. Note that for 
performance reasons the number of past/future quotes required to calculate given 
formula is very approximate. The algorithm is actually quite simple. Every 
built-in function in AmiBroker "knows" how many past and/or future bars it 
requires to calculate properly.
For example Ref( Close, -4 ) "knows" that it requires 4 past bars, and MA( 
Close, 15 ) "knows" that it requires 15 past bars. When checking the formula 
AmiBroker sums up this individual numbers, so for the following formula:Ref( Cross( MA( Close, 15 ), MA( Close, 25 ) ), -4 );
AmiBroker will tell that you need 44 past quotes (15+25+4). This is morethan 
it is really needed, but this is a "safe" guess.
Other features
See the changes list
Sample P&F code showing how to use new graph styles
//// P&F sample code// Originally written by Mirat 
Dave// Modified and adopted for AmiBroker 4.07 by Tomasz 
Janeczko// Disclaimer:// This code is not supposed to be fully working 
P&F chart// and it may (and probably will) give inaccurate 
output.// The ONLY purpose of this code is to show how to use 
new graph style 8128 (stylePointAndFigure)// available in AmiBroker 4.07 
that plots P&F-style O and X symbols.// True P&F charting will be 
available in later versions of AmiBroker.
SetBarsRequired(100000,100000);AvgTR = 
LastValue(ATR(50));EnableScript("jscript");<%High = VBArray( AFL( 
"High" ) ).toArray();Low = VBArray( AFL( "Low" ) ).toArray();ATR = 
AFL("AvgTR");
PFO = new Array();PFC = new Array();
Box = 0.7*ATR; // rma
// initialize first elementj = 0;PFO[j] = 
Box*Math.ceil(High[0]/Box);PFC[j] = Box*Math.floor(Low[0]/Box);down = 1; 
// By default the first bar is a down bar.up = 0;swap = 0;
// perform the loop that produces PF Chartfor( i = 1; i < 
High.length; i++ ){Reverse = Box * 3; // reversal requirement
if( Low[i] < PFC[j] - Box && down){PFC[j] = 
Box*Math.floor(Low[i]/Box);}else{if( High[i] >= PFC[j]+ 
Reverse && down){j++;swap = 1;PFO[j] = 
Box*Math.floor(Low[i]/Box);PFC[j] = 
Box*Math.ceil(High[i]/Box);}}
if( High[i] > PFC[j] + Box && up){PFC[j] = 
Box*Math.ceil(High[i]/Box);}else{if( Low[i] <= PFC[j] - 
Reverse && up){j++;PFC[j] = 
Box*Math.floor(Low[i]/Box);PFO[j] = Box*Math.ceil(High[i]/Box);swap = 
1;}}
if( swap ){swap = 0;if( up ){up = 0;down = 
1;}else{up = 1;down = 0;}}}
delta = High.length - j;
AFL.Var("PFO") = PFO;AFL.Var("PFC") = PFC;AFL.Var("Box") = 
Box;AFL.Var("delta") = delta;
%>
PFO = Ref( PFO, -delta );PFC = Ref( PFC, -delta ) ;/* High-Low 
range sets the height of the P&F bar */H = Max(PFO,PFC);L = 
Min(PFO,PFC);O = PFO;/* the difference between Open and Close should be 
set to box size *//* the sign decides if X or O are plotted 
*/C = O + Box * IIf( PFC > PFO, 1, -1 ); Graph0Style 
= 64+8192; // new style is used hereGraph0BarColor = IIf( PFC > PFO, 5, 4 
);Graph0 = C;
List of AFL constants
True = 1False = 0
stopTypeLoss = 0 stopTypeProfit = 1 stopTypeTrailing = 2 
stopModeDisable = 0 stopModePercent = 1 stopModePoint = 2 
stopModeRisk = 3 
colorCustom1 = 0 colorCustom2 = 1 colorCustom3 = 2 colorCustom4 = 
3 colorCustom5 = 4 colorCustom6 = 5 colorCustom7 = 6 
colorCustom8 = 7 colorCustom9 = 8 colorCustom10 = 9 
colorCustom11 = 10 colorCustom12 = 11 colorCustom13 = 12 
colorCustom14 = 13 colorCustom15 = 14 colorCustom16 = 15 
colorBlack = 16 colorBrown = 17 colorDarkOliveGreen = 18 
colorDarkGreen = 19 colorDarkTeal = 20 colorDarkBlue = 21 
colorIndigo = 22 colorDarkGrey = 23 
colorDarkRed = 24 colorOrange = 25 colorDarkYellow = 26 
colorGreen = 27 colorTeal = 28 colorBlue = 29 colorBlueGrey = 30 
colorGrey40 = 31 
colorRed = 32 colorLightOrange = 33 colorLime = 34 colorSeaGreen 
= 35 colorAqua = 35 colorLightBlue = 37 colorViolet = 38 
colorGrey50 = 39 
colorPink = 40 colorGold = 41 colorYellow = 42 colorBrightGreen = 
43 colorTurquoise = 44 colorSkyblue = 45 colorPlum = 46 
colorLightGrey = 47 
colorRose = 48 colorTan = 49 colorLightYellow = 50 colorPaleGreen 
= 51 colorPaleTurquoise = 52 colorPaleBlue = 53 colorLavender = 54 
colorWhite = 55 
styleLine = 1styleHistogram = 2styleThick = 4styleDots= 
8styleNoLine = 16styleLog = 32styleCandle = 64styleBar = 
128styleNoDraw = 256styleStaircase = 512styleSwingDots = 
1024styleNoRescale = 2048styleNoLabel = 4096stylePointAndFigure = 
8192
CHANGES FOR VERSION 
4.07.0 (as compared to 4.06.1)
help window is detached from application window 
arrows generated by commentary window are refreshed properly when newrt 
bars arrive (arrows are shown for active symbol only) 
e-mail alerts: support for servers requiring SMTP authentication. 
Supported methods:AUTH LOGIN (most popular), POP3-before-SMPT (popular), 
CRAM-MD5, LOGIN PLAIN 
sound alerts: ability to test sound output in 
Tools->Preferences->Alerts 
AFL error box popping up in AA when RT data are flowing does not cause a 
crash 
custom minute bar compression improved - now you can have >60 minute 
bars and also bars not evenly dividing the hour. So you can have 39 or 73 
minute bars for example 
drawing date/time axis improved 
drawing built-in charts optimized for very long histories 
new AFL functions:+ Interval() returns bar interval in seconds+ 
RMI( periods = 20, momentum = 5 ) - Altman's Relative Momentum Index (S&C 
Feb 1993)+ Status() function features new fields:"rangefromdate", 
"rangetodate" - return current auto-analysis From-To range as DateNums 
"rangefromtime", "rangetotime" - return current auto-analysis From-To 
range as DateNums "barinrange" - returns 1 when current bar is within 
current auto-analysis From-To range"barvisible" - (custom indicators only) 
returns 1 when current bar is visible in current view note: this should be 
used only if you really have to, indicator should bewritten without need 
to know how it is displayed+ LastValue has new optional 
parameterLastValue( array, forcelastbar = 0 );forcelastbar - changes 
the behaviour of LastValue when used in Commentaryor Interpretation 
windows. By default it uses selected value, but if youuse LastValue( 
array, True ) then it always use last bar instead of selected one.+ 
SelectedValue( array )
selection bar updates caption in all chart panes (displaying current 
values of all indicators). you can move selection-bar with <- and -> 
cursor arrows on keyboard as before but now when you reach left most or right 
most bar- the chart starts to scroll automatically 
quote selection and caption display works different now: if selection-bar 
is NOT visible then the last VISIBLE bar data are displayed (not the LAST 
available), if selection-bar visible then selected bar data are displayed 
new graph >- plots point-and-figure-style O and X symbols 
instead of candlesticksHigh and Low table are used to determine the height 
of bar,Close-Open distance determines box size. If Close > Open - X's 
are drawnif Close < Open - O's are drawn. 
added bitwise-and '&' and bitwise-or '|' operators to AFL language 
(note that floating point number are converted (truncated) to integers before 
applying bitwise operators) 
CHANGES FOR VERSION 
4.06.1 (as compared to 4.06.0)
fixed tab order in Analysis window (Range radio buttons) (appeared in 
4.06beta) 
fixed problem with using AFL.Var with uppercase letters (appeared in 
4.06beta) 
fixed problem with using gSite.SetVariable / gSite.GetVariable with 
uppercase letters (appeared in 4.06beta) 
fixed problem with exploration (appeared in 4.06beta) 
fixed small display issue in the data tooltips (-1e10 displayed instead of 
{EMPTY}) 
CHANGES FOR VERSION 
4.06.0 (as compared to 4.02.1)
New Interpretation window (View->Interpretation) displays 
chart-sensitive commentaries 
new AlertIF function allows to generate visual, sound, e-mail alerts.It 
also allows to launch any external program on signal generated by AFL formula. 

Automatic Analysis window now allows periodical scans (Scan every n 
minutes) 
new Check feature in Automatic Analysis window allowing you to find out if 
your formula references future quotes or not. 
Data tips show indicator values now and can show also interpretationsof 
indicators 
n QuickAFL technology implemented (Tools->Preferences->Miscellaneous 
-> Enable QuickAFL for indicators) - provides >10x speed-up in custom 
indicator charting with long histories (>1000 bars) 
ability to modify / overlay additional graphs over built-in charts 
(Indicator Builder->Built-in tab) 
ability to create your own interpretation commentaries in Indicator 
Builder 
new AFL functions: 
AlertIf( BOOLEAN_EXPRESSION, command, text, type = 0, flags = 1+2+4+8, 
lookback = 1 ); 
SetBarsRequired( backward, forward= -1) - overwrites heuristic guessing 
algotithm used by QuickAFL technology. Allows to specify the number of 
previous (backward), and future (forward) quotes required by the formula to 
properly calculate - for advanced users only 
GetBaseIndex() - retrieves symbol of base index as defined in 
Symbol->Categories. To plot base security chart just use graph0 = 
Foreign( GetBaseIndex(), "C" ); 
EnableTextOutput( flag ) - enables output of strings into commentary / 
interpretation window. When flag = 0 no string is printed into commentary 
window, 1 - strings are printed 
_N( text ) - the function that prohibits writing the values of 
assignment of string variables: _N( text = "this is a text" ); this does not 
print out the text being assigned into commentary window.
filtering weekends (File->Database Settings->Intraday 
settings->Filter weekends) 
Commentary and Interpretation window are automatically refreshed when 
charts are refreshed 
OLE automation Quotation.Date (GetDate) includes time also 
AFL engine symbol lookup optimized so AFL engine initializes 2x faster and 
symbol lookup is also faster 
when scrolling zoomed-out chart (that displays more than 2048 data bars) 
the refresh is delayed a little. This makes scroll bar more responsive and it 
takes much less to scroll to desired position when working with >100000 
bars. 
CHANGES FOR VERSION 
4.02.1 (as compared to 4.02.0)
added automatic ruin stop that closes all trades loosing more than 99.96% 
CHANGES FOR VERSION 
4.02.0 (as compared to 4.01.0)
added ability to filter after-hours trading (File->Database 
Settings->Intraday settings : Filter after-hours box plus definable session 
start/end (per-workspace settings) 
added ability to shift time displayed on charts/dialogs File->Database 
Settings->Intraday settings : Time Shift (AmiBroker uses computer local 
time, so it displays realtime quotes using the time of the timezone you are 
in. For example if you live in Warsaw - NYSE-quotes stocks will start 15:30 
local (Warsaw) time. If you want however to display time as it is in New York 
(-6 hours -> 9:30) you have to set Time Shift to -6. 
fixed problem with importing very long intraday histories > 300000bars 
(if you want to import that long histories you have to go to File->Database 
Settings and change "Default number of bars" to at least 3000) 
fixed a bug in intraday -> daily time compression 
fixed "no trade list" display of Exposure and RAR 
when writing the formula to HTML report < and > characters are 
encoded to &lt; and &gt; to ensure that formula is not truncated. 
"Apply" button in Indicator Builder inserts/modifies the custom indicator 
only if the formula is correct. This avoids continuously displayed error 
messages when working with real time streaming data. 
fixed bug in list view sorting of numeric columns containing small values 
fixed crash occuring when Equity() function was called from Commentary 
window 
fixed display of huge numbers in the chart grid 
added option to color up/down (traditional) bars : Preferences -> Main 
chart 
CHANGES FOR VERSION 
4.01.0 (as compared to 4.00.0)
Customisable N-tick 
charts in Real Time version (see Preferences -> Intraday tab) and new 
View->Intraday menu 
Ability to backtest custom N-tick bars 
Backtester now makes better decisions on desired order of execution of 
signals that occur the same day. (if both buy and sell (or short and cover) 
signals occur on the very same bar and there is already open trade from the 
any of the previous bars this open trade is closed first, and a new tradeis 
opened next. Otherwise the usual order (buy first then sell) is used. 
HOW TO REPORT BUGS
If you experience any problem with this beta version please send detailed 
description of the problem (especially the steps needed to reproduce it) to<A 
href="">bugs@xxxx