AmiBroker 6.25.0 BETA Read Me
July 25, 2017 0:20
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT
BUGS !!!
Backup your data files and entire AmiBroker folder
first!
INSTALLATION INSTRUCTIONS
First you need to have full version of AmiBroker 6.20 installed. Then just
run the BETA installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 6.25.0" written
in the About box.
See CHANGE LOG below for detailed list of changes. Note that only changes
that affect end-user directly are listed here. Internal code changes/refactoring
is usually not mentioned.
UPGRADE POLICY: This version is a free upgrade for users
who purchased AmiBroker license after July 24, 2015.
6.25 FEATURE HIGHLIGHT:
This version brings:
- new Gui controls (toggle button, checkbox, radio button)
- new AFL functions for GUI
- passing variables by reference in AFL,
- Auto-optimization framework
- HTML5 compatibility in Web Research
- many other improvements
6.22 FEATURE HIGHLIGHT:
This version is experimental because we are migrating 64-bit version to
brand new compiler (VC++ 2017). Such migrations pretty often brings some compatibility
risks therefore backup is highly recommended (although you can always go back
by just installing previous version). We needed to migrate not only the program
itself but many internal libraries taking care not to break backward compatibility.
Note that migration does NOT affect 32-bit version. It is still compiled with
old compiler.
Why do we migrate to new compiler with 64-bit version?
- New compiler supports new CPU instructions (SSE3/AVX) that we can use
to offer better performance
- According to our tests new compiler support produces faster code by itself
(better optimizations, auto-vectorization, etc)
- New compiler is better with error checking (less bugs to slip through)
- We don't need to care about compatibility with pre-Vista systems in 64-bits
version and all 64-bit capable CPUs are "modern" enough.
Why do we stay with old compiler in 32-bit version?
- New compiler does not produce code compatible with older operating systems
(XP or earlier).
Old compiler offers 100% compatibility with all Windows versions
- New compiler requires modern CPUs
Exact performance improvement is function dependent and hardware dependent.
Many functions are faster by 30-50% but in some cases such as Min()/Max() functions
as large
as
8x speed
up can be observed in 64-bit version.
6.21 FEATURE HIGHLIGHT:
This version features preliminary support for native chart GUI (buttons and
edits at the moment). Please be resonable with Gui* functions and be aware
of Windows limits.
As all controls in Windows (buttons, edit boxes, etc) are actual Window objects
they are subject to Windows limitation.
And there is a limit of 10000 windows PER PROCESS. So don't try to create thousands
of buttons (like a button for every bar of data) because
first you will see huge performance decrease and next you will hit the limit
and run into problems (crash)
https://blogs.msdn.microsoft.com/oldnewthing/20070718-00/?p=25963
Best practice is to keep the number under 100-200.
If you need more consider using low-level graphics instead.
Here is a sample formula that shows basic usage of Gui* functions:
GuiButton( "Custom button", 1, 10, 40, 100, 30, 7 );
GuiButton( "Dynamic "+Date(), 2, 120, 40, 150, 30, 7 );
GuiButton( "System button", 3, 320, 40, 100, 30, 7 );
GuiEdit( 5, 450, 40, 100, 20, 31 );
GuiSetColors( 1, 3, 2, colorRed, colorBlack, colorRed, colorWhite, colorBlue, colorYellow, colorRed, colorBlack, colorYellow );
GuiSetColors( 3, 3, 0 ); //
default (system) look
editText = GuiGetText( 5 );
Title = "Text entered: " + editText + "\nLast
event: " + GuiGetEvent( 0, 2 );
id = GuiGetEvent( 0, 0 );
event = GuiGetEvent( 0, 1 );
if( id == 3 && event
== 1 ) GuiSetText("Button
clicked",5);
CHANGE LOG
CHANGES FOR VERSION 6.25.0 (as compared to 6.22.0)
- 64-bit: In 6.22 the array division could produce 1ulp (units at least place)
rounding errors due to too excessive new VC++2017 compiler optimizations.
Workaround implemented to avoid that.
- Added support for formatDateTimeISON
(ISO format NO dashes: YYYYMMDD for end
of day and YYYYMMDD HHMMSS for intraday)
AddColumn( DateTime(), "dt", formatDateTimeISON );
Filter = 1;
- AFL Editor: added one-time message "In
the Debug mode number of bars is limited to 200 bars. You can change it in
Tools->Preferences, Debugger tab" because
users don't read docs
- AFL: ApplyStop now has 8th argument: ActivationFloor
that defines the amount of profit (in dollars or percents, according to stopmode)
that must be exceeded
before stop is activated
- AFL: Gui* - controls are created in the order of
occurence in AFL formula (instead shuffled or reverse as in previous version)
- AFL:
Gui* - keyboard navigation is now enabled (you can tab between controls and
use arrows to navigate control groups such as radio boxes)
- AFL: IsNull() accepts
matrix input and returns 0 (False), i.e. "variable
is not null" if variable is of matrix type
- AFL: math functions such as
sin(), sqrt(), etc can now be applied to matrices (element-wise operation)
(previously such attempt resulted in access violation)
- AFL: New feature: Passing
arguments as reference (allows modification of arguments passed - easy way
to return multiple values), to pass by reference
use & (address-of)
operator before variable identifier
Reference is actually a pointer to (address of) the variable. If it is passed
to function it allows original variable to be modified.
The difference between AFL and C language is that while you are using address-of
operator when you call function,
you don't need any special syntax in the function itself. This has advantage
that same function can be called with arguments passed by value and by reference
and which one is used is just directed by the way you call the function.
AFL automatically and transparently knows that it needs to dereference addresses
when
references are used in aritmetic operations, function calls or assignments.
function test( x, y )
{
x += 1;
y += 2;
}
a = 23;
b = 25;
printf("Before function call: a=%g, b=%g\n", a, b );
test( &a, &b ); // pass references (variables get modified)
printf("After function by ref call: a=%g, b=%g\n", a, b );
test( a, b ); // pass values (no modification happens)
printf("After function by val call: a=%g, b=%g\n", a, b );
- AFL: new function GuiCheckBox - creates
check box
- AFL: new function GuiGetCheck( id ) - gets 'checked' or "ON" state
of toggle, checkbox and radio buttons
- AFL: new function GuiRadio - creates
radio button
- AFL: new function GuiSetCheck( id, checked ) - sets 'checked'
or 'ON' state of toggle, checkbox and radio buttons
- AFL: new function GuiSetFont( "fontface",
size )
- AFL: new function GuiToggle - creates toggle button (like normal button
but it toggles between "on" and "off" state with each
click)
- AFL: SetOption("OptimizeSaveParams", True ); - turns on generation
of AFL file that contains values of optimization parameters producing best
result. The generated file has the same name as formula run but has .opt.afl
extension
This functionality is provided to simplify creation of auto-optimization
schemes
How to use:
1. Create your main formula, say it's file name is "Formulas/Custom/MainFormula.afl"
2. Create your opt param formula: "Formulas/Custom/MainFormula.opt.afl"
In the opt param formula type:
// This file will be automatically overwritten by optimizer with best values
first_param = 6;
second_param = 12;
3. In the main formula type:
#include "Formulas/Custom/MainFormula.opt.afl"
x = Optimize("first_param", first_param, 3, 10, 1 );
y = Optimize("second_param", second_param, 11, 30, 1 );
// causes automatic generation of MainFormula.opt.afl
SetOption("OptimizeSaveParams", 1 );
// dummy system using two params
Buy = Cross( C, MA( C, x ) );
Sell = Cross( MA( C, y ), C );
4. Run optimization
After it is complete MainFormula.opt.afl will be overwritten with optimum
values
- AFL: When using TimeFrame functions, QuickAFL now uses ratio of
requested_interval/current_interval multipled by 30 to better estimate required
bars
- ships with newest AmiQuote 3.22 (see AmiQuote read me for details)
- Analysis:
Detailed log displays information about ignored ScaleIn/Outs because of insufficient
funds or trade size constraints
- Analysis: Detailed log now displays all warnings
about skipped/ignored signals in RED color so they are easier to spot
- Data:
when performing X:Y split and X or Y exceeded 255 the factor was incorrectly
displayed (negative) in the Symbol window. Fixed.
- formatDateTimeISO and formatDateTimeISON
added to syntax highlighter definitions
- Scheduler: Repeat "Daily" mode
repeated batch run every day even if some days were unchecked. Fixed.
- UI:
Place Order dialog - allows typing stop distances smaller than 0.1 now
- UI:
Prefs/Charting: Turning on "Collapse parameter sections" option
causes all sections in Parameter window to be collapsed (NOT good idea for
newbies as they wont see the controls !)
- Web Research: many HTML5 pages did
not display properly because of the fact that web browser used old IE7
mode. Now browser uses IE11 mode at minimum
for proper HTML5 rendering
CHANGES FOR VERSION 6.22.0 (as compared to 6.21.0)
- 64-bit: migrated all code to new compiler VC++2017 which seems to produce
better code for x64 resulting in 30...50% speed improvements for many AFL
functions. The only negative seems to be much bigger runtime libs
- 64-bit: AFL: Sum() function 2x faster
- 64-bit: AFL: Max() and Min() functions 8x faster
- 64-bit: AFL: Ref() funciton 2x faster
- 64-bit: AFL: MACD(), ROC(), StDev(), LinearReg() and many other functions
faster by 30-50%
- AFL: GetExtraData
does not trigger code check and profile warning about
referencing future quotes if plugin implements new GetExtraDataEx function
- AFL:
GuiEdit complained about 2nd parameter instead of 1st (being less than
zero)
CHANGES FOR VERSION 6.21.0 (as compared to 6.20.1)
- AFL: decreased memory fragmentation when user changes type of variable
from array to scalar and back thousands of times
- AFL: GuiButton( "Text",
id, x, y, width , height , notifyflags ) - creates a button
"Text" is a text to be displayed on the button
x, y are pixel coordinates of top-left corner of the control
width, height are pixel width and height of the control
notifyflags - decides which events fire execution of your formula, it can
be any combination of values below
1 - clicked (button)
2 - setfocus (all)
4 - killfocus (all)
8 - hit enter/return key (edit)
16 - edit change (edit)
- AFL: GuiEdit(
id, x, y, width, height, notifyflags ); - creates an edit field
x, y are pixel coordinates of top-left corner of the control
width, height are pixel width and height of the control
notifyflags - decides which events fire execution of your formula, it can
be any combination of values below
1 - clicked (button)
2 - setfocus (all)
4 - killfocus (all)
8 - hit enter/return key (edit)
16 - edit change (edit)
- AFL: GuiGetEvent(
num, what = 0 )
what = 0 - ID of control that received event (number)
what = 1 - the notification code (number)
what = 2 - the ID, the code and the notification description as text (string)
num parameter defines the index of notification in the queue. 0 is first
received (or "oldest") since last execution.
Usually there is zero (when formula execution was not triggered by UI event)
or one event in the queue but
note that there can be MORE than one event notification in the queue if your
formula is slow to process. To retrieve them all use increasing "num" parameter
as long as GuiGetEvent does not return zero (in what =0, =1 mode) or empty
string (what=2).
// read all pending events
for( i = 0; id = GuiGetEvent( i ); i++ )
{
code = GuiGetEvent( i, 1 );
text = GuiGetEvent( i, 2 );
}
- AFL: GuiGetText( id ) - get text from control
- AFL: GuiSetColors( idFrom,
idTo, border , clrText = -1, clrBack = -1, clrBorder = -1, clrSelText = -1,
clrSelBack = -1, clrSelBorder = -1, clrHoverText =
-1, clrHoverBack = -1, clrHoverBorder = -1, clrDisText = -1, clrDisBack =
-1, clrDisBorder
= -1)
idFrom, idTo - define range of control IDs that will use new colors. To set
color for single control use the same value for both idFrom and idTo
border - defines border width of button (does not affect other control types)
clrText, clrBack, clrBorder - define colors of control text (fgcolor), background
(bgcolor) and border (if border width is > 0 ) in "default" control
state (unselected)
selectfgcolor. -1 means colorDefault and if all colors are set to default
then control uses SYSTEM (Windows) look
clrSelText, clrSelBack, clrSelBorder - define colors in selected state
clrHoverText, clrHoverBack, clrHoverBorder - define colors in hover (mouse
over) state
clrDisText, clrDisBack, clrDisBorder - define colors in disabled state
Please note that currently only buttons support custom colors and custom
border
As for v6.21 Edit fields always use system look
- AFL: GuiSetText( "text", id ) - set text of the control
- AFL: RequestMouseMoveRefresh()
- request formula execution / refresh when mouse is moved INSIDE given chart
pane (so it only triggers for ONE window
under
the cursor)
This provides less resource consuming way to handle chart graphics that depends
on mouse hovering over chart pane than using RequestTimedRefresh as it only
triggers one window currently under the cursor and only does not trigger refreshes
when mouse does not move
NOTE2: mouse move refreshes come "as fast as possible". if your
code is fast you can get butter smooth animation (even 50fps)
Example:
Plot( C, "Price", colorDefault );
GfxCircle( GetCursorXPosition(1), GetCursorYPosition(1), 7 );
RequestMouseMoveRefresh();
- If Quote.exe is missing and AmiBroker can't do auto-update of
quotes, a detailed information is displayed of where it expects Quote.exe
file to be present
- Plugin loading changed: first AmiBroker attempts to load
plugins for "Plugins" subfolder
from where Broker.EXE file is located (new behavior) and if subfolder is
NOT found, it then defaults to old behavior (using "Plugins" subfolder
under current working
If you experience any problem with this beta version please send detailed
description of the problem (especially the steps needed to reproduce it) to
support at amibroker.com