CHANGES FOR VERSION 6.92.0 (as compared to 6.91.0)
- Symbol list and category tree now use Dark Mode when it is selected in
the Customize/Appearance dialog
- Layout treeview now uses Dark Mode when it is selected in the Customize/Appearance
dialog
- Charts (formula) treeview now uses Dark Mode when it is selected in the
Customize/Appearance dialog
- Layers list now uses Dark Mode when it is selected in the Customize/Appearance
dialog
- Added 'Warning 904' when SetOpacity is called without proper settings ("Multithreaded
charts" and "QuickGFX" must be turned on in the Preferences)
- Notepad window uses Dark Mode when it is selected in the Customize/Appearance
dialog
- Interpretation window now uses Dark Mode when it is selected in the Customize/Appearance
dialog
- Symbol Information window now uses Dark Mode when it is selected in the
Customize/Appearance dialog
CHANGES FOR VERSION 6.91.0 (as compared to 6.90.6)
- AFL: AddColumn supports 2 new formats: formatDateOnly and formatTimeOnly
to display DateTime() values
- AFL: SetOpacity( opacity = 1 ); to change opacity level (0..1) for subsequent
Plot() calls. Opacity = 1 means totally opaque, 0.5 - half-transparent (translucent)
0 - completely transparent (invisible)
- QuickGFX: Improved rendering of line plots with width>1 to better align
with GDI output
- QuickGFX: Opacity / Alpha blending implemented for styleBar plots
- QuickGFX: Opacity / Alpha blending implemented for styleCandle plots
- QuickGFX: Opacity / Alpha blending implemented for styleDashed plots
- QuickGFX: Opacity / Alpha blending implemented for styleDots plots
- QuickGFX: Opacity / Alpha blending implemented for styleLine plots
- QuickGFX: Opacity / Alpha blending implemented for styleStaircase plots
- QuickGFX: Opactity / Alpha blending implemented for styleArea plots
- QuickGFX: Opactity / Alpha blending implemented for styleHistogram plots
- UI: Column widths in Plugins window scale to DPI
- UI: Parameter dialog now keeps the collapsed state of sections, individually
on per-chartID basis (for as long as AmiBroker is running)
- IB plugin supplied with setup reverted to version 2.11
CHANGES FOR VERSION 6.90.6 (as compared to 6.90.5)
- HtmlView (report viewer) now calculates its initial size from screen DPI
so it gets larger on hidpi screens automatically
- HtmlView (report viewer) remembers its last window size now
- HtmlView (report viewer) has "HiDPI aware" flag set in the manifest,
that prevents Windows for blurring window
- AFL Reference now uses internal viewer that is able to redirect to online
version of the guide if help on particular topic is missing from off-line
(CHM) version
- Changed timestamp formatting in results.rlst back to previously used scheme
with '-' and ';' separators
CHANGES FOR VERSION 6.90.5 (as compared to 6.90.1)
- AFL: new field Status("seqstep") for reporting current sequence
step (1-based), returns 0 if action is NOT run as part of sequence
- NewAnalysis: "auto size to fit content" makes columns 10% wider
than before because MS ListView "autosizing" calculation does not
account for any margin
- NewAnalysis: default width of columns is now scaled by screen DPI so they
are not too narrow on HighDPI screens
- Text tool now has new "Use pixel co-ordinates" mode that allows
to fix position of text to pixel coordinates so it stays in place when you
move the chart
- Maximum number of parameters per section increased to 1000
- Commentary editor (richedit based, not scintilla) displays multi-line calltips
now (maxtipswidth called and long static buffer used)
- Added Help->Activate License dialog to provide better user experience
than given by MS SmartScreen :-(
CHANGES FOR VERSION 6.90.1 (as compared to 6.90.0)
- Registry key changed back to previously used HKCU\Software\TJP\Broker
- Report Explorer command line handling fixed
CHANGES FOR VERSION 6.90.0 (as compared to 6.49.1)
- AFL Editor: now extended function description is displayed in parameter
tooltips for all AFL functions
- AFL: All Gui* control functions added extra 'style' parameter
- AFL: renamed Map() to MapCreate() to avoid conflicts with existing code
using 'map' word as variable identifier, and added alias MxCreate to Matrix
for consistency
- AFL: SetOption - added yet another protection against passing absurd values
in AFL for AccountMargin (outside 1..100)
- AFL: SparseInterpolate function added to interpolate values between sparse
points given as input
- AmiQuote - when UserDataSources.xml config file is not found in the current
working directory, change CWD to the directory where Quote.exe is located
- Charts: an error is displayed when user has zoomed in / scrolled into blank
(no quote) area so there are no data to display
- Charts: Removed data access from non-GUI thread in DrawStockCustom()
- Charts: when pressing "END" key blank bars are only added upto
the point where at least 1 data point is visible on chart
- Filter dialog: added a "Clear All" button to Clear BOTH Include
and Exclude pages in one click
- New Analysis: Exploration: Removed limit of column text length in AddTextColumn
- New Analysis: Filter dialog would show categories that were assigned BLANK
names (or no name at all as) "<Category with empty name>" to
make sure that users don't assume that selecting empty name is the same as
pressing clear button. It isn't
- NewAnalysis: changed notice when "Apply to" filtering was too
strict so no symbol matched to instruct user to switch to "All symbols" or
change the filter
- NewAnalysis: Individual optimization crashed when GenerateReports was turned
on. Fixed.
- NewAnalysis: Removed data access from non-GUI thread in SetupParser in
GetNumberOfQuotations
- NewAnalysis: sharing violation could occur on attempt to write shared results.rlst
file when doing Individual optimization with GenerateReports. Fixed.
- NewAnalysis: since AmiBroker in individual optimization mode is fast enough
to produce dozens of reports in single millisecond a timestamp for report
folder needed to use more resolution than 1ms. Fixed using unique counter.
Now folder has YYYYMMDD_HHMMSS
- NewAnalysis: when user turned on 'Pad and Align" but reference symbol
does not exist in current database, an Error 76 is displayed.
- Regression in 6.49.1 - formulas with lots of AddToComposites could run
slower, now changed idle processing so queue is emptied faster
- ReportExplorer: file re-reads/refreshes are 10x faster now
- ReportExplorer: in case of file sharing violation due to intermittient
update of file by the other process, the message is quietly displayed in
the status bar instead of modal blocking dialog box
- ReportExplorer: now uses hyper-fast list view implementation borrowed from
AmiBroker. Results in 20x display performance improvement
- UI: Changed the way how "Start page" is displayed in the absence
of other MDI windows to prevent opening more than one on loading layout
- UI: Filter dialog now provides instructions to press Clear to start over
if filtering resulted in no symbols meeting selected criteria
- UI: Fixed crash when user attempted to make "Start page" floating
- UI: regression Log window did not show runtime errors from charts in 6.49.1.
Fixed
- UI: Symbol bar, a context menu key on the keyboard (VK_APPS) brings up
context menu (in addition to right click)
- UI: Symbol/Category view and Category dialog do not allow to set category
names to empty (blank) - it will revert to default name if user attempted
to remove name completely
- When weekly time compression was used, "MonthlyWeeklyUseAlwaysLastTradingDay" mode
was used, Monday was not a trading day, and only Tuesday was present, then
weekly bar had Monday timestamp instead of Tuesday. Fixed.
CHANGES FOR VERSION 6.49.1 (as compared to 6.49.0)
- AFL: formatDateTimeISO was working as formatDateISON (no separators). Fixed
so now it includes separators.
- AFL: new function trunc() that truncates fractional part, works identically
as int(). int() is now marked as obsolete and will be removed in some future.
All instances of int() should be replaced by trunc() in new code.
- AFL: in 6.49.0 int() function wasn't doing anything (no-op), regression
fixed.
- UI: in 6.49.0 the interpretation window crashed, regression fixed.
CHANGES FOR VERSION 6.49.0 (as compared to 6.43.0)
- Account: Summary page (grid) in dark mode displays read-only items in lighter
shade of gray for better readability
- AFL Editor: Added simple detector of pasting ChatGPT-generated code. Displays
a notice that ChatGPT is not able in most cases to produce valid code. Due
to stochastic nature of how ChatGPT produces code it might not detect all
cases.
- AFL Editor: Fold margin width now scales with font selected / DPI instead
of being fixed
- AFL Editor: UI, in auto-complete dropdown "Fals" was displayed
instead of "False". Typo fixed.
- AFL Editor: watch window displays arrays with less than 5 elements entirely
without ... (elipssis)
- AFL Editor: when symbol has no quotes, the AFL editor will now create synthetic
data to allow verify syntax and debugging anyway. Artificial data created
is just 1 bar (future), it allows code checking in this edge case
- AFL: added support for C++ -style raw strings
- AFL: AddToComposite requests are now served by idle message queue (gives
slight speed up and allows syncing with post process normalization)
- AFL: atcFlagNormalize performs normalization by dividing OHLCV fields by
the field given as argument (either "I", "1" or "2")
after scan is completed
AddToComposite(C, "~MY_COMPOSITE", "C");
AddToComposite(1, "~MY_COMPOSITE", "I", atcFlagNormalize
| afcFlagsDefaults ); // only use atcNormalize in the "counter"
- AFL: Crash could occur if type of second or subsequent argument for function
call was invalid, due to uninitialized memory. Fixed.
- AFL: experimental - added support for maps (dictionaries of key-value pairs,
aka associative arrays), note that all map variables (unlike other types)
are really references, so when you pass it to a function you are passing
reference and original object i
- AFL: Matrix( rows, cols, init_val = Null, increment = 0 ) has now new parameter
'increment' that allows to create a matrix with monotonically increasing
elements
Example:
m = Matrix( 1, 10, 0, 0.25 );
printf("%s", MxToString( m ) );
would produce
{
{ 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25 }
}
- AFL: micro-allocator block size bumped to 64 bytes in both 32bit and 64bit
versions for better alignment with cache line size and better performance
- AFL: new Error 74 - AmiBroker now reports invalid non-ASCII characters
being used in the formula code. Non-ASCII codes (>127) are only allowed
in strings and comments.
- AFL: Nz() function now accepts scalars and arrays in ValueIfNull argument
(previously only scalar was accepted)
- AFL: SafeDivide - added support for 3rd argument (resultIfZeroDiv) to be
array in case when 1st and 2nd args are arrays
- AFL: Static variable declaration now allows custom initial value. The initial
value expression is evaluated and assigned to static variable only if static
variable wasn't present before. If initial value is not given, declared static
variable is automatically initialized as scalar value of zero (0)
#pragma enable_static_decl(prefix)
static _a = 0, _b = 0, _c = 0; // explicit initial values
static _x; // this would automatically be intialized as number
equal zero (default)
static _my_str_var = ""; // this would be initialized as empty
string
static _y = 1; // this would be initialized as numeric value of 1
static _z = ( High + Low )/2; // this would be initialized with (H+L)/2;
function MyInitFunction()
{
printf("NOTE THAT THIS INTIAILIZER function is called only when static
variable does NOT exist already");
return 2;
}
static _w = MyInitFunction(); // the init will be called just
once, if and only if static variable _w does not exist yet
Static variables declared without initial values are not written to static
var memory unless they are assigned any value later in the code.
This is to conserve memory in case when someone declared variable but did
not use at all.
One caveat for real geeks, regarding non-constant initialization of
static variables: if you are initializing the same non-existing variable
from mutliple threads with different values at the very same time,
initial value expressions (including functions that you might call)
might be executed in parallel in many thread and the final value that
gets assigned to the same static variable from multiple threads would
depend on which thread ends its execution last (as declared static
variables are written back to global memory at the end of formula execution).
To avoid that it is advised to use different prefixes in different
formulas.
- AFL: StaticVarInfo now adds support for "count" field that allows
to count variables based on wildcard mach. StaticVarInfo( "prefix*", "count")
- AFL: stricter checking for format string passed to printf() / StrFormat
and against types of arguments passed
Now if you specify %s it won't allow you to pass non-string in argument list
In similar fashion if you specify %f, %g, %e it won't allow you to pass non-numeric
argument
- AFL: SumSince has new optional argument incFirst - SumSince( Condition,
Array, incFirst = False ) that decides whenever first bar value when condition
is true is included in sum or not
- AFL: using PlaySound somehow slowed down other worker threads. Fixed by
explicit termination of playback of previous sound.
- Charts: flyout buttons for closing/rearranging chart panes now scale properly
with changes in screen DPI
- Indicator maintenance wizard automatically creates timestamped backup file
(broker.newcharts.imYYYYmmddHHMMSS.bak) from broker.newcharts so in case
of failure original broker.newcharts can be easily restored
- New Analysis: add a notice / info in the backtest report when equity gained
more from interest than from trades alone - indicating that results are based
primarily on cash sitting idle than trading system. Also added the number
of times liquidity limit was hit
- QuickGFX: fixed crash with styleCloud when cloud was totally outside visible
area (above top or beyond bottom of chart)
- TDL #3818 revisited. There were more cases when worker thread attempted
to read string from resources sometimes resource handle was set incorrectly,
this caused COleException / unknown error. Fixed by replacing faulty MS CString::LoadString
implementation
- Tools: Indicator maintenance - added check for valid parent (property sheet)
- UI: Edit->Delete range now supports multiple selection in the Symbol
pane, so it can delete range of quotations from multiple symbols at once
As a reminder: multiple selection works when you hold down CTRL key and select
individual items from list, or when you hold down SHIFT key and select first
and last item from the list.
( https://forum.amibroker.com/t/afl-to-delete-quotes-before-a-specific-date-in-a-database/35777/8
)
- UI: In XAML markup, units such as pt, in, cm and mm now scale properly
to HiDPI
- UI: Modal dialog boxes that aren't dismissed first flash but on next wrong
click they move to mouse position
- UI: Property Grid (Symbol Information/Account summary) expand buttons scale
properly to HighDPI displays
- UI: Start page uses system icon font and updated design with scalable vector
icons
- UI: Symbol->Organize Assignments full name column was not always refreshed
initially (required click on radio button). Fixed
- UI: XAML markup checkboxes now properly scale to HiDPI
CHANGES FOR VERSION 6.43.0 (as compared to 6.42.0)
- WebResearch: implemented alternative browser engine - Chromium-based Edge
- (currently this is 64 bit only feature)
Since Microsoft apparently wants to stop supporting Internet Explorer engine
that many 3rd party programs use via CHTMLView MFC component,
and many web sites abandon support for IE HTML engine,
I have implemented alternative web browser based on Chromium/Edge WebView2
that is available on Windows 10+.
To use new web browser engine within AmiBroker you have to use 64-bit AmiBroker
and do the following:
1. Download x64 WebView2 component from Microsoft
https://developer.microsoft.com/en-us/microsoft-edge/webview2/
2. In AmIBroker go to Tools->Preferences, "Miscellaneous" tab
and turn ON the option "Use Chromium/Edge (WebView2) for Web Research"
3. Restart AmiBroker
From now you can use File->New->Web Research and it will use modern
Chromium engine
- AFL Editor: implemented multi-cursor navigation
- AFL Editor: added inline "Info" messages that show which lines/functions
cause looking into the future, can be turned off via Prefs/Debugger or via
Tools->Options menu in AFL Editor
- AFL Editor: added support for multiple selection editing (you can use CTRL+
left mouse button to place multiple cursors / selections and then typing
would occur in sevaral places at once, also Alt+drag will make rectangular
shape + multicursor in each lin
- AFL Editor: implemented CTRL+D (multiple select add word / add next occurrence)
- AFL Editor: implemented split window editing that allows to have two views
on same file (Window->Split or Ctrl+\ (backspace))
- AFL: added a warning 514 (not error for backward compat) to be issued when
NEW LINE is detected in string literal
- AFL: fixed uninitialized variable error when Plot() and subsequent graph0
variable reference was used inside same curly braces block
- AFL: Invalid non-printable characters (such as \n) in Plot() name now generates
warning, not an error, allowing badly written code to continue to work (so
users not reading the ReadMe stop complaining).
- AFL: TrimResultRows( row_count ) - trims the result list to specified number
of rows, positive row count means counting from top, negative from bottom.
TruncateResults( from_row = 10 )
- Analysis: fixed possible CRT invalid parameter exception when user formula
contained forbidden % character
- Charts/Pref: increased upper limit of "Minimum X grid spacing" from
120 to 200 pixels for high-DPI displays
- New Analysis: when symbol's quotes were filtered out completely due to
padding to reference symbol, instead of blocking error dialogs, a summary
of all affected symbols is displayed in the INFO tab
- Parameter file (broker.params) now escapes control characters like \n to
prevent corruption if user does not follow rule of NOT including control
characters in parameter names/values
- UI: Preferences: new tab "Text box" to define text-box font styles
- UI: Text box tool - edit field now uses selected font style/size so it
provides WYSIWYG display of what text would like on chart
- UI: Text box tool - new combo box "Font style" to select one
of 16 user-definable font styles
CHANGES FOR VERSION 6.42.0 (as compared to 6.41.0)
- AFL: new field supported by GetOption("BHSymbol") - get Portfolio
B&H symbol. Note that this is read-only (can't set it via SetOption)
- AFL: one-shot auto-save of persistent static variables feature is now available
via SetOption("StaticVarAutoSave", -1 )
- Fixed possible crash when drawing pointer become invalid (now drawings
are referred by bound checked index)
- IQFeed: the plugin now has "Symbol guide" context menu option
- IQFeed: the plugin now has an option to consolidate unbundled ticks (i.e.
ticks with same TickID)
- Scheduler: added "Pause" button to pause execution of scheduled
tasks (batches already running will complete normally)
- UI: If modal window is displayed (like Filter dialog) and user clicks on
blocked parent 3 times in a row, the modal window is repositioned to where
mouse cursor is, to bring attention of the user to the modal window that
needs to be closed
CHANGES FOR VERSION 6.41.0 (as compared to 6.40.4)
- 64-bit version compiled now with new Visual Studio 2022
- New Analysis: Exploration now supports "Show current trade arrows" command
- QuickGFX: styleDots did not get bigger when width/thickness param is increased.
Fixed.
- QuickGFX: solid rectangle fill speeded upto 3x on larger areas
- AFL Editor: When errors are detected the "Explain" button is
added to the caption bar that displays help page with error explanation.
Subsequent presses to "Explain" button move to next error message
- AFL: added support for Python-style raw strings. Raw strings use letter
r before double or single quote and don't perform espace sequence transformations,
so you don't need to use \\ in paths if you use raw string: r"raw\string\syntax" or
r'raw\string\sy
- AFL: GfxDrawImage function, if underlying Windows LoadImage fails to load
BMP file, the Windows last error code is printed to system debugger (DebugView)
- ASCII import: duplicate lines in very large files caused unusual slow down,
now duplicate lines are detected and removed early, improving import time
in such unusual cases.
- Easy alerts now display comment field content in Alert Output window
- Report: Parameters in the report are now listed in alphabetically sorted
order
- UI: a message box is displayed when system returns from Sleep/Hibernation
while being connected to RT plugin to make user aware NOT to use sleep while
collecting real time data
- UI: added "Start Page" that provides basic new user orientation,
news and updates and links to open new charts, analysis, formulas, and other
windows
- UI: custom tools menu (Tools->Customize, "Tools" tab) allows
now to run batches via #runbatch command. To run a batch, use #runbatch in "Command" field,
and full path to batch (.abb) file in Arguments field
- UI: custom tools menu command arguments now support special token {symbol}
that gets replaced with currently selected symbol. This is to allow triggering
for example AmiQuote downloads for current symbol only
- Zoom and tab order stored in layout could be ignored when number of MDI
windows was too large. Fixed
CHANGES FOR VERSION 6.40.4 (as compared to 6.40.3)
- Charts: on specifically prepared formulas producing sparse array a moire
effect with histogram chart can be seen under rare circumstances. Fixed.
- UI: when Tickerbar was customized in previous versions it could come up
as empty in 6.40.2 until it is RESET via customize dialog. Fixed.
- QuickGFX, simple bar chart, width > 2, end caps are drawn to ensure
that open/close ticks are visible in high zoom out levels
- Toolbar Zoom in/out auto-repeat period decreased to 100ms (from 150ms)
- QuickGFX: styleGradient wasn't supported in 6.40.2-6.40.3. Now it works
again (fallback to GDI)
- Docs: added GuiSetColors to help file
- Charts: 3-color gradient charts could be drawn incorrectly if user-defined
base line level was outside chart Y axis range. Fixed
CHANGES FOR VERSION 6.40.3 (as compared to 6.40.2)
- OLE: new Quotations.Adjust could enter infinite loop. Fixed
- QuickGFX: fixed division by zero on gradient fill when top == bottom
- QuickGFX: styleDashed implemented
- UI: on HiDPI screens Tickerbar dropdown item height was too small in 6.40.2.
FIxed
- UI: Ticker bar has been reimplemented to allow quick handling of millions
of symbols (done in 6.40.2 but missing in change log)
- UI: Ticker bar search / auto-complete is re-introduced (it was not working
in 6.40.2 because TickerBar no longer uses standard combo box and combo box "built-in" features
were absent)
- UI: when Tickerbar was customized in previous versions it could come up
as empty in 6.40.2 until it is RESET via customize dialog. Fixed.
CHANGES FOR VERSION 6.40.2 (as compared to 6.40.0)
- AFL: regression new Error 72 was incorrectly generated when amount was
zero but mode was set to Disable (like in Equity.afl file). The combination
of zero amount and disable is of course valid and error is no longer produced
in such case.
- New Analysis window: #pragma sequence(scan,backtest) - and new "Run
Sequence" button to run same formula with same settings several times
in sequence using different modes
- Charts: QuickGFX rendering of cloud style charts is now 100x faster
- Charts: GDI rendering of cloud style charts is now 2x faster
- 32-bit/Charts: x87 assembly code used for faster conversion from float
to int. This gives +20% performance improvement in both GDI and QuickGFX
rendering modes
- 64-bit: the size of internal exit signal structure increased to allow backtest
with more than 1 million symbols (at the cost of increased RAM usage). 32-bit
version still uses smaller structure and 1 million symbol limit
- AFL Editor: Defunct Print menu option removed from context (right-click)
menu. Working Print option is available in File->Print menu
- AFL: _SECTION_BEGIN() - section name is checked against not allowed control
characters
- AFL: array version of ColorHSB function is 50% faster now
- AFL: new function BarsSinceCompare( past, comparison, current ) - for every
bar, compare past array values with current bar value and return the number
of bars since last time comparision was true
- AFL: New warning 511 for incorrect usage of IIF function: "Assignment
within IIF function arguments. Use IIF() return value instead"
- AFL: Param*() functions check if user passed non-printable/control characters,
that are forbidden in parameter names and display appropriate error message
- AFL: Status("baseinterval") - new field "baseinterval" returns
database base time interval setting in seconds
- AFL: Warning 501 (assignment within conditional) is silenced if assignment
is made to the variable that wasn't intitialized before (i.e. it is first
assignment of given variable ever in code)
- ASCII import: combination of $HYBRID 1 without "autoadd" mode
produces an error on non-existing symbols now.
- Charts: 40% speedup in determination of auto-scale min/max (signficantly
affects chart rendering performance for very large number of bars >500K)
- Charts: Bar-to-XPixel coordinate conversions speeded up 3x by using assembly
in 32-bit and _div64/__emul intrinsics in 64-bit versions
- Charts: when QuickGFX was enabled multi-color title text was slightly truncated
at the color boundaries. Fixed.
- DB: when user renames the symbol corresponding Note text file name is renamed
accordingly now
- Fixed regression introduced in 6.39 when the very last value in MA was
non-Null even if there was not enough data
- OLE: added Stock.Quotations.Adjust() function. long Adjust(BSTR pszFieldList,
float fMultiplier, float fOffset, DATE dDateTime, boolean bBefore)
- QuickGFX: New lines in Title variables caused double spacing. Fixed
- QuickGFX: styleHistogram was invisible for negative values. Fixed
- UI: Param window, names of parameters are not tructated on HighDPI screens
anymore
- When worker thread attempted to read string from resources sometimes resource
handle was set incorrectly, this caused COleException / unknown error. Fixed
by replacing faulty MS CString::LoadString implementation.
- QuickGFX: Line width > 1 implemented
- AFL: ADX/PDI/MDI protected against division by zero when data are completely
flat (H == L == C for long periods of time)
- AFL: Warning 512 added to detect overusage of Foreign/SeForeign calls
- Analysis report charts: regression: when QuickGFX was enabled, report charts
could cause exception. Fixed.
CHANGES FOR VERSION 6.40.0 (as compared to 6.39.1)
CHANGES FOR VERSION 6.39.1 (as compared to 6.39.0)
- 64-bit uses a bit faster float versions powf and modf instead of double
pow/mod for ^ and % operators (non integers)
- Analysis/Settings: added 3 checks and warnings to prevent users from entering
combination of MinPosValue/MaxPosValue/AllowPosShrinking/RoundLotSize that
are likely to prevent all trades from being taken at all
- array ^ (exponentation) operator made 50-100x faster in special cases of
small INTEGER, scalar exponents of 2, 3, 4 and 5 by using multiplication
instead of calls to C runtime powf()
- calling GuiSetText from AFL formula caused notifyEditChange notification
to be sent. If user formula responded to notification with another GuiSetText
this could create loops. Now notifications are silenced if changes come from
user code
- When one pane had Gui controls and the other pane on another chart sheet
was completely blank, then GUI controls from populated tab remained displayed
after switching to completely blank sheet. Fixed
CHANGES FOR VERSION 6.39.0 (as compared to 6.38.0)
- 64-bit: AmiBroker, AmiQuote, AFL Code Wizard migrated to newest VC++ 2019
for even better performance
- AFL Editor: @link commands are executed at mouse up (instead of previous
mouse down) to prevent unwanted text selection when message boxes are dismissed
- AFL Editor: call tips (parameter information tooltips) now provide extra
description about the function and its parameters (as of v6.39 only 20 functions
have this extra info)
- AFL Editor: debugging session is automatically terminated with appropriate
notice when user attempts to edit the code during debugging (this saves mouse
clicks that were needed to stop debug session in order to edit)
- AFL Editor: previously when no text was selected and Prettify Code was
choosen, the message box caused main frame to get focus instead of focus
staying in AFL frame. Fixed
- AFL Editor: when an runtime error is detected debugging session the message
bar shows now number of detected errors (as it did previously during normal "verify"
- AFL Editor: when dark mode list views are used watch window default text
color was black making it hardly visible, changed to white
- AFL/CBT: AmiBroker now displays an error when user passes incorrect bar
number to ProcessTradeSignals() instead of silently skipping wrong arguments
- AFL: added protection against assigning wrong types to some built-in variables
such as *Price arrays. If wrong type is assigned the error 71 Type mismatch
in assignment is displayed
- AFL: ADX() function vectorized in 64-bit version (2x faster than before)
- AFL: backtester crashed when user incorrectly assigned string value to
BuyPrice/ShortPrice/CoverPrice arrays. Fixed.
- AFL: Error("text", stop=False) function - added extra parameter
to stop execution regardless of "stop execution at first error" preference
setting
- AFL: FindIndex( array, value, start_from = 0, dir = 1 ) - find index of
array item matching specified value
Returns:
NUMBER - the index of matching array item
if value is not found in the array, the function returns -1
Parameters:
array - input data
value - what we are looking for
start - the index to start the search from
dir - the direction of the search, 1 is up, -1 is down
Notes:
start can be positive - then it refers to index number counting from the
beginning of array
or it can be negative then it refers to index counting from the END of
the array
// example find all indices when condition
was true
condition = Cross( C, MA( C, 20 )
);
// search forwards
printf( "Search
forwards:\n" );
for( index = 0;
( index = FindIndex( condition, True,
index ) ) != -1; index++ )
{
printf( "condition
is true at index %g\n", index );
}
// search backwards
printf( "Search
backwards:\n" );
for( index = -1;
( index = FindIndex( condition, True,
index, -1 ) ) != -1;
index-- )
{
printf( "condition
is true at index %g\n", index );
}
- AFL: If warning level >= 3, InternetOpenURL() function now displays
a warning 507 if OS generated exception when accessing remote resource, the
same way as InternetPostRequest
- AFL: increased calculated bar requirements for Wilders() function for better
conformance with QuickAFL
- AFL: Last OS error code is set by Internet* functions regardless of warning
level so you can always retrieve it using GetLastOSError()
- AFL: MA( C, BarCount ), StDev( C, BarCount ) return non-Null value
- AFL: new field added to SetOption/GetOpion function calls "MaxPosValue" (per
backtest setting)
- AFL: new function InternetSetHeaders( "headers" ) - set custom
HTTP headers for subsequent web requests
For example to enable GZIP compression you need to use:
INTERNET_OPTION_HTTP_DECODING = 65;
InternetSetOption( INTERNET_OPTION_HTTP_DECODING, 1 );
InternetSetHeaders("Accept-Encoding:
gzip, deflate");
- note that InternetPostRequest will automatically add "Content-Type:
application/x-www-form-urlencoded" header unless user specifies their
own Content-Type in the InternetSetHeaders call
- AFL: new function InternetSetOption( option, value ) - set HTTP option
for internet session. Internet Options can be found here: https://docs.microsoft.com/en-us/windows/win32/WinInet/option-flags
// how to request and handle GZIP compressed
HTTP
INTERNET_OPTION_HTTP_DECODING = 65;
InternetSetOption( INTERNET_OPTION_HTTP_DECODING, 1 );
InternetSetHeaders("Accept-Encoding:
gzip, deflate");
ih = InternetOpenURL("http://www.amibroker.com/news.html" );
if( ih )
{
while( ( text = InternetReadString(
ih ) ) != "" )
{
printf( "%s",
text );
}
InternetClose(ih);
}
- AFL: new function MxCopy - for copying rectangular blocks from one matrix
to the other (copy portions of one matrix to the other matrix)
The function works in-place (ie. no allocation occurs - first argument is
a reference to existing array and that array content would be overwritten)
MxCopy( & dstmatrix, dst_start_row, dst_endrow, dst_start_col, dst_end_col,
src_matrix, src_start_row = -1, src_end_row = -1, src_start_col = -1, src_end_col
= -1 )
src_start/src_end values equal to -1 mean "same value as corresponding
dst_start/dst_end value"
To perform a copy the number of columns multiplied by number of rows in
source and destination "rectangles" must be the same
In other words:
(dst_end_row-dst_start_row+1)*(dst_end_col-dst_start_col+1) == (src_end_row-src_start_row+1)*(src_end_col-src_start_col+1)
- AFL: new function: _exit() - that gracefully ends AFL execution at the
point of the call
- AFL: new function: InternetGetStatusCode function - returns HTTP status
code of last InternetOpenURL or InternetPostRequest call. HTTP status codes
are listed here: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
// Example:
// NON existing page (should result in status code 404)
ih = InternetOpenUrl("http://www.amibroker.com/index3434.html" );
if( ih )
{
printf("HTTP
status code: %g", InternetGetStatusCode(
ih ) );
InternetClose( ih );
}
else
{
printf("Internet
connection can not be open because: %s", GetLastOSError()
);
}
- Analysis/Backtest: added "Max. position value" option in the
settings allowing to specify maximum dollar value of position. Zero (0) means
no maximum. Positions larger will be shinked (if shrinking is enabled) or
won't be entered at all (if shrinking is d
- Charts/Preferences: added Text Tool font setting independent from Axis
font (Preferences->Miscellaneous page)
- Charts: Text Box tool supports user-selectable font size now (selectable
in Study Properties window)
- Database: new 8-digit ICB structure implemented: https://www.ftserussell.com/data/industry-classification-benchmark-icb
- Got rid of obsolete "Request data on save" setting that wasn't
performing as expected
- Plugin interface: added compatibility layer allowing old plugins to safely
call functions even when they have modified signature (added new default
parameters). When plugin calls function with less than expected number of
arguments, missing some of defaul
- When variable was passed to user function by reference, ++ operator inside
had no effect on referenced variable (outside of function). Fixed.
CHANGES FOR VERSION 6.38.0 (as compared to 6.35.1)
- 64-bit version could produce "Invalid parameter" exception from
CRT after backtesting when symbols under test had forbidden characters in
them like "%". Fixed
- 64-bit version: address space layout randomization disabled by /DYNAMICBASE:NO
linker option to facilite easier crash location finding
- AFL: assignment new matrix value to a variable already holding matrix value
did not immediately free memory (at the time of assignment). This memory
was only freed at the end of the formula. Now it is freed earlier (at assignment)
to lower memory usage.
- AFL: GetFnData("lastsplitdate") returns empty val instead of
zero if last split date is not set
- AFL: GfxDrawImage with PNG file could fail if very same file was accessed
simultaneously from multiple threads due to "no-sharing" mode that
3rd party XTP lib used. Fixed by using shareDenyWrite
- AFL: new function Chr( code ) returns string representing single character
of given ascii code
- AFL: new function GetObject( path, class ) providing functionality equivalent
to JScript GetObject and VBScript GetObject
- AFL: new function GuiSendKeyEvents("ED") - register given characters
to be sent as Gui event when keyboard key is pressed. GuiGetEvent will return
code == notifyKeyDown and id of given character, for example id == 'D' for
D letter
- AFL: StaticVarAdd when scalar value was added to already existing static
var array sometimes random value would appear. Fixed.
- AFL: when file creation or modication date was exact midnight fgetstatus()
returned datetime indicating "eod mark" (date without time), now
it gives 00:00:00
- Analysis: Maximum number of threads per single Analysis window has been
increased to 64 (from 32)
- Backtester: generation of Buy&Hold stats was not working when "Allow
position shrinking" was turned OFF by the user and commission > 0.
Fixed
- Chart: Data window can now display upto 40 values per single chart pane
- Chart: Horizontal line snap to open price (keypress O) or close price (keypress
C) was snapping to H-L instead. Fixed
- Charts: Snap to price - the meaning of threshold is changed - instead of
% of price it now means % of chart height. So 5% will snap within +/-5 of
chart height. This allows it to work universally across different securities
(stocks/forex) and different zo
- IQFeed: improved IQFeed plugin (better support for long EOD histories in
mixed mode)
- New Analysis: the name of column "contracts/shares" changes each
time you change futures mode to prevent confusion among newbies
- Plugins: when AFL plugin crashes (throws structured exception) the editor
and indicator windows will display call stack for easier debugging of 3rd
party plugins
- UI: Dialog boxes are moved back main display screen if multi-monitor configuration
was changed and multi-monitor setup is not rectangular (for example monitors
of different sizes)
- UI: Listview sorting by (single) date column is now 10+ times faster
- UI: Listview uses non optimized parsing for str to date conversion for
date formats that include names of the months instead of numbers (avoids
problems with different names of months in different languages)
- UI: Main window and AFL Editor frame is moved back to (0,0) if multi-monitor
configuration was changed and multi-monitor setup is not rectangular (for
example monitors of different sizes), so saved position falls outside currently
available working area
- UI: MDI Close/Minimize/Restore buttons are now HighDPI aware
- UI: MDI Tab client window buttons are now HighDPI aware
- UI: Minimized flicker during docking panes resize by disabling Windows
copy bits
- UI: Toolbar split-popup buttons are now HighDPI aware
- x64 eSignal: reverted to more compatible version compiled with VC2005
CHANGES FOR VERSION 6.35.1 (as compared to 6.35.0)
- When .abb file was saved in older version and was missing Param2 then Param
was incorrectly used as default value. Fixed.
- Changed threshold year for two digit year data files to 25 (previously
it was 20). So YY is now interpreted as 19YY when YY < 25, otherwise it
is interpreted as 20YY
CHANGES FOR VERSION 6.35.0 (as compared to 6.31.0)
- AFL: new function inverf(x) - inverse of erf function
- AFL Editor: added function navigation combo box in the toolbar - detects
user defined functions and allows to quicky navigate to function definition
- AFL: GetOption("PadAndAlignToReference") allows to query Pad
and align setting status (note that this is read-only field, so it will not
work with SetOption)
- AFL: new function erf(x) - computes Error function https://en.wikipedia.org/wiki/Error_function
- AFL: parser warns if empty body is used in 'for' statement, like this:
for( i = 0; i < 10; i++) ; // extra semicolon at the end - empty body
Warning 510
- AFL: parser warns if empty body is used in 'while' statement, like this:
while( condition ) ; // extra semicolon at the end - empty body Warning 510
- AFL: SafeDivide( x, y, valueifzerodiv )- safe division that handles division
by zero using special handling (replace result with user-defined value)
- Batch: added optional parameter to Data Import ASCII command to allow specify
format definition file
- Batch: added optional parameter to Execute and Wait command to specify
current working directory for command
- Batch: added optional parameter to Export to File / Export walk-forward
to file to specify column separator in CSV files
-optional parameter defines the column SEPARATOR used for export. Only single
character is used. When it is not supplied, comma is used.
- Batch: Clipboard Cut/Copy/Paste implemented in batch editor
- Batch: Edit->Delete (from main menu) and Edit-Delete All implemented
for completeness
- Batch: list view uses virtual mode now (owner data)
- UI: All owner-draw list views (NOT in dialogs) now feature customizable
theme (currently available "system (light) theme" and "black
theme") - go to Tools->Customize, "Appearance" tab, "Dark
mode for listviews" checkbox
- UI: Analysis and RT quote window use now exactly the same RGB values for
up/down (green/red) colors for consistency
- UI: Custom virtual listview (owner data) supports per-item data now (SetItemData/GetItemData
work with LVS_OWNERDATA)
- UI: Found workaround to avoid terrible flicker and bad rendering of list
view controls during fast page up/down and side scrolls (even though they
are double buffered by Windows and in theory should be smooth).
- UI: Identified even more bottlenecks in Windows OS that caused even owner
data and owner draw Listview performance to suffer with large number of columns.
OS code circumvented. Listview redraw speeds increased more than 5x compared
to previous speedy implementation
- UI: Implemented resizing of Listview column customization dialog
CHANGES FOR VERSION 6.31.0 (as compared to 6.30.0)
- AFL: Access violation in PercentRank when period is wrong (Null/unitialized).
Now error 52 is displayed instead.
- AFL: InternetPostRequest now silently (or with warning 507 under debugger)
returns NULL handle instead of error when remote server responds with HTTP
Status 50x
- Analysis: manual column re-sorting could be bit off if scientific output
format (xxxEyyy) was used with different exponents. Fixed.
- ASCII importer now handles LastSplitRatio of X:Y where X and Y are 1...32767
(previously only 1..127)
- Batch: add "add results to watchlist" action / WatchlistAddResults
- Batch: add "clear watchlist" action / WatchlistClear
- Batch: add "comment" action
- Core/DB: fixed access violation when all data were removed while QuickData
was turned on
- DebugView: eliminated some internal messages from DebugView output (from
release version)
- InternetPostRequest - even if URL started with https, previous version
wanted to connect to port 80, instead of 443. Fixed.
- UI/Listview: since 6.28 exception could occur if single cell text length
exceeded 1024 characters. Fixed.
- When database is empty, ticker box displays <No symbol> grayed text
instead of blank or reminiscent of previous database symbol
CHANGES FOR VERSION 6.30.2 (as compared to 6.30.0)
- AFL Editor: @link command now works on single click (instead of double
click)
- AFL Editor: multiple error messages per single code line are now differentiated
and lead to different user guide pages when clicked
- AFL Editor: When mouse hovers over the error message the mouse cursor changes
to "Hand" and the error message is clickable as normal "link" leading
to users guide description of error message
- AFL: ApplyStop with ExitAtStop=2 parameter when used together with backtestRegular
mode did not trigger stops in 6.25-6.30. Fixed.
- AFL: new function InternetPostRequest( url, data, flags = 0 ) - allows
to make POST HTTP requests
ih = InternetPostRequest( "http://server_name_here.com/testpost.php?param3=7&m4=8", /*POST
DATA*/ "param1=9&m2=12" );
if( ih )
{
while( ( str = InternetReadString(
ih ) ) != "" )
{
printf( "%s",
str );
}
InternetClose( ih );
}
// testing code (server side ) in PHP:
<?php
echo "Post variables: \r\n";
foreach ($_POST as $key => $value){
echo "{$key} = {$value} \r\n";
}
echo "Get variables: \r\n";
foreach ($_GET as $key => $value){
echo "{$key} = {$value} \r\n";
}
?>
- AFL: Now() function supports format = 11 - returns Unix timestamp (number
of seconds since Jan 1, 1970)
- AFL: OscP/OscV could cause exception in unlikely event when entire Close
or Volume array was filled by Null values. Fixed
- Docs: added detailed descriptions of Warnings 504, 505, 506, 507, 508 and
509, Errors 63, 64, 65, 66, 67, 68, 69, 70
- Docs: updated documentation on ApplyStop to include activationFloor
- Intraday date axis hours could show 24:00 when negative timeshifts were
defined in the settings. Fixed
- Matrix variables that were passed to single-argument math functions (sqrt,
exp) did not have their ref count updated correctly. Fixed.
- Plugins are now loaded from work_dir\Plugins if exe_dir\Plugins folder
does not exist
- Pref: "Ask before closing indicator pane" is now turned on by
default
- Pref: Misc/ Max Number of decimal places in titles and RT quote bumped
o 7
- UI: In 64-bit version only the .AFL extension in the editor window caption
was removed. Fixed.
- Web Research predefined profiles: removed "MarketWatch" because
the site is not available anymore
CHANGES FOR VERSION 6.30.0 (as compared to 6.29.0)
- AFL: GfxSelectPen function - added support for geometric pens (including
flat endcap):
PS_ENDCAP_FLAT = 0x200;
PS_ENDCAP_SQUARE = 0x100;
GfxFillSolidRect( 100, 80, 200, 260, colorGreen );
// flat end cap
GfxSelectPen( colorRed, 10,
PS_ENDCAP_FLAT );
GfxMoveTo( 100, 100 );
GfxLineTo( 200, 200 );
// square end cap
GfxSelectPen( colorRed, 10,
PS_ENDCAP_SQUARE );
GfxMoveTo( 100, 120 );
GfxLineTo( 200, 220 );
// round end cap (default)
GfxSelectPen( colorRed, 10 );
GfxMoveTo( 100, 140 );
GfxLineTo( 200, 240 );
- AFL: GuiEnable( id, enable ) - enables / disables GUI control. Disabled
control can not be clicked and has "grayed" look
- AFL: GuiGetValue( id ) - gets the value of GUI control (for example slider
position). For non-slider controls value is number representing control text
converted to number)
- AFL: GuiSetValue( id, value ) - sets the value of GUI control (for example
slider position). For non-slider control value will be converted to text
and assigned as GuiSetText( id, NumToStr( value ) )
- AFL: GuiSetVisible( id, visible ) - shows/hides GUI control
// control identifiers
idSlider = 1;
idEnable = 2;
idDisable = 3;
idShow = 4;
idHide = 5;
function CreateGUI()
{
if ( GuiSlider(
idSlider, 10, 30, 200, 30, notifyEditChange )
== guiNew )
{
// init
values on control creation
GuiSetValue(
idSlider, 5 );
GuiSetRange(
idSlider, 1, 100, 0.1, 100 );
}
GuiButton( "enable",
idEnable, 10, 60, 100, 30, notifyClicked );
GuiButton( "disable",
idDisable, 110, 60, 100, 30, notifyClicked );
GuiButton( "show",
idShow, 10, 90, 100, 30, notifyClicked );
GuiButton( "hide",
idHide, 110, 90, 100, 30, notifyClicked );
}
function HandleEvents()
{
id = GuiGetEvent( 0, 0 );
switch ( id )
{
case 2:
GuiEnable(
idSlider, True );
break;
case 3:
GuiEnable(
idSlider, False );
break;
case 4:
GuiSetVisible(
idSlider, True );
break;
case 5:
GuiSetVisible(
idSlider, False );
break;
}
}
CreateGUI();
HandleEvents();
Title = "Value = " + GuiGetValue(
idSlider );
- AFL: Hexadecimal numbers can be now written using 0x prefix (as in C/C++)
- AFL: In 6.29 GfxSelectPen function was not functioning without geometric
style. Fixed.
- AFL: InternetOpenURL( url, flags = 0 ) - added 'flags' parameter
Note 1: Flags are the same as defined by WINAPI, examples:
INTERNET_FLAG_RELOAD = 0x80000000;
INTERNET_FLAG_NO_COOKIES = 0x00080000;
Flags should be combined using binary OR operator: |
Note 2: ASCII transfers are used always
INTERNET_FLAG_RELOAD = 0x80000000;
INTERNET_FLAG_NO_COOKIES = 0x00080000;
// Example don't use cached content and don't use
cookies
ih = InternetOpenURL( "http://www.google.com",
INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_COOKIES );
InternetClose( ih );
- AFL: new function GuiSetRange( min, max, step, ticfreq ) - sets the min-max
range of slider control
if( GuiSlider( 1, 10, 30, 200, 30, notifyEditChange )
== guiNew )
{
// init values on control creation
GuiSetValue( 1, 5 );
GuiSetRange( 1, 1, 100, 0.1, 100 );
}
Title = "Value = " + GuiGetValue( 1 );
- AFL: new function GuiSlider( id, x, y, width, height, notifyflags ) - creates
slider control
- AFL: new function remap( x, fromMin, fromMax, toMin, toMax ) - performs
re-mapping from one range to another, works on scalars and arrays
- AFL: When OLEDATE type (read from OLE objects) is assigned to AFL variable
it gets converted to string using ISO format (YYYY-MM-DD HH:MM:SS). Time
part only appears for records within non-zero time component
- ASCII import: Aux1/2 fields can now be imported separately from two different
files (combined) when using $HYBRID
- In 6.29 estimated number of optimization steps displayed in 'warning' in
case of tiny (fractional) step increment may be lower than actual number
of steps
- In 6.29, due to changes, some chart Gui* controls (owner draw) did not
repaint on window resize. Fixed.
- UI: File->New Database-> Create button now recursively creates all
missing directories if multiple nested non-existing dirs were typed in
- UI: new databases are now created in separate "databases" subfolder
by default
CHANGES FOR VERSION 6.29.0 (as compared to 6.28.0)
- AFL: added GuiDateTime function
lastdate = StaticVarGetText("lastdate");
if( GuiDateTime( 100, 10, 35, 200, 30,
notifyEditChange ) == guiNew )
{
GuiSetText( lastdate, 100 );
_TRACE("new!!!!");
}
id = GuiGetEvent( 0, 0 );
code = GuiGetEvent( 0, 1 );
if( id == 100 && code
== notifyEditChange )
{
lastdate = GuiGetText( 100 );
StaticVarSetText( "lastdate",
lastdate );
}
Title = "" + lastdate;
Plot(C,"t", colorRed );
- AFL: Gui creation functions (GuiButton, GuiEdit, GuiDateTime and others)
return guiNew (1) when control
is newly created or guiExisting (2)
when control already exists. This is useful for one-time initialization when
control is being created.
- AFL: InternetSetAgent("agent") - new function to set user agent
for InternetOpenURL
- AFL: new Error 70 - displayed on attempt yo use InternetSetAgent when it
is already set or connection was already open
- Analysis: added Notice 802: Trade size limite of X% of entry bar volume
has been hit N times.
- Charts: Vertical line (Y axis line) between chart area and Y axis scale
is drawn with ZOrder = 0 instead of ZOrder = 128
- Charts: Y-axis scale for huge negative values (below minus 1 billion) was
incorrect. Fixed
- File: Chart template, complete now also saves the content of files included
using #include_once
- New Analysis: decreased number of cases when IEEE rounding of fractional
steps result in one step less than naive expecation in optimization
- UI: 'Backtest settings' caption changed to 'Analysis Settings' and changed
the layout of 'general' tab - data settings (that apply to everything mode)
grouped separately from purely backtest settings
- UI: increased number of user-definable Tool window menu items to 20 (from
10)
CHANGES FOR VERSION 6.28.0 (as compared to 6.27.1)
- AFL: AddToComposite will issue error 69 if user passes field code other
than "O", "H", "L", "C", "V", "I", "1", "2",
or "X"
- AFL: another protection for users shooting themselves in the foot: AddToComposite
will issue error 68 when user passes invalid symbol string (empty or with
characters like comma or new line or tab)
- AFL: improved type checking for bad type of array arguments
- AFL: New warning 508 is displayed if same category type is used multiple
times in the Filter settings window and formula calls GetOption("FilterInclude*")
or GetOption("FilterExclude*). Code using such statements is incorrect
for such filters.
- AFL: now you can pass references as arguments to built-in funcitons and
they will be automatically dereferenced ("by value" sematics enforced)
- AFL: user-defined functions that return matrix reclaim memory faster than
before to avoid large memory consumption on super-long loops calling them
- AFL: VarGet was not working properly with matrices on 64 bit version. Fixed.
- AQ: 3.29 - when current working directory is set incorrectly it sets it
back to where it should be. Correct working dir is required for relative
paths to work
- Backtest: interest earned on cash balances and charged on margin load is
reported separately in backtest report now (if non-zero)
- Core: sizes of some hash tables increased to speed up lookups
- enable_static_decl created prefixes in original case (both upper and lowercase).
Since StaticVar* functions always use lowercase names this made them unable
to read declared statics other than all lowercase. Now declared variables
are internally lowecase
- Gui control custom colors - defaults changed to use Windows default "hot" color
(blue) for hover outline and (hover + selected) state is now drawn with hover
border and text but 'selected' background
- GuiGetCheck returned 0 on owner draw toggle (custom colors) due to Windows
limitation. Fixed.
- IB plugin: right mouse button click : Backfill Current was causing exception
for symbols longer than 26 letters. Fixed. (Version 2.0.10)
- If user formula had run-time errors and produced zero trades the "Info" tab
issued "Reporting has been turned off by SetOption" since there
was no report generated but not because of option, but because of formula
error. Fixed (the message is not displaye
- IQFeed: in mixed mode EOD data got preference if there is not enough room
to fit all intraday and all eod in defined "number of bars"
- New Analysis: added 'notices' to Info tab that inform the user about potential
problems and recommended actions. Currently one notice is displayed when
user tries to use ranking or composites without enabling padding. Will add
more notices in the future
- New Analysis: progress bar will not display "remaining time" until
at least one step is completed. Also if remaing time is > 2 billion years
it will display (unknown), and will report remaing time in million years
if necessary (for example when user star
- Setup 64-bit: program and all plugins use newest compiler and newest VC++2017
runtime
- Setup 64-bit: activation key should work without installing VC2005 runtime
- UI: "OK" button appears on splash screen only if it does not
auto-close
CHANGES FOR VERSION 6.27.1 (as compared to 6.26.0)
- AFL Editor: preprocessor command (#include/#include_once/#pragma) are highlighted
with different color to give visual clue that preprocessor command is NOT
regular code
- AFL: #pragma enable_static_decl accepts prefix given in quotation marks
(as regular string).
#pragma enable_static_decl "myprefix{chartid}"
- AFL: due to changes in 6.25 BETA TimeFrameSet applied on 1-tick base interval
could result in division by zero exception. Fixed.
- AFL: Error 66 has new meaning now. It is issued to prevent attempts to
mix static declarations with old style access. Error 66. Variables with '---'
prefix are inaccesible via StaticVarGet/Set/Remove in this formula. This
prefix is reserved by #pragma ena
- AFL: Removed Error 66: invalid identifier from VarSet/VarGet. Instead of
issuing error message, VarGet/VarSet automatically sanitizes invalid identifiers
by replacing all characters other than digits and A-Z, a-z letters by underscore
- AFL: runtime tokens {chartid}, {symbol}, {interval} are now supported in
#pragma enable_static_decl
- AFL: SetFormulaName - displays error 67 if user tries to use file-system
forbidden characters for formula name
- AFL: StaticVarRemove() when called with EMPTY string: StaticVarRemove("")
nullifies all static variables declared with static keyword within given
formula, so this:
#pragma enable_static_decl(test)
static _x, _y, _z;
_x = 1;
_y = 2;
_z = 3;
StaticVarRemove(""); //
nullify all declared static variables
printf("%g %g %g",
_x, _y, _z );
is equivalent to writing
#pragma enable_static_decl(test)
static _x, _y, _z;
_x = 1;
_y = 2;
_z = 3;
_x = Null; _y = Null; _z = Null;
printf("%g %g %g",
_x, _y, _z );
// note that setting declared static variable to
Null value results in removing it from memory
StaticVarRemove("")
-
returns number of variables nullified. Returns 0 on
failure (no declared static variables
found in current formula)
- AFL: when declared static variable is assigned the NULL value, it will
be removed from memory when formula finishes
- ASCII importer: importer logged "ran of industry space" even
if it didn't. Fixed.
- CBT: If user called ApplyStop AND calls EnterTrade from low-level backtest
and did not switch backtestRegular mode to raw mode (which should be done),
backtester would automatically turn on 2nd phase stops handling to prevent
crash
- Charts: a crash could occur if user had lots of drawn trendlines on multiple
panes and some of them had start date BEFORE first available bar and RT stream
was frequently updating. Fixed.
- Make #pragma enable_static_decl is now private functionality. This means
that it will work just fine but we don't provide any help/support except
of what is written in readme/manual
- New Analysis: you can now copy dates between "From" and "To" date
pickers (right click menu or Ctrl+C/Ctrl+V)
- UI: Bar replay From-to controls support copy-paste (right click or Ctrl+C/Ctrl+V)
- UI:added preprocessor color picker in Tools->Preferences, "Editor"
- 6.27.1 fix: In 6.27.0 VarSet did not work properly. Fixed.
- 6.27.1 fix: Backtest: since 6.25 crash could occur if "detailed log" was
enabled and trade was not entered due to unsufficent funds because format
string was not matching arguments. Fixed.
CHANGES FOR VERSION 6.26.0 (as compared to 6.25.0)
- AFL: new static keyword: declare identifier as static variable - a little
'revolution' in static variable use, declare variable as static and use as
'regular' variable, no need to call functions
// the pragma below is required to enable support
for static declarations
// it also defines the prefix which is added to variables declared with static
keyword
// it is one prefix per formula.
#pragma enable_static_decl(prefix)
// it is really good idea to consequently use naming
convention that
// distinguishes declared static variables from the others
// we highly recommend using UNDERSCORE '_' before all declared static variables
// so they can be easily spotted in the code
// The other choice could be s_ prefix
static _myvar; //
this var is also accessible by "prefix_myvar"
printf( "This variable
is really static %g", _myvar++ );
// keep in mind that for speed static variable is
read only once at the declaration
// and saved only once - when formula execution is completed
// This way declared static variables offer same speed as regular variables
(no speed penalty)
- AFL Editor: contrast of error location indicator on dark backgrounds increased
- AFL Editor: C-style comments /* ... */ are now foldable in the editor
- AFL Editor: new menu choices View->Fold Comments / Unfold Comments -
allow to fold/unfold all multi-line comments (enclosed with /* .... */)
- AFL: added constants notifyClicked, notifySetFocus, notifyKillFocus, notifyHitReturn,
notifyEditChange, notifySelChange, notifyMouseEnter, notifyMouseLeave
- AFL: Another protection against users shooting themselves in foot, VarSet/VarGet
now displays error when you try to use characters different than A-Z, 0-9
and '_' in variable names
- AFL: Attempt to use single subscript on matrix variable now results in
error message "Accessing Matrix elements requires two subscript operators"
- AFL: Due to the fact that Windows may send WM_MOUSEMOVE message even if
mouse did not move, AmiBroker now has internal check that prevents ReqestMouseMoveRefresh
from triggering if mouse position did not change
- AFL: GetLastOSError (for getting last error message from Windows) - allows
getting information about and handling of runtime OS errors
// Example 1:
fh = fopen("non_existing_file.txt", "r" );
if( ! fh )
{
printf("File
can not be open because: %s", GetLastOSError()
);
}
// Example 2:
ih = InternetOpenUrl("http://non_existing_host.com" );
if( ! ih )
{
printf("Internet
connection can not be open because: %s", GetLastOSError()
);
}
- AFL: GuiButton and GuiToggle in native OS style use background color of
the chart for small border instead of default grey
- AFL: GuiButton/GuiCHeckBox/GuiToggle/GuiRadio support now new events notifyMouseEnter
(64) and notifyMouseLeave(128) which detect hovering without need for constant
refreshes
#pragma enable_static_decl(myprefix)
static _counter;
flags = notifyMouseEnter | notifyMouseLeave;
GuiButton("test", 1, 20, 20, 100, 100,
flags);
GuiCheckBox("test 2", 2, 200, 20, 200, 20,
flags );
GuiSetColors( 2, 2, 0, colorRed, colorBlue );
Title = StrFormat( "%s.
Refresh # %g\n", GuiGetEvent( 0, 2 ),
_counter++ );
nc = GuiGetEvent( 0 , 1 );
if( nc == notifyMouseEnter ) GfxTextOut( "MOUSE
ENTER", 200, 50 );
if( nc == notifyMouseLeave ) GfxTextOut( "MOUSE
LEAVE", 200, 50 );
_TRACE(Title );
- AFL: GuiCheckBox and GuiRadio now support custom colors of text and background
- AFL: In 6.25 Gui* keyboard navigation interferred with delete key and possibly
other shortcuts due to the way how windows works. Implemented workaround
so keys are only intercepted if child window (control) has focus.
- AFL: In 6.25 Gui* keyboard navigation was turned on by default, now it
is off by default but can be turned on if you use SetOption("GuiEnableKeyboard",
True )
- AFL: In 6.25 GuiGetCheck returned -1 on unchanged. Now it returns only
0 (unchecked) or 1 (checked)
- AFL: In case of Windows INET API error, Internet* functions now report
Warning 507 instead of generic error 47. Warning 507 is Level-3 warning,
i.e. editor-only, which means it will pop up in the formula editor, but won't
break execution in runtime (indic
- AFL: Now can use subscript operator [ ] on references to arrays and matrices
- AFL: Passing by reference does not create nested references in user-defined
function calls
- AFL: VoiceSetRate( rate ) - sets SAPI voice (speech synthesis) rate. Rate
of 0 (zero) is "normal", negative is slower, positive is faster
(allowable range -10..+10)
- AFL: VoiceSetVolume( volume ) - sets SAPI voice (speech synthesis) volume
(0..100)
- AFL: VoiceWaitUntilDone( timeout ) - waits until voice has finished speaking
or specified timeout (1..100ms) has elapsed. Returns True if voice finished,
False if the timeout elapsed
VoiceSetRate( -10 );
Say("I am speaking
slowly", False);
while( ! VoiceWaitUntilDone( 100 )
);
printf("Done 1\n");
VoiceSetRate( 0 );
Say("I am speaking
normally", False);
while( ! VoiceWaitUntilDone( 100 )
);
printf("Done 2\n");
VoiceSetRate( 5 );
Say("I am speaking
fast", False);
- broker.master file is saved to a new name and renamed later to avoid corruption
when Windows decides to shutdown, restart or sleep during save
- Dev: 64-bit new compiler (VC2017) broke backward compatibility with singletons
that UI lib uses causing infinite loop when High Contrast scheme was used.
Workaround implemented.
- Misc: 64-bit: Restored correct manifest (from pre6.22) with compat records
so Win 10 does not lie about version number and re-added 24-bit large PNG
icon
- New Analysis: Added support for clickable links. If you put @link URL in
any cell of Analysis result list it creates a clickable row. If you double
click on the row while holding down ALT key it will open the link
AddTextColumn("@link
http://www.amibroker.com/", "double
click me with ALT key");
// Hidden links are possible if you add
the @link in the column past the last defined one
AddRow( "ticker\tdatetime\ttest\t@link
http://www.amibroker.com" );
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
CHANGES FOR VERSION 6.20.1 (as compared to 6.20.0)
- Batch: DataImportASCII command allows to automate imports via batch. The
parameter is file name to be imported. The importer uses file extension to
determine format file used, so if you are importing File.aqh then aqh.format
definition file will be used
- Default for time compression timestamping changed
to recommended value, i.e. 'start time of interval'
- GetExtraDataEx to support
pad&align
struct ExtraData
{
int nStructSize;
int nArraySize;
int nPeriodicity;
DATE_TIME_INT *anTimestamps;
void* (*pfAlloc)(size_t nSize);
};
typedef Variant (* GetExtraDataPtr) ( LPCTSTR pszTicker, LPCTSTR pszName,
int nArraySize, int nPeriodicity, void* (*pfAlloc)(size_t nSize) );
/////////////
PLUGINAPI AmiVar GetExtraDataEx( LPCTSTR pszTicker, LPCTSTR pszName, struct
ExtraData *pData )
{
AmiVar var;
var.type = VAR_ARRAY;
var.array = (float *)pData->pfAlloc( pData->nArraySize * sizeof( float
) );
for( int i = 0; i < pData->nArraySize; i++ )
{
AmiDate dt;
dt.Date = pData->anTimestamps[ i ];
// this simple example produces DateNums synced with current selection
var.array[ i ] = (dt.PackDate.Year - 1900) * 10000 + dt.PackDate.Month * 100
+ dt.PackDate.Day;
}
return var;
}
NOTE:
Contrary to legacy GetExtraData call which is always called only from UI thread,
a new function - GetExtraDataEx can be called from both UI and worker (non-UI)
threads
CHANGES FOR VERSION 6.20.0 (as compared to 6.19.0)
- AFL: new function GetExtraDataForeign( "fieldname", "symbol")
- the same as GetExtraData but works with user-specified ticker instead of
current one
- AFL: ShellExecute supports "runbatch" command. After running
batch batch and analysis windows that were opened by batch are automatically
closed. ShellExecute( "runbatch", "path_to_batch.abb", "" );
- Batch: new command DataPluginCmd - calls data plugin DataPluginCmd function
(if it is exported from your data DLL) - allows custom actions to be peformed
by the plugin from the batch (like maintenance)
This function allows automation/batch support for any kind of user-provided
features, such as maintenance, for example a batch could use
DataPluginCmd maintenance
to run internal database maintenance by the plugin. This functionality
is likely to be used by data vendors such as Premium Data to provide maintenace
runs automation.
Ask your vendor for more info on available data plugin commands.
PRELIMINARY INFORMATION SUBJECT TO CHANGE
To support this feature in your plugin you would need to export DataPluginCmd
function
#define DPC_INVALID_COMMAND -1
#define DPC_NOT_IMPLEMENTED 0
#define DPC_SUCCESS 1
#define DPC_STARTED_IN_THREAD 2
struct CommandData
{
int nStructSize;
HWND hNotifyWnd;
LPCTSTR pszDatabasePath;
struct _Workspace *pWorkspace;
struct InfoSite *pInfoSite;
};
int DataPluginCmd( LPCTSTR pszCommand, struct CommandData *pCmdData )
{
if( strcmp( "mycommand", pszCommand ) == 0 )
{
// do something
return DPC_SUCCESS;
}
else
{
return DPC_ INVALID_COMMAND;
}
}
return values
DPC_INVALID_COMMAND = -1
The command passed is invalid / does not exist
DPC_NOT_IMPLEMENTED = 0
Plugin does NOT implement any commands (this is automatically set by AMiBroker
prior to calling Notify())
DPC_SUCCESS = 1
Command completed successfully (command executed and completed)
DPC_STARTED_IN_THREAD = 2
(For future use - not implemented yet)
Command recognized but launched by the plugin in separate thread. Its completion
will be signalised by sending proper finalize message .
When starting in separate thread you should NOT use pCmdData pointer after
function returns as it is temporary and will be destroyed as soon DataPluginCmd
returns.
- Batch: new command ExecuteAndWait - allows to execute external program
and wait for its completion (allows among other things launching AmiQuote
download and waiting until it is complete)
Example:
Launches AmiQuote, loads "YourTickerList.tls", performs download
and closes AmiQuote:
ExecuteAndWait amiquote\quote.exe YourTickerList.tls /download
/close
- New Analysis: changed forced refresh frequency of result list to every
250ms when analysis is in progress (since 6.16 when messaging system has
changed it was refreshed "on idle")
- New Analysis: when user specified symbol with NO quotes at all as a reference
symbol AND used "last N days" range AND used Exploration then it
would lead to crash. Protection implemented against this scenario.
- OLE: AnalysisDoc.Export supports now extra (optional) parameter WhatToExport
and it allows now to export not only result list but also walkforward tab
Analysis.Export("file", 1 );
Export( Filepath, WhatToExport = 0 )
WhatToExport decides what data should be exported:
= 0 - exports result list (the default behavior when this parameter is
not provided)
= 1 - exports walkforward tab
- UI: In 64 bit version File Dialog was not resizable due to differences
in Microsoft runtime. Now it is made resizable.
CHANGES FOR VERSION 6.19.0 (as compared to 6.18.0)
- Batch Scheduler implemented (Tools->Scheduler) - integrated tool
to schedule automated runs of your batches
Batch scheduler runs user-defined batches.
Check period is every 10 seconds, so if you schedule something for 12:14:47,
it will actually run on 12:14:50.
If multiple tasks are scheduled on the same time they will be run in order
of appearance in the Scheduler list.
Scheduled tasks are run sequentially and next one would not start if previous
did not finish.
For this reason avoid batches that require user intervention such as use
of "PAUSE" command.
Scheduled tasks are only started when UI is not in the modal state, i.e.
UI is NOT waiting for user input (such as File open dialog, or any other
modal input dialog).
Once modal dialog is closed, missed tasks will be run.
Scheduled tasks are only run when AmIbroker is running. AmiBroker does not
create background / hidden processes.
Windows already have too many wasteful processes running all the time.
If you need 24/7 operation, just do not close AmiBroker.
If you close AmiBroker, it won't run any tasks until you start AmiBroker
again.
Then all missed tasks will be run once and afterwards they will be run on
normal schedule (if repeat option is used).
- Batch: ExportWalkForward command added
- Batch: Pause command added
- AFL: GetOption supports all fields available in SetOption call
- AFL: new function: AddMultiTextColumn - adds a text column to the exploration
where text displayed is choosen based on array value
AddMultiTextColumn( ARRAY, "TextList", "Caption", format
= 1.2, fgcolor = colorDefault, bkcolor = colorDefault, width = -1 )
ARRAY - parameter decides on bar-by-bar basis which item from TextList
is choosen
TextList - newline-separated list of texts to be displayed depending on
ARRAY value. Note: newline is a "\n" symbol
This work so, when ARRAY value is zero, then first item from TextList
is choosen and displayed, when ARRAY value is 1 then second item is choosen
and so on.
This allows outputting conditional text in the exploration output, like
this:
Buy = Cross( MACD(), Signal()
);
Sell = Cross( Signal(), MACD()
);
Filter = 1; //
all bars
AddColumn( Buy, "Buy" );
AddColumn( Sell, "Sell" );
TextList = "No signal\nBuy\nSell\nBuy and Sell";
TextSelector = 1 * Buy + 2 * Sell; /*
would give 0 if no signal, 1 if a buy, 2 if a sell, 3 if both buy and sell
*/
AddMultiTextColumn( TextSelector, TextList, "Which
signal" );
Note this feature works only in new Analysis window.
- AFL: new function: MxSum - calculates sum of all elements of matrix (grand
sum)
- AFL: StDev added support for variable period (faster and more accurate
than formula-based solutions)
- AFL: Title now accepts {{VOLUME}} and {{FULLNAME}} special tokens that
get replaced by current volume and full name of the symbol. Example Title
= "{{VOLUME}}";
- AFL: updated text of Error 62 message to list newly supported sequence
%s
- AFL: variable period Sum() now returns NULL if range is greater than current
bar index (previously returned partial sum)
- Analysis: WalkForward settings including IS/OS dates are no longer global,
they are now per-project and saved in APX file
- ASCII importer: added $RAWCLOSE2AUX1 and $RAWCLOSE2AUX2 commands that allow
to put raw close into aux1/aux2 fields when using ADJCLOSE in 'close' field
- Changed wording to "Free upgrade period expired." (from "License
expired")
- Date/Time fields in XML files now use ISO format always (not regional format),
for better file exchangability accross regions
- Debugger: Watch window: added ability to display values of static variables
in watch window - just append '$' (dollar) prefix before static variable
name
- Default report chart dimensions (new instals) increased to 800x480px
- On HiDPI (>=150dpi) screens icons in menus were small, now they are
bigger
- On HiDPI screens XYCharts and MonteCarlo charts could have axis labels
partially truncated depending on choosen font size. Now it is fixed.
- UI: Performance Monitor shows now the number of static variables used and
the amount of memory consumed by them (Tools->Performance Monitor)
- UI: Plugin data access time is now displayed with microsecond precision
- UI: Symbol and interval combo boxes in toolbar are made larger on HiDPI
screens
CHANGES FOR VERSION 6.18.0 (as compared to 6.17.0)
- AFL: GetFnData/GetFnDataForeign added support for "PointValue" and "FullName" fields
- Batch processor: In 6.17.0 Export to file command was executed properly
but never marked as completed. Fixed.
- Batch window checks if there is any other batch running and refuses to
start when the other batch has not finished.
- Batch: Added command line parameter to exit AmiBroker after running batch
file (/exit)
- Batch: Added command line parameter to run batch files: /runbatch "full
path to batch file
Example 1:
broker.exe /runbatch "C:\yourbatch.abb"
Example 2:
run batch and exit program when batch is finished
broker.exe /runbatch "C:\yourbatch.abb" /exit
Example 3:
load database from specified path, run batch and exit
broker.exe /database "C:\program files\amibroker\mydatabase" /runbatch "C:\yourbatch.abb" /exit
- Batch: Load Database "path to workspace/database" - warning this
function may be RISKY because it may interfere with other running operations,
use it with care
- Batch: new command: Save Database
- Batch: new command: Set log filename "filename"
- Batch: new command: Write text to log "text"
- OLE: added new method to AnalysisDoc object: Abort() - will abort any running
Analysis scan/exploration/backtest
- UI: File->Database Setings displayed underestimated memory usage per
symbol (32 bytes per quote instead of 40). Corrected.
CHANGES FOR VERSION 6.17.0 (as compared to 6.16.0)
- AFL: Changed default number formatting string from "%g" to "%.7g" (so
7 significant digits are now displayed instead of 6)
- AFL: new function GetFnDataForeign( "field", "symbol" )
- the same as GetFnData but retrieves non-current symbol's data
- AFL: new function InternetClose( handle )
- AFL: new function InternetOpenURL( "url" )
- AFL: new function InternetReadString( handle ) - read a string (line) from
internet resource
NOTE:
If End-Of-File has been reached, the function returns empty string ("")
If End-of-File has NOT been reached, the function always returns non-empty
string because each line read by this function ends with new line character "\n",
so if server has sent empty line it will be read as "\n"
You can trim new line characters using StrTrim
Internet* functions open wide area of applications including:
1. querying web APIs for extra data
2. using web/rest APIs for communication ( sending messages/alerts to Twitter,
SMS gateways, etc)
Example:
ih = InternetOpenURL( "https://www.quandl.com/api/v3/datasets/SEC/AAPL_SALESREVENUENET_Q.csv?api_key=" );
printf( "AAPL Revenue:\n" );
if( ih )
{
while( ( str = InternetReadString(
ih ) ) != "" )
{
printf( "%s",
str );
}
InternetClose( ih );
}
- AFL: printf/StrFormat/TRACEF support now "%s" (string specifier)
and accept string arguments passed and made faster too
- Data: Gics.txt classification updated (thanks to PremiumData)
- New Batch processor - allows to define sequences of scans/explorations/backtests/optimizations
using different project files that are then run automatically. Detailed documentation
on Batch window can be found here http://www.amibroker.com/guide/h_batch.html
- OLE Automation: individual backtest is now supported via OLE automation
- OLE: Interval property of Document object is now writable so you can set
chart interval from OLE
AB = new ActiveXObject("Broker.Application");
doc = AB.ActiveDocument;
doc.Interval = 60; // interval is given in SECONDS (60 second is 1-minute
interval)
- Startup is made faster
- UI: AFL Editor MDI UI did not get immediate refresh after file name change
when main window was in modal state due to the way how MFC works. Fixed.
- UI: File->Database Settings, default maximum "number of bars" increased
to 1 million
- UI: New Analysis Settings submenu is now duplicated in main window Analysis->Options
menu for easier access for beginners
- Watch window: added support for modulo (%) operator in watches
CHANGES FOR VERSION 6.16.0 (as compared to 6.15.0)
- New Analysis: implemented entirely new inter-thread communication method
that does not strain main thread message queue. This gives tremendous improvement
in responsivity of UI when Analysis is running.
- New Analysis: removed forced message pumping when AFL finished as it was
causing issues with proper MDI tab refreshes in Windows 10 while Analysis
was running
- New Analysis: UI: added an option to keep using existing AFL file on opening
APX project instead of asking the user what to do when differences are found
between AFL file and content of APX project.
- AFL: changed the way how custom-backtest reports "stocknum".
Previously Status("stocknum") was equal to zero on custom backtest
phase and this may have caused parts that use if(Status("stocknum")==0)
to be excecuted during custom backtest phase. Now custom backtest run gives
Status("stocknum") equal to -1 (minus one).
- AFL: DateTimeConvert supports now more formats, format = 6 - day, 7 - month,
8 - year, 9 - day of week, 10 - day of year, 11 - quarter (1..4)
- Charts: as apparently single pixel geometric pens are 8 times slower than
DC pen, the optimization has been implemented that uses DC single pixel pen
instead of geometric pen when bar width is 1, giving 8x faster 1-pixel bar
charts
- Since 6.15 when $AUTOADD was set to 0 (zero), then symbols not existing
in the database but present in the imported file were not logged into import.log
as earlier. Fixed.
- UI: when AM/PM (12 hour format) was used in list views 12:00AM was interpreted
as 12:00 (noon), instead of 00:00 (midnight). Fixed.
When backtesting Short only strategy and using backtestRegular mode and using
HoldMinBars > 1, a disabled stop could trigger if it was enabled in previous
backtest run. Fixed.
- Support for Windows 98 and Millenium is dropped. If anybody needs that
back please let us know (email to support)!
CHANGES FOR VERSION 6.15.0 (as compared to 6.14.0)
- AFL: DateTimeFormat( "formatstr", datetime ) - converts datetime
to string according to user-specified format
formatstr argument contains formatting string that specifies how date time
should be converted to string.
For example to get full week day name of date time use
DateTimeFormat( "%A", dt );
To get YYYYMMDD without separtors use:
DateTimeFormat("%Y%m%d", dt );
Available formatting sequences are exactly like in strftime() C-runtime
functionstrftime :
%a
Abbreviated weekday name
%A
Full weekday name
%b
Abbreviated month name
%B
Full month name
%c
Date and time representation appropriate for locale
%d
Day of month as decimal number (01 – 31)
%H
Hour in 24-hour format (00 – 23)
%I
Hour in 12-hour format (01 – 12)
%j
Day of year as decimal number (001 – 366)
%m
Month as decimal number (01 – 12)
%M
Minute as decimal number (00 – 59)
%p
Current locale’s A.M./P.M. indicator for 12-hour clock
%S
Second as decimal number (00 – 59)
%U
Week of year as decimal number, with Sunday as first day of week (00 – 53)
%w
Weekday as decimal number (0 – 6; Sunday is 0)
%W
Week of year as decimal number, with Monday as first day of week (00 – 53)
%x
Date representation for current locale
%X
Time representation for current locale
%y
Year without century, as decimal number (00 – 99)
%Y
Year with century, as decimal number
%z, %Z
Time-zone name or abbreviation; no characters if time zone is unknown
%%
Percent sign
Extra # flag may prefix any formatting code. In that case, the meaning
of the format code is changed as follows.
Format Code Meaning
%#a, %#A, %#b, %#B, %#p, %#X, %#z, %#Z, %#% # flag is ignored.
%#c Long date and time representation, appropriate for current locale.
For example: “Tuesday, March 14, 1995, 12:41:29”.
%#x Long date representation, appropriate to current locale. For example: “Tuesday,
March 14, 1995”.
%#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y Remove leading
zeros (if any).
- AFL: new function Kurtosis( ARRAY, range, population = True )
Kurtosis( ARRAY, range, False ) - works the same as Excel's KURT function
Kurtosis( ARRAY, range, True ) - gives population Kurtosis (Excel does not
have equivalent KURT.P function yet)
Note that these functions calculate excess kurtosis, so for normal distribution
it is 0.
There is some controversy about what kurtosis really tells about distribution.
Most sources say that
The kurtosis of a data set provides a measure of the peakedness of the
distribution of the data, relative to the normal distribution.
A positive kurtosis value indicates a relatively peaked distribution and
a negative kurtosis value indicates a relatively flat distribution.
but Dr. Peter Westfall published an article that addresses why kurtosis
does not measure peakedness
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4321753/
He says that "The kurtosis [...] is a measure of the combined weight
of the tails relative to the rest of the distribution."
- AFL: new function Skewness( ARRAY, range, population = True )
Skewness( ARRAY, range, False ) - works the same as Excel's SKEW function
Skewness( ARRAY, range, True ) - works the same as Excel's SKEW.P function
The Skewness of a data set is a measurement of the asymmetry of the distribution
about the mean.
A Skewness of zero indicates perfect symmetry;
A positive Skewness indicates that more values lie below the mean and the
distribution has a 'tail' which extends towards the higher values;
A negative Skewness indicates that more values lie above the mean and the
distribution has a 'tail' which extends towards the lower values.
- AFL: new modes added to DateTimeToStr() that use ISO regardless of regional
settings mode = 3 (iso date and time YYYY-MM-DD HH:MM:SS) HH:MM:SS part is
only included for non-EOD records, 4 (iso date only YYYY-MM-DD), 5 (iso time
only HH:MM:SS)
- AFL: NumToStr could crash if format parameter was greater than 127. Fixed.
Now an error message is displayed when format parameter is too large
- AFL: NumToStr now supports formatDateTimeISO
- AFL: StDev function added 3rd argument "Population = True", when
Population is True it calculates population based stdev, otherwise sample
based
StDev( Array, range, False ) - works the same as Excel's STDEV
StDev( Array, range, True ) - works the same as Excel's STDEV.P
- ASCII import: from version 6.11 importer always added new symbols even
if $AUTOADD 0 was used. Fixed.
- UI: Charts window - an attempt to rename a file or directory to something
that already exists is now prevented and results in error message box.
- UI: in 6.14 when New Analysis was switched to 'floating' mode, it could
crash on attempt to run analysis. Fixed.
- UI: Quote editor - in single-symbol mode "ticker" field sometimes
was not updated. Fixed.
- UI: Symbol->Quick Find menu command brings focus to Symbol's window
search box. New installations use F3 key assignment for Quick Find. Old installations
use old assignment (you can change F3 assignment in Tools->Customize->Keyboard)
CHANGES FOR VERSION 6.14.0 (as compared to 6.13.0)
- AFL: ParamDate() added support for format=2 to return datetime instead
of datenum/string
- AFL: PercentRank function now accepts variable period (range)
- AFL: PriceVolDistribution crashed if startbar argument was negative. Fixed
by implementing protection against negative bar indexes.
- AFL: PriceVolDistribution sometimes produced some random values in 6.13.
Fixed.
- ASCII importer now supports microsecond resolution timestamps (HH:MM:SS.mmmuuu)
where mmm - milliseconds 000..999, uuu - microseconds 000..999
- New Analysis: new feature a PAUSE button to temporarily pause/resume any
running analysis. Note that already running threads are not interrupted,
they are allowed to complete gracefully and then pause state is entered.
- UI: A warning message is displayed when user attempts to close AmiBroker
while Analysis is in progress
- UI: QuoteEditor in some cases did not properly round fractional part of
millisecond down to microsecond. Fixed
- UI: QuoteEditor: Edit fields for OHLC prices, Volume, OpenInt and Aux now
check for proper entry as you type and display red background if entered
string is not proper numer. Also those edit fields don't accept characters
other than digits (0..9), decimal
- UI: Toolbar icons are set to "Large icons" mode automatically
on HighDPI screens
- When broker.workspace file was corrupted or truncated, the file remained
open which eventually prevented from writing it on close. Fixed.
CHANGES FOR VERSION 6.13.0 (as compared to 6.12.0)
- AFL Editor: calling SetForeign thousands of times followed by RestorePriceArrays()
could cause exception during code verify when number of symbols exceeded
cache size. Fixed.
- AFL Editor: changes made in 6.11 to the way how automatic names for new
formulas are assigned have been removed and replaced by new method that is
faster and more reliable.
- AFL Editor: if clipboard is locked by another application the editor would
retry opening clipboard upto 8 times before giving up
- AFL Editor: when formula was open cursor was located at the end. Now it
is located at the top.
- AFL: GfxSetCoordsMode( mode ) accepts now four different modes
mode parameter now accepts values 0, 1, 2, 3 with the following meaning:
0 - X and Y coordinates are expressed in screen pixels
1 - X coordinate is bar index, Y coordinate is price
2 - X coordinate is pixel, Y coordinate is price
3 - X coordinate is bar index, Y is pixel
- AFL: MA function made upto 2 times faster, StDev function made 20% faster,
Correlation made 40% faster
- AFL: NormDist( x, mean = 0, sigma = 1, cumulative = True ) function. Implements
hi-precision algorithm.
The function uses hi-precision algorithm that gives accurate results even
for extreme left and right tails (<-5 and >+5)
The results are compatible with Excel 2003 and later which introduced higher
precision NORMDIST than previous versions (Excel 2002 and earlier).
x = 19;
m = 2;
s = 9;
printf("PDF %g CDF %g", NormDist( x, m, s, False ), NormDist(
x, m, s, True ) );
x = -7;
m = 0;
s = 1;
printf("PDF %g CDF %g", NormDist( x, m, s, False ), NormDist(
x, m, s, True ) );
- AFL: PriceVolDistribution( priceH, priceL, vol, bins, absolute = False,
startbar = 0, endbar = -1 )
// a demo showing
// re-implementation of VAP overlay using
// PriceVolDistribution and low-level graphics
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
mx = PriceVolDistribution( H, L, V, 100, False, fvb, lvb );
GfxSetCoordsMode( 1 );
GfxSelectPen( colorRed );
bins = MxGetSize( mx, 0 );
for( i = 0; i < bins; i++ )
{
price = mx[ i ][ 0 ]; // price level
relvolume = mx[ i ][ 1 ]; // relative volume 0..1
relbar = relvolume * (lvb-fvb+1);
GfxMoveTo( fvb, price );
GfxLineTo( fvb + relbar, price );
}
Plot( C, "Price", colorDefault, styleBar );
if( ParamToggle("BuildinVAP", "No|Yes") ) PlotVAPOverlay(
100, 100, colorGreen, 2 );
- AFL: 64-bit version AFL Correlation() produced slightly different values
(+/-0.00001 typ) than 32-bit version due to compiler differencies. Now 64-bit
version produces same values as produced by all 32-bit versions.
- Charting: new feature - Snap to Tick grid. Snap drawing tool end points
to TickSize-spaced grid (if TickSize > 0 for given symbol)
- Plugin loading routine displays a message box when plugins with incorrect
bitness are found
- Plugin loading routine writes detailed error message to the broker.log
in case of problem of DLL loading (must enable plugin log to use this feature)
To enable plugin loading messages you need to create the following key in
the registry:
HKEY_CURRENT_USER\Software\TJP\Broker\Diagnostics
and add
Flags
(DWORD 32bit) key with value = 5
Example error codes:
Loading 'AmiBroker\Plugins\FT.dll' - failed. Error code: 126: The specified
module could not be found.. (0.63 ms)
- this means that the FT.DLL could not be loaded because it depends on
other DLL that is missing (or not found in search path)
Loading 'AmiBroker\Plugins\TC2K.dll' - failed. Error code: 1114: A dynamic
link library (DLL) initialization routine failed.. (0.23 ms)
- this means that TC2K.DLL was loaded fine but its InitInstance function
exited with error code. In that case it was because Telechart was not installed
and/or its OLE server not registerd
Loading 'F:\AmiBroker\Plugins\Sample.dll' - failed. Error code: 193: Not
a valid 32-bit DLL. (0.14 ms)
- this means that you attempted to use 64-bit DLL with 32-bit application
(not supported by OS)
- When drawn study is being modified, Y distance shown in the status bar
accounts for activated snap-to-price and/or snap-to-tick mode now.
CHANGES FOR VERSION 6.12.0 (as compared to 6.11.0)
- AFL: new function GfxDrawImage( "filename", x, y )
Notes:
The function currently supports BMP and PNG files.
Per-pixel transparency (alpha channel) is supported ONLY for 32-bit PNG files.
PNG files with 32-bit depth are rendered with AlphaBlend which is not be
available on oldest systems (Win95).
BMP files PNG files of lower depths are rendered without transparency using
BitBlt (fast and always available)
Loading and drawing BMP files is much faster than PNG (as much as 10 times
faster), approx load and rendering time is 0.3 ms for BMP, 3 ms for PNG
(alphablended).
Timings that you get from Code check and profile are misleading for Gfx
functions because they don't include actual on-screen rendering.
GfxDrawImage( "wizard.bmp", 100, 0 ); // bitmap - fast
GfxDrawImage( "logo.png", 30, 30 ); // png - supports per-pixel
alpha channel / transparency
- AFL: new function ProdSince( condition, array ) - cumulative product of
array elements since condition is met
On bar when condition is met, initial product value is 1.
- AFL: new function Prod( array, range ) - cumulative product of array elements
over specified number of bars (range)
Note: when range is less or equal zero, product is equal 1.
- AFL: new function CumProd( factor ) - cumulative product of array elements
y = CumProd( 1.05 ); // 1% per-bar growth
Plot( y, "exponential growth", colorRed );
- AFL: new function VoiceCount( ) - returns number of available SAPI (Speech
API) voices - to be used with Say() command
- AFL: new function VoiceSelect( num ) - select SAPI (Speech API) voice to
be used with Say() function, num is a numerical index of installed voices.
By default Windows comes with just one voice, but one can add countless 3rd
party voices
- AFL: StaticVarAdd with non-array input produced incorrect results. Fixed.
- UI: Symbols with COMMA (,) caused problems with multiple-selection operations.
Now it is handled properly.
- UI: Symbol Information - date fields (like last split date, div date or
delisting date) can now be cleared (select all and press DELETE) to set Empty/Null
date
- UI: Realtime quote window: a RMB context menu items are grayed when local
data is used and an empty message is set to inform the user that he/she needs
realtime data source to use this window
- UI: Quote Editor allows now immediate search for matching date - just type
digits in format YYYYMMDD and list will automatically scroll and mark to
quote that most closely matches entered date
- UI: New Analysis: Alt+Enter shortcut added to bring up settings window
CHANGES FOR VERSION 6.11.0 (as compared to 6.10.0)
- AFL: added formatDateTimeISO for ISO formatting regardless of locale settings,
example:
Filter = 1;
AddColumn( DateTime(), "DT
ISO", formatDateTimeISO ); // generate a
date/time column that is always in ISO format regardless of regional
settings in Windows
- AFL: MxFromString was slow on very large matrices (>100000 cells) due
to poor performance of strtod function from Microsoft C runtime. Now MxFromString
does not use it and is even 1000 times faster on 100K+ cell matrices (5ms
vs 5second)
- ASCII importer can now be even 20 times faster when importing NEW (non
existing) data that were oddly sorted (like for example in reverse order
- descending dates instead of ascending).
- ASCII importer is now twice as fast when updating already existing quotes
thanks to using in-house code instead of msvcrt functions.
- Charting: Fibonacci maximum user-definable level increased to 9000% (from
1000%)
- Idle processing is forced now every 125 ms (instead of 250ms) in Analysis
window to update UI components more frequently under heavy CPU load
- Ruin stop is identified by Short(ruin) / Sell(ruin) instead of Short(6)
/ Sell(6)
- Startup splash screen is displayed a little sooner now and some pre-loading
of editor components is done at start to save time to open editor later
- When there were thousands of files in "Formulas" folder opening
editor for the first time could take some time. Now this time is significantly
reduced.
CHANGES FOR VERSION 6.10.0 (as compared to 6.09.0)
- SetOption new fields for Monte Carlo
MCUseEquityChanges - use equity changes instead of trade list
MCChartEquityScale - 1 for log scale, 0 for linear scale
MCLogScaleFinalEquity - 1 for log scale, 0 for linear scale
MCLogScaleDrawdown - 1 for log scale, 0 for linear scale
MCNegativeDrawdown - 1 - use negative numbers for drawdown (reverse drawdown
CDF)
- QuickData cache was not flushed when double clicking on Analysis result
list to display chart. Fixed.
- MonteCarlo: added an option to use negative number for drawdowns (on by
default). This reverses the ordering of "drawdown" column in the
MC table and reverses the meaning (i.e. 10% percentile value means that there
is 10% chance of drawdowns being equal or worse (more negative) than presented
value). Wwith this option turned off (as in old versions), drawdowns are
reported as numbers greater than zero and 10% percentile value means 10%
chance of drawdowns being equal or better (smaller) than presented amount.
- AFL: Gfx: low-level graphic recorded on layer 128 was played prematurely.
Fixed.
- Added error message when user attempts to write value to BarCount (read-only
symbol)
- More documentation updates
CHANGES FOR VERSION 6.09.0 (as compared to 6.08.0)
- AFL Editor: an error message box displayed when @link file was not found
caused main frame to get focus. Fixed.
- AFL Editor: auto-complete and parameter tooltips poped up when adding/editing
Doxygen/JavaDoc comment sections. Fixed.
- AFL: new function fgetcwd - get current working directory
- Analysis: Monte Carlo - semi logarithmic scale can be now used for Equity,
Final Equity and $ Drawdown distribution charts (see Settings)
- Analysis: Monte Carlo simulation has now a few mode "Simulate usign
equity changes". This uses bar-per-bar percent portfolio equity changes
to generate permutations instead of trade list.
- Docs: updated help files
- UI: Enlarged crash recovery window because people send us screenshots instead
of clicking "Send report" button. Please click "SEND REPORT" instead
of sending screenshots. Screenshots unfortunatelly do not contain all information,
so now at least some more
- UI: On Windows Vista and higher all tree views now use double buffering
to avoid flicker
- UI: XY charts and Monte Carlo charts axes use M suffix for numbers bigger
than one million
CHANGES FOR VERSION 6.08.0 (as compared to 6.07.0)
- AFL Editor: Implemented clickable JavaDoc/Doxygen-style links in doc comments
To use links in comments you have to put @link command followed by path to
file or URL inside JavaDoc/Doxygen style comment:
a) multiline comment that begins with
/**
@link readme.html
@link http://www.amibroker.com
*/
(note double asterisk after initial slash)
b) single line comment that begins with triple slash
/// @link readme.html
/// @link c:\program files\amibroker\readme.html
/// @link http://www.amibroker.com
Now when you hover the mouse over @link command you will see the underline
that indicates it is clickable.
It reacts to DOUBLE CLICK (not single click). When you double click it
linked document will be open
@link command can open web pages, local files (both relative and absolute
paths are supported) with Windows-registered program
to open given file type. So if you use
/// @link something.doc
then MS word would be used.
/// @link test.xls
would open test.xls in Excel.
Relative paths refer to AmiBroker working directory.
Html files are open with default browser, txt files are usually open with
Notepad (or whatever application you use).
If file does not exist then you will get an error message.
- AFL: Unary minus and NOT operator could cause crash when applied to result
of undefined function or variable of non-numeric type. Fixed.
- 64-bit stack walker does not use Microsoft symbol server anymore so it
can init a lot faster. Also initialization of stack walker is moved to startup
sequence because doing it after exception is risky and unreliable
- 64-bit: access violations during Analysis run do not result in 'application
not responding' freeze. Instead bug report is displayed with proper call
stack.
- After change in 6.02 exception dialog displayed first error in the formula
even if exception was really caused not by first but last error. Fixed.
- Exception info could get mixed up when multiple threads generated them
at the same time. Fixed.
- New Analysis: Auto-size column functionality re-displayed hidden columns.
Fixed.
- UI: AmiBroker now prevents piling on "Bug recovery" dialogs when
multiple exceptions are thrown from multiple threads. First dialog is displayed,
other exceptions are logged into DebugView as long as "Bug recovery" is
not dismissed.
- "Rename" and backup functions in several places could fail if
new file name already existed. Fixed.
- Support for Windows 95 is dropped
CHANGES FOR VERSION 6.07.0 (as compared to 6.06.0)
- AFL: compression for array Static variables implemented to save memory
and file size: StaticVarSet has additional parameter that controls compression
compressMode parameter decides whenever given variable will be compressed
or not.
By default only persistent static variables will be compressed (cmDefault).
You can turn it off completely compressionMode = cmNever, or turn it on for
persitent and non-persistent variables using
compressionMode = cmAlways
Compression is done by removing repeated values from the sequence as repeated
values
are restored when doing StaticVarGet.
Compression is NOT compatible with non-aligned mode of StaticVarGet.
If compressed array is retrieved by StaticVarGet with align=False, then
repeated values found in original array would not be retrieved.
Turning compression on slows down StaticVarSet (as it needs to do some
extra processing), but does not affect performance of other functions,
so StaticVarGet is equally fast with or without compression.
- AFL: printf/StrFormat check for %s, %c, %d, %x, %i, %u, %x, %p sequences
that are not supported now and prints Error 62 when they are found.
- AFL: printf/StrFormat now implement a check for correct formatting string
as sometimes users passed strings with % that is special marker for formatting
string instead of %% to print actual percent sign
When check failes, "Error 61. The number of % formatting specifier(s)
does not match the number of arguments passed." is displayed
- AFL: Some variable period functions such as Ref/Sum/MA incorrectly accepted
matrix as a 'period'. Fixed (proper error message is displayed now).
- AFL: StaticVarGet/StaticVarSet functions now support matrices including
persistency (so matrices can be written to disk and loaded back between AmiBroker
runs)
- AFL: VarSet/VarGet officially accept matrices (allow dynamic variables
of matrix type). (FWIW they were accepted in previous versions but implementation
was incomplete.)
- Charting: Candlestick wicks thickness is now user definable as % of candle
width with a max. pixel width (Tools->Preferences, "Bars and Candles" tab).
Also by default wick thickness is now 25%/5px max instead of constant 1 pixel.
- Charting: Cycles tool in weekly chart produced incorrect lines when it
went past 2038. Fixed.
- Charting: Horizontal line tool level is now displayed with number of decimals
as defined in Preferences (Misc tab, "decimal places in chart titles/tools").
Note that this setting is used when you draw a new line or modify old.
- Debugger: Added F5 key as keyboard shortcut for "Debug / Go"
CHANGES FOR VERSION 6.06.0 (as compared to 6.05.0)
- AFL Editor: Bookmarks implemented (Ctrl+F2 - toggle bookmark, F2 - go to
next bookmark, Shift+F2 - go to previous bookmark
- AFL Editor: Find in Files - when file name contained braces () double click
on it would not open it. Fixed.
- AFL Editor: Line comment puts double // comments on lines that appear after
empty line. Fixed. Now empty lines are left untouched.
- AFL: extra parameter for DateTimeToStr function mode (mode = 0 - convert
both date and time portion, 1 - only date, 2 - only time ) Note that mode
2 would give you empty string when applied on chart with daily or longer
interval
- AFL: new function GfxFillSolidRect( x1, y1, x2, y2, color ) - it is fastest
method to fill solid rectangle with single color (faster than GfxRectangle)
pw = Status("pxwidth");
ph = Status("pxheight");
GfxFillSolidRect( 0, 0, pw, ph, colorBlack );
- AFL: new function SumSince - a fast sum of array elements since condition
was true, works like Cum( array ) - ValueWhen( condition, Cum( array ) )
or Sum( array, BarsSince( condition ), but much faster
Syntax: SumSince( condition, array )
- AFL: Variable period Sum() performance improved significantly when period
changes +/-1 on bar by bar basis
- Categories dialog: added ability to re-arrange the order of markets/groups/sectors/industries
and watch lists using "Move Up" / "Move down" buttons
This is non-trivial task as all symbols must be synchronized with the change
as when the ordering of categories change then all symbols data must be re-indexed
to reflect new order as symbols refer to oridinal position of category.
- New Analysis: Added an option "Auto-size columns to fit content" -
OFF by default. When turned on, column widths are adjusted to fit the content
after analysis is complete. Note that this means that any widths specified
in width parameter in AddColumn width will be ignored when this is turned
ON.
- New Analysis: when "Wait for backfill" was turned ON and some
symbols in the "Apply to" list were wrong (non-existing) then Analysis
attempted to run code for symbol without quotes causing trouble. Fixed.
CHANGES FOR VERSION 6.05.0 (as compared to 6.04.0)
- AFL Editor Find in Files implemented - on the output list you can double
click on line to open the file in the editor
- AFL Editor/Debugger: Code Check and Profile stopped working when it was
run after debugging session. Fixed.
- AFL: Null is accepted by MxFromString now
- AFL: performance of printf() for large volume output (>60000 characters)
improved ~60 times.
- Charts: reduced tearing when resizing the chart window
- Debugger now can use either base time interval or current chart interval
(Tools->Preferences, Debugger tab, "Bar interval" setting)
- Debugger: implemented Output window (for printf() output during debugging)
- Removed old-style legacy AFL editor from the code, removed "use new
editor" checkbox from the preferences. A new editor is used always now.
- UI: Unfold triangles in tree views and checkboxes in Layers list were hard
to click on HighDPI screens because icons were too small. Fixed. Now larger
icons (32x32) are used instead of small (16x16) on small tablets like 8''
Windows with righ resolution (such as 1920x1200) that have very high DPI
(approx 200DPI).
- Watch window: now expressions with 2D subscripts to access elements of
matrix matrix[ x ][ y ] are supported
CHANGES FOR VERSION 6.04.0 (as compared to 6.03.0)
- AFL Editor & Watch Window: the contents of matrices is now displayed
in value tooltips and watch window
- Debugger state (watch variables/expressions and breakpoint locations) is
now saved between AFL editor sessions (formula-wise so each formula has its
own "debug state"). The data are saved in XML file with .dbg extension
- Debugger: MDI mode implemented. In 6.0.3 AFL Editor did not support 'MDI
mode' (even crashed), now this functionality is back. Also Watch window is
available in MDI mode and debugger is working in MDI mode too.
- Preferences: added new page with Debugger settings.
The settings are as follows:
+ Limit BarCount to - defines maximum number of bars in arrays (BarCount)
used during debugging
+ Auto-scroll to first changed item - when this is ON, the "Arrays" list
in the Watch window is scrolled automatically to first array item that has
changed (so you don't need to locate elementsm that changed manually)
+ Keep debugging state - when this is ON, AFL editor saves the debug state
(breakpoints and watches) in the .dbg file along with the formula when closing
the editor and restores the state when formula is reopened.
- Preferences: 'Editor' tab moved so 'AFL', 'Editor', and 'Debugger' tabs
are next to each other, also 'Alerts' and 'Currencies' tabs moved before
'Miscellaneous'
- Watch window: a new tab "Arrays" shows exploration-like array
output for detailed examination of array contents (first 20 arrays from watch
window are reported)
- Watch window: implemented array item change highlighting and auto-scrolling
so first changed item is always visible in the 'Arrays' tab
- Watch window: implemented expression evaluator, so you can not only display
variables, but also expressions involving variables such as (high+low)/2
or individual array elements such as myvariable[ i ] where i is dynamic loop
counter
- Watch window: implemented value change highlighting: changed values are
displayed with light yellow background, additionally numeric (scalar) values
are displayed in green when they increased or red if they are decreased
- Watch window: pressing DELETE key while editing variable name caused deletion
of variable from watch. Fixed.
- Watch window: variables can now be drag-dropped from AFL editor window
CHANGES FOR VERSION 6.03.0 (as compared to 6.02.0)
- AFL Editor: Implemented brand new fully integrated Visual AFL Debugger
NOTES: this the work-in-progress more features will be added in later betas
- Debugger: Implemented breakpoints (including those set before compilation
as well as adding/removing breakpoints during debugging)
To add/remove breakpoint use red circle toolbar button or press F9
Breakpoints can be added and removed at any time (during editing, when debugger
is in 'running' state or stopped at breakpoint)
Breakpoints are implemented statement-wise (as single-stepping). Keep in
mind that there can be only one breakpoint in any single line so if line
has more than one statements
like this:
x=1;y=1;
the breakpoint will trigger before first statement in this line.
Breakpoints currently work with:
a) regular statements (that end with semicolon). For multi-line statements
place breakpoint at the beginning line of the statement
b) for loops
c) while loops
d) do-while loops (you need to place breakpoint where 'while' clause is
located, it won't break at the 'do' line as it essentially is no-op, if
you want to break at the beginning
of do, just place breakpoint on first statement inside { block }
d) if statements
e) return statements
f) switch/case statements
g) break statements
Breakpoints that you place on other lines, won't trigger. The AFL editor
won't allow to place breakpoint on empty line, or line that beginnins with
// comment or sole brace
- Debugger: Implemented single-stepping Step Into, Step Over
Single-stepping is done statement-wise. So it works on single statement at
a time. So for example, empty lines are skipped and statements spanning multiple
rows like below are treated as one step.
x = "test" +
" second row" +
" third row";
But if you put two statements in single line like this:
x = 1; y = 2;
Then this line would be treated as two steps (each expression x =1; and
y=2; separately).
Keyboard shortcuts:
Step Over F10
Step Into F11
- Debugger: Implemented variable value inspection tooltips (hover mouse over
variable to see its value)
- Debugger: Implemented Watch window with variable value display automatically
updating when debugger single-steps or reaches breakpoint
To add variable to watch window simply double click on the list (at the end
to add new variable).
You can also change variable name by double clicking on existing item
- Renaming of PersistVars.temp to PersistVars.bin failed on some versions
of OS. Fixed.
- RT Quote window: drag-drop list view shows small arrow marker for the drop
point now.
- RT Quote window: when moving items using drag-drop, moved items image was
flickering. Fixed
- UI: Chart zoom via Ctrl+mouse wheel now works so it attempts to current
mouse position as a "center" point of zoom when possible. (Previously
it always worked so right border was the 'center').
- AFL: Sum(array,N) outputs NULL values for indices starting from 0 upto
index N-1 instead of N
- When intraday data were used timestamp of 00:00:00 was not displayed in
data tooltip (empty field was shown). Fixed.
CHANGES FOR VERSION 6.02.0 (as compared to 6.01.0)
- AFL Editor: Implemented Line comment/uncomment feature (Edit->Line Comment,
Ctrl+Q) to automatically add/remove // line comments from single or multiple
lines. If multiple lines are selected, the content of the first selected
line is deciding whenever block of lines is to be commented or uncommented
- AFL: If any matrix cell has Null value then matrix product operator @ produces
Null respective row/column of the result matrix.
- AFL: if user called (a) GetPerfomanceCounter( 1 ) then (b) GetPerformanceCounter(
0 ) then subsequent call to GetPerformanceCounter(0) returned cumulated time
not from call (a) but from system boot. Fixed.
- AFL: matrix identifier can now be used in if-else statement. Such condition
checks whenever very first element of matrix [0][0] is NOT NULL. This is
useful for checking output of functions like MxInverse/MxSolve that would
return NULL in all cells if matrix is singular
So
m = Matrix( 10, 10, 0 );
// do something with matrix
if( m )
{
// some code
}
is equivalent to
if( NOT IsNull(
m[ 0 ][ 0 ] )
)
{
// some code
}
- AFL: MxSolve/MxInverse now return a matrix filled with Nulls as a result
if source matrix can not be inverted and produce warning level 2 instead
of an error.
- AFL: On Windows Vista and higher static variables use slim read-write (SRW)
lock instead of critical section. This gives 5% performance increase in multithreading
scenarios.
- AFL: StaticVarAdd( "name", value, keepAll = True, persistent
= False ) - an atomic addition (interlocked read-add-write) operation for
static variables
It is multithreading safe addition for static variables that are shared by
multiple threads. This function is atomic with respect to calls to other
static variable functions.
KeepAll flag when it is set to true emulates the behavior of AddToComposite.
It keeps all values that are already present, so if data holes exists in
current symbol,
the bars that are present in static variable but not present in current
symbol remain untouched.
When KeepAll is set to false then only bars that are present in current
symbol are kept. Any other bars that were present in static variable but
not present in currently
processed symbols are removed. That is what normally happens with StaticVarSet().
In fact when KeepAll is set to False, StaticVarAdd can be seen as the
following pseudo code:
EnterCriticalSection
x = Nz( StaticVarGet( "name" ) ); // read exisiting value (and
convert Nulls to zero)
x += Nz( value ); // add value to existing
StaticVarSet( "name", x ); // store updated value
LeaveCriticalSection
The function can be used to create composites like this:
if( status("stocknum")
== 0 )
{
// remove any earier composite values
StaticVarRemove("~Composite");
}
StaticVarAdd( "~Composite", MACD() > Signal()
);
Buy = 0;
NOTES:
1. StaticVarAdd automatically converts all Nulls to zeros (as AddToComposite
does).
2. If you want to replace AddToComposite with StaticVarAdd, keep in mind
that by default AddToComposite skips symbols in group 253. This is done
so composite symbols
are not added to themselves. If you have composite symbols in your database
and want to skip symbols in group 253 you can use
if( GroupID() != 253 ) StaticVarAdd("~Composite", values );
3. Thanks to extensive code tuning, StaticVarAdd generally offers better
performance than AddToComposite which was already blazing fast. Single
threaded StaticVarAdd may be twice as fast as ATC. With 8 threads running
StaticVarAdd may be 4x as fast (it does not scale as much as naive person
may think, because critical section limits performance due to lock contention).
To illustrate the amount of fine tuning applied it can be said that first
'straightforward' version of StaticVarAdd was actually 20 times slower
than ATC.
4. Be careful when using "quickafl" as StaticVarAdd would not
increase 'required bars' (as ATC does), so if you want to actually add
all bars and quick afl is turned on in analysis, it is better to add SetBarsRequired(sbrAll,
sbrAll)
- AFL: Study() returned NULL array when line's start date was greater than
end date. Fixed (now it works for lines drawn from right to left too).
- Docs: Example polynomial fit formula shows how to gracefully handle singular
matrix and overflow/not-a-numbers in polynomial calcs
order = Param( "n-th
Order", 10, 1, 16, 1 );
length = 60;
lvb = BarCount - 1;
fvb = lvb - length;
yy = Matrix( length + 1, 1, 0 );
xx = Matrix( length + 1,
order + 1, 1 );
yy = MxSetBlock( yy, 0,
length, 0, 0, Ref( C,
fvb ) );
x = BarIndex() - length/2;
for( j = 1;
j <= order; j++ )
{
xx = MxSetBlock( xx, 0,
length, j, j, x ^ j );
}
xxt = MxTranspose( xx );
aa = MxSolve( xxt @ xx, xxt ) @ yy;
//aa = MxInverse( xxt @ xx ) @ xxt @ yy; // alternative
way
if( aa ) // check
if matrix is not null (so solution exists)
{
rr = Null; // store the fit in
rr
for( i = fvb;
i <= lvb; i++ )
{
rr[i] = aa[0][0];
for(
j = 1; j <= order; j++ )
{
rr[i] += aa[j][0]
* x[ i - fvb ] ^ j;
}
}
if( IsNan(
rr[ fvb ] ) )
{
// our polynomial
yields infinite or not-a-number result due to overflow/underflow
Title = "Polyfit
failed. The order of polynomial is too High";
}
else
{
SetChartOptions( 0, chartShowDates );
SetBarFillColor( IIf( C > O, ColorRGB( 0, 75, 0 ), IIf( C <= O, ColorRGB( 75, 0, 0 ), colorLightGrey )
) );
Plot( rr, "rr", colorWhite, styleLine | styleThick);
}
}
else
{
Title = "Matrix is singular. The order
of polynomial is too high";
}
Plot( C, "", IIf( C > O, ColorRGB( 0, 255, 0 ), IIf( C <= O, ColorRGB( 255, 0, 0 ), colorLightGrey )
), styleDots | styleNoLine );
- Persistent static variables are now saved to PersistVars.temp and once
write is successful the file is renamed to PersistVars.bin. This is to prevent
data loss when writing very large sets of persistent variables.
- When more than one error is detected in single line of the formula then
the first error message is displayed instead of last one in chart/commentary/analysis.
CHANGES FOR VERSION 6.01.0 (as compared to 6.00.0)
- AFL: MxDet( mx, method = 0 ) - calculates determinant of the matrix
method = 0 - auto (use slow method for matrices of upto and including 5x5,
fast for larger matrices)
method = 1 - slow (slow, more accurate)
method = 2 - fast (LU decomposition, less accurate )
"slow" method uses Laplace expansion
" fast" method uses LU decomposition
" Slow" method for small matrices (1x1, 2x2, 3x3, 4x4) is actually
faster than "fast", equally fast for matrix 5x5 and
slower than "fast" method for matrices larger than 5x5
For this reason "auto" method uses "fast" LU method
only for matrices larger than 5x5
LU decomposition is fast but subject to higher numerical errors. "Slow" method
is slower yet produces much more reliable results.
For example Octave/MatLab that use LU decomposition would say that determinant
of singular matrix like this
{ {16, 2, 3, 13}, { 5, 11, 10, 8}, {9, 7, 6, 12}, {4, 14, 15, 1 } }
is -1.4495e-012 due to roundoff errors of LU method.
If you want to calculate determinant using fast (LU decomposition) method,
call MxDet with fast parameter set to 2.
CAVEAT: Laplace method has complexity of O(N!) and for this reason, even
if you use method = 1, the maximum dimension for this method is limited
to 10x10.
Matrices larger than that are always calculated using LU method
- AFL: MxFromString() - creates a new matrix out of string in Mathematica/Wolfram
list-style: "{ { 1, 2, 3 }, { 4, 5, 6 } }" or Matlab/Maple style "[
[ 1, 2, 3 ], [ 4, 5, 6 ] ]" or GNU Octave comma-semicolon style [ 1,
2, 3; 4, 5, 6 ]
- AFL: MxGetBlock( matrix, startrow, endrow, startcol, endcol, asArray =
False )
Retrieves items from rectangular submatrix (block) and returns either smaller
matrix (when asArray is set to False)
or "normal" AFL array (when asArray is set to True). If array has
different number of bars, unused elements are filled with Null.
z = Matrix( 2, 20, 0 );
// first row
z = MxSetBlock( z, 0, 0, 0, 19, Close );
// second row
z = MxSetBlock( z, 1, 1, 0, 19, RSI( 5 ) );
printf("Matrix z\n");
printf( MxToString( z ) );
x = MxGetBlock( z, 0, 1, 0, 19, True );
printf("Items are now in regular array (data series):\n" );
for( i = 0; i < 20; i++ )
printf( NumToStr( x[ i ] ) + "\n" );
z = MxGetBlock( z, 0, 1, 0, 1 ); // retrieve upper 2x2 submatrix
printf("Upper submatrix z\n");
printf( MxToString( z ) );
- AFL: MxInverse( mx ) - calculates inverse of the matrix (see comments to
MxSolve for more info)
- AFL: MxSetBlock( matrix, startrow, endrow, startcol, endcol, values = 0
)
Sets values in the rectangular block of cells (rows in the range startrow..endrow
and columns in the range startcol..endcol inclusive).
This allows to fill entire or partial rows, columns and all other kind of
rectangular areas in the matrix with user specified data
Row and column numbers are zero based.
If values parameter is scalar, all cells in specified block are filled with
that value.
If values parameter is an array, cells in the block are filled from left
to right and from top to bottom with consecutive values taken from that array.
If there are more cells in the block than values in the array, the array
item counter wraps around to zero and starts taking values from the beginning
Note: the function creates new matrix as a result (so source matrix is
unaffected unless you do the assignment of the result back to the original
variable)
Example 1:
// Create a matrix 6x6
// and fill 4x4 interior (except edges with consecutively increasing numbers)
y = Matrix( 6, 6, 0 );
y = MxSetBlock( y, 1, 4, 1, 4, Cum(1));
printf("Matrix y\n");
printf( MxToString( y ) );
Example 2:
// Create a matrix 2 rows x 20 columns and fill rows 0, 1 with first 20
values of Close and RSI(5) arrays respectively
z = Matrix( 2, 20, 0 );
// first row
z = MxSetBlock( z, 0, 0, 0, 19, Close );
// second row
z = MxSetBlock( z, 1, 1, 0, 19, RSI( 5 ) );
printf("Matrix z\n");
printf( MxToString( z ) );
- AFL: MxSolve( A, B ) - solves linear equation system A@X = B
A needs to be square matrix NxN
B has to have N rows and at least one column (vertical vector).
Then calling
X = MxSolve( A, B ) would give vertical vector holding solution of the system
of equations A @ X = B
B can also be a matrix,with each of its column representing different
vector B. This way single call to MxSolve can solve several systems with
same matrix A but different right hand vectors.
If B is a matrix NxM then MxSolve will produce result also having NxM cells
with each column representing single solution.
Example 1:
A = MxFromString("[ 1, 1, 1, 1; 0, 2, 5, -1; 2, 5, -1, 1; 2, 2, 2,
1 ]");
B = MxFromString("[ 7; -5; 28; 13 ]" ); // single vertical vector
B
printf( "Solving A * X = B\n" );
printf("Matrix A\n");
printf( MxToString( A ) );
printf("\nMatrix B\n");
printf( MxToString( B ) );
X = MxSolve( A, B );
printf("\nSolution X\n");
Example 2:
A = MxFromString("[ 1, 1, 1, 1; 0, 2, 5, -1; 2, 5, -1, 1; 2, 2, 2,
1 ]");
B = MxFromString("[ 7, 14 ; -5, -10; 28, 56; 13, 26 ]" ); //
2 right-hand side vertical vectors
printf( "Solving A * X = B\n" );
printf("Matrix A\n");
printf( MxToString( A ) );
printf("\nMatrix B\n");
printf( MxToString( B ) );
X = MxSolve( A, B );
printf("\nSolutions X\n");
printf( MxToString( X ) ); // two solutions
(Highly) Technical note about numerical precision:
Despite the fact that both MxSolve and MxInverse use double precision
arithmetic solving/inverting matrices is subject to numerical precision
of double IEEE
and for example zero result may come up as something like 1.4355e-16 (0.0000000000000001)
due to the fact that double precision is still limited in accuracy (16
digits).
The result of
X = MxInverse( A ) @ B;
although mathematically the same as solving the system of equations, would
yield slightly different result because if you do the inverse the returned
matrix is converted back
to single precision and matrix product is performed with single precision.
When you use MxSolve you are performing all calcs using 64-bit (double)
precision and
only end result is converted back to single precision. So for example polynomial
fit code works better with MxSolve than MxInverse
// Least Squares Polynomial Fit test
order = Param( "n-th Order", 15, 1, 25, 1 );
length = 60;
lvb = BarCount - 1;
fvb = lvb - length;
yy = Matrix( length + 1, 1, 0 );
xx = Matrix( length + 1,
order + 1, 1 );
yy = MxSetBlock( yy, 0,
length, 0, 0, Ref( C,
fvb ) );
x = BarIndex() - length/2;
for( j = 1;
j <= order; j++ )
{
xx = MxSetBlock( xx, 0,
length, j, j, x ^ j );
}
xxt = MxTranspose( xx );
aa = MxSolve( xxt @ xx, xxt ) @ yy;
//aa = MxInverse( xxt @ xx ) @ xxt @ yy; // alternative
way
rr = Null; // store the fit in rr
for( i = fvb; i <= lvb; i++
)
{
rr[i] = aa[0][0];
for( j = 1;
j <= order; j++ )
{
rr[i] += aa[j][0]
* x[ i - fvb ] ^ j;
}
}
SetChartOptions( 0, chartShowDates );
SetBarFillColor( IIf( C > O, ColorRGB( 0, 75, 0 ), IIf( C <= O, ColorRGB( 75, 0, 0 ), colorLightGrey )
) );
Plot( rr, "rr", colorWhite, styleLine | styleThick);
Plot( C, "", IIf( C > O, ColorRGB( 0, 255, 0 ), IIf( C <= O, ColorRGB( 255, 0, 0 ), colorLightGrey )
), styleDots | styleNoLine );
- AFL: MxSort( mx, dim = -1, ascening = True ) - sorts the matrix
Sorts all items in a matrix
When dim == -1 (the default) it would sort:
a) a row if there is only one row (vector is horizontal)
b) a column if there is only one column (vector is vertical)
c) each column separately if there are more rows and columns than one (so
we have actual 2D matrix).
When dim == 0 the function sorts the items in each row separately
When dim == 1 the function sorts the items in each column separately
// example
m = MxFromString("[ 9, 5, 6; 8, 7, 3 ]");
printf( MxToString( m ) + "\n\n" );
printf("%g, %g\n\n", MxGetSize( m, 0 ), MxGetSize( m, 1 ) );
m2 = MxSort( m, 0 ) ;
printf( MxToString( m2 ) + "\n\n" );
m3 = MxSort( m, 1 ) ;
printf( MxToString( m3 ) + "\n\n" );
- AFL: MxSortRows( mx, ascending = True, col1 = 0, col2 = -1, col3 = -1 )
Sorts the rows of the matrix in ascending/descending order of the col1 column.
When the col1 column has equal values, SortRows sorts according to the col2
and col3 columns in succession (if col2 and col3 are specified and >=
0 ).
Column numbers are zero based.
Hint: if you want to sort columns instead you can Transpose/Sort rows/Transpose
back.
m = MxFromString("[ 9, 1, 6; 40, 30, 20; 8, 7, 3; 3, 5, 1 ]");
printf("Input matrix\n");
printf( MxToString( m ) + "\n\n" );
printf("Rows %g, Cols %g\n\n", MxGetSize( m, 0 ), MxGetSize(
m, 1 ) );
printf("Sorting every row separately\n");
m2 = MxSort( m, 0 ) ;
printf( MxToString( m2 ) + "\n\n" );
printf("Sorting every column separately\n");
m3 = MxSort( m, 1 ) ;
printf( MxToString( m3 )+ "\n\n");
printf("Sorting rows by contents of first column\n");
m4 = MxSortRows( m, True, 0 ) ;
printf(MxToString( m4 )+ "\n\n");
printf("Sorting rows by contents of second column\n");
m5 = MxSortRows( m, True, 1 ) ;
printf(MxToString( m5 )+ "\n\n");
- AFL: MxToString - creates string out of matrix variable in the Wolfram
list style like this (for 3x3 matrix): { { x00, x01, x02 }, { x10, x11, x12
}, { x20, x21, x22 } }
CHANGES FOR VERSION 6.00.2 (as compared to 6.00.1)
- AFL: An "Error 60: Requested matrix size is too large" message
is displayed now when MxCreate is called with ( rows * cols ) > 532 million
- Analysis:
Optimizer allows larger search spaces when using non-exhaustive optimization
without triggering Error 709
- Charting: you can zoom out using Ctrl+ mouse
wheel to the max (previously it zoomed out to 2000 bars only)
- Splash screen
is now centered on default monitor screen when main frame is maximized instead
of using old co-ordinates.
- Startup steps are logged into the broker.log to
diagnose rare cases of slow startup and/or crash at startup
- UI: Color picker
controls were too small on HighDPI display. Fixed.
- UI: New AFL Editor, Analysis
pages now have Options page in Customize dialog allowing to turn on "Large
icons" mode for HighDPI displays
CHANGES FOR VERSION 6.00.1 (as compared to 6.00.0)
- A crash could occur if user formula had PlotShapes() with layer argument
less than zero or greater than 255. Fixed (error 52 is displayed in such
case)
- AFL: MxTranspose could fail if rows > cols. Fixed.
- Calculate composites could crash if database had incorrectly set up market
ID for symbols. Fixed.
- UI: a crash could occur if user attempted to open WebReseach with weblinks.cfg
file missing or empty (could happen if setup program was not run). Fixed.
- UI: Analysis: Progress bar disappeared when user switched from floating
window to normal while analysis (like optimization) was in progress. Fixed.
- UI: Analysis: when window was in floating mode it was possible to close
running analysis window without warning. Fixed (now error message is displayed
and floating window is not closed until you cancel pending analysis)
- UI: Bug recovery window now properly reports Windows 8.1 and Windows 10
in version info
- UI: Improved font scaling of new splash screen/about window on Windows
8 and above and screens high DPI screens (>=200)
CHANGES FOR VERSION 6.00.0 (as compared to 5.99.0)
CHANGES FOR VERSION 5.99.0 (as compared to 5.98.0)
- AFL: added support for matrices (2D tables of numbers).
Matrix support is preliminary and subject to change.
To create a matrix use
my_var_name = Matrix( rows, cols, initvalue)
To access matrix elements, use:
my_var_name[ row ][ col ]
where
row is a row index (0... number of rows-1)
and
col is a column index (0... number of columns-1)
Matrices and their elements support all scalar (element-wise) arithmetic
and logical operations
So you can for example add, subtract, multiply, divide two matrices
if they have same dimensions with one call.
x = Matrix( 5, 6, 9 ); // matrix 5 rows 6 columns, initial value 9
y = Matrix( 5, 6, 10 ); // matrix 5 rows 6 columns, initial value 10
z = y - z; // will give you matrix 5 rows and 6 columns filled with
elements holding value 1 (difference between 10 and 9).
All those operations are performed ELEMENT-WISE.
You can also apply any arithmetic and logical operation on matrix AND
scalar value. This would perform element-wise
operation on each element of source matrix and given scalar value.
m = Matrix( 10, 10, 0 ); // m will be 10x10 matrix filled with zeros
z = m; // z is now also a matrix
for( i = 0; i < 10; i++ )
{
z[ i ][ 4 ] = i; // fill z with some other values, note that m will remain
unaffected.
}
for( i = 0; i < 10; i++ )
_TRACEF( "%g = %g, %g, %g\n", i, m[i][1], m[ i][4], z[ i][4]);
// scalar addition (element wise)
z += 3;
m += 5;
for( i = 0; i < 10; i++ )
_TRACEF( "%g = %g, %g, %g\n", i, m[i][1], m[ i][4], z[ i][4]);
Additionally there is a new operator @ that handles matrix product (matrix
multiplication in the sense used in linear algebra). This operator requies
that number of columns in first array is the same as number of rows in
second array.
- AFL: new Error 59. Too many subscripts - displayed when user attempts to
use 3 or more subscripts on matrix identifier
- AFL: new function Matrix( rows, cols, init_value = 0 ) - creates 2 dimensional
table with defined number of rows and column
- AFL: new matrix product (multiplication) operator: @
a new operator @ that handles matrix product (matrix multiplication in the
sense used in linear algebra). This operator requires
that number of columns in first array is the same as number of rows in second
array.
A = Matrix( 1, 3 );
B = Matrix( 3, 2 );
// matrix A = [ 1, 4, 6 ]
// matrix B = [ 2, 3 ]
// [ 5, 8 ]
// [ 7, 9 ]
A[ 0 ][ 0 ] = 1; A[ 0 ][ 1 ] = 4; A[ 0 ][ 2 ] = 6;
B[ 0 ][ 0 ] = 2; B[ 0 ][ 1 ] = 3;
B[ 1 ][ 0 ] = 5; B[ 1 ][ 1 ] = 8;
B[ 2 ][ 0 ] = 7; B[ 2 ][ 1 ] = 9;
X = A @ B;
_TRACEF("%g %g", X[ 0 ][ 0 ], X[ 0 ][ 1 ] );
- Charts: when chart is moved vertically by the user so it falls outside
upper edge, the parts falling outside are not drawn as flat line anymore
- New Analysis: Attempt to run Walk forward on periods without any data for
any symbols could result in exception. Fixed.
- New Analysis: Show current trade arrows did not show sell arrow after Individual
backtest. Fixed.
- UI: Color text output in the Interpretation window was sometimes incorrect
when numbers followed immediately EncodeColor call. Fixed.
- UI: Interval combo dropdown list adapts its width to higher DPI displays
now
- UI: Notepad is refreshed on sliding back from auto-hide
- UI: Updating Symbol Information after ASCII import
- Upgrade info: Free upgrade only for users who purchased license after May
31, 2013
CHANGES FOR VERSION 5.98.0 (as compared to 5.97.0)
- Analysis: Monte Carlo CDF charts use denser X grid (5% stepping)
- Analysis: Monte Carlo min/max/avg equity charts can now be displayed as
percent change instead of absolute values
- Analysis: Monte Carlo stats are now generated in out-of-sample Walk forward
steps by default
- Analysis: Walk forward Out-Of-Sample summary report includes Monte Carlo
simulation from ALL trades of all Out-of-sample periods
- Analysis: Walk forward: A crash could occur when Monte Carlo sim was enabled
in walk-forward optimization. Fixed.
- Analysis: Walk forward: Buy&Hold stats Max. sys drawdown was too large
for 2nd and next steps of walk forward OOS. Fixed.
CHANGES FOR VERSION 5.97.0 (as compared to 5.96.0)
- Analysis: Backtest report uses now client-side script pagination when trade
list contains more than 1000 trades so it takes less time to display it (3s
vs 15s for 30K trades). (Experimental, may be removed)
- Analysis: MC: MC Min/Max/Strawbroom equit chart was getting slow when number
of trades in backtest exceeded 1000. It draws faster now.
- Analysis: Monte Carlo charts are now moved to Reports (so they appear in
the REPORT as a separate page, not as tabs in Analysis) and generated in
separate thread
- Analysis: Monte Carlo: numerical values of distributions are now included
in the Report / Monte Carlo page
- HtmlView: new version 1.3, improved performance of Edit->Copy Table
for large tables (>30K rows) by 2 orders of magnitude. Also added support
for paginated tables.
- In 5.9x single-symbol portfolio backtests were reported as "0-symbols" in
Report Explorer. Fixed (fix applies to newly run backtests only)
- OLE: added LoadWatchlists() method to Broker.Application object. It allows
to re-load watchlist files for currently loaded database without re-loading
entire database. (Just in case you ask for SaveWatchlists - watchlists are
saved when you call SaveDatabase)
- OLE: splash screen closes automatically after 1 second if program was launched
from OLE, instead of being displayed as long as OLE object is active
- UI: Added global Analysis->Report Explorer menu to access Report explorer
without need to open Analysis window
- UI: small tweaks and fixes to About/Splash screen.
CHANGES FOR VERSION 5.96.0 (as compared to 5.95.0)
- AFL Editor: Verify Syntax uses raw symbol quotes, so it is faster and works
regardless of "mixed data" setting
- AFL Editor: Word wrap - wrapped lines uses same indent as previous line
- AFL: added SetStopPrecedence function
- AFL: ApplyStop() has 2 more parameters: ValidFrom/ValidTo - define starting
and ending bar since entry when stop is active
// Applystop( type, mode, amount, exitatstop, volatile, reentrydelay, validfrom,
validto )
ValidFrom - defines first bar since entry when stop can generate an exit.
0 means from the very beginning
ValidTo - defines last bar since entry when stop can generate an exit.
-1 means "infinite".
By default stops are valid all the time (0/-1).
So now you can create stops that get actived/deactivated in different
times.
This setting is independent for each stop type. It also works in conjunction
with SetOption("HoldMinBars", x ).
HoldMinBars affects BOTH regular exits and stops, preventing ALL kind of
exits during defined period.
ValidFrom/ValidTo works on each stop separately and does not affect regular
exits.
For example always have a stopTypeLoss always in affect and only allow
a trailing stop to become active after so many bars:
ApplyStop(stopTypeLoss, stopModePercent, 10, 1);
ApplyStop(stopTypeNBar, stopModeBars, 40, 1);
ApplyStop(stopTypeTrailing, stopModeRisk, 7, True, True, 0, 4 /* valid
from 4th bar after entry */ );
This feature is extended implementation of FC item #514
IMPORTANT:
Precedence parameter introduced in 5.95 has been REMOVED.
That functionality has been replaced by new SetStopPrecedence function.
- AFL: new function: _TRACEF() - printf-formatted trace
_TRACEF( "Close %g, Open %g", Open, Close );
- AFL: Param() offers increased stepping precision for small fractional increments
- Analysis: some newly introduced settings (MC mainly) were not saved in
Analysis project. Now they are saved.
- In 5.95.0 formulas 0, 1, -1, Null constants for Buy/Sell/Short/Cover assignments
and using Equity() could crash. Fixed.
- In 5.95.0 when ExitAtStop==1 for NBarStop was used it deactivated other
stops in backtestRegular mode. Fixed.
- In backtestRegular mode (old code path) when HoldMinBars was >=2 and
exit was triggered on very first bar opening after hold period price was
not adjusted to open as in other (new) backtest modes. Fixed.
- Monte Carlo: MC can be now enabled in Optimization and Individual Backtest
To enable Monte Carlo simulation in each backtest of optimization process
and each individual backtest you can use
SetOption( "MCEnable", 2 ); // value == 2 forces MC to be enabled
everywhere (in every mode including optimization).
the old option:
SetOption("MCEnable", 1 ); // value == 1 enables MC only in portfolio
backtests (default)
Note that enabling MC in optimization is highly discouraged unless you
actually use MC metrics as optimization target via custom backtester
or otherwise use MC distributions in the optimization process.
Monte Carlo process is computationally costly and while few hundred milliseconds
added to one backtest don't matter much,
in case of optimizations when these are multipled by number of steps you
can easily increase optimization time by orders of magnitude.
So unless you REALLY need MC distribution as custom metric and optimization
target, do NOT enable MC in optimization.
- UI: added special "meaningful" message on attempt to open the
.APX file that has invalid format
- UI: Analysis settings are now made newbie-friendly - a new "SCENARIO" combo
has been added that allows to choose from 4 preset scenarios
If user chooses preset scenario, the application sets properly the following
fields
- trade prices & delays
- exitAtStop modes
- N-bar stop priority
- ActivateStopImmediately
and disables those preset controls from accidential change.
Using presets prevents beginners from using wrong settings.
It is still possible to override any setting from the formula level (so
be careful what you write in your formula).
A default "CUSTOM" scenario works as in old versions -i.e. all
fields are enabled for change but it is user responsibility
to set those fields properly. Flexibility comes at a cost - some combinations
of settings that are not covered by preset scenarios
may make no sense and sometimes lead to wrong results. The user should
consult the manual and/or ask support when in doubt.
- UI: Analysis Settings: "Activate stops immediately" check box
has been moved from "General" to "Stops" tab where it
really belongs functionally
- UI: new About dialog/startup splash screen (asynchronously showing app
loading info)
- UI: Parameter window: when parameter names are very long, value area is
shrinked down to give more space for name, but not less than 160px/96DPI
CHANGES FOR VERSION 5.95.0 (as compared to 5.94.0)
- AFL Editor: Pretiffy formatting fixes and improvements. Also editor attempts
to keep unchanged scroll position after prettify.
- AFL Editor: Prettify selection now removes extra padding around parenthesis
and leaves only one space pad inside
- AFL Editor: Word wrap implemented (View->Word Wrap menu)
- AFL Engine: upsizing certain common scalar values (-1, 0, 1, Null) to array
is much quicker thanks to caching
- AFL: #pragma maxthreads N - where N is a natural number
1...<number of cores>. Allows to lower the number of parallel threads
using in Analysis. For example to run in just one thread use #pragma maxthreads
1
Attention: lowering number of threads degrades performance
- AFL: ApplyStop has new, 7th parameter: precedence that
defines the order in which stops are triggered if they appear on the very
same bar
Accepted values are 0, 1, 2, 3.
Stops are executed in increasing precedence order, so 0 is executed first,
1 - second, 2 - third, 3 - as the last.
Values outside 0..3 range are ignored.
Specifying -1 means "no change" - use default order.
Keep in mind that if you are changing ApplyStop order/precedence you
1. MUST DEFINE ALL APPLYSTOP even if you don't use all stop types. It you
don't use given stop type use stopModeDisable in mode parameter
2. There must be NO DUPLICATE in precedence numbers. Otherwise unpredictable
behavior may occur.
3. The order of events inside bar is unknown so specifying given order
of execution of stops
is based on assumptions that may or may not be correct for given trading
scenario. It is advised to keep max. loss stop as first one.
Whenever N-bar stop is executed first or not depends on your trading setup.
If you trade on open, then Nbar stop may be executed first (even before
max loss).
Trailing stop can be excuted before or after profit target depending on
your setup. Contrary to "gut feeling" executing trailing stop
before profit target is not necesarily more pessimistic, because
in several cases leads to increasing CAR instead of decreasing it. Now
you can test both. Choose whatever fits your trading style. Choo
Example:
// Applystops will be excuted in the following order: loss, trailing, profit,
n-bar:
ApplyStop( stopTypeLoss, stopModePercent, 5, True, False, 0, 0 /*precedence*/
);
ApplyStop( stopTypeTrailing, stopModePercent, 5, True, False, 0, 1 /*precedence*/
);
ApplyStop( stopTypeProfit, stopModePercent, 5, True, False, 0, 2 /*precedence*/
);
ApplyStop( stopTypeNBar, stopModeBars, 40, False, False, 0, 3 /*precedence*/
);
Note:
for backward compatibility:
With stopTypeNBar, when Precedence parameter is provided then ExitAtStop
setting is ignored.
When Precedence parameter is not provided for stopTypeNBar
there are two possible sequences applied by default
if NBarHasPriority setting is true or you call ApplyStop with ExitAtStop
set to true then sequence is N-bar, loss, profit, trailing
otherwise default sequence is loss, profit, trailing, N-bar
These defaults will be re-applied whenever you call ApplyStop( stopTypeNBar
... ) without providing precedence parameter.
Note 2:
Fixed ruin stop (99.6% loss) is always executed as last one.
- AFL: Custom Backtest: Monte Carlo simulation results are now available
in custom bactester (after backtest or PostProcess()).
per = Optimize( "period", 20, 2, 100, 1 );
Buy = Cross( C, MA( C, per ) );
Sell = Cross( MA( C, per ) , C );
SetOption("MCEnable", True );
SetOption("MCRuns", 1000 );
SetPositionSize( 1, spsShares );
SetCustomBacktestProc("");
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest(); // run default backtest procedure
// get access to Monte Carlo results
// note 1: it may be NULL if MC is NOT enabled
// note 2: MC results are available after Backtest() or PostProcess as
MC simulation is done in final phase of post processing
mc = bo.GetMonteCarloSim();
if( mc )
{
// get 25-th percentile of final equity distribution
bo.AddCustomMetric("FinalEq25", mc.GetValue( "FinalEquity",
25 ) );
}
}
- GetMonteCarloSim() to retrieve MC object to access distributions
MonteCarloSim object:
Methods:
GetValue("field", percentile)
- AFL: MonteCarloSim GetValue( "field", percentile
)
Available "field" values:
" FinalEquity"
" CAR"
" LowestEquity"
" MaxDrawdown"
" MaxPercDrawdown"
- AFL: new function: IIR - general-purpose Infinite Impulse
Response filter of order 1-4
IIR( input, b0 = 1, a1 = 0, b1 = 0, a2 = 0, b2 = 0, a3 = 0, b3 = 0, a4 =
0, b4 = 0 )
It implements fast 4th-order infinite impulse response filter.
Analytically it is:
y[ n ] = b0 * x[ n ] + b1 * x[ n - 1 ] + b2 * x[ n - 2 ] + b3 * x[ n -
3 ] + b4 * x[ n - 4 ]
+ a1 * y[ n - 1 ] + a2 * y[ n - 2 ] + a3 * y[ n - 4 ] + a4 * y[ n -4 ];
AFL equivalent:
y = x; // init so no glitches at the beginning appear
for( n = 4; n < BarCount; n++ )
{
y[ n ] = b0 * x[ n ] + b1 * x[ n - 1 ] + b2 * x[ n - 2 ] + b3 * x[ n -
3 ] + b4 * x[ n - 4 ]
+ a1 * y[ n - 1 ] + a2 * y[ n - 2 ] + a3 * y[ n - 4 ] + a4 * y[ n - 4 ];
}
Filters of orders 3 and 2 can be implemented by leaving unneeded arguments
at default value of zero.
Coefficients b0, b1, b2, b3, b4 multiply the input signal x[n] and are
referred to as the feedforward coefficients. Coefficients a1, a2, a3, a4
multiply the output signal y[n] and are referred to as the feedback coefficients.
Pay careful attention to the sign of the feedback coefficients. Some design
tools flip the sign of the feedback coefficients. In this case the feedback
coefficients must be negated.
This convention is used so feedback coefficients work the same as in AMA2
in case of first order filter, so
IIR( array, factor, 1-factor )
is the same as
AMA2( array, factor, 1-factor )
(with very minor difference is that IIR uses internally double precision
arithmetic while AMA2 uses single precision)
simple ema:
factor = 2/(period+1);
IIR( input, factor, 1- factor );
wilders:
factor = 1/period
IIR( input, factor, 1-factor );
Ehlers Supersmoother
Periods = 10;
c1 = 1.41421 * 3.14159 /
Periods;
c2 = 2.71828^-c1;
a1 = 2 * c2 * cos(
c1 );
a2 = -c2^2;
b0 = (1 - a1 - a2)/2;
b1 = b0;
x = IIR( Close, b0, a1, b1, a2 );
Plot( x, "Super Smoother", colorRed );
- AFL: SetOption/GetOption new fields for MC Equity/Straw broom chart, "MCChartEquityCurves" (true/false), "MCStrawBroomLines" (0..100),
MCPosSizePctEquity (0..100)
- AFL: Status("ThreadID") - gets the current thread ID under which
formula is executed
- Analysis: MCS: new position sizing method: Percent of Equity
- Backtest: fixed ruin stop (99.6% drawdown) in backtestModeRegular is executed
last as in other modes now.
- Memory usage was larger in 5.94 when lots of chart panes were open. Now
it is back to previous levels.
- MonteCarlo: Min/Max/Avg Equity + Straw broom chart implemented + Settings
- UI: Enhanced Assignment Organizer: Faster operation, display FULL NAME
alongside with symbol, sorting by column, alternate row background, proportional
resizing of both left/right lists
CHANGES FOR VERSION 5.94.0 (as compared to 5.93.0)
- Analysis: implemented Monte Carlo simulation (preliminary) produces CDF
charts of MC Final Equity, MC CAR, MC Max Drawdown $ and %, Lowest Equity
This feature is preliminary and subject to change.
AmiBroker's built-in Monte Carlo simulator is high speed (30+ million
trades per second) simulator that runs series of random trade sequences
based on backtest output.
It uses high-quality Mersene Twister random number generator.
It is run automatically after backtest and produces a series of CDF charts
(see extra tabs in the New Analysis window). These charts are probably
going to be moved
to the report at later stage.
Monte Carlo simulator is by default available only during portfolio backtest
runs. It is NOT available/running during optimization or individual optimization.
(I may enable it in the future).
You can control process of Monte Carlo simulation using new Settings page:
"Enable Monte Carlo Simulation" - turns on/off MC simulator
"Number of runs" - defines how many MC simulation runs is done
(default 1000)
"Position sizing" - defines position sizing used by Monte Carlo
simulator.
Position sizing algorithm used by MC process is independent from that used
by backtest. To do so MC may apply special processing to trade list obtained
from backtester depending on this option setting.
- "Don't change" - uses trades as they are coming from the backtester
without changing position size and profit as it is reported from the backtester
- "Fixed size: N shares/contracts" - trade fixed number of shares/contracts.
It takes per-share profit as reported by backtester and muliplies it by
N contracts as entered in the settings. Per-share profit is calculated
by dividing profit reported by the backtester by number of shares/contracts
reported by the backtester
- "Constant value: X" - trades fixed amount per trade. Takes
percent profit reported by backtester and multiplies it by constant value
entered to get the profit.
- AFL: SetOption/GetOption support new fields that control Monte Carlo simulation: "MCEnable" (true/false), "MCRuns" -
default 1000, "MCPosSizeMethod" - 0 - don't change, 1 - fixed size,
2 - constant amount, "MCPosSizeShares" (number), "MCPosSizeValue" (number)
- AFL: 32-bit round() is 7X faster and now works in "round half to even" (default
IEEE mode) instead of half towards infinity. Hand written in assembly due
to slowness of CRT
- AFL: int() and frac() functions are 2X faster now
- AFL: integer division operator \ (experimental)
- AFL: StrMatch() - string pattern/wildcard matching
StrMatch( "sting", "searchsting");
returns TRUE or FALSE whenever string matches searchstring or not.
Searchstring is can contain wild-card characters such as:
* - matches any string, including empty strings
? - matches any single character
This function is case sensitive (of course except wildcard characters).
If you want case insensitive matching - convert both string and searchstring
to lowercase or uppercase
prior to matching (StrLower/StrUpper)
Example:
x = StrMatch("Every breath you take", "Every * you *");
// x will be TRUE
x = StrMatch("Every step you make", "Every * you *");
// x will be TRUE
- AFL: support for UCN (universal character numbers) \uXXXX where XXXX is
hexadecimal character code. UCN output works in PlotText/PlotTextSetFont,
GfxDrawText, GfxTextOut, Chart titles, Interpretation and Commentary windows.
Requires Windows 2000 or higher
For example
heart "\u2764"
sun "\u2600"
star "\u2605"
EURO currency: "\u20ac"
Sigma (greek): "\u03a3"
alpha (greek): "\u03b1"
beta (greek): "\u03b2"
umbrella: "\u2602"
telephone: "\u260e"
hand pointing up "\u261D"
Tables of all UCN/Unicode characters
http://www.unicode.org
http://unicode-table.com/
http://www.unicodemap.org
http://en.wikipedia.org/wiki/List_of_Unicode_characters
Various arrows:
http://www.unicode.org/charts/PDF/U2190.pdf
Enclosed alphanumerics:
http://www.unicode.org/charts/PDF/U2460.pdf
(note: NOT all glyphs (graphical representations of characters) are actually
present in current font. This depends on your operating system. For example
Segoe UI in Windows 7 has lots of characters, but Windows 8 has more,
if a glyph is missing usually an empty rectangle is drawn). DejaVu free
font has lots of glyphs, Symbola free font has lots of weird shapes.
Plot( C, "", colorDefault );
PlotTextSetFont( "\u2665\u2126\u2191\u21d1\u24ee\u261D", "Segoe
UI", 30, 20, HighestVisibleValue( C )/2 + LowestVisibleValue( C )/2
, colorRed );
Title = "A demo of UCN: "+EncodeColor(colorRed)+"\u2665\u2126\u2191\u20ac\u03a3\u03b2\u2602\u260E";
- UI: Charts: when creating a new chart window Interval Lock was often marked
automatically. Now it is fixed (it is always OFF for new charts).
- UI: XY-charts could enter infinite loop (hang) if ALL Y-coordintates were
the same. Fixed.
- UI: XYCharts tooltip display shows X/Y point data under the cursor as in
old version but when it does not find any, it shows data point from relevant
X position
CHANGES FOR VERSION 5.93.0 (as compared to 5.92.0)
- AFL Editor provides precise positioning of cursor for errors that occur
within argument list of function calls
- AFL: Error 5 (incorrect type of argument in function call) is now much
more precise: it tells what function expects and what type is actually found
- AFL: Low Level Gfx: GfxSelectStockObject() added - allows to select so
called "stock" GDI objects such as Hollow brush (that allow to
draw empty circles, polygons and so on)
Available stock objects:
WHITE_BRUSH 0
LTGRAY_BRUSH 1
GRAY_BRUSH 2
DKGRAY_BRUSH 3
BLACK_BRUSH 4
NULL_BRUSH 5 (the same as hollow brush)
HOLLOW_BRUSH 5
WHITE_PEN 6
BLACK_PEN 7
NULL_PEN 8
OEM_FIXED_FONT 10
ANSI_FIXED_FONT 11
ANSI_VAR_FONT 12
SYSTEM_FONT 13
DEVICE_DEFAULT_FONT 14
SYSTEM_FIXED_FONT 16
DEFAULT_GUI_FONT 17
Example circle with hollow interior:
GfxSelectPen( colorOrange, 4 );
GfxSelectStockObject( 5 ); // hollow brush
GfxCircle(100, 100, 20 );
- AFL: Low-Level Gfx: GfxSelectHatchBrush( color, style )
Supported hatch styles:
HS_HORIZONTAL 0 /* ----- */
HS_VERTICAL 1 /* ||||| */
HS_FDIAGONAL 2 /* \\\\\ */
HS_BDIAGONAL 3 /* ///// */
HS_CROSS 4 /* +++++ */
HS_DIAGCROSS 5 /* xxxxx */
Hatch color is specified by color parameter, hatch background is specified
by current background color
see: GfxSetBkColor()
GfxSelectPen( colorOrange, 4 );
GfxSetBkColor( colorLightGrey );
GfxSelectHatchBrush( colorBlue, Param("Hatch pattern", 5, 0,
5 ) );
GfxCircle(100, 100, 20 );
- AFL: Low-level Gfx: GfxSetZOrder now supports using z-order outside -5...+5
range, but displays a warning 903 in the editor about possible decrease in
performance
- AFL: Percentile() function now supports variable period and has default
value for rank = 50 (such param gives median with average of upper/lower
median for even periods)
Note that Percentile is very computation intensive function (it involves
re-sorting arrays every bar)
and variable-period version (if you call it with period being ARRAY) runs
slower than scalar version
bi = BarIndex();
x = Percentile( Close, bi, 50 );
Plot( x, "Cumulative 50% Percentile", colorRed );
Plot( Close, "Price", colorDefault, styleCandle );
- AFL: XYAddChartPoint has new parameter (linecolor)
- AFL: XYChartSetAxis now supports the following styles: styleLine, styleDots,
styleHistogram, styleThick and combinations of those styles. Multiple lines
are possible - to start a new line call add a NULL point - XYAddChartPoint(
chartname, "", Null, Null );
chartname="example";
XYChartSetAxis(chartname, "[x]", "[sinx/x]", styleLine
| styleDots ); // bar style
for( x = -10; x < 10; x += 0.2 )
{
y = sin(x ) / x;
XYChartAddPoint( chartname, "", x, y, colorGreen, colorRed );
}
XYChartAddPoint( chartname, "", Null, Null ); // add a NULL point
to begin new line
for( x = -10; x < 10; x += 0.2 )
{
y = sin( 2 * x ) / x;
XYChartAddPoint( chartname, "", x, y, colorOrange, colorBlue
);
}
- Backtest: Buy-And-Hold simulation is performed and its statistics are calculated
and included in the Backtest Report.
This feature in worst case (single symbol test) may add upto 30% to backtest
time. In portfolio case the impact is negligible.
The Buy-and-Hold calculations are turned OFF when detailed reports are not
generated, for example during optimizations, so there is no slow down,
unless you turn on report generation during optimization SetOption("GenerateReport",
1 )
You can turn it off from Settings, Reporting
Buy-and-hold simulation uses current symbol when doing single-symbol backtests/optimization.
When doing portfolio backtest for more than one symbol, it uses "Portfolio
B&H symbol" as a benchmark for buy and hold.
- Backtest: Report : numerical values don't get wrapped when report window
is made small
- Backtester: implemented user-definable interest on account margin loans,
charged when net cash balance drops below zero. Margin rate (0..100%) is
definable in Analysis Settings.
Margin Rate is added ON TOP of interest rate defined in the settings.
So if interest rate is set to 0.1% and Margin rate is 1%, then effective
margin loan rate is 1.1%.
It also works with dynamic Interest rate, so if you define dynamic Interest
Rate symbol
then Margin Rate is added ON TOP current value taken from dynamic Interest
Rate
Current rates used are listed in the Detailed Log
- Backtester: implemented variable interest rate earnings
To use variable interest rate:
1. Add a symbol that will hold interest rates. It does not need to have
quotes every day,
you can have only quotes on days when interest rate changes.
Interest rates should be expressed in PERCENTS. So if interest is 5% you
should enter 5 in "close" price field for particular date
2. Enter the rate symbol into "Dynamic interest symbol" in
the Settings.
3. Enter "Fixed interest rate" in the Settings. It will be
used for days PRIOR to very first date available in intrest rate symbol.
- Backtester: interest earnings on positve cash balance and deductions on
margin loans are now reported in detail in "Detailed log" mode
every day
- Filter window enhanced. Now you can select multiple categories of the same
type (for example even 7 different watch lists) and combine them using "OR" (match
ANY), or "AND" (match ALL)
- UI: Commentary: added marquee progress bar to give visual clue to the user
when formula is being executed
- UI: Deletion of symbols is now confirmed with better looking task dialog
that has explicit button "Yes, delete permanently" to avoid user
mistakes
CHANGES FOR VERSION 5.92.0 (as compared to 5.91.1)
- Analysis: Exploration's XYChart now allows bar style in addition to point
style.
- AFL: New argument for XYChartSetAxis("chartname", "xaxis", "yaxis",
chartStyle = 0 )
Note that XY chart styles are different than regular chart styles and only
two are supported at the moment: 0 (default) - point style, 1 - bar style
(new)
Example of bar style usage (this is EXPLORATION code):
chartname = "example";
XYChartSetAxis( chartname, "[x]", "[sinx/x]", 1 ); //
bar style
for ( x = -10;
x < 10; x += 0.2 )
{
y = sin( x ) / x;
XYChartAddPoint( chartname, "",
x, y, colorGreen );
}
Second example:
chartname = "gaussian";
XYChartSetAxis( chartname, "[x]", "[gaussian]", 1 );
for ( x = -3;
x < 3; x += 0.125 )
{
y = exp( - x ^ 2 );
XYChartAddPoint( chartname, "",
x, y, IIf( abs( x ) <= 1, colorGreen, colorRed )
);
}
Bar style is useful for displaying probability distribution charts
- AFL: SetChartBkColor did not change the background behind X-axis text.
Fixed.
- AFL: WriteVal/NumToStr has now new roundAndPad parameter that controls
whenever function rounds output beyond 7th significant digit (and pads the
rest with zeros), By default rounding is OFF now because it was off in 5.90
and earlier and rounding introduced in 5.91 could confuse old time users
- AFL: WriteVal/NumToStr will display Warning 506 if specified format exceeds
maximum IEEE precision (7 significant digits) and roundAndPad option is turned
off
- Analysis: 3D optimization chart was not available after Individual (MT)
Optimization. Fixed.
- Analysis: a faster Export to CSV routine in 5.91.0 caused memory leak.
Fixed.
- Analysis: Export to CSV could run out of memory when exporting more than
2GB. Fixed.
- Log window shows correct path when using "Check AFL syntax" in
the editor, especially helpful if error is inside #included file
- Log window: double clicking on error line brings up AFL editor and scrolls
to error line / column automatically
- PersistentVars.bin loading moved to AFTER CWD fix (prevents problem with
deleting persistent variables when program is started with incorrect working
directory)
CHANGES FOR VERSION 5.91.0 (as compared to 5.90.1)
- AFL/Charts: GfxSetCoordsMode( 1 ) now works with logarithmic scale too.
- AFL: added "Warning 505. Division by zero" (level 2 warning).
It detects divison by zero in arrays too and prints which array element was
zero
- AFL: failed COM type conversion is reported as a regular error within editor/log
window instead of displaying message box
- AFL: new field in SetOption("WarningLevel", x ); -- allows to
change warning level. Level 1 is default for all AFL executions with exception
of AFL editor and commentary where warning level is set to 4
Warning Level
1 - report only level 1 warnings (502- too much plots)
2 - report level 1 and 2 warnings (above plus assignment within conditional,
division by zero, threadsleep period too long)
3 - report level 1, 2 and 3 warnings (above plus createobject/createstaticobject
)
4- report all warnings (default for the AFL editor)
- AFL: new function AddRow("text") to add a raw text row to the
exploration (allows outputing things without respecting Filter and without
being limited to number of bars). This function is preliminary and its parameters
are subject to change.
SetOption("NoDefaultColumns", True );
Filter = 1;
AddColumn( Close, "Column1" );
AddColumn( Null, "Column2" );
for( i = 0;
i < 10; i++ )
{
AddRow( StrFormat( "row
%g\tsecond column", i ) );
}
- AFL: new functions SparseCompress( query_points, data ) /SparseExpand(
query_points, data )
only_when = ( Month() % 2 )
== 0; // even months
only
x = SparseCompress( only_when, Close ); //
compact sparse data
y = MA( x, 10 ); //
regular calculation
y = SparseExpand( only_when, y ); //
expand sparse data
Plot( C, "Price", colorDefault, styleBar );
Plot( y, "Sparse MA from
even months", colorRed );
function SparseCompressEquiv( sparse_array,
data_array )
{
result = Null;
j = BarCount - 1;
for( i = BarCount - 1;
i >= 0; i-- )
{
if( sparse_array[
i ] ) result[ j-- ] = data_array[ i ];
}
return result;
}
function SparseExpandEquiv( sparse_array,
data_array )
{
result = Null;
j = BarCount - 1;
for( i = BarCount - 1;
i >= 0; i-- )
{
if( sparse_array[
i ] ) result[ i ] = data_array[ j-- ];
}
return result;
}
- AFL: NumToStr protected against user error of specifying precision higher
than provided by IEEE standard (display never exceeds 7 significant digits,
rest is padded with zeros)
- AFL: the engine displays more verbose error in case when GetArraySymbolCopy
fails
- Analysis: CSV Export speeded up 100+ times. Now exporting large files takes
seconds instead of hours. Export speeds on ordinary hard disks > 80MB/sec
- Charts: Interval Lock added (so now you can lock symbol or interval or
both)
- Commentary window - warning level raised to 4 (report all warnings in commentary
window)
- Sort() could crash with IndexMode = True and start parameter was greater
than zero. Fixed.
- When chart pane is being resized/dragged, real-time chart refreshes are
temporarily held to prevent disappearing of tracking rectangle
CHANGES FOR VERSION 5.90.0 (as compared to 5.89.0)
- AFL Editor: keytrigger expansion wasn't properly undone (via Edit->undo).
Fixed.
- AFL Editor: when last document was closed usign tab "X" mark the
message prompt that asked to save changes could pop up on wrong monitor in
multiple monitor setups and not disable AFL editor frame making it possible
to press "X" again and cause re-entrancy problem/crash. Fixed.
- Charts: rarely when chart sheets were switched an attempt to free already freed
memory could occur. Fixed.
- DB: fixed crash when switching databases while outstanding call for Foreign
from other thread was attempting to bring up other symbol data.
- IB plugin allowed to trigger backfill even if it was not connected causing
potential freeze/crash. Fixed.
- New Analysis: added error message when user has incorrect setting for PointValue.
PointValue MUST be greater than zero.
- OLE: attempt to set negative or zero PointValue results in exception
- Parameter window: when screen size is not enough to fit color popup beneath
color item, the popup is now displayed above the item
CHANGES FOR VERSION 5.89.0 (as compared to 5.88.0)
- AFL: Performance of variable-length Sum() improved significantly in some
common scenarios. Accurracy improved too.
- AFL: Sort displayed an error message if first == last even though this
case is perfectly fine. Fixed (no error and no sorting of single-element
array)
- AFL: Sort() with indexmode = True could cause immediate app exit in 64-bit
version only. Fixed.
- AFL: when negative 'range' was passed to variable-length version of Sum()
an application exited immediately. Fixed.
- Charts: Left/right extended Trend lines and Rays now use user-definable
Extension Factor (new field in Study properties) instead of always infinite
extent. Ext. Factor equal to ZERO means INFINITE, other values 0.1 ... 26
define how far to the left/right line is extended
- Charts: max zoom achievable via View->Zoom Out is increased to 5 million
bars, also Pref/Charting/Default zoom limit set to 5 million. Note that it
is still possible to zoom to "all" quotes regardless of number
of bars using View->Zoom->All
- Debug: Crash recovery window now requires to enter steps required to reproduce
problem. Without knowing what you did before it is very difficult to find
out the reason and fix the problem.
- Debug: Turned off remove frame pointers optimization in 32-bit builds for
better stack traces
- New Analysis: Exploration: default column width is increased automatically
to fit %6.2f number when there is a free space available in the right margin
- New Analysis: Optimization: when user-selected "Optimization target" can
not be found in the backtest results an error 711 is displayed and optimization
process is stopped
- New Analysis: trying to bring up "Parameters" window when currently
selected symbol had no quotes resulted in access violation. Fixed.
- New Analysis: Walk forward tab - when you click on result list Begin/End
column headers - these columns are now sorted by date instead of alphabetically.
CHANGES FOR VERSION 5.88.0 (as compared to 5.87.0)
- AFL: new function NullCount( array, mode = 1 ) - counts
the number of consecutive nulls at the beginning of the array (mode = 1),
at the end of the array (mode=2), from both ends (mode=3) and all nulls in
the array (including non-consecutive) (mode=0)
x = MA( C, 20 );
printf("Empty values
at the beginning = " + NullCount( x
) );
- AFL: Sort() now has additional "indexmode".
If indexmode is turned on, Sort() function returns array of indexes to the
sorted values instead of values themselves. So if first returned value is
2923 it means that input array[ 2923 ] is the smallest element
Filter = 1; AddColumn( BarIndex(), "Bar
Index", 1.0 );
AddColumn( Close, "Close" );
AddColumn( Sort( Close ), "Sorted
Close" );
AddColumn( Sort( Close, 0,
-1, True ), "Index
of sorted item", 1.0 );
- Charts: line drawings now have user definable line width in pixels (new "Line
width" field in Study Properties dialog). In addition to that "Thick
line" box makes line twice as wide (so actual width of thick line is
2 * lineWidth instead of adding 1 pixel to width)
- Charts: when formula causes an exception and Preferences are set NOT to
catch exceptions within indicator, then further execution of formula that
caused exception is blocked until Bug recovery window is dismissed (to prevent
stacking multiple bug recovery windows)
- Debug: 64-bit version now implements invalid parameter handler for catching
wrong C runtime calls
- Debug: 64-bit version: Crash recovery window now includes call stack to
allow better debugging of 64-bit app (previously only available in 32-bit)
- Debug: when AFL engine can not allocate memory for variable a proper message
is displayed instead of plain crash
- Debug: when program can not allocate memory for static variable you will
get actual message "Out of memory during creation of static variable");
- New Analysis: program checks From-To dates and if From > To it displays
error 710 instead of starting analysis
- New Analysis: QuickAFL finally implemented. To turn it on go to Settings
and check "Use QuickAFL" box. Gives very significant speed-ups
(>2x) when range is smaller than "All quotes"
- Prefs/Backtest: Number of user-definable currencies in Tools->Preferences
increased from 20 to 100.
- Prefs/Charting: "Default zoom (number of bars in a chart)" can
now be greater than 32767 (previous limit). Now it can be in range from 10
to 10 000 000.
- UI: when free virtual memory drops below 200 MB a popup is displayed in
the status area
CHANGES FOR VERSION 5.87.0 (as compared to 5.86.0)
- AFL Editor: in-line error reporting use bold font to highlight identifiers
in the error messages for better readability
- AFL: GetOption can now read BuyDelay/SellDelay/ShortDelay/CoverDelay
which makes it easier to write like this:
InLong = Ref( Buy, GetOption("BuyDelay") ); // make sure we delay
the signal in sync with settings
ApplyStop( stopTypeLoss, stopModePercent, IIF( InLong, 10, 15 ), True );
// 10% stop for long 15% stop for short
- AFL: new function: Reverse( array, first = 0, last = -1
) - returns a new array with the order of the elements in specified range
reversed
- AFL: new function: Sort( array, first = 0, last = -1 )
- sort a numerical array in ascending order starting from 'first' element
ending at 'last' element. If 'last' is not specified or negative then AmiBroker
will use BarCount - 1
Filter = 1;
AddColumn( BarIndex(), "BI");
AddColumn( Close, "Close");
AddColumn( Sort( Close ), "Sorted");
AddColumn( Reverse( BarIndex()
), "Reversed BI" );
- AFL: new function: StrSort( "item,list,to,be,sorted",
caseSensitive = True, separator = ',' ) - perform sorting of comma-separated
string (case sensitive/insensitive, separator definable!)
- AFL: new function: StrTrim( "string", "targets",
side = 3 ) - a function to trim extra characters (specified in "targets")
from either left (1), right(2) or both(3) sides of the string. If "targets" parameter
is an empty string, then function trims whitespaces (i.e. space, tab, newline)
Here is example of StrSort/StrTrim in per-symbol profit / loss custom metrics
code. Compared to Knowledge Base article it outputs SORTED list of symbols.
function ProcessTrade( trade
)
{
global tradedSymbols;
symbol = trade.Symbol;
//
if( ! StrFind(
tradedSymbols, "," + symbol + "," )
)
{
tradedSymbols += symbol + ",";
}
//
// HINT: you may replace it with
GetPercentProfit if you wish
profit = trade.GetProfit();
//
if( trade.IsLong()
)
{
varname = "long_" +
symbol;
VarSet( varname, Nz( VarGet(
varname ) ) + profit );
}
else
{
varname = "short_" +
symbol;
VarSet( varname, Nz( VarGet(
varname ) ) + profit );
}
}
//
SetCustomBacktestProc( "" );
//
/* Now custom-backtest procedure follows */
//
if ( Status( "action" )
== actionPortfolio )
{
bo = GetBacktesterObject();
//
bo.Backtest(); // run
default backtest procedure
//
tradedSymbols = ",";
//
//iterate through closed
trades
for (
trade = bo.GetFirstTrade( ); trade; trade = bo.GetNextTrade( ) )
{
ProcessTrade( trade );
}
//
//iterate through open
positions
for (
trade = bo.GetFirstOpenPos( ); trade; trade = bo.GetNextOpenPos( ) )
{
ProcessTrade( trade );
}
//
tradedSymbols = StrTrim(
tradedSymbols, "," );
tradedSymbols = StrSort(
tradedSymbols );
//iterate through the list of
traded symbols and generate custom metrics
for (
i = 0; ( sym = StrExtract(
tradedSymbols, i ) ) != ""; i++ )
{
longprofit = VarGet( "long_" +
sym );
shortprofit = VarGet( "short_" +
sym );
allprofit = Nz(
longprofit ) + Nz( shortprofit );
// metric
uses 2 decimal points and
//
3 (calculate sum) as a "combine method" for walk forward out-of-sample
bo.AddCustomMetric( "Profit
for " + sym, allprofit, longprofit, shortprofit, 2, 3 );
}
}
//
SetOption( "MaxOpenPositions", 10 );
//
Buy = Cross( MACD(), Signal()
);
Sell = Cross( Signal(), MACD()
);
Short = Sell;
Cover = Buy;
SetPositionSize( 10, spsPercentOfEquity )
;
- AFL: StrExtract has now extra parameter allowing to specify
separator character, example StrExtract("This;Is;Semicolon;Separated",
3, ';' );
- AFL: StrMid( "string", start, count ) now allows
to skip "count" parameter. If you skip count, then a substring
starting from 'start' to the end of the string will be returned.
- Charts: added ability to control number of decimals in chart value labes
via GraphLabelDecimals variable (example, adding GraphLabelDecimals =
2; to the formula would give you value lables with 2 decimal places
- Removed old-style Graph3*, Graph4*, Graph5*, Graph6*, Column3, 4, 5, 6
identifiers from auto-complete lists (only 0..2 left)
- Report Explorer: Edit->Copy now copies selection only (not entire table)
CHANGES FOR VERSION 5.86.0 (as compared to 5.85.0)
- AFL Editor: repeat replace + wrap around restarts only once and if no further
matches/replaces are found it displays "no more matching texts" instead
of restarting again.
- AFL Editor: when user closed Find&Replace dialog and then pressed F3
(find next) a couple of times to pass thru the end of document a crash could
occur. Fixed.
- Analysis: HTML report generator - settings page used </TD> tags to
close some <TH> tags which is formally incorrect, even if it works.
Fixed.
- Charts: Extreme descenders in text could be truncated (by one pixel) in
multiple line Title strings. Fixed.
- HTMLView - Backtest report viewer - added Edit/Copy, Edit/Select All and
Edit/Copy TABLE. The last command transforms HTML tables into CSV format
and copies it into clipboard so tables can be pasted easily to Excel. Also
it divides Entry/Exit columns into separate Entry/exit date/price columns
- Parameter window: mouse wheel scroll is now supported
- Realtime Quote window: added Bid/Ask trend - a graphical indicator showing
the direction of 10 most recent changes in real-time bid/ask prices
The right-most box is most recent and as new bid/ask quotes arrive they are
shifted to the left side. Color coding is as follows:
Dark green: bid > previous bid OR ask > previous ask
Bright green: bid > previous bid AND ask > previous ask
Dark red: bid < previous bid OR ask < previous ask
Bright red: bid < previous bid AND ask < previous ask
Red / Green box: ask < previous ask AND bid > previous bid
Green / Red box: ask > previous ask AND bid < previous bid
If bid/ask prices don't change there is no new box.
NOTE: This column works only if there are real-time quotes streaming (markets
are open)
- Realtime Quote window: Sorting by Full name column did no work. Fixed
- Report Explorer: Column layout (order and sizes) is now saved and restored
between runs
- Report Explorer: Loading and refresh performance significantly improved
(5x) using owner draw/ virtual mode
- Report Explorer: Multi-column sorting implemented
- Report Explorer: Numeric columns are now right aligned for better readability
- Report Explorer: visuals significantly improved (list uses modern style,
grid lines, immediate column resizing, double buffering for no flicker, thousand
separators, negative values are displayed in dark red, HighDPI aware, changed
toolbar)
- Snippet properties window now includes formula field for quick reference
(no highlighting here - it is by design)
CHANGES FOR VERSION 5.85.0 (as compared to 5.84.0)
- AFL Editor: backtest* mode constants added to auto-complete list
- AFL Editor: now Code snippets are available in auto complete list (type
@ plus first letter of snippet key trigger), and even without auto complete
activated @keytrigger is replaced by snippet text
- AFL: added support for single-character literals, so you don't need to
use Asc() funciton.
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );
Filter = Buy OR Sell;
AddColumn( IIf( Buy, 'B', 'S' ), "Signal", formatChar );
- AFL: adding/removing symbols to/from watch list via CategoryAddSymbol/CategoryRemoveSymbol
wasn't thread safe. Fixed.
- AFL: AmiBroker now checks number passed to SetOption("MaxOpenPosition",
x ) and SetOption("WorstRankHeld",x ) and trims down the request
to number of symbols in database to prevent running out of memory when user
specifies some absurdly high values,
- AFL: new function SendEmail( "subject", "message",
ShowUI = False )
A direct version of functionality already provided by AlertIF. This function
sends e-mail unconditionally and it is easier to use if you don't need state
logic provided by AlertIf.
Note that "From" and "To" addresses as well as SMTP email
configuration should be done in Tools->Preferences, "Alerts" page.
Without configuring E-mail settings first this function will not work.
E-mails are sent asynchronously (so function returns BEFORE e-mail is
actually sent, sending occurs in the background)
ShowUI parameter decides whenever user interface of e-mailer program is
shown after sending e-mail or not.
- AFL: SetOption("MarginRequirement", x ) checks if x is in the
range 1..100 and displays an error if not.
- Backtest: backtestRegular now keeps detailed info on sequencing of signals
within single bar to avoid problems with premature exit of just opened trade
when same bar exits were allowed and previous trade was not open due to insuffcient
funds leaving an unmatched exit signal.
In case when an exit signal that really belongs to previous trade was found
on the bar when next trade was open AmiBroker would display the following
entry in the detailed report log:
< Symbol> Exit/Entry/Scaling ignored because signal predates already processed
event.
FWIW: The issue did not affect other backtest modes.
- Code Snippets: added "Properties" button to the toolbar that
allows editing name/description/key trigger without re-inserting snippet
- Code Snippets: New snippet/Properties dialog is now resizable
- UI: changed cursor shape in all tree views from "hand" to normal
arrow
- UI: Code snippet window is now also available when AFL editor is in MDI
mode (use Window->Code Snippet menu when AFL editor is open)
- UI: Interpretation window: Ctrl+C (clipboard copy) did not copy the interpretation
text in 5.8x. Fixed.
CHANGES FOR VERSION 5.84.0 (as compared to 5.83.0)
- AFL Editor: Idle-time Info tips were positioned incorrectly in 5.83. Fixed.
- AFL Editor: Text of inserted snippet is selected so one can easily see
what was inserted and delete it if was a mistake.
- AFL: added Error 57. Invalid quotation mark (when user uses curly quotation
marks instead of straight quotation marks " to type a string literal)
- OLE: Document object has new property Interval (integer, read/write) -
selected Interval in seconds (tick/range/volume intervals are represented
by negative values)
- Report Charts: now it is possible to output HTML instead of graphics in
report chart formulas using AFL: EnableTextOutput( 3 ) - HTML output to backtest
report
- Report Charts: rewritten 3. Profit Table.afl using HTML embedding features
auto-scalable layout (so it enlarges when numbers are bigger), bold summary
columns, negative values in red, boundary date changed to last day of year/month
- UI: added Code Snippets window - allows inserting/deleting/saving selected
parts of the formula as snippets. Also implemented is convenient drag-drop
of snippet to the formula edit window
- UI: Further display improvements of Parameter window for high-DPI displays
(ParamList bullet point is bigger and positioned better, Slider is resized
when resizing param window, etc, etc)
- UI: On non-standard DPI displays Parameter window could show some visual
artifacts when scrolling. Fixed.
CHANGES FOR VERSION 5.83.0 (as compared to 5.82.1)
- New Analysis: Watch list 0 was used automatically (without opening WL selection
dialog) when new watch list is created between scan and RMB click->Add
results. Fixed.
- UI: Parameter window look and feel improved. Item height is increased and
slider thumb made wider for easier use on small size/high DPI screens
- Commentary: attempt to display commentary on symbol without any quotes
could cause access violation. Fixed.
- AFL Editor: Verify formula run on symbol without any quotes could cause
access violation. Fixed (proper error message is displayed).
- Analysis: Table header in the HTML report trade list is now right aligned
(to match number alignment) (affects newly generated reports only)
- AFL editor: when syntax check is performed and errors are detected, the
editor is immediately scrolled to first error
- Analysis: Minimum value for "Margin Requirement" is now 1 (1%)
- AFL: Since v5.65 RestorePriceArrays() did nothing when there was no preceding
SetForeign/TimeFrameSet. Now restores data if user explicitely overwrote
OHLC arrays in the code preceding it.
- Analysis: Detailed Log message "Symbol not entered bcause of insufficient
funds" improved to display requested position size in units such as
shares/% of equity instead of just encoded negative value
- AFL engine: brand new custom micro allocator speeds up AFL execution of
complex formulas with nested loops upto 3 times.
- Turned on LowFragmentationHeap in number of places
- Code snippets: New line \n was truncated from "data export" snippet.
Fixed.
- AFL Editor: parameter info tip does not disappear on pressing Backspace
key anymore.
- AFL Editor: Parameter info updates highlighted parameter when moving cursor
inside function's param list
- New Analysis: Less refreshes of Info page provide some extra speed
- Analysis: fixed HoldMinBars check for scenario 3 with both buy and sell
generated on all bars and random scores.
CHANGES FOR VERSION 5.82.1 (as compared to 5.82.0)
- AFL Engine: fixes for stability issues in 5.81.0/5.82.0
- Filter dialog: a matching count wasn't updated on opening the dialog. Fixed.
- Bug report window made a little bigger so at least crash address is seen
when someone sends screenshot instead of text
CHANGES FOR VERSION 5.82.0 (as compared to 5.81.0)
- UI: Interpretation and Commentary windows now support color text (via EncodeColor),
bold and italic styles (tags: <b></b> for bold, <i> </i> for
italic). Example:
printf("<b>Bold
text</b>\n");
printf("<i>Italic
text</i>\n");
printf("Now " + EncodeColor( colorRed )
+ "red text\n");
printf("and finally " + EncodeColor( colorGreen )
+ "green <b>AND bold <i>AND italic</i></b>\n");
printf(EncodeColor( colorBlack )
+ "going back to black");
- UI: Notepad, Interpretation and Commentary windows use default GUI font
instead of hard-coded Tahoma now
- AFL: functionality of PlotGrid() function extended
PlotGrid( level, color = colorDefault, pattern = 1, width = 1, label = True
)
pattern - defines line pattern. Available grid patterns 1..10 as shown
in the Tools->Preferences, "Axes & Grids"
1-7 are single pixel patterns, 8 is regular windows dot pattern (PS_DOT)
, 9 is regular Windows dash pattern (PS_DASH), 10 is solid line
width - grid line width (in pixels). Note that due to Windows GDI limitations
only patterns 8 (PS_DOT), 9 (PS_DASH), 10 (PS_SOLID) are available in widths > 1
label - whenever to display value label or not
Use PlotGrid to display horizontal lines that are constant instead of using
Plot.
PlotGrid offers much better performance in this case.
So instead of
Plot( 50, "", colorRed, styleLine | styleThick );
use:
PlotGrid( 50, colorRed, 10, 2, False ); //
solid line 2 pixels thick, no label
- AFL Editor: added 4 new snippets under "Function" category
- UI: Filter dialog now displays number of matching symbols in real-time
as selections are made
- AFL: CCI function speeded up by 50%
- Inserting indicator with Param() calls into chart when currently selected
symbol had no quotes caused exception. Fixed.
- AFL: In 5.81.0 CategoryGetName returned nothing (void) instead of string
type when specified category did not exist. Fixed (empty string is returned
now)
- New Analysis: portfolio backtest processing was attempted even if there
was no symbols that matched "apply to" filter. Fixed (unnecesary
processing is skipped now).
- AFL engine: in v5.81 access violation could occur when AFL array size was
0. Fixed.
CHANGES FOR VERSION 5.81.0 (as compared to 5.80.3)
- AFL Engine: custom memory allocator does not use Microsoft runtime lib
for reference tracking anymore. Result - complex formulas with lots of loops
and OLE (especially low-level custom backtests) run upto 3 times faster in
32 bit and 4 times faster in 64-bit
- AFL Editor: Parameter info tip significantly enhanced - now it re-opens
on typing each , (comma) and highlights current parameter to be entered.
- UI: Column setup dialog: added Mark All / Toggle All buttons
- AFL: GetFormulaPath() function added - returns full formula file path
- AFL Editor: Smart reference highlighting implemented (usage: mark a word
and all references become highlighted).
- AFL Editor: Find/Replace shows a message box when reached the end of the
file and offers restarting from the beginning if new "Wrap around" option
is turned on.
- AFL Engine: code refactoring for reduced size and improved speed
- AFL: when value of unsupported type was appended to string a crash could
occur. Fixed.
- AFL Engine: when IIf was called the memory upsized from scalar to array
could get freed twice (wrong). Fixed
- AFL: MACD() and Signal() functions made faster (approx 1.5-2x times)
- Analysis: Interest is added at the beginning of next bar (instead of end
of current bar), to account for overnight rate. This also fixes the problem
of ignoring interest in v.> 5.69
- UI: fixed yet another place where entering customization changed working
dir
CHANGES FOR VERSION 5.80.3 (as compared to 5.80.2)
- GfxTextOut / GfxDrawText did not work well in new co-ords mode = 1. Fixed.
- When Customize was entered from editor frame and user browsed for bitmap image
for the toolbar it could change current working directory. Fixed.
- Editing and saving some old charts formulas that were using absolute paths
(instead of relative) did not cause immediate chart update. Fixed.
CHANGES FOR VERSION 5.80.2 (as compared to 5.80.0)
- UI: Status bar prompt for recent databases and recent files was incorrect.
Fixed.
- When a formula that uses Category* functions is run inside commentary
window, the symbol list is auto-refreshed now.
- When commentary window was
open on completely empty database a crash could occur. Fixed.
- New Analysis:
Progress bar is not hidden until custom portfolio backtest phase is completed
- AFL:
when artithmetic operator was applied to variable that was uninitialized
or having invalid type a crash could occur. Fixed.
- DB: If external data source
set incorrect group or market or industry ID (lower than 0 or higher than
255) a crash could occur when updating symbol
list. Fixed,
incorrect data are switched back to zero and warning message is displayed.
- New
Editor: when user changes the formula name and presses "Save" the
editor now displays a confirmation dialog if file already exists
- Charting:
X-axis grid calculation speeded up 3x (for large number of bars)
- When chart
pane had NULL formula path attempt to edit formula or drag-drop it could
cause crash. Fixed.
- New Editor: crash could occur when formula was Saved as..." for
the first time outside "Formulas" folder and its subfolders. Fixed.
- AFL: Error 56 "Variable has an invalid type" added when variable
has uninitialized type or type set to some strange value (plugins may cause
this due to programmer error)
- AFL: in multithreaded charts unhandled exceptions
where not caught inside indicator even though preferences setting was to
catch them. Fixed.
- AFL: when formula is executed in "Indicator" mode
the execution stops at very first error and this error is displayed as most
relevant in
the chart
pane instead of last error which is usually not relevant (often side effect
of previous errors)
CHANGES FOR VERSION 5.80.0 (as compared to 5.79.0)
- New Analysis: An error 709 is displayed when user specified so many Optimize()
calls that search space is larger than 10^19 combinations (100 times more
than the age of The Universe in seconds)
- New Analysis: progress bar update is forced so even if program is 100%
busy the progress bar gets repainted
- New Analysis: "the analysis is in progress" text was not always
cleared after analysis has completed. Fixed.
- New Editor: Param info is displayed even when there are spaces between
identifier and opening brace
- New Editor: A full path to formula is displayed in the Status bar when
mouse hovers over formula name edit
- New Editor: pressing ENTER just after identifier name resulted in auto-change
case function ommitting first letter of the word. Fixed
- New Editor: added Window->Keep On Top menu (in separate frame mode)
- New Editor: Auto-complete pop up in immediate mode now does not appear
when editing existing word in the middle, but it is available on demand (Ctrl+SPACE)
- AFL: increased maximum acceptable value for ThreadSleep function to 1000
ms, and added appropriate level2 warning
- AFL: Error 52 wording changed from 'argument must be positive' to 'argument
must be greater than zero'
- UI: when any non-modal dialog was displayed, activation of the app always
brought up main frame in front possibly hiding New Editor. Fixed.
- UI: removed "use new editor" option from Preferences window.
New editor is always used now.
- UI: Main frame is now disabled (modal) when file dialog is open from AFL
editor
- Pre-processor errors occuring in run-time caused that chart pane stopped
refreshing. Fixed.
- Charts: Bar chart close/open ticks are by default one pixel smaller
- Weekly compression for Sunday data was off by one day for dates pre-1970.
Fixed.
- Weekly compression now offers user-selectable "first day of the week" in
File->Database Settings->Intraday Settings
- Application manifest modified to include compatibility section for Win
8.x
- Threads use current dir stored at application startup and resolve relative
paths in AB, not to rely on Windows, so relative paths are resolved even
if Windows changes dir
CHANGES FOR VERSION 5.79.0 (as compared to 5.78.0)
- New Editor: Inverting colors on printout did not work for many backgrounds.
Now white color is always used for background, foreground colors are kept
unchanged, except for white which is replaced with black
- New Editor: Changing formula name marks it as "modified" so Save
icon becomes enabled
- New Editor: Edit->Clear error message menu item added in MDI mode
- New Editor: Save icon is now grayed when formula is not modified
- New Editor: when separate editor frame was minimized, choosing "Edit
formula" did not restore frame back to normal (non-minimized) state.
Fixed.
- New Editor: Fold/Unfold did not always work correctly. Fixed. Also Fold
All folds on 1st level only, so it requires less clicks to unfold one section.
- New Editor: Copy as HTML automatically replaces white font with black.
Also HTML is shorter (black text does not use <font> tag) and coloring
is forced, so long texts are correctly copied with colors.
- New Editor: relative paths caused problems with ReplaceFile API and FAT32,
so relative paths are now converted to absolute prior to saving
- New Analysis now rejects attempts to use non-exhaustive optimization (OptimizeSetEngine)
when number of exhaustive optimization steps is less than 100 (Error 708)
- DB: when broker.markets, broker.groups, broker.workspace files were missing
then markets and groups from previously loaded DB leaked to newly created/loaded
db. Fixed - now they are always initialized with defaults. Also default market
0/group 0/sector 0/industry 0 is now labelled "Undefined"
- ASCII import: $MARKET and $GROUP commands allow to specify the name of
market/group (after comma) to be updated during import
- UI: added File->Save All menu item to separate editor frame
- AFL: reverted change #2623 as it resulted in regression in custom portfolio
backtest speeds
- Charts: Reverted #2621 change from 5.78.0 cached bitmap is now stretched
when chart is resized while the formula is being run
- Persistent variables that were loaded from PresistVar.bin but not updated
by the formula were removed on next start. Now they are kept.
CHANGES FOR VERSION 5.78.0 (as compared to 5.77.0)
- Prefs: "Use new editor" is now always turned ON at the start
of application.
- Low Level Gfx: performance improved for formulas making thousands of calls
to Gfx functions (3x speed up for 200K calls)
- Charts: cached bitmap is now stretched when chart is resized while the
formula is being run
- On saving broker.newcharts file a backup file is created prior to saving.
Then on startup in case broker.newcharts is corrupted, a backup file is used
instead
- New Editor: when auto-complete was in immediate mode typing xx.a resulted
in xx.AddCustomMetric to be shown immediately. Fixed - now in 'immediate'
mode single-selection choices are not auto-completed without user consent.
- New Editor: when user selected black background the colors on printout
are inverted to save toner/ink. Also added File->Print/Print Setup menu
item.
- New Editor: on application close editor window frame is closed first instead
of last. This gives more 'graceful' exit.
- New Editor: on dark backgrounds unmatched brace is displayed in lighter
blue color (instead of dark blue) for better visibility
- New Editor: Autocomplete listbox is now dismissed when user drags separate
editor frame or MDI child frame
- New Editor: now it uses application theme instead of hard-coded "VS2010" theme
- New Editor: auto complete does not try to pop up in file paths in #includes.
Also improved auto-complete operation in the very last line.
- New Editor prints debug string when saving document in order to diagnose
possible issues with FAT32/WinXP
- Sometimes crash occured on Window->Floating command when Interpretation
window was open. Fixed.
- UI: Window->Toggle Frame restores window from icon state (if was minimized)
now.
- UI: added View->Fold / Unfold, Margin menu items in the MDI editor menu
- UI: Charts file treeview gets refreshed when saving AFL to any folder,
not only 'Custom'
- UI: Customize keyboard page now displays an error message on attempt to
create shortcuts with A-Z letters and 0-9 digits without Ctrl/Shift/Alt modifiers
to prevent clash with the editor
- UI: AFL formulas are saved in separate MRU (most recently used) list (File->Recent
Formulas) so they do not interfere with other document types using Recent
File list
CHANGES FOR VERSION 5.77.0 (as compared to 5.76.0)
- New Editor: 'Use separate frame' mode implemented (Tools->Preferences, "Editor" to
turn this off and open as tab in main frame)
- New Editor: Toolbar customization functionality added
- UI: Window->Toggle Frame (Ctrl + ` ) menu/shortcut added to quickly
switch between main and separate editor frame
- UI: Window menu reordered (Tile/Cascade items moved up)
- New Editor: in 5.76 pressing Help button on dialogs when new editor was
open, directed help file to 'formula editor' page instead of given dialog
help file. Fixed.
- New Editor: On dark backgrounds the selection is darker than it was before
- New Editor: typing non-US characters (with right Alt key) is now working
- New Editor: Copy As HTML implemented
- New Editor: added ability to turn off line number margin, selection margin,
fold margin (from View menu)
- New Editor: added View->Fold All / Unfold All commands
- New Editor: when relative paths were used sometimes auto-reload and auto-save
before analysis did not work. Fixed.
- New Editor: Caret Ln/Col position is displayed in the status bar
- New Editor: Closing top error message bar clears ALL in-line error messages
- New Editor: added Edit->Clear Error message menu (Ctrl+E) - it clears
an error(s) in currently selected line/range
- New Editor: The width of line number margin is automatically adjusted with
regards to font size and line count and zoom level
- New Analysis: Progress bar is shown/hid quicker
CHANGES FOR VERSION 5.76.0 (as compared to 5.75.0)
- New Editor: Auto-complete has now 3 modes: disabled, on-demand (shows auto
complete list when you press Ctrl+SPACE as in old editor) and immediate (auto-complete
pops up immediately)
- New Editor: Auto change case and auto parameter info features can be turned
off from the preferences
- Prefs: Editor page changed:
a) added "Virtual space" checkbox to control whenever ability to
move caret past the end of the line is enabled or not
b) replaced "Auto-complete" box with 3-way selection radio buttons
(Disable/On-demand (Ctrl+Space)/Immediate) - to control whenever auto-complete
opens on Ctrl+SPACE combination or immediately after typing first letter
c) removed "Use syntax highlighting" box (now it is always ON)
d) removed "Highlight error line" (now it is always ON)
- New Editor: File is saved automatically when it is open in Analysis window
and analysis is run
- UI: leftover and/or user-defined keyboard accelerators for HOME/END/PAGE
UP/DOWN, letters and digits without Ctrl/Alt modifier are removed on startup
not to interfere with the editor
- UI: Ctrl+F added to default key accelerators
- New Editor: Implemented user-defined colors/styles/font (from Tools->Preferences, "Editor").
NOTE:
In 5.75 on Vista, Windows 7 and Windows 8 the editor automatically switched
to modern ClearType "Consolas" font that is present on those systems.
If you want to use this new font instead of old "courier" font,
go to Tools->Preferences, "Editor" and choose "Consolas" font
and size 10pt.
- New Editor: Implemented Help features (access to help pages Function reference,
Using AFL Editor, Param info, etc)
- New Editor: Chart tree is auto-refreshed when formula is saved under new
name (Save As...)
CHANGES FOR VERSION 5.75.0 (as compared to 5.74.0)
- Completely new AFL Editor, integrated with MDI structure with many new
features
- line numbering
- code folding
- automatic indent
- indentation markers
- brace highlighting
- improved auto-complete
- shows up immediately after typing 1 char
- properly detects multi line comments
- displays custom backtester member methods / properties
- in-line error reporting / highlight
TO SWITCH BACK TO OLD editor use Tools->Preferences, "Editor" tab:
UNCHECK "Use New Editor"
NOTE ALSO: that color/font preferences do not affect new editor yet (it
is on to-do list).
- New Analysis: few messages displayed in modal message box were moved to
message bar
- UI: Active state is tracked separately for each document type (so there
is 'last active chart' , 'last active analysis") to allow functioning
of new editor
- InfoSite added to the PluginNotification structure (Notify API callback)
struct PluginNotification
{
int nStructSize;
int nReason;
LPCTSTR pszDatabasePath;
HWND hMainWnd;
struct StockInfoFormat4 *pCurrentSIOld;
struct _Workspace *pWorkspace;
struct StockInfo *pCurrentSINew;
struct InfoSite *pInfoSite; // NEW 5.74
};
- AFL: Parser tracks position of some operators better so errors and warnings
should show locations more precisely (for example Warning 501 points to =
sign now)
- AFL: Parser produces more descriptive "Syntax error, indentifier 'name'
is undefined " or "... is not a function" when it encounters
a function call for undefined identifier or indentifier that is a variable.
Previously it returned 'syntax error, unexpected '('
- UI: removed global user-definable accelerators for Chart/Pageup/down/home/end
because they interferred with new AFL editor. Instead chart page/up/down/home/end
implemented locally (work only when chart has focus)
CHANGES FOR VERSION 5.74.0 (as compared to 5.73.0)
- AFL Editor: Code snippets implemented (phase 1). Code snippet is a small
piece of AFL code. It can be inserted by right-clicking in the AFL editor
window and choosing "Insert Snippet" menu
This is phase 1 of implemetation of code snippets. There will be other elements
added in the future.
There are two files located in AmiBroker directory that hold snippets:
CodeSnippets.xml - these are snippets shipped with AmiBroker installation
(and can be replaced in subsequent installations, so don't modify it!)
UserSnippets.xml - these are user-definable snippets. This file is NOT present
in the installation and user can create it by him/herself.
The XML schema for snippets file is simple (as below). Key trigger functionality
is NOT yet implemented, however Keytrigger fields should be included in
the definition for future use. It will be work like 'autocomplete' so that
you type the shortcut it, it will unfold to the formula.
Suggestions for new snippets are welcome.
<?xml version="1.0" encoding="ISO-8859-1"?>
<AmiBroker-CodeSnippets CompactMode="0">
<Snippet>
<Name>First Snippet</Name>
<Description>Description
of the snippet</Description>
<Category>User category</Category>
<KeyTrigger>?trigger1</KeyTrigger>
<Formula>
<![CDATA[
// the formula itself
]]>
</Formula>
</Snippet>
<Snippet>
<Name>Second Snippet</Name>
<Description>Description
of the snippet</Description>
<Category>User category</Category>
<KeyTrigger>?trigger2</KeyTrigger>
<Formula>
<![CDATA[
// the formula itself
]]>
</Formula>
</Snippet>
</AmiBroker-CodeSnippets>
- AFL: Low level GFX: Multi-layering (z-order) implemented. AFL: GfxSetZOrder
implemented
Plot( C, "Price", colorDefault );
GraphGridZOrder = 1;
GfxSetZOrder(0);
GfxSelectSolidBrush( colorGreen );
GfxCircle( 100, 100, 100 );
GfxSetZOrder(-1);
GfxSelectSolidBrush( colorRed );
GfxCircle( 150, 150, 100 );
GfxSetZOrder(-2);
GfxSelectSolidBrush( colorBlue );
GfxCircle( 180, 180, 100 );
- AFL: Low-level GFX: radius in GfxCircle() function is expressed in "X" units
(so it actually draws circle instead of ellipse when coords mode is 1). Additionally
you can specify radius in pixels even in co-ords mode = 1. To do so pass
radius as NEGATIVE number. Also one pixel is now added to the rounding box
so circle is centered at "x,y".
// fractional radius
is supported, so 0.5 would mean half of space between bars
Plot ( C, "", colorDefault);
GfxSetCoordsMode( 1 );
GfxSelectSolidBrush( colorViolet );
GfxSelectPen( colorRed );
bi = BarIndex();
start = FirstVisibleValue(
bi );
end = LastVisibleValue(
bi );
r = Param("radius", 1,
-5, 4, 0.1 );
for ( i
= start; i <= end; i ++ )
{
GfxCircle (
i , Close [i] , r);
}
- AFL: Low level GFX: in 5.73.0 the pixel co-ordinates were rounded differently
than in 5.72 and earlier. Fixed.
- AFL: Low level GFX: new function GfxGetTextWidth - returns pixel width
of specified string. NOTE: it is slow because it has to create temporary
DC and font to measure the text. It takes 40us (microseconds), that is about
40 times more than other Gfx functions.
GfxSetZOrder(5 );
GfxSelectFont("Tahoma", 30 );
GfxSetTextColor( colorWhite );
text = "This is a test";
GfxTextOut(text, 0, 50);
GfxSetTextColor( colorRed );
GfxTextOut("second
part in red", GfxGetTextWidth(text), 50 );
- AFL: fopen - new parameter: 'sharing' decides whenever file is open in
sharing mode or not. When sharing is True a file is prepared for subsequent
shared reading and writing.
When sharing parameter is True the following things happen:
- when mode is "w" (writing) or "a" (appending) then
file is open with a sharing flag that denies others to read and/or write
at the same time
- when mode is "r" (reading) then file is open with a sharing flag
that denies others to write to the file (shared reads are allowed)
- when open is unsuccessful due to sharing violation (other processes / threads
have that file open and deny reads/writes) then fopen would wait for 250ms
and retry automatically 4 times. After 4 unsuccessful retries it fails with
file handle == Null.
When sharing parameter is set to False (default) no such checking occurs
and file is open anyway without denying others to read/write. This may
cause data corruption if file is written to from multiple threads/external
processes at the same time. If you want to use this mode (sharing set to
False) in multithreaded environment to write data, you need to care about
synchronization yourself for example using critical section.
- UI: Added "Name" (full name) column to Real-time quote window
- AFL: Implemented user control over Y-axis cursor and tooltips by means
of new option chartDisableYAxisCursor, chartDisableTooltips added to SetChartOptions
SetChartOptions( 1, chartDisableYAxisCursor | chartDisableTooltips ); //
don't change cursor shape in Y axis area and tooltips
CHANGES FOR VERSION 5.73.0 (as compared to 5.72.0)
- AFL: SetOption("StaticVarAutoSave", interval ) - added to allow
periodical auto-saving of persistent static variables
The interval is given in seconds.
For example:
SetOption("StaticVarAutoSave", 60 ); // auto-save persistent variables
every 60 seconds (1-minute)
It is important to understand that persistent variables are saved ON EXIT
automatically, without any user intervention
so it should be enough for most cases. If you for some reason want auto-saves
when AmiBroker is running, then
you can use this function.
Please note that writing many static variables into physical disk file
takes time and it blocks all static variable access
so you should AVOID specifying too small auto-save intervals.
Saving every second is bad idea - it will cause overload. Saving every
60 seconds should be fine.
Calling function with interval set to zero disables auto-save.
SetOption("StaticVarAutoSave", 0 );
-
AFL: new GfxSetCoordsMode - rewritten Low-Level Gfx to allow fractional
coords and bar/price co-ords mode in addition to pixel
// NEW FUNCTION
GfxSetCoordsMode( mode );
- allows to switch co-ordinate system for low-level gfx functions from
sceen pixel (mode = 0) - the default, to
bar / price mode (mode = 1 ) where X is expressed in bar index and Y is
expressed in price.
This new mode allows way easier overlays on top of existing charts without
need to do conversion between bars/price pixels
and without any extra refresh normally required in old versions when Y
scale changed.
The function can be called to switch back and forth from pixel -> bar/price
mode and vice versa a number of times
allowing to mix different modes in the same chart.
When co-ordinate mode 1 is selected (bar/price), co-ordinates can be fractional.
For example if x is 2.5 it means half way between bar 2 and 3.
Example:
// The sample shows
how using GfxSetCoordsMode( 1 )
// results in
// a) easier coding of overlay charts
that plot on top of built-in charts (no need to convert from bar/price
to pixels)
// b) perfect matching between built-in
Plot() and Gfx positioning
Plot( C, "Price", colorDefault, styleLine );
GfxSetOverlayMode( 1 );
GfxSetCoordsMode( 1 ); //
bar/price mode (instead of pixel)
GfxSelectSolidBrush( colorRed );
GfxSelectPen( colorRed );
boxheight = 0.01 *
( HighestVisibleValue( C )
- LowestVisibleValue( C )
);
bi = BarIndex();
start = FirstVisibleValue(
bi );
end = LastVisibleValue(
bi );
for ( i =
start; i <= end; i++ )
{
Cl = Close[
i ];
Op = Open[
i ];
Color = IIf(
Cl > Op, colorGreen, colorRed );
GfxSelectPen(
Color );
GfxSelectSolidBrush(
Color );
bodyup = Max(
Op, Cl );
bodydn = Min(
Op, Cl );
GfxEllipse(
i - 0.4, bodyup, i + 0.4,
bodydn );
GfxMoveTo(
i, H[ i ] );
GfxLineTo(
i, bodyup );
GfxMoveTo(
i, bodydn );
GfxLineTo(
i, L[ i ] );
}
-
Charts: functions calculating day offset (GetBarsBetweenDates) support
years > 2038 and are now much faster (don't count days in loops but
use smarter calendar math instead)
-
Charts: Cycle Lines tool has drawn lines in weird places when using very
long cycles that resulted in lines being positioned beyond 2038. Fixed.
-
UI: added View->Price chart style->Bars without ticks
-
Change #2534 made in 5.71.0 (allowing Null for Close field in bar chart)
created backward compatiblity issue. Reverted. Instead a new styleBarNoTick
introduced that allows to plot bar chart without open/close ticks:
Plot( IIf( Month() & 1, C, Null ), "Price", colorDefault, styleBarNoTicks | styleThick ); //
bar chart without open/close ticks
-
New Analysis: when Non-exhaustive Optimize was used on symbol without
any quotes, UI displayed error and remained disabled and it was not possible
to re-run non-exhaustive opt. Fixed.
-
New Analysis: Backtest: Profit figures are color-coded now (negative -
red/positive - green)
CHANGES FOR VERSION 5.72.0 (as compared to 5.71.0)
CHANGES FOR VERSION 5.71.0 (as compared to 5.70.2)
CHANGES FOR VERSION 5.70.2 (as compared to 5.70.0)
- Vertical selector line for the very first quote in a chart was not displayed.
Fixed.
- Exception could occur when passing openpos object to user-defined function.
Fixed.
- Deleted databases are removed on start up from that "Recent databases" menu
- An
exception at 678BAB24 when full name edit was incomplete and symbol was changed.
Fixed.
- In 32-bit version of AmiBroker, StaticVarInfo could return negative
value when static memory usage was greater than 2GB. Fixed
- Added extra checks
in SetOption to avoid crash when user deletes symbols while formula is running
(which is bad idea anyway)
- On attempt to print/copy image of an empty chart
pane appropriate message is displayed
- State of command bars is loaded with
'silent' option to prevent "due to
software update the toolbar has changed " messages that could appear
when user launched AmiBroker from different folders or different versions
(old and
new)
CHANGES FOR VERSION 5.70.0 (as compared to 5.69.0)
- GDI: use of PS_ALTERNATE style in Windows 95/98 causes resource leak. Fixed.
- UI:
Place Order dialog, it was problematic to enter fractional offsets for brackets.
Fixed.
- "
Recent database" menu randomly listed files instead of databases. Fixed.
Note if you have custom toolbar with "Recent database" submenu
added, you need to delete it and re-insert.
CHANGES FOR VERSION 5.69.0 (as compared to 5.68.1)
- Adding symbols via ASCII import caused change of selected symbols in charts.
Fixed.
- OLE: AnalysisDoc.Run supports Individual Optimization now (Action ==
5)
- Charts: when formula file can not be found the detailed information about
the path referenced and current working directory is displayed instead of
old "the
formula can not be found - no chart to display"
- New Analysis: added Auto-repeat
status icon in the right-hand corner of the Info bar (yellow 'play' arrow
shows up when auto-repeat is active and scheduled
for next run)
- AFL: Percentile() uses now new algorithm that has linear O(n)
complexity instead of O(log(n)*n) so it is MUCH faster than the old one and
close to
Median()
that uses quickselect (which is fastest)
By the way, to find average of upper and lower median for EVEN number of elements
you can use
Percentile( array, range, 50 )
- it will execute approx 30% slower than Median, but Median only returns
LOWER median for even 'range' parameter.
- ODBC plugin: now available in 64-bit
- AFL: since 5.63 round() function used
32-bit floorf which resulted in some differnces as compared to 5.60. Previous
code version is restored now.
- DDE plugin: 64-bit version of DDE plugin was
producing incorrect timestamps. Fixed.
- Default seed for Random() and mtRandom()
was based on time(), which could be the same for threads created in the very
same moment. Now the seed in
multiple
threads is guaranteed to be unique. This prevents repeated pseudo-random
sequences in multiple threads created in the very same moment.
- IB plugin:
added support for CFDs (security type=CFD, exchange=SMART) and commodities
(security type = CMDTY, exchange = SMART)
Example symbology for CFD:
IBUS500-SMART-CFD-USD
Symbol-SMART-CFD-Currency
Example symbology for commodities:
XAUUSD-SMART-CMDTY
Symbol-SMART-CMDTY-Currency
- UI: Now there are separate MRU (most
recently used) menus for files and databases (File->Recent Databases,
File->Recent Files_)
- Removed / changed some mnemonics (key accelerators)
in menus to avoid duplicates
- The default setting for Layers/"Auto-Select
Layer" is changed to
OFF.
- Custom Backtester interface: added FullName read-only property to Trade
object (gives full name of symbol)
You can use it for example to add full name as a custom metric to the trade
list
SetCustomBacktestProc("");
/* Now custom-backtest procedure follows */
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest(1); // run default backtest procedure
// iterate through closed trades first
for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
{
trade.AddCustomMetric("FullName", trade.FullName );
}
bo.ListTrades();
}
// your trading system here
fast = Optimize("fast", 12, 5, 20, 1 );
slow = Optimize("slow", 26, 10, 25, 1 );
Buy=Cross(MACD(fast,slow),Signal(fast,slow));
Sell=Cross(Signal(fast,slow),MACD(fast,slow));
- SPSO (standard particle swarm optimizer)
plugin: now available in 64-bit
- Tribes plugin: now available in 64-bit
- DDE plugin: now available in 64-bit
CHANGES FOR VERSION 5.68.1 (as compared to 5.68.0)
- fixed crash in 64-bit version when usign StaticVarGenerateRanks
on large arrays
- AFL: since 5.63 round() function used 32-bit floorf which resulted in some
differnces as compared to 5.60. Previous code version is restored now.
CHANGES FOR VERSION 5.68.0 (as compared to 5.67.2)
- AFL: new function: Error("text") - allows to display user-defined
error messages and stop execution of the formula. Good for 3rd party plugin
implementors to display error messages
Example:
Error("Something went wrong");
Note that error number in case of user-defined error message is always 99.
- AFL: new function: StaticVarGetRankedSymbols( "outputprefix", "inputprefix",
datetime )
- AFL: new function: StaticVarGenerateRanks function (flexible ranking
function)
NOTE: This function is NOT intended to replace bakctester's built-in ranking
via PositionScore. Just the opposite: whenever you can, you should use
PositionScore
as it is way way faster and less memory-consuming way to perform backtests
with ranking. To learn more about how to use PositionScore see "Portfolio
level backtesting" section of the tutorial.
StaticVarGenerateRanks is intended to be used for tasks OTHER than backtesting
such as explorations or indicators
that may require ranking functionality.
WARNING: this function is computationally and memory intensive. It
takes about 20ms per 15K bars and 7 symbols. Try to call it JUST ONCE
per scan/exploration/backtest using
if( Status("stocknum")==0) or better yet, use separate scan
just once to pre-calculate ranks and use it later (like composite creation
scan).
If you fail to do so and call StaticVarGenerateRanks for every symbol
performance would drop significantly as this function not only needs
lots of time to compute
but it also has to lock the access to shared memory used by static variables
so other threads trying to access static variables would wait until this
function completes.
StaticVarGenarateRanks( "outputprefix", "inputprefix",
topranks, tiemode )
"inputprefix" is a prefix that defines names of static variables
that will be used as input for ranking.
AmiBroker will search for all static variables that begin with that prefix
and assume that remaining part of the variable name is a stock symbol.
Say you want to rank stocks by ROC (rate of change). All you need to
do is to store values into static variables.
Let us say that we will use static variable names like "ValuesToSortAPPL", "ValuesToSortMSFT",
and so on.
To fill input static variables you can use this loop:
for( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++
)
{
SetForeign(sym );
Value = ROC( C, 10 );
RestorePriceArrays();
StaticVarSet( "ValuesToSort" + sym, Value );
}
Now you are ready to perform sorting/ranking. There are two modes, normal
ranking mode and Top/Bottom Rank mode.
Normal ranking mode is performed when toprank argument is set to zero.
StaticVarGenerateRanks( "rank", "ValuesToSort",
0, 1224 );
In this case StaticVarGenerateRanks call would generate set of static
variables starting with prefix defined by 2nd argument
each variable holding the rank of particular symbol, so in this case
RankValuesToSortMSFT will hold ranking of MSFT
RankValuesToSortAAPL will hold ranking of AAPL
Note that in AmiBroker rank count start from ZERO.
Third argument (topranks) is zero in normal ranking mode
Fourth argument (tiemode) defines how ties are ranked. Supported modes
are 1234 and 1224. In 1224 mode ties are numbered with equal rank.
Example code for normal ranking mode (everything done is done in one
pass, can be used in indicator):
symlist = "C,CAT,DD,GE,IBM,INTC,MSFT";
// delete static variables
StaticVarRemove("ValuesToSort*");
// fill input static arrays
for( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ )
{
SetForeign(sym );
Value = ROC( C, 10 );
RestorePriceArrays();
StaticVarSet( "ValuesToSort" + sym, Value );
}
// perform ranking
StaticVarGenerateRanks( "rank", "ValuesToSort", 0,
1224 ); // normal rank mode
// read ranking
for( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ )
{
Plot( StaticVarGet( "RankValuesToSort" + sym ), sym, colorCustom10
+ i );
}
Top/bottom ranking mode (that generates top/bottom ranking tables that
hold indexes to top ranking values. When topranks > 0 top ranked values
are used, when topranks < 0 then bottom ranked values are used.
The values are stored in variables that have format of:
OutputprefixInputprefixN where N is a number 1, 2, 3 representing top/bottom
ranks. Let us assume that
OutputPrefix parameter is "Top" and Inputprefix parameter is
ROC.
In such case variable TopROC1 would hold the index of top rated value.
TopROC2 would hold second top rated value, and so on.
StaticVarGenerateRanks function uses rank numbering that starts from
ONE.
In top ranking mode StaticVarGenerateRanks will also prepare static variable
that contains comma separated list of variable names that can be used
to
find out which index refers to which symbol. So if TopROC1 holds 1 you
would lookup first substring in TopROCSymbols variable to find out what
variable (symbol)
ranked at the top.
Additionally StaticVarGetRankedSymbols gives easy-to-use method to retrieve
comma separated list of ranked symbols for particular datetime.
Example code for top ranking mode
symlist = "C,CAT,DD,GE,IBM,INTC,MSFT";
// delete static variables
StaticVarRemove("ValuesToSort*");
// fill input static arrays
for( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ )
{
SetForeign(sym );
Value = ROC( C, 10 );
RestorePriceArrays();
StaticVarSet( "ValuesToSort" + sym, Value );
}
// perform ranking
StaticVarGenerateRanks( "rank", "ValuesToSort", 0,
1224 ); // normal rank mode
StaticVarGenerateRanks( "top", "ValuesToSort", 3,
1224 ); // top-N mode
StaticVarGenerateRanks( "bot", "ValuesToSort", -3,
1224 ); // bottom-N mode
// read ranking
for( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ )
{
Plot( StaticVarGet( "RankValuesToSort" + sym ), sym, colorCustom10
+ i );
}
sdt = SelectedValue( DateTime() );
Title = "{{NAME}} -{{DATE}} - {{VALUES}} TOP: " + StaticVarGetRankedSymbols( "top", "ValuesToSort",
sdt ) +
"
BOT: " + StaticVarGetRankedSymbols( "bot", "ValuesToSort",
sdt ) ;
- New
Analysis: when two Analysis windows were open and running Scan simultaneously
with AddToComposite composites could get reset by scan running in second
window. Fixed.
- Added millisecond support to ASCII importer. Supported time format
with milliseconds is HH:MM:SS.mmm (where mmm is milliseconds 000..999)
- Unsettled sale proceeds were settled at the end of the day instead of the
beginning of the next day. Fixed.
- The message 'trade not entered because
of insufficient funds' is modified to mention that it also it may not be
entered because of incorrect
position size
specified by the user
CHANGES FOR VERSION 5.67.2 (as compared to 5.67.0)
- Using more than 100 Plot() statements in one formula could cause memory
corruption sometimes resulting in access violation. Fixed.
- File->New->Blank chart and then clicking "View" caused
exception in 5.67.1. Fixed
- Low-level gfx playback engine resets colors to black pen / white background,
so it does not get influenced by chart colors like labels.
- GfxSetOverlayMode(
2 ) sometimes produced incorrect output in 5.67.0. Fixed.
CHANGES FOR VERSION 5.67.0 (as compared to 5.66.0)
- New Analysis: Optimization continued even if there was error inside custom
backtest procedure. Fixed.
- Charting: a new "Warning 902 can not plot
a chart in logarithmic scale as a data set contains negative value(s)" message
is displayed on attempt to use log scale with negative data and the chart
is plotted in linear scale
instead.
- UI: 'Logarithmic scale' item added to "View" menu.
Also the user can add this to View toolbar using toolbar customization (click
on arrow in the "View" toolbar, "Add or remove buttons" then "View" then "Logarithmic...")
- AFL: new function
fdir( "wildcard", flags = 1 ) - returns comma separated
directory list (like "DIR" command)
"wildcard" is a path with a wildcard pattern to match.
For example "C:\\*.*" will give you all files in C: drive, but "C:\\*.txt" will
give you only files with .txt extension.
flags - controls what is returned the default is 1 - only files, 2 - only directories,
3 - both files and directories
Example:
printf("Only files:\n");
_N( list = fdir( "c:\\*.*", 1 ) );
for( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
{
printf( filename + "\r\n" );
}
printf("\n\nOnly directories:\n");
_N( list = fdir( "c:\\*.*", 2 ) );
for( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
{
printf( filename + "\r\n" );
}
printf("\n\nBoth files and directories:\n");
_N( list = fdir( "c:\\*.*", 3 ) );
for( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
{
printf( filename + "\r\n" );
}
- GfxSetOverlayMode( mode = 1
) did not work with "alternate background
fill". Fixed.
- Analysis Settings Load/Save buttons were positioned wrong
in RTL (right-to-left) systems. Fixed.
- AFL: CategoryCreate( "name", category
) - adds new category (currently supports only adding watchlists)
newwl = CategoryCreate( "name", categoryWatchList ) - this will add
(create new) watch list with "name" (if it does not exist) or will
return existing "name" watch list
newwl will hold new watch list index.
Currently only creation of watch list is supported by this function.
- 64-bit:
Fixed crash with backtest of more than 10 million bars
- 64-bit: Fixed 'squeeze'
problem with charts at full zoom out when more than 10 million data bars
were displayed
- OLE Stocks.Add and Stocks.Remove trigger resynchronization
of selected indexes to avoid problems with "symbol locked" charts
CHANGES FOR VERSION 5.66.0 (as compared to 5.65.0)
- 32-bit and 64-bit versions now use different registry key to save list
of DLLs so warning messages about non-certified 3rd party plugins are not
displayed
each time you switch between 32-bit and 64-bit app version anymore.
- Foreign("~~~EQUITY" )
within custom backtest proc in old AA returned zero (because of change in
5.65). Fixed.
- CBT: when low-level mode was used (no ProcessTradeSignals was
called) ~~~Equity open interest field was not filled with number of open
positions. Fixed.
- When user moved default Formula path somewhere else Report
charts were not generated properly. Fixed.
- CBT: a new field "TransactionCosts" (equivalent
to report's "total
transaction costs") is now supported in the custom backtester Stats.GetValue
method
- ASCII importer: added DELISTING_DATE to fields available in $FORMAT command.
To import delisted symbols you may use file like this. Acceptable date formats
are
YYYY-MM-DD (ISO standard) and DD-MM-YYYY (automatically detected).
Note that MM-DD-YYYY (US) is not detected because one can not automatically
detect if 01-02-2003 means
february 1st or january 2nd
#
$FORMAT NAME, DELISTING_DATE
$NOQUOTES 1
$OVERWRITE 1
SYMBOL,"2012-07-0
- AFL:
GetFnData returned invalid value for fields DividendPayDate and ExDividendDate
when they were empty (not set) in the Information window. Fixed (now Null is
returned)
- AFL: GetFnData now supports new field "DelistingDate"
dd = GetFnData("DelistingDate");
if( IsNull( dd ) )
printf("Security is active");
else
printf( "Delisted at" + dd + DateTimeToStr( dd ) );
- Information
window: added "Delisting date" field.
Delisting Date is a last day when security was available for trading due to
delisting. If the security is still active the field is empty.
- Information window: it was
not possible to set/change Dividend Pay Date and Ex Dividend date from UI.
Fixed.
- Preferences window: new tab "Candles & Bars" that controls
detailed appearance of candlestick and traditional bar charts
Use up/down colors - when marked bar charts use candlestick up/down color defined
in the Colors tab
End cap style - controls whenever bar charts are plotted so the endings of
lines are rounded, square or flat.
The difference between square and flat is that square end will plot with "square" pen
and with wide pens it will plot width/2 pixels above high and below low because
of pen thickness (looks good but high/lows are not precisely marked).
"
Flat" means that ends terminate at exact position (so high and lows are
precise), but the open/close ticks may look weird when plotted at high/low
("staircase effect")
Open/Close tick % thickness - controls the thickness of line used to plot
open/close ticks. It is expressed in % of main bar thickness (default is
100%)
Open/Close tick % length - controls the length of open/close ticks. It is
expressed in % of candle width which is usually half the distance between
bars (but not more than 30 pixels).
- The database
save was triggered when opening documents using recent file list. Fixed.
- Parameter
window: Right mouse button double click over parameter label resets selected
parameter to the default value now
- AFL: PlotShapes() now has XShift parameter
- Custom metric optimization target
(WF tab) is now matched case-insensitive (FC#2442)
CHANGES FOR VERSION 5.65.0 (as compared to 5.64.0)
- In-memory quotation cache can now be larger than 20K symbols. Now the maximum
is 100K symbols (user definable in Tools->Preferences, "Data" tab).
Caveat use extreme values ONLY if you have plenty of memory AND you are using
64-bit version
- New Analysis: Walk-forward result list colums had "alpha" type
which resulted in alphabetic sort when user clicked on column. Fixed (numeric
type
is used now).
- QuickData did not work properly for not time-based intervals
so it is now automatically turned off for charts using such intervals.
- Fixed
crash @0048C19A/48C1C4 (click on result list after backtest to show arrows
sometimes produced this).
- Trade profit calculation speeded up which results in upto 15% faster optimization
with lots of trades
- New Analysis: In 5.64.x "stocknum" incorrectly
started counting from 1 instead of 0 as in old versions. Fixed.
- Foreign/SetForeign/RelStrength
of the same symbol as active does nothing (i.e. refers to already existing
thread local data, instead of querying database)
- New Analysis: when SetSortColumns
was used in 5.63 and above it could trigger redundant multiple sorts. Now
it is fixed (sort only once)
- New Analysis: results are now sorted after
Individual Optimization the same way as after portfolio Optimization
CHANGES FOR VERSION 5.64.0 (as compared to 5.63.0)
- New Analysis: Multi-threaded Individual Optimization (experimental). Upto
NumberOfCores faster. Note: no CBT and only exhaustive mode is supported as
of now
The new optimizer is called "Individual Optimize" in the New analysis
window and you can access it here:
Note that old "Optimize" button runs OLD (i.e. 5.60) optimizer -
for comparison purposes.
"Individual Optimize" will use all available processor cores to
perform single-symbol optimization.
In "Current symbol" mode it will perform optimization on one symbol.
In "All symbols" and "Filter" modes it will process all
symbols sequentially, i.e.
first complete optimization for first symbol, then optimization on second
symbol, etc.
Limitations:
1. Custom backtester is not supported (yet)
2. Smart optimization engines are NOT supported - only EXHAUSTIVE optimization
works.
For explanation of these limitations see http://www.amibroker.com/guide/h_multithreading.html
Eventually I may get rid of limitation (1) - when I change the CBT NOT to
use OLE anymore.
But (2) is probably here to stay for long.
- Built-in constant are set up once and shared among all threads to save
setup time (gives 10% speed up in execution of simple formulas)
- Built-in constants
such as colorBlack are now read-only and any attempt to overwrite such constant
value results in error 55.
- New Analysis, list view in scans, explorations and individual optimizations
is refreshed less often to gain some speed.
- In case of individual backtest
/ individual optimization the backtester allocates much smaller price cache
(just for 2 symbols) - takes less time.
- In 5.63 Bar Replay did not with "QuickData" enabled
(it required View->Refresh All to start working). Fixed.
- Some actions (like
import of past data, split, etc) did not trigger automatic chart refresh
when QuickData was enabled. Fixed.
CHANGES FOR VERSION 5.63.0 (as compared to 5.62.0)
CHANGES FOR VERSION 5.62.0 (as compared to 5.61.0)
- AddSummaryRows now supports also flag = 32. This flag adds standard deviation
row
Filter=1;
AddColumn(V, "Volume" );
AddSummaryRows( 63, 1.2 );
// add Total, Average, Min, Max, and Count and StdDev rows (1+2+4+8+16+32)=63
- with two decimal places summary rows are added at the top of the list
- AddSummaryRows treated NULLs as zeros in averages. Now it is fixed and
NULLs are not included in calculations.
- Drawing tooltip "bars" count
starts from 0 (when line is pure vertical) to match status bar X distance
display. Status bar coords display
is hidden
once drawing is done to prevent user confusion.
- Snap to price now allows
snapping to Closing and Opening price, to activate snap to close hold down "C" key,
to activate snap to open hold down "O" key
while drawing line / moving the mouse
- When "Play" button is pressed
Bar replay dialog checks if Start Date is earlier than End date and displays
error message if that is not
the case.
- Ticker box is updated with new full name if it is changed from
symbol information
- Per-symbol UserData fields are accessible now via GetFnData("UserData0")..GetFnData("UserData99").
This feature is for implementors of custom data plugins to allow them to
expose custom data
for( i = 0; i < 100; i++ )
printf( "UserData%g %g\n", i, GetFnData("UserData"+i) );
- New Analysis: In 5.61.0 Walk Forward kept old "Current
symbol" until
Scan/Explore/Backtest was run. Fixed
- First line in "Parallel trendlines" tool
is snapped to price (if the option is turned on) as normal trendline.
- eSignal:
now plugin supports EOD history for more than 40 years back
- Charting: Copy-Paste
Special allows to copy entire chart pane with various options
a) Entire chart pane (fully independent) - it creates a copy of chart pane,
assigns new chart ID, creates duplicate of the formula file so parameters are
independent and formula is private (not shared with source pane)
b) Entire chart pane (independent parameters, but shared formula), the same
as (a) but does NOT create duplicate of the formula so it shares the very
same formula file with the original pane
c) Entire chart pane (hard-wired, shared parameters, formula and drawings,
same chartID) - a new pasted pane is directly hard-wired with pane being
copied, so it shares the same CHART ID and every change made to it is made
to the original (source) too.
- Backtest report
now includes 'Total transaction costs' (sum of all commissions paid)
- Aux1/Aux2
fields now allow user-definable aggregation/compression mode (File->Database
Settings->Intraday Settings). Available choices are last (default),
first, highest, lowest, sum
CHANGES FOR VERSION 5.61.0 (as compared to 5.60.3)
- When using any drawing tool X and Y distance is shown in the status bar
(FC #2380)
- When position can not be entered due to insufficient funds the
Backtester
in the "detailed mode" gives additional info such as: requested
entry price, requested position size (and dollar value) and requested round
lots
(FC#2377)
- Time&Sales column layout persists between runs now (FC #2341)
- Running
any #import command (including "Update US symbol list and categories")
is preceeded by prompt for confirmation now
- Report Explorer now supports copying
selected items to clipboard (Edit->Copy),
Ctrl+C (FC#2288)
- Quote Editor: added "Go to selected" button that
quickly scrolls to and selects the data bar marked on chart (FC#2342)
- New
Analysis: parameters were not reset to default values when formula was loaded.
Fixed. (#2353)
- New Analysis: "Add artificial future bar" option
does not affect Exploration and Scan anymore (FC#2353)
- Max. chart rendering
time of 1000 ms when multithreaded charts are turned ON can be overriden
now by registry setting. See FC#2330 for details.
- Increased width of symbol
combo boxes in Symbol->Merge dialog to prevent
truncation of ticker names
- Floating window caption is now synchronized even
if it is not active (FC#2376)
- eSignal: new version allows to select
whenever EOD bars should report Settlement price or regular close
- Change
PlotShapes does NOT use "shape0", "shape1" variables
anymore to prevent clashing with user-defined variables (#104931)
- ASCII importer
now supports $WEBID command and WEBID field in the $FORMAT command to allow
importing web ID (FC#2362)
- ASCII importer now supports $ISINDEX, $ISFAVORITE
commands, and ISINDEX and ISFAVORITE fields in the $FORMAT command (FC#2310)
- Apply
To: Filter dialog takes less time to show up
CHANGES FOR VERSION 5.60.3 (as compared
to 5.60.2)
- When custom backtest formula was defined
in separate file then report "Formula" tab
shown CBT formula instead of actual system
formula. Fixed.
- New Analysis, when Apply to was set to "Current" then
changing current symbol during optimization
affected results. Fixed
- New Analysis, database's time shift was
applied twice in "Show current trade
arrows" mode. Fixed.
- Custom backtest procedure was not called
when number of trades was equal zero (no
trades at all). This prevented creation of
custom metrics in such case. Now CBT code
is called anyway.
- 3D optimization chart was corrupted when
optimization included custom metrics. Fixed.
- Corrections and updates to Users' Guide
CHANGES FOR VERSION 5.60.2 (as compared
to 5.60.1)
- Setup: GICS.txt file had 50102010 category
incorrectly entered (without new line). Fixed.
- Setup: Formats\aqgi.format file added
- Scale in/out column could have thousand
separator added in incorrect place. Fixed.
- New Analysis: when there was no selected
formula filey a number of empty items were
added to the combo box. Fixed.
- New Analysis: Walk-forward summary report
name and from date was not reset in second
and subsequent runs in the same Analysis
window. Fixed.
- New Analysis: if symbol did not have any
quotes at all, "wait for backfill" did
not wait. Fixed.
- New Analysis: Exploration - a little speed
up by decreased number of string reallocations
in CAnalysisExploreJob::Run
- Inactive Web research window did not sync
with selected symbol when "sync always" was
turned on. Fixed. MG #113
- Filter dialog background change did not
look nice on Windows XP and earlier. Turned
this off in pre-Vista OSes.
- eSignal: in "EOD" mode when started
outside trading session a last bar could
be duplicate of previous day bar. Fixed
- eSignal: 64-bit plugin now correctly downloads
daily (EOD) history (so mixed mode works
fine too).
- eSignal plugin: added support for extended
intraday (to enable it use Configure: "Use
extended intraday history data request")
- Due to Windows "feature" dotted
lines with width of 1 were printed as solid
lines on a printer. Workaround (forcing width
to 0) for printer implemented.
- Default black chart theme is only set when
no preferences file is found. If broker.prefs
exists but it is stored in pre-5.52 version
then white scheme is applied by default.
- Charts: when loading multiple chart layout
the invisible/obscured windows were not always
scrolled to the end (most recent quote).
Fixed.
- Auto-hidden Analysis windows sometimes
did not repaint properly. Fixed.
- Sharpe ratio now uses floating point trade
length/qty ratio instead of integer to prevent
rounding.
- AFL: Now OLE strings passed by reference
(VT_BSTR|VT_BYREF) are accepted too.
CHANGES FOR VERSION 5.60.1 (as compared
to 5.60.0)
CHANGES FOR VERSION 5.60.0 (as compared
to 5.59.0)
- Upgrade information: keys issued before
2011-04-13 are expired with 5.60
- UI: removed unused options from Prefs/Miscelleneous
page
- UI: In 5.59 ticker box was not in sync
with currently selected symbol on loading
single-chart layout. Fixed
- UI: importing custom icon image using Tools->Customize,
button RMB -> Edit Image -> Import
image caused change of current working directory.
Now CWD is saved and restored after customization.
- UI: Floating panes use themed frames now
- UI: Filter settings dialog is resizable
now (and static fields use proper background
color)
- UI: Crash could occur if the user customized
Tools menu by moving "Update US stock
list..." item from the very last position
in the menu elsewhere. Fixed.
- UI: cosmetic color changes (chart sheet
tabs)
- On attempt to close Analysis window that
is currently running scan/exploration/backtest
an appropriate error message is displayed.
- New Analysis: the message "No symbols
matched apply to / filtering criteria" shows
up in the message bar instead of dialog,
so one does not need to click OK
- New Analysis: Specifying ReEntryDelay > 0
in ApplyStop rotational and raw modes caused
incorrect results in second and subsequent
backtests (MG#79). Fixed.
- New Analysis: In 5.59 3D optimization chart
- wrong 2nd axis legend was wrong (duplicate
of 1st axis). Fixed.
- New Analysis: In 5.58 and 5.59 smart optimizer
engine was not finalized properly when user
pressed "Cancel" during optimize
run. Fixed.
- New Analysis: error message bar text is
now trimmed to 110 characters to ensure there
is a place for the "Details" button
- In colorCycle sequence colorRed is replaced
with colorLightOrange for better visibility
when displayed with red candles
- In 5.58 View->Intraday->Tick turned
incorrect "0-tick" interval which
resulted in effective 1-second compression.
Fixed.
- colorDefault is now user- definable in
the preferences (Colors tab) and selectable
from Parameters window and associated with
chart theme
- Charts: Print Preview and printout had
incorrect colors due to the fact that SetDCPenColor/SetDCBrushColor
APIs do not work with metafiles/printers.
Fixed.
- Charts: In 5.59 chart could stop refreshing
when it had odd number of Plot() calls combined
with a couple of PlotForeign() calls and
total number of items to display in tooltip/data
window exceeded 20. Fixed.
- Changed default Price all in one volume
to color to ColorBlend( ColorRGB( 128, 128,
192 ), GetChartBkColor(), 0.5 )),
- Changed default colors for charts to "Black" scheme
and outline mode to "One color for entire
handle and hollow up candle body"
- Changed default chart layout for clean
installation
- Changed default appearance to VS2010 /
pane tabs on bottom
- Changed Bollinger band filled default color
to ColorBlend( Color, GetChartBkColor(),
0.8 )
- changed all price formulas shipped in setup
to use colorDefault instead of colorBlack
- Blank chart panes now use defined chart
background color instead of white
- Background of built-in dark grey theme
made slightly lighter than black
- ASCII import: sector names beginning with "Sector" and
industry names beginning with "Industry" were
not imported properly. Fixed.
- aqh.format, aqd.format, aqg.format changed
- removed $VOLFACTOR 0.01 previously used
so volume is reported in shares not in hundreds
of shares
- ApplyStop( stopTypeNBar, ... ) in backtestRegularRaw
/ backtestRegularRawMulti/Rotational - N-bar
stop exited 1 bar later than in regular mode.
Fixed.
- AFL: when array was passed as "amount" argument
to DateTimeAdd, the results could be incorrect.
Fixed.
- AFL: SetChartOptions did not write chart
flags in 5.5x. Fixed
- AFL: GetFnData() now supports "Country" field
CHANGES FOR VERSION 5.59.0 (as compared
to 5.58.0)
- New Analysis: loading previously stored
APX files into 5.58 resulted in ICB filter
being set (instead of cleared). Fixed.
- New Analysis: 3D optimization chart can
also be displayed from single-parameter optimization
now, without need to add dummy Optimize()
- IB data plugin: CMDTY historical requests
use MIDPRICE instead of TRADES
- IB data plugin: Max. number of symbols
increased to 1000
- UI: Tools->Preferences/Charting: added
setting to show (or hide) the bar number
in the crosshair's X label, by default the
bar number is NOT shown now (previously it
was ON by default)
- UI: Tools->Preferences/Charting removed
setting for "'New look' charts" -
now 'New look' is used always
- UI: For PlotOHLC and Plot with styleCandle/styleBar
tooltip and data window display OHLC data
in this order (instead COHL in previous versions)
- UI: Data window now displays values for
all panes at once (you can turn the display
of single pane back using right click menu
option)
- ASCII importer: added $COUNTRY command
and COUNTRY field to $FORMAT command
- AFL: in ROC, RSI, RSIa, TRIX, CCI, MFI,
MA, EMA, Hold, BBandBottom, BBandTop, PDI,
MDI, ADX, ATR, Correlation, Wilders functions
'range' parameter is now checked for > 0
and error is displayed when it is negative
- Interval-locked layers did not work correctly
for N-tick/volume/range intervals. Fixed.
CHANGES FOR VERSION 5.58.0 (as compared
to 5.57.1)
- DB: Automatic setup and update of stock
symbol listing, together with sectors, industries,
markets and groups (Tools->Update US symbol
list and categories). This is implemented
using new #import command and new ASCII importer
commands (see below for the details)
- UI: custom tools menu - added special internal
command #import that allows to import ASCII
files from local disk or even from remote
(web) sources. In the Tools->Customize, "Tools" page,
you can now define custom tool that uses
new #import command
Command: #import
Arguments: URL to download data from
Initial dir: path to format definition file
- UI: custom tools menu - when an error occurs
during launching of external command appropriate
error message is displayed (instead of nothing
like in old versions)
- DB: The support for Industry Classification
Benchmark (ICB) category system added (See
icb.txt file for definitions)
- OLE: Stock object has new property (string):
ICB (read/write)
- ASCII importer: support for importing sector/industry
scheme and assignments by name (new SECTORNAME
and INDUSTRYNAME fields in $FORMAT command)
- ASCII importer: new command $CLEARSECTORS
1 to wipe existing sector / industry structure.
- ASCII importer: new $SORTSECTORS command
to sort existing sector/industry structure.
$SORTSECTORS 1 - sort case sensitive, without touching sector/industry ==
0 (undefined sector/undefined industry)
$SORTSECTORS 2 - sort case sensitive, all defined sectors/industries
$SORTSECTORS 3 - sort case insensitive, without touching sector/industry
== 0 (undefined sector/undefined industry)
$SORTSECTORS 4 - sort case insensitive, all defined sectors/industries
- ASCII importer: crash could occur if required
numeric arguments for some commands were
missing. Fixed.
- ASCII importer: added support for ICB import:
ICB field added to $FORMAT command and added
$ICB command
For example ICB assignments for NYSE can be imported from this site:
http://www.nyse.com/indexes/nyaindex.csv
(to import use this format def)
$FORMAT FullName, Ticker, Skip, ICB, Skip, Skip, Skip, Skip
$SKIPLINES 2
$SEPARATOR ,
$CONT 1
$GROUP 255
$AUTOADD 1
$NOQUOTES 1
- ASCII importer: numeric field data may
be enclosed in double quotation marks and
still properly interpreted as numbers now.
- AFL: SetChartOptions did not allow to overwrite
miny/maxy in 5.51-5.57. Fixed.
- AFL: CategoryGetSymbols, CategoryGetName,
CategorySetName, CategoryAddSymbol, CategoryRemoveSymbol,
CategoryFind updated to support categoryICB
(new constant = 8)
- AFL: added InIcb() and IcbID() functions
- AFL: Added Status("lastbartimeleftrt")
- it works like "lastbartimeleft" but
uses the most recent RT stream update time
instead of Now(). Also added Status("lastrtupdate")
- time of last RT stream update
Depends on RT plugin to deliver correct DateUpdate / TimeUpdate data.
If plugin or date source sends incorrect datetimestamps or does not send
DateUpdate/TimeUpdate correctly this function will not operate properly.
Note that most data sources send weird (not current) datetime stamps on weekends.
Also IQFeed plugin sends DateUpdate/TimeUpdate only inside regular trading
hours
- UI: Interval combo box was not updated
after changing preferences / intraday / custom
interval settings. Fixed.
- Analysis: when optimization is stopped,
Optimize() returned NON-default value when
Status("action")==actionPortfolio
in subsequent backtest. Fixed
CHANGES FOR VERSION 5.57.1 (as compared
to 5.57.0)
- When real-time quotes were streaming interval
combo refreshed too often making it hard
to enter new interval in 5.57.0. Fixed.
- Entering custom interval in the combo did
not always work correctly for floating windows
in 5.57.0. Fixed.
CHANGES FOR VERSION 5.57.0 (as compared
to 5.56.0)
- Charts/UI: now there is a new chart interval
combo box that allows to either select predefined
interval OR simply type ANY interval you
want without the need to define it in the
preferences
Supported interval codes are:
Y - yearly, Q - quarterly, M - monthly, W - weekly, D - daily, N - day/night,
h - hourly, m -minute (note lowercase m), s - second, T - tick, R - range,
V.
D, h, m, s, T, R, V intervals can be preceded by a number. So if you type
15m it means 15 minute chart,
if you type 13T it means 13 tick chart, if you type 200R it means 200R
(range) chart.
If you type just a number (x) without the following letter it will treat
it as x-minute chart.
Note that while AmiBroker is trying to keep layout files backward compatible,
attempt to load the layout that uses 'new' interval that is not present
in defined set into *old* (pre-5.57) version will result in this extra
interval being replaced by simply daily chart.
- Tools->Auto update quotes is now native
command (not a 'custom tool' as it was)
This change was caused by the fact that custom tools menu is stored in HKEY_CURRENT_USER
registry key that is shared between 32-bit and 64-bit version.
That caused that if both 32-bit and 64-bit versions were installed an unmatching
bitness version of AmiQuote could be launched and that in turn
caused problems because in Windows OS 64-bit automation first calls 64-bit
server and only in absense of it tries 32-bit. So if both versions were installed
only one was updated properly (the last one installed) using "Auto-update" command.
Having this command native ensures that proper bitness version is launched
so 32-bit and 64-bit versions of AmiBroker can be updated with appropriate
corresponding versions of AmiQuote.
- Default "X grid spacing" changed
to 50 (from original 60) pixels
- 12 hour X grid spacing replaced by 6 hour
CHANGES FOR VERSION 5.56.0 (as compared
to 5.55.1)
- New Analysis: A new walk-forward summary
report that covers all out-of-sample steps
There were significant changes to walk forward testing made to allow summary
out-of-sample report.
The most important change is that each subsequent out-of-sample test uses
initial equity equal to previous step ending equity.
(Previously it used constant initial equity).
This change is required for proper calculation of all statistics/metrics
throughout all sections of out-of-sample test.
Summary report shows the note that built-in metrics correctly represent
all out-of-sample steps
but summary custom metrics are composed using user-definable method:
1 first step value, 2 last step value, 3 sum, 4 average, 5 minimum, 6 maximum.
By default summary report shows last step value of custom metrics UNLESS
user specifies different combining method in
bo.AddCustomMetrics() call. bo.AddCustomMetrics has now new optional parameter
- CombineMethod
bool AddCustomMetric( string Title, variant Value, [optional] variant
LongOnlyValue, [optional] variant ShortOnlyValue , [optional] variant DecPlaces
= 2, [optional] variant CombineMethod = 2 )
This method adds custom metric to the backtest report, backtest "summary" and
optimization result list. Title is a name of the metric to be displayed
in the report, Value is the value of the metric, optional arguments LongOnlyValue,
ShortOnlyValue allow to provide values for additional long/short-only columns
in the backtest report. Last argument DecPlaces controls how many decimal
places should be used to display the value.
Supported CombineMethod values are:
1 first step value, - summary report will show the value of custom metric
from very first out-of-sample step
2 last step value (default), - summary report will show the value of custom
metric from the last out-of-sample step
3 sum, - summary report will show the sum of the values of custom metric
from all out of sample steps
4 average, - summary report will show the average of the values of custom
metric from all out of sample steps
5 minimum, - summary report will show the smallest value of custom metric
from all out of sample steps
6 maximum.- summary report will show the largest value of custom metric
from all out of sample steps
Note that certain metrics calculation methods are complex and for example
averaging them would not lead to mathematically correct representation
of all out of sample test.
Summaries of all built-in metrics are mathematically correct out-of-the-box
(i.e. they are *not* averages, but properly calculated metrics using method
that is appropriate for given value). This contrasts with custom metrics,
because they are user-definable and it is up to the user to select 'combining'
method, and still it may happen that none of the available methods is appropriate.
For that reason the report includes the note that explains what user-definable
method was used to combine custom metrics.
- New Analysis: walk forward procedure now
produces detailed reports for every out-of-sample
step
- Enhanced backtest report: color-coding
'good' and 'bad' values in backtest report
Some of the metrics in the backtest report are color-coded.
Blue means "neutral", Green means "good", Red means "bad"
Metrics that are not colorized are always black
This color coding is of course arbitrary and should be used as guideance
only.
Treat 'red' as a warning flag and advice to check the value in detail.
As of now the following metrics are colorized:
Net Profit, Net Profit % - bad < 0, good > 0
Annual Profit %, bad < 0, neutral betwen 0 and 10, good > 10
RAR % bad < 0, good > (10 / Exposure)
Avg. Profit/Loss all trades (Expectancy $) - bad < 0, good > 0
Avg Profit/Loss % all trades (Expectancy %) - bad < 0, good > 0
Max. system % drawdown - bad: dd worse than -30%, neutral: dd between -30
and -10%, good - -10% to 0%
CAR/MaxDD, RAR/MaxDD - bad < 1, neutral between 1 and 2, good > 2
Recovery factor - bad < 1, neutral between 1 and 2, good > 2
Payoff ratio - bad < 1, neutral between 1 and 2, good > 2
- Report: a note added to tooltips for Sharpe
ratio and UPI metrics telling where user
can change risk-free rates for those metrics
- Report Explorer 1.0.2 - added alternate
row background color
- Removed "00:00:00" time in the "date
from" in the backtest report / settings
page
- Param window: clicking on category that
had exactly same name as parameter resulted
in changing parameter value. Fixed.
- Analysis: all custom metrics were treated
as numbers (for example got formatted with
thousand separator). Now AmiBroker custom
metrics of string type are treated as strings
and do not get any extra formatting for the
display.
- Added recommendation to activate multithreading
to the performance warning tooltip when multithreading
is currently turned OFF.
CHANGES FOR VERSION 5.55.1 (as compared
to 5.54.0)
- Random characters could appear in list
view clipboard copy in 5.55.0. Fixed (5.55.1).
- _SECTION_BEGIN/_SECTION_END/_PARAM_VALUES
appeared twice in auto-complete listbox.
Fixed.
- SetOption("PortfolioReportMode",
x ) changed exploration columns too. Fixed.
(bmg#92)
- AFL: new function GetAsyncKeyState( vkey
)
GetAsyncKeyState is 100% equivalent of Windows API function of the same name.
See: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646293(v=vs.85).aspx
The function queries current state of keyboard keys (at the time of the
call).
vkey is virtual key code to query (see table below).
The function returns 0 if key is NOT pressed and value < 0 ( less than
zero) when key is currently pressed.
Example:
Plot( C, "Close", colorRed );
vk_Shift = 16;
if( GetAsyncKeyState(
vk_Shift ) < 0 ) Title = "Shift
is pressed";
Virtual Key codes:
vk_BackSpace = 8;
vk_Tab = 9;
vk_Return = 13;
vk_Shift = 16;
vk_Control = 17;
vk_Alt = 18;
vk_Pause = 19;
vk_CapsLock = 20;
vk_Escape = 27;
vk_Space = 32;
vk_PageUp = 33;
vk_PageDown = 34;
vk_End = 35;
vk_Home = 36;
vk_Left = 37;
vk_Up = 38;
vk_Right = 39;
vk_Down = 40;
vk_PrintScreen = 44;
vk_Insert = 45;
vk_Delete = 46;
/* NOTE: vk_0..vk_9 vk_A.. vk_Z match regular ASCII codes for digits and
A-Z letters */
vk_0 = 48;
vk_1 = 49;
vk_2 = 50;
vk_3 = 51;
vk_4 = 52;
vk_5 = 53;
vk_6 = 54;
vk_7 = 55;
vk_8 = 56;
vk_9 = 57;
vk_A = 65;
vk_B = 66;
vk_C = 67;
vk_D = 68;
vk_E = 69;
vk_F = 70;
vk_G = 71;
vk_H = 72;
vk_I = 73;
vk_J = 74;
vk_K = 75;
vk_L = 76;
vk_M = 77;
vk_N = 78;
vk_O = 79;
vk_P = 80;
vk_Q = 81;
vk_R = 82;
vk_S = 83;
vk_T = 84;
vk_U = 85;
vk_V = 86;
vk_W = 87;
vk_X = 88;
vk_Y = 89;
vk_Z = 90;
vk_LWin = 91;
vk_RWin = 92;
vk_Apps = 93;
/* numerical key pad */
vk_NumPad0 = 96;
vk_NumPad1 = 97;
vk_NumPad2 = 98;
vk_NumPad3 = 99;
vk_NumPad4 = 100;
vk_NumPad5 = 101;
vk_NumPad6 = 102;
vk_NumPad7 = 103;
vk_NumPad8 = 104;
vk_NumPad9 = 105;
vk_Multiply = 106;
vk_Add = 107;
vk_Subtract = 109;
vk_Decimal = 110;
vk_Divide = 111;
/* function keys */
vk_F1 = 112;
vk_F2 = 113;
vk_F3 = 114;
vk_F4 = 115;
vk_F5 = 116;
vk_F6 = 117;
vk_F7 = 118;
vk_F8 = 119;
vk_F9 = 120;
vk_F10 = 121;
vk_F11 = 122;
vk_F12 = 123;
vk_F13 = 124;
vk_F14 = 125;
vk_F15 = 126;
vk_F16 = 127;
vk_NumLock = 144;
vk_ScrollLock = 145;
vk_LShift = 160;
vk_RShift = 161;
vk_LControl = 162;
vk_RControl = 163;
vk_LAlt = 164;
vk_RAlt = 165;
vk_SemiColon = 186;
vk_Equals = 187;
vk_Comma = 188;
vk_UnderScore = 189;
vk_Period = 190;
vk_Slash = 191;
vk_BackSlash = 220;
vk_RightBrace = 221;
vk_LeftBrace = 219;
vk_Apostrophe = 222;
- AFL: Status() function supports new fields "lastbarend", "lastbartimeleft", "timeshift"
Status("lastbarend") returns DateTime of the end of last bar. For
example 5 -minute bar at 9:00 will have end time of 9:04:59 (works for time-based
bars only)
Status("timeshift") returns database timeshift expressed in seconds
Status("lastbartimeleft") returns number of seconds to the completion
of current last bar. Works for time-based bars only. Note that for proper
operation this requires database timeshift to be set properly (so dates displayed
on chart match your local computer time zone).
- List view clipboard copy now uses regional
settings decimal separator.
You can turn it off and revert to "always dot" decimal separator
by creating registry key
HKEY_CURRENT_USER\TJP\Broker\Settings
DWORD value "UseLocaleForClipboard" = 0
- Charting: added left- and right extend
option to the rectagle drawing tool
- List view date column sort was incorrect
when regional settings time format was set
to: H:mm:ss. Fixed.
- When multithreading in charts was turned
OFF, drawing tools did not work properly
in 5.53-5.54. Fixed.
- XYChartAddPoint does not generate error
anymore when Null values are passed as X,
Y co-ords. Instead it silently ignores such
points (they are not plotted) and XYChartAddPoint
returns FALSE (0)
- AFL: new function StaticVarInfo( "varname", "field" )
StaticVarInfo( "varname", "field") - provides information
about static variables
" varname" - is a variable name. It can be also a wildcard template
such as "myvariable*" and then it means that AmiBroker will search
for all variables beginning with
" myvariable". * character matches any string, ? matches any single
character
Supported "field" values are:
" list" - returns the list of static variables
" memory" - returns memory usage in bytes (not including memory used
for variable name itself)
" totalmemory" - returns memory usage in bytes (including memory used
for variable name)
Example:
StaticVarSet("my_array1", Close );
StaticVarSet("my_array2", Close );
StaticVarSet("my_scalar", 12 );
StaticVarSetText("my_text", "Text123456" );
"All variables in memory: " + StaticVarInfo( "*", "list" );
" Total static var memory: " + StaticVarInfo( "*", "totalmemory");
" Only my_ variables: " + StaticVarInfo( "my_*", "list" );
" Memory 2 arrays (bytes): " + StaticVarInfo( "my_array*", "memory" );
" Memory scalar (bytes): " + StaticVarInfo( "my_scalar", "memory" );
" Memory text (bytes): " + StaticVarInfo( "my_text", "memory" );
CHANGES FOR VERSION 5.54.0 (as compared
to 5.53.1)
- New Analysis: "Sync chart on select" did
not respect linked charts and symbol lock.
Fixed.
- AFL: new function XYChartSetAxis( "chartname", "x-axis
name", "y-axis name" )
- AFL: new function XYChartAddPoint( "chartname", "text",
x, y, color )
- New Analysis: Implemented XY (scatter)
charts in Explorations
Example:
// XY chart coding example
// This formula generates 2 X-Y scatter charts
that display relationship between
// final trade profit and MFE and MAE
Buy = Cross( MACD(), Signal());
Sell = Cross( Signal(), MACD()
);
Short = False;
Cover = False;
Eq = Equity( 1 ); //
single-security equity this evaluates stops (if you use them)
and removes extra signals
Entry = Buy OR Short;
EqAtEntry = ValueWhen(
Entry, Eq );
Profit = 100 * ( Eq
- EqAtEntry ) / EqAtEntry; // percent profit
// MAE and MFE below use CLOSING equity, MAE
and MFE in the report use high/low price
MAE = 100 * ( LowestSince(
Entry, Eq ) - EqAtEntry ) / EqAtEntry; // percent
MAE
MFE = 100 * ( HighestSince(
Entry, Eq ) - EqAtEntry ) / EqAtEntry; // percent
MAE
bi = BarIndex();
Len = bi - ValueWhen(
Entry, bi );
EntryPrice = ValueWhen(
Entry, BuyPrice );
// if you prefer MAE/MFE using high/low price
// uncomment the lines below (long only Version)
MAE = 100 * ( LowestSince(
Entry, Low )
- EntryPrice ) / EntryPrice ; // percent MAE using
low
MFE = 100 * ( HighestSince(
Entry, High )
- EntryPrice ) / EntryPrice ; // percent MAE using
high
Exit = Sell OR Cover;
dt = DateTime();
Clr = ColorHSB( Status("stocknum"), 255, 255 );
for( bar = 0;
bar < BarCount;
bar++ )
{
if(
Exit[ bar ] )
{
// item text consists
of two parts
// first part
(before \t) is a item name displayed immediatelly on XY chart
// second part
(after \t) is a tooltip hint text that is displayed in the tooltip
// when you hover
on given item
// here we will
only use hint text
HintText = "\t" + Name()+"@"+ DateTimeToStr(
dt[ bar ] );
XYChartAddPoint( "Profit
vs MAE", HintText, MAE[ bar ], Profit[ bar ],Clr );
XYChartAddPoint( "Profit
vs MFE", HintText, MFE[ bar ], Profit[ bar ], Clr
);
XYChartAddPoint( "Profit
vs trade length", HintText, Len[ bar ], Profit[ bar
], Clr );
}
}
XYChartSetAxis( "Profit
vs MAE", "[MAE]", "[Profit]" );
XYChartSetAxis( "Profit
vs MFE", "[MFE]", "[Profit]" );
XYChartSetAxis( "Profit
vs trade length", "[Length]", "[Profit]" );
Filter = Exit;
AddColumn( Eq, "Equity" );
AddColumn( Profit, "Profit" );
AddColumn( MAE, "MAE" );
AddColumn( MFE, "MFE" );
AddColumn( Len, "trade
length" );
- {{INTERVAL}} gave incorrect (unstable)
results in custom n-tick/n-range/n-volume
charts when used with multithreading. Fixed.
- Interval(2) returned incorrect (unstable)
results in custom n-tick/n-range/n-volume
charts when used with multithreading. Fixed.
- Preferences: Currency page was not working
properly. Fixed.
- Status bar look matches now appearance
settings (esp. visible in VS2012 style)
- Parameter window now allows to select combined
styles (like styleHidden) as well as their
components styleNoRescale+styleNoDraw independently
- User setting for minimum pixel spacing
in X grid (Tools->Preferences, "Axes
/ Grids") - it is recommended to keep
it at default value (60 pixels), for denser
grid use less spacing (minimum 30 pixels),
for wider grid use more x spacing (maximum
120 pixels)
- Sometimes panes did not refresh to final
size when chart sheets are switched (for
example - one tab has only one pane second
tab has two panes). Fixed.
CHANGES FOR VERSION 5.53.1 (as compared
to 5.53.0)
- Trend lines and other drawing tools sometimes
were blinking or disappeared in 5.53.0. Fixed
- Plots with styleDashed mixed with plots
using other styles could cause continuous
growth of rendering time in 5.52/5.53. Fixed.
CHANGES FOR VERSION 5.53.0 (as compared
to 5.52.0)
- Triangle drawing tool now supports filled
interiors
- Vertical selector line was flicerking with
RT update when more than one chart window
was open. Fixed
- SetChartGradientFill renamed to SetGradientFill
- SetGradientFill now has 2 more arguments:
baseline and baselinecolor. Allows reverse
gradient chart (such as underwater equity)
and 3 color gradients top->baseline->bottom
- Added 2-year and 5-year x grid spacing
- Gradient chart sometimes disappeared when
null values were in the data set and chart
was zoomed out to the maximum. Fixed.
- GUI: Preferences dialog adjustments (moved "bold" checkbox
in color page, removed obsolete "show
vertical line" boxes in charting page,
moved candlestick outline color settings
from charting to color page )
- styleClipMinMax interferred with styleGradient
in 5.52.0. Fixed (both styles can now be
used independently as well as combined together)
CHANGES FOR VERSION 5.52.0 (as compared
to 5.51.2)
- Chart themes implemented, featuring new
look, new grid settings, new background gradient
fills, predefined themes for more details
see: http://www.amibroker.com/guide/h_themes.html
- Charts: X-axis algorithm rewritten (now
it is clearer and prevents overcrowded/unreadable
X labels)
- Charts: added native gradient area charts.
Gradient chart is obtained using styleGradient.
Upper gradient color is specified by color
parameter in Plot() function, bottom gradient
color is either background color or can be
defined using SetChartGradientFill function.
styleGradient can be combined with styleLine
Example
SetChartGradientFill( colorLightOrange, colorPaleGreen );
Plot( C, "Close", ColorBlend( colorPaleGreen, colorBlack ), styleGradient | styleLine, Null, Null, 0,
-1 );
- Charts: Plot/PlotForeign/PlotOHLC now adds
extra parameter "width" that controls
the width of the line. Positive values specify
PIXEL width, negative values specify width
in percent of current bar width. So for example
-20 will give you dynamic width that is 20%
of bar width. Example:
Plot( C, "Close", colorBlack, styleBar, Null, Null, 0, 1,
-20 /*
line width as percent of bar */ );
- Eliminated build-up of rendering times
caused by growing of MFC temporary GDI object
maps in non-UI threads. Now rendering engine
uses direct WINAPI calls without MFC
- View->Filtering menu was disabled in
5.51.x. Fixed
- Data window was not working in 5.51.x.
Fixed
- " Show middle lines" = "NO" causes
date axis to be moved down outside visible
area. Fixed.
- Selector line was not working correctly
in 5.51. Fixed.
- Bold dotted trendline did not work in 5.51
BETA. Fixed
- AFL: LinearReg/LinRegSlope/LinRegIntercept/TSF/StdError
display proper error message when user passes
negative (wrong) parameter
- Study tooltip information now includes
also number of bars between start and end
of the trendline
- New Analysis: saving last column layout
works better
- Account manager: Edit->Undo menu was
missing. Fixed.
- GetFnData() now supports retrieving "Address" field
too
- On Win98 and above drawing engine uses
DC_PEN/DC_BRUSH for speed
- Optimize() reduced possibility of IEEE
floating point accumulation errors with steps < 1
(such as 0.01)
- PlotShapes() does not plot multiple times
in same x/y pos anymore - it results in faster
rendering when shapes overlap (large zoom
outs)
CHANGES FOR VERSION 5.51.2 (as compared
to 5.51.1)
- PlotShapes() rendering was slower in 5.51
than in 5.50. Fixed.
- Interpretation was blank with new rendering
engine. Fixed.
- Charts: Quick AFL was disabled in new rendering
engine causing slowdowns with > 100K bars.
Fixed
CHANGES FOR VERSION 5.51.1 (as compared
to 5.51.0)
- fix for low-level Gfx* functions causing
crash when multithreaded GDI was enabled
CHANGES FOR VERSION 5.51.0 (as compared
to 5.50.5)
- Charts: Multithreaded GDI implemented for
super-smooth UI response and preventing GDI-intensive
charts from detoriating entire UI responsiveness
- Maximum rendering time limit increased
to 1000ms (1sec) when multithreaded charts
+ GDI are enabled (allowing 2 times more
complex plots without Warning 901)
- 64-bit only: eSignal plugin - first BETA
version of 64-bit eSignal plugin (3.0.0)
CHANGES FOR VERSION 5.50.5 (as compared
to 5.50.4)
-
Newly created chart template did not save current tab when
it was not switched before saving. Fixed.
-
Notepad window is refreshed when it is brought back from invisible
tab
-
AFL Code Wizard: sometimes
64-bit
version of AFL wizard could hang on clicking "AND/OR" rule.
Fixed (AFL
Wizard 1.0.2)
-
Charts: Invisible Symbol-linked charts may not
be properly refreshed when changing symbol (happens only when
not using streaming RT source). Fixed.
-
OLE: AnalysisDoc.Run now supports mode =3 (individual backtest)
-
AFL: Equity()/Status()/GetOption used on chart referred to
OLD AA settings instead of last run analysis (whenever it is
old AA or new). Now uses last run analysis settings .
-
AFL: SetFormulaName did not work in New Analysis. Fixed.
CHANGES FOR VERSION 5.50.4 (as compared to 5.50.3)
-
New Analysis: "Show arrows for actual trades" sometimes
used date range from old AA. Fixed
-
New Analysis:
Individual backtest - custom metrics
columns would not appear if very first symbol under test
does not generate
ANY trades. Fixed.
-
UI: when
you float a maximized MDI window it becomes
little smaller so it does not
overlap
MDI tabs.
-
Print/Print
Preview: circle/arc/rectangle
objects outside
current view
are properly clipped
on printouts
-
New
Analysis: When
user cancelled
optimization in the
middle and ran
backtest afterwards
then
this single
follow up backtest
could
be incorrect and
required
another run to
produce correct
result again.
Fixed.
-
When
timeshift != 0
then duplicate
range markers
could appear
at day boundary.
Fixed.
-
Small
rounding issue
in ray
drawing
fixed
-
When
multiple
chart
panes
were
using
SetForeign
on
rare
occassions
foreign
call
could
fail
(return
other
symbol
data)
Fixed.
CHANGES FOR VERSION 5.50.3 (as compared to 5.50.2)
- New Analysis: proper symbol list refresh is triggered when
composites are created or user calls SetOption("RefreshWhenCompleted,
True );
- When settlement delay was set to zero, then interest rate
setting was ignored (5.46-5.50.2). Fixed.
- New Analysis: Individual backtest: setting different report
mode took place only after second run / second symbol. Fixed.
- Formulas: styleNoLabel is now default for all "Band" formulas
(Bollinger/Keltner/Percent)
- Formulas: faster version of Portfolio Equity formula
- Formulas: Ichimoku cloud added
- TC2K/TC2KFunds plugins updated to check Wow6432Node registry
key on 64-bit installations (should avoid TC2k detection
issue on 64-bit Windows)
- PlotVAPOverlay did not draw the very last level line. Fixed.
Also done some cosmetic tweaks.
- New Analysis: Walk forward tab table did not display custom
metrics. Fixed.
- Ticker bar prevents from adding empty '' symbol names
- Blank chart can be closed using flyout minitoolbar now
- When database is empty or chart does not have properly
selected symbol the information note is displayed in the
chart window (instead of blank chart)
- Fixed crash @7C8097FF when trying to drag drop indicator
on chart when database is empty
CHANGES FOR VERSION 5.50.2 (as compared to 5.50.1)
-
New Analysis: If current formula is open in the formula
editor it is auto-saved prior to running any Analysis (as
old AA did)
-
New Analysis: on Backtest/Optimization current
formula is saved
in @LastBacktestFormula registry
key so it can be referenced by Individual Equity formula
-
New
Analysis and Old AA: HoldMinBars > 0
can now be
used together with AllowSameBarExit=True
Settings: 'Stops' tab: N
Bar stop
has priority check box state was not saved.
Fixed
-
New
Analysis: on attempt
to load analysis project file
that contains formula
path that does not
exist or is not writable
AmiBroker will create
the formula in the "Formulas\Imported" folder
instead of not creating
it at all
-
New
Analysis: WinXP-only
- RMB click column descend/ascend
menus were
not working due to Windows
XP bug. Fixed.
-
New
Analysis: when formula
is picked from the
folder that is inside
current working directory,
then relative
path is used and stored
in project
instead of absolute
path previously used
-
New
Analysis:
SeparateLongShortRank
required
proper
MaxLongPos and MaxShortPos
definitions in order
to work. Now if
they
are missing defaults
are applied as in
old
AA.
-
Plugins:
IQFeed:
added "You
can't close
plugin window" on
attempt
to close
working IQFeed
window.
-
UI:
Chart
tree,
Layout
tree
in "Explorer" theme
-
UI:
Category
list
now
features
new
icons
and
decreased
indentation
-
UI:
Owner-draw
listviews
now
fully
implement
ellipsis
item
truncation
mechanism,
but
using
ExtTextOut
only
which
is
6
times
faster
than
DrawText
that
Windows
uses
-
UI:
Floating
non-chart
windows
(account/web
browser/analysis)
are
not
closed
when
switching
layouts.
-
Plugins:
IQFeed
plugin
uses
new
faster
IQFeed
API,
downloads
less
and
uses
way
more
efficient
method
to
backfill
1/5/15-second
base
time
intervals
CHANGES FOR VERSION 5.50.1 (as compared to 5.50.0)
- New Analysis: Individual Backtest implemented. Note that
it runs with approx same speed as old AA as Individual Backtest
is single threaded for reasons explained in the User's manual http://www.amibroker.com/guide/h_multithreading.html
- New Analysis: toolbar icons for parameters and settings
changed to avoid confusion with the icon for preferences
- UI: Symbol List uses Windows 7/Vista style
- New Analysis: Toolbar customization is now saved
- MRU (most recently used) file menu moved to submenu and
MRU list increased to 10 items
- Charts: fixed small alignment problem on Y axis when using
fixed (nonproportional) font
- New Analysis: backtester object now has EquityArray property
that returns entire equity array (not just current value).
Please note that values are filled during backtest and only after backtest
is complete, all values are valid. If you call it in the middle, it will
contain only "upto given point" data. Avoid abusing this function
and it is costly in terms of RAM/CPU.e).
You may use
bo.EquityArray instead of Foreign("~~~Equity", "C" )
in custom backtester code.
It accesses local copy of equity in New Analysis (unlike Foreign that accesses
global symbol)
- New Analysis: AddToComposite with atcDeleteValues | atcEnableInPortfolio
did not delete previous values. Fixed
- New Analysis: "Interval" menu item in the auto-repeat
group renamed to "AR interval" because some users
interpreted it wrong (as periodicity)
- New Analysis: OLE interface implemented
Description in the http://www.amibroker.com/guide/objects.html
Example
The following JScript example
a) opens analysis project from C:\Analysis1.apx file
b) starts backtest (asynchronously)
c) waits for completion
d) exports results
e) closes analysis document
AB = new ActiveXObject( "Broker.Application" );
try
{
NewA = AB.AnalysisDocs.Open( "c:\\analysis1.apx" ); //
opens given analysis project file
if (
NewA )
{
NewA.Run( 2 ); //
starts analysis (asynchronous - returns immediatelly
// (0-scan, 1- exploration, 2- portfolio
backtest, 4- optimization, 6-walk forward)
while (
NewA.IsBusy )
WScript.Sleep( 500 ); //
wait for completion
NewA.Export( "test.html" ); //
exporing results
WScript.echo( "ended" );
NewA.Close(); // closing analysis
window
}
}
catch ( exc )
{
WScript.echo( "Exception: " +
exc.message );
}
- Charts: more tweaks for Y axis algorithm for readability.
Now in Tools->Preferences, "Charting" the user
may select different grid stepping: Instead of default 1,
2, 5, 10 grid stepping, user may select to use 2.5 step instead
of 2 (Use 2.5 step in Y axis)
- GetFnData() supports new field "Alias" - return
Alias field without need to use OLE
- GetOption supports new fields: ApplyTo and Filter*, eliminates
the need to use OLE for that purpose
New fields:
-"ApplyTo" - returns Analysis "Apply To" setting 0 -
all symbols, 1 - current symbol, 2 - filter
- "FilterIncludeIndex", "FilterIncludeFavorite", "FilterIncludeMarket", "FilterIncludeGroup", "FilterIncludeSector", "FilterIncludeIndustry", "FilterIncludeWatchlist" -
return "Include" filter settings -1 - means NOT selected (not included), >=
0 index of included category
- "FilterExcludeIndex", "FilterExcludeFavorite", "FilterExcludeMarket", "FilterExcludeGroup", "FilterExcludeSector", "FilterExcludeIndustry", "FilterExcludeWatchlist" -
return "Exclude" filter settings -1 - means NOT selected (not excluded), >=
0 index of excluded category
- Fix for FPU inaccurracies in range bars implemented
CHANGES FOR VERSION 5.50.0 (as compared to 5.49.2)
- New Analysis: "Save" creates now a Analysis project
(.apx) file that includes all settings and formula needed
in single file. The file itself is in human readable XML
format. When such file is loaded on somebodys' else computer
it will recreate original formula if one is not present.
It will warn if there is a name conflict and let you decide
to keep existing formula or overwrite.
- UI: File open dialog now has "All supported files" option
in the "Files of type"
- UI: PopupWindow is now resizable (see size gripper in the
lower-right corner)
- AFL: PopupWindow function has additional parameters to
control width/height and flag that controls whenever popup
window captures input focus
PopupWindow( "bodytext","captiontext", timeout = 5, left
= -1, top = -1, width = -1, height = -1, captureFocus = True );
width = width in pixels, -1 - use default width
height = height in pixels, -1 - use default height
captureFocus - decides whenever popup window captures input focus or not
Example: popup window that does not change input focus:
PopupWindow("test", "caption", 30, -1, -1, -1, -1,
False);
- New Analysis: ApplyStops applied in non-regular modes are
passed to 2nd phase properly now.
- New Analysis: "Show current trade arrows" fixed.
- New Analysis: View->Filtering menu options were not
available when New Analysis was active. Fixed.
- New Analysis: Standard Edition has a limit of max 2 threads
per Analysis window instance.
- UI: Log window clicking on error displayed AFL Editor and
marked Line+1, Col+1 char position instead of proper place.
Fixed
- New Analysis: Errors are now displayed in a modern message
bar instead of dialog box
- UI: holding down Ctrl and Q keys simultaneously while AmiBroker
is starting resets all menus/command bars to defaults
- New Analysis: scroll bar properly works when "Walk
forward" tab is active
- New Analysis: Walk forward tab content can be now copied
using Edit->Copy / Ctrl+C
- New Analysis: when "wait for backfill" was turned
on and external data source was very slow to repond (like
IQFeed during backfill) subsequent calls to Status('stocknum')
could give non-unique numbers. Fixed.
- New Analysis: Copy to clipboard includes headers now
- New Analysis: Column customization/state persistence implemented
- Charts: New Y axis grid algorithm for clearer display on
condensed charts
- AFL: CategoryGetSymbols supports new categoryAll (all symbols
in the database) and new Mode parameter
CategoryGetSymbols( category, number, mode = 0 );
Mode parameter decides what field is retrived:
0 (default value) - ticker symbol
1 - full name
Example: to get all symbols existing in the database simply call
CategoryGetSymbols( categoryAll, 0 );
to get full names of all symbols use:
CategoryGetSymbols( categoryAll, 0, 1 );
- AFL: Added Warning 503. Using OLE / CreateObject / CreateStaticObject
is not multi-threading friendly. See Users' Guide ""Efficient
use of multithreading"" for more details.
- AFL: Added ThreadSleep( milliseconds ) function. It suspends
current thread for specified number of milliseconds (maximum
is 100 ms). Works only from NON-UI threads. When called from
UI thread the function does NOTHING and returns immediatelly.
Please do NOT abuse this function. Using it may negatively
impact performance.
- AFL: Added StaticVarCompareExchange function. Provides
atomic interlocked compare/exchange functionality
Parameters
" varname"
Specifies the name of the destination static variable. Static variable if
exists must be scalar numeric type. If static variable is not initialized,
the function assumes that it has value of zero.
exchange
Specifies the exchange value. Scalar numeric.
Comperand
Specifies the value to compare to the destination static variable. Scalar
numeric.
Return Values
The return value is the initial value of the destination static variable.
If variable did not exist, it returns zero.
The StaticVarCompareExchange function performs an atomic comparison of
the "varname" static variable value with the Comperand value.
If the static variable value is equal to the Comperand value, the Exchange
value is stored in the static variable. Otherwise, no operation is performed.
The function StaticVarCompareExchange provides a simple mechanism for
synchronizing access to static variables that are shared by multiple threads.
The following examples show how to implement semaphore and critical section
in AFL using StaticVarCompareExchange function:
// EXAMPLE 1 : Simple
semaphore (no waiting)
if( StaticVarCompareExchange( "semaphore", 1, 0 )
== 0 ) //
obtain semaphore
{
// protected section here
// Here you have exclusive access
(no other threads that check for semaphore will enter simultaneously)
/////////////////////////
StaticVarSet("semaphore", 0 ); //
reset semaphore
}
else
{
_TRACE("Can
not obtain semaphore");
}
///////////////
// EXAMPLE 2 HOW TO IMPLEMENT CRITICAL
SECTION IN AFL
///////////////
function _TryEnterCS(
secname )
{
global _cursec;
_cursec= "";
// try obtaining semaphore for 1000 ms
for(
i = 0; i < 1000;
i++ )
if(
StaticVarCompareExchange( secname, 1, 0 )
== 0 )
{
_cursec = secname;
break;
}
else ThreadSleep( 1 ); //sleep
one millisecond
return _cursec
!= "";
}
// call it ONLY when _TryEnterCS returned TRUE
!
function _LeaveCS()
{
global _cursec;
if(
_cursec != "" )
{
StaticVarSet(
_cursec, 0 );
_cursec = "";
}
}
function TimeConsumingWork()
{
// WARNING: the Percentile is CPU
hungry as it involves lots of sorting, the loop below may take > 1 second
to complete
for(
i = 0; i< 10;
i++ ) Percentile( C, 100, 10 );
}
//_TRACE("Without CS Begin " + GetChartID()
);
//TimeConsumingWork(); // some time consuming
calculation
//_TRACE("Without CS End" + GetChartID() );
// Example usage (critical section)
if( _TryEnterCS( "mysemaphore" )
)
{
// you are inside critical section now
_TRACE("Begin
CS " + GetChartID()
);
TimeConsumingWork(); // some time consuming
calculation
_TRACE("End
CS " + GetChartID()
);
_LeaveCS();
}
else
{
_TRACE("Unable
to enter CS");
}
CHANGES FOR VERSION 5.49.2 (as compared to 5.49.1)
- New Analysis: added Optimize->3D Optimization chart
menu
- New Analysis: buttons for Portfolio Equity/Individual Equity
charts added
- New Analysis: Info Bar added (that duplicates some of the
info that normally appears on the Info Tab). It can be turned
on using Settings->Info Bar
- New Analysis: Report generation is now OFF by default when
running optimization/walk forward as in old AA. This gives
about 0.9 sec gain per step.
- New Analysis: Single-symbol optimization made faster by
caching already compressed quote array on subsequent steps
- New Analysis: the check for Status("StockNum")
was sensitive to blanks between parenthesis, function name
and string parameter. Now it is made insensitive to blanks.
- New Analysis: when "Range" was "n last bars" or "n
last days", Status("rangefromdate") gave date
of preceding bar. Fixed.
- UI: "Performance" tooltip title was not always
updated on time. Fixed.
- UI: "Wait for plugin" window displays progress
bar with "marquee" style instead of circle of dots
CHANGES FOR VERSION 5.49.1 (as compared to 5.49.0)
- New Analysis: Testing on unaligned data sometimes took
longer than expected because of the work necessary to bring
signals in order. Now a smart method avoids most of the memory
transfers and can give 10x speedup on backtesting
very long unaligned intraday data.
- New Analysis: "Backtest started", "Exploration
started" text in the info tab appeared twice per run
(instead of once). Fixed
- New Analysis: Backtest report did not include formula code.
Fixed.
- New Analysis: Fixed crash that could occur when running
analysis with Range set to "N recent bars" and
N was exceeding number of quotes.
- New Analysis: Float/Normal/Close popup menu RMB menu was
active everywhere in floating window instead of only caption
area. Fixed.
- New Analysis: Implement single-thread start when Status("StockNum")
is detected in the code. Other threads are started when first
symbol processing is completed.
- New Analysis: Send to Analysis did not update formula combo
box properly in certain scenarios: when formula X was selected,
then formula Y, then formula X again. Fixed.
- Old AA: status bar displays true timing for fair comparisons
between old AA and new Analysis. Watching progress bar numbers
was misleading as it closed before all processing was truly
complete, so it looked like old AA completed sooner than
it really did
- UI: menu item for Old Automatic Analysis restored as apparently
some users got lost. Also attempt to run old Automatic analysis
displays an information about new Analysis window
CHANGES FOR VERSION 5.49.0 (as compared to 5.48.0)
- New Analysis: when floating pane is made normal from/to
dates were reset to today. Fixed.
- New Analysis: when Apply To: Filter is defined so NO symbol
matches the criteria, appropriate message is displayed when
trying to run Analysis and action is terminated instead of
displaying progress bar forever
- New Analysis: when analysis window is "floating" double
click/show arrows/sync affects active MDI chart just like
old AA did, as opposed to last one (when analysis is not
floating)
- New Analysis: Optimization parameter setup stage uses now
not more than 100 bars. This reduces setup time.
- New Analysis: implemented import / export, File menu now
has Import HTML and Export HTML/CSV commands
- New Analysis: Implemented "Wait for backfill" option.
This slows down analysis sequence so AmiBroker waits for
external RT data source to deliver backfill data
When "wait for backfill" option is turned on, AmiBroker checks
if data for given symbol are complete, if not, it sends request to external
source to backfill the data and waits 1 second.
After one second, it checks again, it data are complete, if not, it waits
another 1 second, and so on. Once data are complete given symbol is used
for formula execution.
- New Analysis: Custom backtester uses "last backtest
settings" when calling GetStatus() instead of old AA
settings
- New Analysis: auto-repeat interval edit field did not allow
to enter values if moved to main toolbar via customization.
Fixed.
- Formula Editor Analysis toolbar button now operates on
New Analysis window
- Default for timestamping of intraday compression changed
to "Show START time of interval"
- Charts: AFL error message color is now definable in Tools->Preferences, "Color" tab
- Charts: Tooltips automatically display also OHL prices
(in addition to close) when Plot style is set to candlestick,
bar or when PlotOHLC was used
- UI: Adjusted item Y offset for owner drawn listviews for
consitent look with old layout of system listviews in Windows
XP and earlier OSes
- UI: Account, Analysis and Web research windows don't use
client edge/border anymore - gives slicker / less crowded
look
- UI: when focus is switched to floating document window,
the application menu is switched to proper context
- UI: When File->Close was used on floating pane, document
was closed but docking pane was not. Fixed.
- UI: The toolbar button and menu option to launch old Automatic
Analysis window are now hidden (can be brought back by using
Tools->Customize), old AA can also be launched from new
Analysis via Analysis->Old Analysis menu
- UI: New menu options and toolbar button to launch new analysis
window
- UI: Moved all menu items controlling visibility of docking
windows to "Window" menu
- UI: floating state of windows can now be turned on/off
using right-click menu over tab / floating window caption
- UI: File->Save (when currently selected window is a
chart) command now saves Chart template. To save database
use "Save database" instead.
- UI: Defaults for data window are changed, so extra OHL
display is turned off by default as currently PlotOHLC displays
all 4 prices in the tooltip and data window already
- UI: Data window scroll bars are hidden and do not flicker
when updating
- UI: "Save All" toolbar button removed, "Save
database" button added to replace it
- Web Research: turned on "silent" mode - should
prevent error message boxes displayed by IE engine.
- QuoteEngine: Range bars algorithm improved significantly
- Quote array uses 20480 bytes (512 quotes) allocation chunk
size (exactly 5x4KB page) for better alignment with Windows
virtual memory pages
CHANGES FOR VERSION 5.48.0 (as compared to 5.47.0)
- New Analysis: custom metrics columns were invisible in
backtest/optimizations. Fixed. (#91031)
- New Analysis: backtest did not display proper column names
when Report mode was different than trade list. Fixed. Also
added support for changing report mode via SetOption().
- New Analysis: Auto-repeat Scan/Explore implemented (aka. "Run
every" in old AA) (use drop down menu next to "Settings" button)
- New Analysis: Showing arrows by double click implemented
- New Analysis: Sync chart on select option implemented (use
drop down menu next to "Settings" button)
- Fixed window activation issue after RMB click in chart
window when non-chart floating windows are active
- New Analysis: Cancelling walk-forward did not restore date
range and settings and didn't reset internal step counter.
Fixed.
- New Analysis: Formula path disappeared when window was
made floating. Fixed.
- New Analysis: in 5.47 non-exhaustive optimizers sometimes
stopped after first step in walk-forward. Fixed.
- Charting: scroll bar zoom function remains active even
at extreme zoom in levels
- New Analysis: Fixed problem with opt steps warning dialog
appearing sometimes in the out-of-sample tests in walk forward
sequence
- New Analysis: Signal heaps are separated now, allowing
to run concurrent backtest/optimizations in many analysis
windows
- New Analysis: removed unnecessary refreshes of symbol list
during optimizations that caused slowdowns when user had
large database
- New Analysis: The size of control fields is properly adjusted
with regards to DPI
- New Analysis: Status("StockNum") was always zero
in 5.47 and earlier. Now it is set properly.
Caveat: be careful when you run codes that use Status("StockNum")==0
for special processing in multithreading mode.
Other threads with "StockNum" = 1, 2, 3,... will run simultaneously!
If you store static variables in step 0 these variables may be empty if you
access them from other parallel running threads.
- Fixed Error 53 message that was giving an error when proper
\" (quotation mark espace sequence) was used
CHANGES FOR VERSION 5.47.0 (as compared to 5.46.0)
- New Analysis: last used ApplyTo/Range/From/to dates/filters
and other settings are saved when Analysis window is closed
- Fix to "slow response" problems some users reported
when switching symbols
- Fibonacci retracement- modifying Z-order affected only
control trendline, not all lines as it should. Fixed.
- New Analysis: implemented Walk-Forward testing (use drop
arrow next to Optimization button)
- AFL engine: new error 53: incorrect \ espace sequence.
Error is issued when user forgets that single slash must
be written as \\
- Default title for new analysis window is "AnalysisX" (instead
of "Unnamed") where X is consecutive number 1,
2..
- attempt to use Say() on computer without sound card or
without driver installed does not result in throwing exception/crash
report, but it is rather silently ignored
CHANGES FOR VERSION 5.46.0 (as compared to 5.45.0)
- New Analysis: Exhaustive multi-threaded optimization implemented
- New Analysis: Smart (non-exhaustive) multi-threaded optimization
implemented in a way compatible with existing optimizer plugins
Note however that due to the fact that most non-exhaustive optimization plugins
are not re-entrant, AmiBroker prevents from running more than one non-exhaustive
multi-threaded optimization at a time. You can however, run many exhaustive
optimizations in parallel, as they don't require external plugins.
- Slight modification to the way how compressed bar charts
are drawn (so bars with H==L are better visible)
CHANGES FOR VERSION 5.45.0 (as compared to 5.44.1)
- 64-bit version compiled with new version of C runtime (Microsoft
security update)
- Fixed date/time column sorting in virtual list views when
regional date format was different than yyyy-MM-dd
- AFL: ClipboardSet() returns True (1) when clipboard has
been successfully set. Sometimes clipboard is locked by another
applications and then write can fail (ClipboardSet() will
return zero/False then)
- New Analysis: Changed alignment of Date/Time column to
left in backtest result list.
- Most AFL engine setup moved to worker threads. Result -
smaller UI thread load in MT charts (better scalability)
and much faster (upto 2x) explorations/scans in New Analysis
window
- New Analysis: added "Info" tab that provides
some summary information about analysis (number of rows,
timings, backtest summary) - contents can be copied using
Ctrl+C / Edit->Copy
NOTE:
End users should only look at "Completed in... sec" line that shows
actual run time of the analysis (scan/exploration/backtest).
The times shown in "timings" row are for Amibroker.com internal
use. In development/testing they help us tweak the performance of various
parts of analysis engine. The detailed timings do not sum up to actual
run time. No further infomation is available at the moment. The "timings" row
is subject to change/removal in the future versions.
If you have problems/questions with the performance of new Analysis window
please copy (Ctrl+C) the contents of Info tab and send to support.
- New Analysis: first-phase backtest signal processing and
ranking moved to non-UI threads, enabling better parallelism,
results in better backtest performance (upto 2x in with trivial
codes)
CHANGES FOR VERSION 5.44.0 (as compared to 5.43.1)
- New Analysis: fixed AddToComposite()
- New Analysis: Interval() function was working incorrectly
in new analysis window. Fixed.
- New Analysis: Backtest ~~~EQUITY symbol did not have "use
only local database" set in 5.43.1. Fixed.
- New Analysis: Backtest performance improved by removing
some unnecessary list view refreshes (now it should never
be slower than old AA even with simplest formulas)
CHANGES FOR VERSION 5.43.1 (as compared to 5.43.0)
- When range different than "All quotes" was selected,
backtest in new Analysis window could produce incorrect results
in 5.43.0. Fixed.
CHANGES FOR VERSION 5.43.0 (as compared to 5.42.0)
- New Analysis Window: multi-threaded Backtest feature implemented
(experimental)
Note that only first phase of backtest is multithreaded (each symbol in separate
thread). 2nd phase (custom backtest) is executed in main thread as there
is only one symbol to work on (i.e. equity) and it needs to talk with OLE
which is single threaded and GUI.
- Load/Unload buttons removed from Plugins dialog. This was
developer-only feature and it was abused by ordinary people
who were unloading plugins that were actually in -use (such
as data plugins when being connected to given data source)
- ListViews: the last line (partially shown) in RT quote
window was not easily selectable. Fixed
- New Analysis window: Implemented Parameters dialog
- AFL: GetCursorMouseButtons() sometimes missed clicks when
multithreading was on and formula took ages to execute. Now
it is now 100% reliable.
- Auto-selection of proper layer based on selected viewing
interval
NOTE: This feature can be turned off by click with RIGHT mouse button over
layers window and UNCHECKING "Auto-select layer"
- IRA accounts support - implemented Settlement delay in
backtester, via SetOption("SettlementDelay", x
)
"SettlementDelay" option describes the number of days (not bars) it
takes for sale proceeds to settle and be available for opening new positions.
SetOption("SettlementDelay", 3 ); // this will cause that proceeds
from sale are only available for trading on 3rd day after sale
For detailed tracking
" Detailed log" report option now shows available and unsettled funds
for T+1, T+2 and so on
Note: when using this option it is recommended to use backtestRegularRaw
instead of backtestRegular, otherwise some trades may not be entered
because funds are not settled immediately and you need to be able to enter
not on first but subsequent buy signals and that is exactly what backtestRegularRaw
offers.
Note2: old backtester (Equity() function) ignores settlement delay
- Zoom in/out toolbar buttons zoom in finer steps (+/-10%)
- Analysis ListView, RMB menu new option: "Add Rank
column" - adds a column with ordinal rankings based
on current sort or just row number column when list is not
sorted
- New feature: Adding new chart/research/account/analysis
via (+) tab
- New Analysis window: Implemented SetSortColumns
- New Analysis window: Implemented AddSummaryRows
CHANGES FOR VERSION 5.42.0 (as compared to 5.41.0)
- Implemented right click menu in new Analysis windows (Add
symbols to watchlist/Show arrows functionality)
- Zoom in/out toolbar buttons now have auto-repeat feature
- In 5.41.0 Ctrl+C from list view copied text without tabs
(column separators). Fixed
- In 5.41.0 did not refresh progress dialog optimization
status list. Fixed. (owner draw list view initial size is
retrieved in PreSubclass now)
- In 5.41.0 did not display Time&Sales in reverse order
(newest on top). Fixed.
CHANGES FOR VERSION 5.41.0 (as compared to 5.40.3)
- New Analysis window (File->New->Analysis)
- featuring multithreaded Scan and Exploration
Performance note:
to fully benefit from multithreading it is best to use AmiBroker local NATIVE
database (not external)
as it is the only database that can deliver data quickly enough.
Tests show that on AmiBroker native databases scans and explorations are
100% scalable to multiple cores
- i.e. for example would run upto 8 times faster on 8 CPU/core machine.
IMPORTANT: This window is work-in-progress. Multithreaded Backtest and
Optimization features will be added later.
- AFL: AddColumn - added mini bar charts to explorations
Exploration now features ability to create mini bar charts in individual
cells.
AddColumn has new parameter 'barchart'
AddColumn( ARRAY, "Caption", format = 1.2, fgcolor = colorDefault,
bkcolor = colorDefault, width = -1, barchart = null )
'barchart' parameter accepts values from 0...100 represening percentage
width of bar chart displayed in a cell
the in-cell bar chart is drawn with bkcolor (background color).
Example usage:
Filter=1;
AddColumn( Close, "Close" );
rank = PercentRank( Close, 100 );
Color = ColorHSB( rank * 64/100, 255, 255 );
AddColumn( rank, "100-day percent rank", 1.2, colorDefault, Color,
-1, rank );
Note that although this example uses same value for numeric display
and chart bar width, it does NOT need
to be the same, i.e. numerical value of the cell is independent from bar
chart.
- Totally rewritten listview with very efficient owner draw
code speeds up list view scrolling/resizing/repainting more
than 10 times. Native system ListView control is terribly
slow on Windows XP/Vista/7 (surprisingly it was many times
faster in Win9x!)
- AFL: Percentile() does a param check for range > 0 now
- Mini-chart in RT Quote window - Mini chart shows where
LAST price is within LOW-HIGH range.
- Errors and warnings are now displayed in red color in the
indicator pane
- During actual GDI chart rendering AmiBroker measures time
and if it exceeds 500ms timeout it stops rendering with Warning
901.
This check is required because GDI rendering occurs in GUI thread and if
GUI thread does not process messages for half second Windows will think that
application is "not responding".
This prevents making application stuck with some overly complex, possibly
incorrect formulas that call hundreds of Plot()s
- Warning 502: Calling Plot()/PlotOHLC over 500 times is
displayed in indicator in runtime to prevent abuse
- All list views, pressing Ctrl and NumPad'+' automatically
adjusts column widths to content
- if data are missing in the in-memory cache, Foreign() calls
from non-GUI threads use synchronous retrieval method for
reliability.
This provides reliable results in AA but may slow down the multi-threaded
operations if cache size is too small and user uses more Foreign() calls
than in-memory cache size.
IMPORTANT:
For optimum performance in-memory cache setting (Tools->Preferences->Data)
should be GREATER than number of Foreign() calls in any single formula used.
Values lower than that cause lots of disk activity and serialization of all
Foreign calls that means that additional threads must wait for data retrieval
to complete.
- Old and new Analysis window: outputting millions of rows
to listview is much faster now
- All list views - Ctrl+A (Select All) made much faster
CHANGES FOR VERSION 5.40.3 (as compared to 5.40.2)
-
GfxTextOut produced too large text on paper / printout. Fixed.
-
GicsID
returns empty string when GICS is not defined for symbol
-
PlotText:
y==Null check added to skip calls that don't produce
any output
CHANGES FOR VERSION 5.40.2 (as compared to 5.40.0)
-
64-bit version: MS VC++2005 compiler default floating point code
generation option switched back to fp:precise because fp:fast produced
incorrect code
-
Print preview and Edit->Image->Copy respect Price
chart style setting
-
Notepad window: pressing Ctrl+C/V/X and ESC
key afterwards closed AmiBroker without warning. Fixed.
-
Quick review:
Volume is printed without using scientific notation upto 9 billion
-
SaveNewChartsInfo
is called in SaveWorkspaceInfo() to ensure that broker.newcharts
is in sync with saved layout, Broker.cpp
line
927
-
Exception dialog "Exit program" exits
program forcefully now. This prevents situation
when program could not be closed and sometimes
corrupted
data on exit.
-
Selection line is handled properly
again in Print preview/Edit->Image->Copy
-
AA / Scan outputting
lots (10K+) of signals made much faster
-
Memory consumption during
AA / Explorations reduced significantly, also multi-column
explorations are
much faster (10x)
-
64-bit version: AB
x64 reverted to "Daily" setting when re-entering
AA Settings dialog if user previously
selected weekly/monthly/quarterly/yearly. Fixed
CHANGES FOR VERSION 5.40.0 (as compared to 5.39.0)
-
Fixed crash occuring when drawing object was not deselected prior
to switching symbol
-
Added extra thread safety measure for Foreign()
so it handles situation
when other thread is deleting symbol while it is being accessed
via Foreign()
-
New version (1.3) of 3D chart viewer (O3G) fixes problem
with Edit->Copy
image function on Vista/Windows 7 with desktop composition
turned ON
-
Multithreading does not revert to "ON" state
on startup when user turned if OFF last time (it was so in
5.34-5.39 to force
testing of
MT)
-
Temporarily removed asInvoker manifest because it
created problems with 3rd party programs/plugins that are not
Windows 7 compatible
(QP2, FastTrack)
-
AFL: PercentRank( array, range
) implemented
array - input data
range - lookback range
Returns percent rank (0...100) of the current element of the array
within all elements over the specified range.
A value of 100 indicates that the current element of the array is
the highest for the given lookback range, while a value of 0 indicates
that the current value is the lowest for the given lookback range.
It is equivalent (but 2x faster) to:
function PercentRank2( Data, Periods)
{
Count = 0;
for ( i = 1; i <= Periods ; i++ )
{
Count += Data > Ref( Data, -i );
}
return 100 * Count / Periods;
}
-
AFL thread termination is safer and faster now
(this also eliminates randomly occuring
AFL syntax errors when
swithing
layouts)
CHANGES FOR VERSION 5.39.0 (as compared to 5.38.0)
- Lookup( array, datetime, mode = 0 ) enhanced to support mode = -2 and
mode 2
mode now has following allowable values
mode = 0 - find exact match, otherwise return Null
mode = -1 - find exact match, otherwise return nearest predecesor (if datetime
is past last bar it will return last bar value)
mode = -2 - find exact match, otherwise return nearest predecessor EXCEPT
the very last bar (if searched datetime is past last bar it will return Null)
mode = 1 - find exact match, otherwise return nearest successor (if datetime
is before first bar it will return first bar value)
mode = 2 - find exact match, otherwise return nearest successor EXCEPT the
very first bar (if searched datetime is before first bar it will return Null)
- GetPriceStyle() caused chart flashing when different windows had different
price style selected. Fixed.
- Log output/error messages from AFL engine are now passed to main window
asynchronously (via PostMessage)
- Chart was not refreshed immediatelly when using drag-drop on single-pane
charts with non-streaming DB. Fixed
- Account manager: Transactions list: "Gross value" column
calculation fix.
- Bar Replay dialog has now new checkbox "Reset alert time" that
resets last alert time for all symbols when you press Play button enabling
AlertIf() to be triggered again from the start on each replay
- Fixed problem with incorrect reading of previously saved layout/template
when user decreased number of chart sheets in the preferences
- "Show arrows for current trade" in AA did not work with 12
hour AM/PM time format. Fixed
- Fixed Lookup() function handling of end-of-day-only records and mode=0
(exact match).
- Quote Editor: "Use timeshift" checkbox position wasn't adjusted
when resizing dialog. Fixed.
- Quote Editor was not able to edit quotes after 12:00PM when 12 hour
AM/PM time format was used. Fixed
- In 5.31.x BETAs syntax error message was displayed without error number.
Fixed.
- Fixed problem of incorrect allocation of chart value cache when window
width was below 16 pixels.
CHANGES FOR VERSION 5.38.0 (as compared to 5.37.1)
- Fixed structure packing in x64 version causing problems with display
of parameter tooltips for 3rd party DLLs
- WMA had trouble with null handling at the beginning. Fixed.
- Improved CCI accuracy in x64 version (as compared to x86 version)
- Added switch to turn reset chart zoom level when loading layout
Tools->Preferences, "Charting"
" Reset zoom to default when loading layout"
- by turning this ON, zoom level gets reset to default number of bars
as defined in preferences for
any loaded layout, bringing old (pre-5.37) behaviour
- AFL: FIR( array, coefficients, size ) implemented
This function implements general-purpose Finite Impulse Response filter (FIR)
http://en.wikipedia.org/wiki/Finite_impulse_response
The output is convolution of input aray with coefficents table (impulse
response table).
The function performs automatic normalization of coefficient table if
necessary (if its sum is not 1)
INPUTS:
array - input array to be smoothed
coefficients - array of FIR coefficients
size - number of coefficients ( filter_order + 1 )
It is functional (but 2+ times faster) equivalent of following AFL:
function FIR_AFL( input, coeff, size )
{
result = 0;
sumcoeff = 0;
for( i = 0; i < Min( size, BarCount ); i++ )
{
sumcoeff += coeff[ i ];
result += coeff[ i ] * Ref( input, - size + i + 1 );
}
return result/sumcoeff;
}
For example 5 bar weighted moving average can be written:
coeff[ 0 ] = 1;
coeff[ 1 ] = 2;
coeff[ 2 ] = 3;
coeff[ 3 ] = 4;
coeff[ 4 ] = 5;
FIR( Close, coeff, 5 );
Another example: ALMA which is FIR filter with shifted Gaussian coefficents
can be implemented as follows:
function ALMA_AFL( input, range, Offset, sigma )
{
local m, im, s, Coeff;
m = floor( Offset * (range - 1) );
s = range / sigma;
for( i = 0; i < Min( range, BarCount ); i++ )
{
im = i - m;
Coeff[ i ] = exp( - ( im * im )/ ( 2 * s * s ) );
}
return FIR( input, Coeff, range );
}
- AFL: HMA (Hull Moving Average)
HMA - Hull Moving average it is equivalent to this AFL:
function HMA_AFL( input, Range )
{
return WMA( 2 * WMA( input, int( Range / 2 ) ) - WMA( input, Range ), int(
sqrt( Range ) ) );
}
- AFL: new function: DateTimeAdd( datetime, amount, interval = inDaily
)
The function adds specified amount of 'intervals' to input datetime array.
Allows for example to calculate datetime 5 days back or 13 months into the
future
INPUT:
datetime - scalar or array - the datetime value to add to (for example returned
by Now(), DateTime() or StrToDateTime/_DT or ConvertDateTime functions)
amount - number of 'intervals' to add (seconds/minutes/hours/days/etc - depending
on interval parameter)
interval - specifies unit you want to add, supported units are in1Second,
in1Minute, inHourly, inDaily, inWeekly, inMonthly, inQuarterly, inYearly
RETURNS:
datetime (scalar or array) - returned type depends on input
Example 1:
x = Now( 5 ) ;
printf("11 days from now " + DateTimeToStr( DateTimeAdd( x, 11,
inDaily ) ) ;
Example 2 (commentary):
x = Now(5);
" now is " + DateTimeToStr( x );
for( shift = -12; shift <= 12; shift++ )
{
printf("%g seconds from now is " + DateTimeToStr( DateTimeAdd(
x, shift, 1 ) ) + "\n", shift );
printf("%g minutes from now is " + DateTimeToStr( DateTimeAdd(
x, shift, in1Minute ) ) + "\n", shift );
printf("%g hours from now is " + DateTimeToStr( DateTimeAdd(
x, shift, inHourly ) ) + "\n", shift );
printf("%g days from now is " + DateTimeToStr( DateTimeAdd( x,
shift, inDaily ) ) + "\n", shift );
printf("%g weeks from now is " + DateTimeToStr( DateTimeAdd(
x, shift, inWeekly ) ) + "\n", shift );
printf("%g months from now is " + DateTimeToStr( DateTimeAdd(
x, shift, inMonthly ) ) + "\n", shift );
printf("%g quarters from now is " + DateTimeToStr( DateTimeAdd(
x, shift, inQuarterly ) ) + "\n", shift );
printf("%g years from now is " + DateTimeToStr( DateTimeAdd(
x, shift, inYearly ) ) + "\n\n", shift );
}
- AFL: new function: Lookup( array, datetime, mode = 0 )
The function searches for the bar with specified datetime and returns the
value from the same position of the input array.
If exact match can not be found it returns:
Null - when mode is 0 (zero) - the default behaviour,
closest predecesor bar value - when mode is -1
closest successor bar value - when mode is 1
Example:
InputDate = "2011-04-05";
Title = "Close value at (or before) " + InputDate + " is " +
Lookup( Close, _DT( InputDate ), -1 );
This function uses very fast binary search and it is many times faster
than previous AFL-based methods
such as FindValueAtDateTime() presented in the past.
Any call to FindValueAtDateTime ( input, dt, value ) can be now replaced
with Lookup( input, value )
(there is no need to pass dt- datetime).
NOTE: This function does not affect QuickAFL required bars, therefore
it will only search bars that are actually
loaded in arrays. For indicators it may mean that it won't be able to find
value if it is invisible, unless you
use SetBarsRequired() function to ensure that more bars are loaded.
- AFL: function _DT( "string" ) added - this is short alias
for StrToDateTime() function
- AFL: added FirstVisibleValue/LastVisibleValue functions
// in charts / indicators /interpretation they return the values of array
at first and last visible bars
// in other (non-indicator) modes they return array elements with subscripts
of 0 and BarCount -1 respectively
// Note that these functions do not affect QuickAFL, so LastVisibleValue
may be used instead of LastValue
// These functions are intended to complement functionality already available
via HighestVisibleValue and LowestVisibleValue
x = C;
Plot( x, "x", colorRed );
Plot( FirstVisibleValue( x ), "fvv", colorGreen );
Plot( LastVisibleValue( x ), "lvv", colorBlue );
- Cum( Null) was causing exception in AFL engine. Fixed
- Print preview flickered when moving the mouse due to frequent refreshes
when crosshair was enabled. Fixed.
- Structured exception handler is set for every thread for better exception
reporting
CHANGES FOR VERSION 5.37.1 (as compared to 5.36.0)
- EncodeColor did not accept colorDefault (-1) in 5.37.0. Fixed 5.37.1.
- AFL Code Wizard 1.01: fixed incompatibility with Internet Explorer
9
- AFL: PlotText() internally detects if given x-coordinate is outside
visible area, skips entire processing and returns zero (without plotting
anything) for invisible bars. This saves execution time for inefficiently
written formulas that did not check for visible bars by themselves.
- Report charts now use Formula path as defined in preferences not hard-coded
one so they work if user has moved his/her formula folder elsewhere
- Fixed crash occuring sometimes on completly blank chart when user set
number of blank (future) bars to zero (#75570)
- Fixed crash when trying to use Overlay onto blank chart
- AmiBroker is now marked as DPI-aware (this ensures crisp display by
turning off Win7 DPI virtualization that scales and blurs image on high
DPI (>=150dpi) displays)
- AFL: added new message: 'Error 52. Invalid argument value. Argument
must be positive (and not Null))'. The message is displayed when you
pass incorrect value to a function (like Null as a range to Sum() )
- Layout files now include zoom factor so charts are loaded with most
recently used zoom level
- Updated version of UI library featuring new appearance themes and alpha-channel
resize tracker
CHANGES FOR VERSION 5.36.0 (as compared to 5.35.0)
- AFL Editor more detailed code checks implemented - now displays *warnings*
(for code parts that are syntactically correct but likely errorneous
in practice)
Example: Warning 501. Assigment within conditional. Did you mean == instead
of = ?
The warning will display if you use = (assignment operator) as a condition
in
if(), while(), do-while(), and for() statements and IIf() function
The result of an = assignment statement is the value of the right-hand
side of the = statement. You can use an assignment statement as a conditional
test, but it is not recommended. It usually is the result of a typo where
a == equality test was intended, as the following example shows:
Example:
if( x = 3 ) // x will be assigned with 3 then it is used as "true" value
so condition is always met - AmiBroker will display warning 501. Assignment
within conditional
{
// this if will ALWAYS be executed
}
Probably the user meant:
if( x == 3 ) // x will be compared to 3
{
// this is true conditional part
}
If you want to overcome warning 501 while still doing assigment within
conditional perform a check like this:
if( ( x = 3 ) == True ) // this NOT cause warning 501
{
printf("test");
}
- Temporary workaround for docking window crash when Internet Explorer
9 is installed and web research window resized
- AFL: GicsID and InGICS added
GicsID( mode )
returns STRING
- gives information about current symbol GICS category
mode = 0 - returns string containing GICS code alone (such as " 15103020")
mode = 1 - returns string containing GICS category name (such as "Paper
Packaging")
mode = 2 - returns string containing both code and name (such as "15103020
Paper Packaging")
InGics( "gics_code" )
- performs yes/no test if current symbol belongs to given GICS category
for example
if GICS set for the symbol is 15103020
InGics("15"), InGICS("1510"), InGics("151030")
and InGics("15103020") will ALL return true
but all others (like InGics("20")) will return false.
Example usage:
"GICS(0) = " + GicsID( 0 );
" GICS(1) = " + GicsID( 1 );
" GICS(2) = " + GicsID( 2 );
for( i = 10; i < 90; i+= 1 )
{
gics_code = StrFormat("%02.0f", i );
printf("In Gics '"+ gics_code + "' = %g\n", InGics(
gics_code ) );
}
- In minimised windows RequestTimedRefresh with onlyvisible parameter
set to False worked unreliably when multithreading was ON. Fixed.
- AFL engine gives more detailed information about exceptions (including
line numbers and file path)
- Formula editor, indicators and commentary catch all exceptions, not
only system exceptions
- Fixed potential crash when param dialog is referring to non-existing
view (NO_CHART_ID)
- AFL: "Unknown exception" should now be reported with line
numbers for easier identification of ofending function
- AFL: for/while/do-while loops were not executed if syntax or runtime
error occured before them and "stop parsing on first error" was
turned off. Fixed
CHANGES FOR VERSION 5.35.0 (as compared to 5.34.5)
- AFL Editor: "firstvisiblebarindex" and "lastvisiblebarindex" are
initialized with first and last data bar when using "Verify syntax" to
avoid problems. Although these Status fields should only be used in indicators,
it is quite common mistake among users to use them unconditionally
- AFL: Sum() function displays Error 52. Invalid argument value when
range argument is negative (instead of random crash)
- Account manager: fixed OLE exception in date conversion occuring randomly
due to uninitialized exit date when trade has been opened.
- Indicator Maintenance Wizard now creates log (indmaint.log in AmiBroker
directory) that reports all layout files read and eventual errors found.
It also attempts to read corrupted layouts in a "safe" way
so it does not crash
- Parameter window: fixed handling of mixed section and section-less
parameters
- Quote Editor: fixed editing when timeshift was not zero plus added
ability to turn on/off timeshift (so quotes can be edited in original
exchange zone)
- Fix: Click on items in param() window did not set focus ( fix @ line
1505 HotPropCtrl.cpp )
- AFL: Error 10. Subcript out of range message now gives information
about exactly which array element was accessed
- AFL: Added new error message "Error 51. Array subscript has Null
value"
- /STACK:2097152,16384 (2M/16K) option for x64 compilation - to allow
deep nesting in AFL, also reduced stack usage by Execute() function
- Removed (evil) IsBadReadPtr function
- OLE: AB.RefreshAll( [optional] Flags = 1 ) - takes now new optional
parameter Flags. Flags = 1 means refresh only charts (fast), Flags =
3 means refresh charts, dialogs, symbol list, chart list, etc (SLOW!)
- OLE: AB.RefreshAll() changed for improved consistency (marks for refresh
and it is refreshed every 1 second regardless of number of requests within
one second)
- //--Indicator-End-- special marker is now obsolete and does nothing
(entire formula is executed). For conditional execution of interpretation
code use conditional statement if with Status() function
- Fix: switch( str_function_call_here ) did not work properly when expression
was a function call returning string such as StrLeft(). Fixed
- Fix: internal time conversion (flocaltime) made thread safe using TLS
- AFL: Equity() now uses thread local storage for keeping stop state
variables to prevent interference when multiple threads call Equity()
- AFL: mtRandom(A) now uses thread local storage, so using non-null seed
yields reproducible sequence even if multiple threads are calling mtRandom
in parallel
- Foreign() uses SendNotifyMessage instead of PostMessage if symbol data
are not already cached to trigger loading quicker (solves support #78278)
- Implemented cross-thread bidirectional communication mechanism that
allows to call functions across threads in safe way. This allows among
other things to make non-threading safe APIs (like Quotes Plus) to operate
properly with multi-threading enabled. (Fixes GetExtraData crash with
QP2 - FC#2072)
- Prefs/Misc/"Show interpretation in tooltips" checkbox removed
as this functionality has been removed in 5.32.0. Use Interpretation
window instead (View->Interpretation)
- OLE: AB.Import() - UI is automatically refreshed after import so there
is no need to call RefreshAll() anymore. Also the refresh is "smart" it
only updates symbol lists if any symbols were added
CHANGES FOR VERSION 5.34.5 (as compared to 5.34.0)
- Worked around Microsoft OS bug #248760 and #209467 - writing to metafiles
from multiple threads causes lost object selections. This has caused
display unstability for Gfx function-generated output. The only way to
fix that was NOT to use metafiles at all. Gfx code was rewritten not
to use Microsoft metafiles. As a result of custom implementation Gfx
functions work now 3 times faster and are multi-threading safe.
- GfxDrawText automatically falls back to much (4x) faster ExtTextOut
when format is 0 or DT_NOCLIP and string does not contain any new line
characters
CHANGES FOR VERSION 5.34.0 (as compared to 5.33.0)
- Fix: Gfx functions when run in multithreaded mode slowed down over
time due to Micosoft MFC library GDI wrappers not being thread-safe.
Fixed by replacing MFC calls with straight WINAPI calls.
- Multi-threading charts are now ON by default and will be reset to ON
on each restart. This change is temporary but added because some people
forget to turn this on.
- Fix: When Symbol Lock was ON, currently focused chart did not update
its quote cache. Fixed
- Fix: Status("redrawaction") was giving 0 result for timed
refreshes in 5.31-5.33 while it should give 1. Fixed.
- Fix: GDI leak found when using Gfx* functions in Automatic Analysis
that resulted in resource exception after long use. Fixed
- Fix: GDI leak found after Parameter windows "Reset all".
Fixed
- Fix: Black screen in Edit->Image->Copy as bitmap/Metafile/Export/Send
e-mail. Fixed. Now uses separate instance of AFL engine not to interfere
with execution running in the background.
- Fix: AFL engine did not release memory buffer for pre-processed parts
(#include). Fixed
- AmiBroker now has requestedExecutionLevel set to "asInvoker" in
its manifest file and that prevents Vista/Windows 7 folder virtualization.
It also displays a warning message when it does not have write access
to its working directory.
CHANGES FOR VERSION 5.33.0 (as compared to 5.32.1)
- OLE: Analysis object - added IsBusy property that allows OLE programs
to check whenever AA is currently running asynchronous AA operation
- In 5.32.1 only active window was refreshed automatically by streaming
data - others required mouse click. Fixed.
- In 5.32 formulas using Status("actionex") == actionIndicator
caused blank pane when focused because actionex was NOT indicator. Compatibility
shim implemented.
- Fixed bad crash occuring when using AddToComposite with atcFlagsEnableInIndicator
in multi-threaded mode
- Fix: Interval linked charts did not update immediatelly and multi-window
layouts required click to update after loading. Fixed.
- Fix: Crash @501C30 when doing double right click on Data window
- Dangling pointer to view (after its deletion) removed from timedrefresh
map and parameter window. This prevents some crashes
- Compat: In 5.32 when SetOption() was placed AFTER custom backtester
procedure code in user formula - such options did not affect CBT results.
Technically 5.32 was correct one and 5.30 incorrect (such options affected
CBT results), but because probably too many user formulas are poorly
written without taking attention on placement of SetOption() calls and
that created false bug reports, an old compatible behaviour was restored
till the time when error messages about wrong placement of SetOption()
calls are implemented, so users become aware about their coding errors.
- Bug recovery/report dialog now allows the user to type steps required
to reproduce the crash and select how often given problem occurs
- Attempts to run AA asynchronous operation (Backtest/Optimize/Scan/Explore)
via OLE while another one is still running are detected and prevented
(with error message "Automatic Analysis is Busy processing")
- AFL thread termination routine checks for possible same-process COM
call deadlock and pumps COM messages if necessary to complete thread
gracefully
CHANGES FOR VERSION 5.32.1 (as compared to 5.32.0)
- Fix: when "stop parsing at first error" option was turned
on "Reset all" button in parameters window caused params to
disappear. Fixed
- Fix: random crash @7792E25B (small alloc heap corruption) fixed
- Fix: random crash @4BFFF7 (when accessing static variables from multiple
threads at once). Fixed.
- Fix: Eliminated multi-threaded race condition that randomly caused
blank charts.
CHANGES FOR VERSION 5.32.0 (as compared to 5.31.2)
- Parameters work also without _SECTION_BEGIN/_SECTION_END, Parameters
'Reset All' operation improved
- Interpretation does not use extra execution cycle anymore (text evaluation
is done within normal indicator execution)
- Formula Editor: Syntax check, Apply indicator, Insert work faster because
it only uses 100 bars to perform syntax check instead of all bars
- Formula Editor: Code check & profile uses not more than 100K bars
- Fix: Timing display in the chart shows correctly AFL execution and
redraw time when multi-threading is ON and does not flicker
- Fix: Say() function works properly when multithreading is ON
- Fix: Errors occuring in JScript/VBScript parts do not result in crash
anymore
- Data Window now allows to choose which of default data elements (OHLCV,
OI, Aux1/2) to display - use Right click context menu
- Data window display is immediate and does not require extra AFL execution
- Data tooltip readout is immediate - does not use extra execution cycle
anymore (implemented internal cache)
- When there are no parameters for given indicator - empty brackets are
not added anymore for display in tooltip/data window and as a return
value of _DEFAULT_NAME().
CHANGES FOR VERSION 5.31.2 (as compared to 5.31.1)
- Fixed: Problems with Gfx functions in 5.31.1
- Fixed: Parameters window was not refreshed properly after ResetAll
in 5.31.1
- Fixed: Crash when switching layouts in 5.31.1
- Fixed: Crash @004C297D - Foreign returned wrong interval in 5.31.1
- Fixed: Crash @0040F91C / @0040FA2B (all references to ChartInfo removed
from AFL engine) in 5.31.1
- Fixed: Automatic Analysis ignored changes done via SetOption and other
runtime settings-related changes in 5.31.1
- Fixed: Changing chart display interval did not work immediatelly in
5.31.1
CHANGES FOR VERSION 5.31.1 (as compared to 5.31.0)
- fixed crash @0040BACD (using Gfx... functions) when multi-threading
was enabled
- fixed crash @0041E27C (JScript/VBScript embedded code) when multi-threading
was enabled
- fixed crash @7686F05D and @004B83EC (load/create new database) when
multi-threading was enabled
CHANGES FOR VERSION 5.31.0 (as compared to 5.30.4)
- Major change: AFL Engine rewritten completely to allow multi-threaded
execution
CAVEAT: this is very new code and may not be stable
This change will lead to several improvements that will be added
in future versions. First public release of multi-threaded AFL engine
(5.31.0 BETA) features support for multi-threading in commentary and
charts.
By default multi-threaded execution in charts is disabled.
To enable multi-threaded execution of charts, go to Tools->Preferences, "AFL" tab
and check "Multi-threaded charts".
Note that once you turn this option on, each chart PANE will execute in separate
thread, so refreshes of each pane will become completely asynchronous, non-blocking.
This has quite dramatic (positive) effect on perceived snappiness of user
interface.
However, there are also things you need to keep in mind. If your formulas
rely on certain order of execution of panes, they may work incorrectly because
generally all panes will be executing in parallel, and it depends on complexity
of formula which one will finish earlier. Also a formula that is quick to
execute may run several times while the other lenghty one is only finishing
one run.
This has also another side effect that Foreign and AddToComposite functions
when they are used in chart formulas, will operate in asynchronous way (what
you write with AddToComposite may not necesarily appear instantly if you
read it back right after using Foreign()), therefore it is recommended to
use static variables when you need synchronized access between threads.
Since each thread uses approximatelly 1 MB of RAM for thread stack, the memory
consumption when using multi-threading may be slightly larger.
There are some things that do not work properly yet when "multi-threading
charts" are turned on:
- Performance meter / chart timing display do not show AFL execution
times (the values reported are minimal).
- Data tooltips / Data window are still executed in main GUI thread
and this in theory can lead to problems (to improve
stability it is recommended to turn off price data tooltips in Tools->Preferences->Miscellaneous)
- $HYBRID now allows importing OpenInterest, Aux1, Aux2 onto existing
data without need to specify price
- New AFL function: PlaySound( "filename" )
The function plays back specified .WAV file
returns 1 on success, 0 on failure
Example:
PlaySound("c:\\windows\\media\\ding.wav");
- New AFL function: ShellExecute( "filename", "arguments", "workingdir",
showcmd = 1 )
The function opens a file or runs executable.
It is equivalent of Windows API ShellExecute, with one difference, it
always uses "open" verb.
This allows running executables, scripts, opening document files using
their associated editors, etc.
If the function succeeds, it returns a value greater than 32. If the function
fails, it returns an error value that indicates the cause of the failure.
For possible error codes, consult Microsoft documentation:
http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx
Example:
ShellExecute("notepad.exe", "", "" );
- Multiple file open dialogs now use 1MB buffer (instead of 256K)
- OptimizerSetOption and OptimizerSetEngine are now no-ops for anything
but backtest/optimization action
This prevents random problems when one used OptimizerSetOption or OptimizerSetEngine
within indicator code.
- Value labels are drawn with a little offset from the Y axis. First
Plot() label is drawn with an arrow pointing out exactly price level
- When main application window is in modal state (displaying File open
dialog for example), RequestTimedRefresh is held
This fixes problem with file dialog changing current working directory while
browsing for directory (FC #1670)
- When multiple MDI windows are open and one is maximized, the windows
in back that are completely obscured by others and minimized windows
are not redrawn during normal RT refresh
It is worth noting that if you use RequestTimedRefresh the chart will continue
to be refreshed periodically even if obscured by other windows.
If you use RequestTimedRefresh with "onlyvisible" parameter set
to False, the chart will be also refreshed if it is minimized
CHANGES FOR VERSION 5.30.3 (as compared to 5.30.1)
- Added GICS property to Stock OLE object
- Tools->Prefs->Data "In
memory cache size" upper limit was
sometimes calculated incorrectly on 64 bit Windows. Now upper limit is equal
to physical RAM size even if > 4GB
- RequestTimedRefresh now supports sub-second
(down to 0.1 sec) resolution, when enabled via registry setting (HKCU/Software/Broker/Settings/EnableHiresRTR,
DWORD value = 1 )
CHANGES FOR VERSION 5.30.1 (as compared to 5.30.0)
-
Show arrows for actual trades does not show arrows immediately. Fixed
-
IB
plugin: set Aux1/Aux2/OpenInt to zero
-
Added Gradient Price chart and
Spread Chart
-
Default redraw time (when no
charts are displayed) is set to arbitrary 0.1 sec (instead of 1 sec
used previously)
-
Other minor fixes
-
Performance warning tooltip is popped up automatically
only once per run unless you exceed 1000% load
-
Fixed access violation when
refreshing "Charts" window under extreme
load
-
PluginNotification structure is now larger - has pCurrentSINew
that is a pointer to new StockInfo structure, while pCurrentSI
is reverted
to StockInfoFormat4
to maintain compatibility with plugins that were no rewritten
using new API
CHANGES FOR VERSION 5.30.0 (as compared to 5.29.6)
- When non-existing symbol is typed into "ticker" box, AmiBroker
will first check if symbol with given Alias does not exist before proposing
to add new symbol
- AmiBroker now ensures that during writing of data and config files no
other process is reading or writing to them in order to prevent possible
data corruption when running multiple simultaneous instances accesing same
files. In case some other process is working with given file AB will retry
to access given file within next 0.25 sec and repeat four times before
failing
- Simple trading from the chart implemented (see "Place a buy/sell
on chart" buttons in the toolbar and Insert menu) - requires installation
of auto-trading interface
- Possible small database reading speed enhancements via use of FILE_FLAG_SEQUENTIAL_SCAN
- Parameters file (broker.params) was kept open all the time instead being
closed right after reading/writing and that could cause problems. Fixed
- New status bar indicator showing performance measure: percentage load
factor and more info in the tooltip
- Status bar information auto pop time set to 10 seconds to allow easier
reading
- Filling symbol combo box is speeded up
- " Wait for plugin" shows up only when plugin takes more than
0.5 sec to initialize/release and uses simpler animation and does not use
topmost style therefore does not cover IQFeed Connect dialog
CHANGES FOR VERSION 5.29.6 (as compared to 5.29.5)
- Race condition between UI threads
eliminated (resulting in "wait for plugin" window not being
closed sometimes)
CHANGES FOR VERSION 5.29.5 (as compared to 5.29.2)
- Sometimes when copying AA list to clipboard three dot (...) sequence
appeared every 2048 characters of copied text and some characters could
be missing. Fixed.
- GUI: chart context window items re-arranged - 'Close' menu item moved
to the bottom and 'Properties' menu item moved to top (after Parameters)
- styleClipMinMax constant is now highlighted in AFL editor
- When different symbol were selected in active chart and in the Symbols
pane (because of filtering) operations like adding/removing from watchlist
got confused. Now AmiBroker asks the user what to do.
- NumToStr/WriteVal are polymorphic now (means better performance for scalar
input arguments)
- Aux1/Aux2 reserved variables are highligted now in AFL editor
- PREV/NEXT sibling keyboard shortcut functionality restored
- Added "wait for plugin" window when switching external plugin-driven
databases because sometimes plugin may take long time to shutdown/initialize
- New symbol bar: inability to select first symbol after new search when
previously displayed was one symbol, current symbol is re-selected automatically
when search string changes. In-place symbol editing disabled.
- Under some circumstances when broker.master was deleted/corrupted/inaccessible
AmiBroker could hang loading database. Fixed.
- Cum() function does NOT use all bars any more by default.
In the past versions Cum() functions effectively turned OFF QuickAFL feature
by requesting all bars to be processed.
Since Cum() function was popular it caused that many legacy formulas that
used it were not benefiting from QuickAFL.
To enable QuickAFL with such formulas now Cum() function does NOT affect
required bars count (previously it forced all bars).
This change may lead to different results when comparing with old versions.
If you are interested in getting old behaviour and use all bars just add:
SetBarsRequired( sbrAll )
anywhere in your formula.
- BarIndex() now returns values always starting from zero (even if QuickAFL
is turned on).
This change is required because Cum() now does not require all bars and formulas
mixing Cum(1) and BarIndex would work improperly otherwise.
- Due to operating system changes in Vista and Windows 7, structured exceptions
like address violations were not handled properly by exception handler
and caused immediate program exit. Fixed.
- Status() function new fields
Status can now retrieve "quickaflfirstdatabar" and "quickafllastdatabar".
This feature is for internal use only.
These are bar indexes of actual underlying compressed quotation array that
make up AFL's array[ 0 ] and array[ BarCount - 1]
- Crash report now properly lists Windows Vista (OS 6.0) and Windows 7
(OS 6.1)
- Crash recovery window now sends bug reports directly over http (WWW)
protocol instead of relying on clients' MAPI email program as on Windows
7 e-mail program is no longer installed by default.
Improved crash recovery should also be able to catch exceptions in more (all?)
cases.
New direct send in future will offer immediate resolution to problem once
given exception is identified and entered into database.
Privacy:
Direct bug reporting allows to send bug report to amibroker.com on user request
(click on "Send report" button).
It works over regular http (www) port 80, and sends only the information
displayed explicitely on screen
(i.e. AmiBroker version, OS version, crash information, database info (number
of symbols) and machine info (memory figures)).
No other information is sent. The user has option to send anonymously (without
providing e-mail address). Although e-mail
address is optional, it is recommended to provide one if user wants to receive
e-mail response to the error report.
CHANGES FOR VERSION 5.29.2 (as compared to 5.29.0)
- Some issues with datestamps (including wrong montly compression) were
introduced by change to EOD markers done 5.29.0. Reverted/fixed.
- New symbol window is properly filled with categories even if not initally
visible
- New symbol window category/list panes can be resized now
- GetPlaybackDateTime did not return zero when playback was not active
in 5.27-5.29. Fixed.
- When plugins used InfoSite.AddStock (old one) more than once per symbol
certain category assignments could be improperly set in 5.27..5.29.0. Fixed.
- Added fopen()/fclose() tracking and error message (Error 51) when user
forgot to close files. On such error files are automatically closed by
AB
CHANGES FOR VERSION 5.29.0 (as compared to 5.28.1)
- ASCII importer: added GICS support
Now you can import GICS symbol-code assignments using ASCII importer.
$FORMAT command now supports GICS code
and there is $GICS command for single-symbol files.
For example if your file looks as follows:
(format is symbol, full name, gics sub industry code)
AAN,AARON'S INC,25504060
Then to import it usign AmiBroker's import wizard use the following
$FORMAT Ticker,FullName,GICS
$OVERWRITE 1$
$SEPARATOR ,
$CONT 1
$GROUP 255
$AUTOADD 1
$NOQUOTES 1
- Fixed loading of old AA settings so Chart dimensions are initialized
with (500,300) instead of zero
- Trade.EntryDateTime, Trade.ExitDateTime were reporting values incompatible
with DateTimeToStr in 5.27/5.28. Fixed
- Fixed assertion in Import Wizard (refering to non-existing combo box)
- A blank chart timing is now set to arbitrary value of 10ms
- All numeric edit fields in AmiBroker now display numbers in regular (non-scientific)
notation upto 10^15 and max available precision (7 significant digits in
case of single-precision IEEE)
- ASCII importer: removed 2^31 cap on volume field and removed some (int)
conversions that were left from old days
- Implemented protection against re-entrant WM_PAINT messages sent by Vista
and Win7 during COM calls
- New symbol list is repainted immediately after some changes now.
- Quote Editor in 5.28 editing EOD records caused creation of duplicates.
Fixed.
- When converting from old database format, Aux1/2 fields are initialized
with zero instead of some random values.
- When focus was inside new symbol window, accelerator keys did not work
in 5.28. Fixed
CHANGES FOR VERSION 5.28.1 (as compared to 5.28.0)
- Re-based DLLs included to increase contiguous virtual memory space
- " Index" category was showing nothing in a new symbol window.
Fixed.
- Quote Editor - multiple quote deletion was not possible in 5.27/5.28.0,
only first selected item was deleted. Fixed
- Right-click beyond last symbol in the symbol list in a new symbol window
caused crash in 5.28. Fixed.
- Changed the way in DateTime() values are coded to support legacy formulas
that are not using currently recommended comparision method via DateTimeDiff()
- OLE: ZoomToRange() method works for floating windows
- ADK: Added GetDateTimeArray to site interface
GetDateTimeArray returns a pointer to internal date time array. Array of
DATE_TIME_INT elements.
The SiteInterface structure now looks as follows (struct size = 40 on
32-bit platforms, 76 on 64-bit platforms)
struct SiteInterface
{
int nStructSize;
int (*GetArraySize) (void);
float * (*GetStockArray)( int nType );
AmiVar (*GetVariable) ( const char *pszName );
void (*SetVariable) ( const char *pszName, AmiVar newValue );
AmiVar (*CallFunction) ( const char *pszName, int nNumArgs, AmiVar *ArgsTable
);
AmiVar (*AllocArrayResult) (void);
void * (*Alloc) (size_t nSize);
void (*Free) (void *pMemory);
DATE_TIME_INT* (*GetDateTimeArray) (void);
};
- In 5.27/5.28 DateTimeConvert function returned incorrect datenum. Fixed
- New symbol list supports selection via typing few first letters (like
symbol combo)
- When saved Automatic Analysis settings contained some garbage data in
MaxLongPos/MaxShortPos parameters the backtester could exit with "Not
enough memory" error. Fixed
CHANGES FOR VERSION 5.28.0 (as compared to 5.27.3)
- GICS is now available as Filter category (in Automatic Analysis, Quick
Review and DB Purify)
- Completely redesigned Symbol window (View->Symbol)
New symbol window now features:
a) separate category/filter view
b) full text search with category filtering
full text search works in two modes:
- simple substring search (enter the text into "<search>" edit
and
it will find all symbols that contain search phrase in either symbol or full
name (anywhere, not just at the beginning)
- wildcard search (if you enter the search phrase with either * or ? wildcards
AmiBroker will perform wildcard search. For example ??? will return only
3-character symbols, and *-A0-FX - will return all forex symbols on eSignal
database. Please note that search feature operates on symbols PRESENT in
the AmiBroker database, it will not find symbols that do not exist in the
AmiBroker database yet but are generally accessible after importing/adding
them.
c) sorting by symbol or by full name
d) GICS support
e) hierachical filtering (if you select sector from category view it will
show symbols
belonging to all industries within given symbol)
f) multiple selection of symbols (hold down CTRL key while selecting, or
SHIFT to select groups)
allowing watchlist/favorite operation on multiple symbols at once
g) super-fast operation (all filtering/search/display takes less than 0.01
sec with 10000 symbols)
- Quote Editor Aux1 field was overwritten with value of Aux2 field. Fixed
- Quote Editor column layout/width is saved between sessions (again)
- N-second custom intervals can now be defined in Tools->Preferences->Intraday
- GICS categorisation
AmiBroker now reads GICS.txt file from its installation folder.
It contains GICS categories listed one by one in order of GICS code in the
following format
GICS;Name;Description<CRLF>
GICS is numeric code from 2 digits upto 8 digits
Name is GICS category name
Description is GICS category description
These fields must be separated by semicolon
< CRLF> means carriage return/line feed characters (means "new line" -
just press ENTER/RETURN key if you are editing with text editor)
There must be only one category per line in GICS.txt file
The default GICS.txt file is supplied already.
- Added support for GICS to AFL
There is a new constant : categoryGICS that works
in conjunction with category functions like
CategoryGetSymbols
CategoryGetName
CategorySetName
CategoryAddSymbol
CategoryRemoveSymbol
CategoryFind
Note that these functions take index parameter, but the meaning of index
parameter is different for GICS category - the index for categoryGICS is
actually GICS code. Such as 10 for energy sector or 351010 for "Health
Care Equipment & supplies" industry.
The codes are fixed even if new classifications are added at some point
in the future. This means that you won't need to change AFL codes even
if new classifications are added. But it is important to understand that
these codes work in hierarchical way. So
GetCategorySymbols( categoryGICS, 10 ) will return all symbols belonging
to energy sector, including those in 10101010 - Oil & Gas Drilling
sector as well as 10102050 - Coal & Consumable Fuels; for example.
See
http://en.wikipedia.org/wiki/Global_Industry_Classification_Standard
for more details on GICS system
NOTE: current databases DO NOT have GICS codes assigned to symbols.
As far as I know PremiumData http://www.premiumdata.net/ is
planning to release AmiBroker-compatible database with GICS support.
CHANGES FOR VERSION 5.27.3 (as compared to 5.27.2)
- HighestSince/LowestSince ignored very first bar [0] in the array. Fixed
- Stock object date fields can be set to "empty" by assigning
zero.
- Aux1,Aux2 added to Import Wizard comboboxes
- View->Data window is now present in Customization dialog
- Weekly chart was not displayed if settings were to show first date of
week and first date was before 1970. Fixed.
- Added DateTimeDiff( arg1, arg2 ) AFL function that returns difference
in seconds between two date time arguments
It is important to understand that DateTime is not a simple number but rather
bitset and two datetime values can only
be reliably compared for equlity or inequality using == or != operators.
Any other comparisions (less than/greater then)
using normal operators > < can lead to wrong results, therefore to
compare two datetime numbers you should use
DateTimeDiff( arg1, arg2 ) which will return positive values if arg1 > arg2
and negative values if arg1 < arg2.
- Symbol->Quote Editor now uses fully virtual mode - it does not require
extra memory and shows up immediatelly and works fast regardles of number
of quotes per symbol and is auto-refreshed every 5 sec
- eSignal plugin does not fill AuxData with random data (they are initialized
with zero now)
- Fixed DateTimeToStr and StrToDateTime
- Fixed crash when saving symbols that had name() longer than 32 characters
CHANGES FOR VERSION 5.27.2 (as compared to 5.27.1)
- Fixed 16-character name problem in Metastock plugin
- Fixed monthly compression problem present in 5.27.1
- Fixed problem when OLE automation was used to modify symbol properties
on OLD format databases without saving them first in new format
- Aux1 and Aux2 are new built-in AFL price arrays
- Fixed Text tool bug (Vertical text instead of horizontal in 5.27.1)
- 'Avg' field compression with TimeFrameSet fixed.
- Added AUX1 and AUX2 to ASCII importer field definitions
- Auxilliary data fields writable by AddToComposite field "1" (aux1),
and field "2" (aux2)
- Quotations object added new method: long RetrieveEx(long Count, VARIANT*
Date, VARIANT* Open, VARIANT* High, VARIANT* Low, VARIANT* Close, VARIANT*
Volume, VARIANT* OpenInt, VARIANT* Aux1, VARIANT* Aux2);
- Aux1/Aux2 available as properties of Quotation object (OLE interface)
CHANGES FOR VERSION 5.27.1 (as compared to 5.27.0)
- Fixed incorrect year when importing intraday data using ASCII importer
- Fixed intraday filtering issue that occurred for auto-converted databases
- Market ID was not properly set in 5.27.0 alpha
CHANGES FOR VERSION 5.27.0 (as compared to 5.26.5)
CHANGES FOR VERSION 5.26.5 (as compared to 5.26.0)
- Symbol lock on per-chart window basis (available via padlock button next
to chart sheet tabs and chart context menu)
- User interface dialogs now use MS Shell Dlg 2 (Tahoma) font on Windows
2000, XP, Vista and Windows 7
- several minor fixes for 64 bit version
CHANGES FOR VERSION 5.26.0 (as compared to 5.25.0)
- Implemented user-definable report charts
Now it is possible for the user to create any number of charts that will
be automatically generated and included in the backtest report.
To add user-defined chart to the report, simply save your chart formula
under "Report Charts" folder.
That's all.
Any formula present in the "Report Charts" folder will be executed
after completion of the backtest using ~~~EQUITY as selected symbol.
The beta ships with 3 sample charts:
a) portfolio equity
b) underwater equity (drawdown)
c) profit table
The charts are displayed in alphabetical order (using file name as a chart
name).
- Built-in price arrays (OHLC, V, OI, Avg) are protected against assigning
the value of wrong type (non-array)
CHANGES FOR VERSION 5.25.0 (as compared to 5.24.0)
- StaticVarGet() now has additional parameter - align
StaticVarGet("varname", align = True );
second parameter - 'align' - booleand True/False, default: True
- decides whenever AmiBroker performs timestamp synchronization/alignment
or not.
The default value is True and it means that values stored in static variables
are retrieved and aligned to currently selected symbol data/timestamp
on each bar basis so data for corresponding date/time stamps match.
This is recommended setting and this is the way it worked in previous versions.
When align is switched to False - it means that AmiBroker does not perform
any checks nor any alignment and will fill the array with consecutive values
stored in static array regardless of their timestamps.
If there are less bars in the static array than in the current arrays,
the last
value of static array will be propagated till BarCount - 1.
It is advised NOT to use align=False, unless you know exactly what you
are doing
and you are aware that date/time stamps have no meaning in particular variable
or in case when date/time stamps are are aligned using your own method.
Note that speed difference between align 'on' and 'off' is usually negligible
because alignment algorithm is very fast and has similar complexity as
plain
memory copy.
- AFL: HighestVisibleValue( array ), LowestVisibleValue( array )
Two new functions that calculate single value (not array) representing
highest and lowest values of given array within VISIBLE range (on chart).
Should be applied only in indicators as only indicators have concept of "visible" bars.
The function will return Null value if no visible bars are present.
They are equivalent to the following coding:
function HighestVisibleValueEquivalent(
array )
{
bv = Status("barvisible");
Hh = -1e8;
for(
i = 0; i < BarCount;
i++ )
{
if(
bv[ i ] AND array[
i ] > Hh ) Hh = array[ i ];
}
return hh;
}
function LowestVisibleValueEquivalent(
array )
{
bv = Status("barvisible");
ll = 1e8;
for(
i = 0; i < BarCount;
i++ )
{
if(
bv[ i ] AND array[
i ] < ll ) ll = array[ i ];
}
return ll;
}
As you can see the AFL equivalent is simple, but native functions
are faster.
- When user picks a drawing tool, AmiBroker offers switching to default
layer (0) if current layer is not visible
- StaticVarRemove("varname") now supports wildcards in the variable
name
"varname" parameter can be either exact variable name or wildcard match
string.
The '*' matches any number of characters, including zero characters. The
'?' matches exactly
one character.
Example 1:
StaticVarRemove("MyVariables*");
// this will remove all static variables beginning with MyVariables prefix.
Example 2:
StaticVarSet("DifferentName", 1 );
printf( "Total
static variables = %g\n\n", StaticVarCount() );
for( i = 1;
i <= 5; i++
)
for(
j = 1; j <= 5;
j++ )
{
VarName = "Test_X=" +
i + "_Y=" + j;
printf("Setting
variable " + VarName + "\n" );
StaticVarSet(
Varname, 1 );
}
printf( "Total
static variables = %g\n\n", StaticVarCount() );
printf( "Now
wildcard remove *X=1*\n" );
StaticVarRemove( "*X=1*" );
printf( "Total
static variables = %g\n\n", StaticVarCount()
);
printf( "Now
wildcard remove Test*\n" );
StaticVarRemove( "Test*" );
printf( "Total
static variables = %g\n\n", StaticVarCount()
);
printf("Removing
'differenname' variable\n");
StaticVarRemove("DifferentName" );
printf( "Total
static variables = %g\n\n", StaticVarCount()
);
- StaticVarCount function added - returns the total number of static variables
in memory
- Study() function now allows to specify which Y scale to use (Study( studyid,
chartid, scale = -1))
Study( studyid, chartid = 1, scale = -1 )
scale parameter specifies which scale should be used
scale = -1 : automatic (default value) - either linear or logarithmic depending
on actual chart setting, chart is specified by chartID
scale = 0 : linear scale
scale = 1 : logarithmic scale
- data and optimizer plugins are loaded later (saves upto 15MB of RAM)
- Fixed GetChartBkColor function
- " show trading arrows" feature optimized for significantly
lower CPU usage
- hi-density (>2x more data bars than pixels) variable color styleHistogram
charts are plotted with correct colors
- less reallocations in real-time mode, 10% performance improvement and
less fragmentation
- arrays for storing dynamic stop levels are only allocated/filled when
needed (saves about 10% of AFL setup time)
- Added miny/maxy parameters to SetChartBkGradient (allows gradient area
charts in combination with cloud style)
Example Gradient Area chart:
function PlotGradientArea(
array, caption, ColorTop, ColorBottom )
{
bkclr = GetChartBkColor();
HH = HighestVisibleValue( array );
if( NOT IsNull(
hh ) ) SetChartBkGradientFill(
ColorTop, ColorBottom, bkclr, Null,
HH );
Plot( array,
Caption, ColorBlend(
ColorBottom, colorBlack )
);
PlotOHLC( HH,
HH, array, HH, "",
bkclr, styleNoLabel | styleNoTitle | styleCloud, Null, Null, 0,
-10 );
}
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}}
- {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )
) ));
PlotGradientArea( C, "Close", ParamColor("Top", colorLightOrange), ParamColor("Bottom", colorPaleGreen )
);
_SECTION_END();
CHANGES FOR VERSION 5.24.0 (as compared to 5.23.0)
- typeof() incorrectly returned compile-time type instead of run-time type.
Fixed.
- Static array variables implemented
StaticVarSet( name, value ) and
StaticVarGet( name )
AFL functions now accept arrays in addition to numbers (scalars).
Static arrays can be even 100 faster than AddToComposite/Foreign, however
these two are not strictly equivalent.
There are following limitations / differences of static arrays as compared
to Foreign/AddToComposite:
a) static array variables store only as many bars as there are currently
in use by given chart
(so they do not affect QuickAFL in any way). This is different that AddToComposite
that forces usage and store of all bars.
b) static array variables work best if you read them using the same interval
as they were written to. I.e when you create static array variables using
5-minute chart, for best results read them in some other 5-minute chart.
Reading in different intervals is possible, but subject to limitations
of timestamping (see below)
c) when you read static variable in a different interval that it was originally
stored,
static variables perform padding/synchronization and time compression/decompression
automatically in a similar way as foreign,
however Foreign compresses data always from base-time interval, while static
variables operate on previously stored interval,
hence result may differ. For example, if previously stored data was in
daily interval, and you read such static variable in intraday
chart, you will see essentially flat lines for each day, representing static
data from daily interval.
d) static array variables do not work well for non-time based intervals
(tick/n-volume/n-tick) because timestamps in those intervals
may not be unique (i.e. several bars may have same time stamp), so time
synchronization is not reliable.
e) static array variables are little slower than normal AFL variables,
so for best performance, use read-once, write-once paradigm, using
temporary normal variable for any processing during formula execution,
like this:
// start of the formula:
temp = StaticVarGet("mystaticarray" );
// now perform all necessary calculations using temp variable
temp = Nz(temp) + C/2;
...
// at the end of the formula store to static
StaticVarSet("mystaticarray", temp );
CHANGES FOR VERSION 5.23.0 (as compared to 5.22.0)
- Font used by progress window, string input, tip of the day, search file
is now "MS Shell Dlg" (the same as elsewhere in AB) that means
that is CoolType friendly (TTF)
- AFL: SetOption("ExtraColumnsLocation", col) - this new option
allows the user to change the location of custom columns added during backtest/optimization
"extra" columns mean:
a) any custom metrics added using custom backtester
b) any optimization parameters defined using Optimize() function
If both custom metrics and optimization parameters are present then
custom metrics appear first then optimization parameters
This function is provided to allow the user to change the default "at
the end" location of custom columns/optimization parameters.
For example
SetOption("ExtraColumnsLocation", 1 );
will cause that custom metrics and opt params will be subsequently added
starting from column 1 (as opposed to last column default)
Note that this setting changes "visual" order of columns, not
really in-memory order or export order, so
exported data files or copy/paste format do not change.
- Implemented hiding columns in all list views (right click over list view
HEADER to bring "Setup Columns" dialog)
- Storing column state (widths/ordering/visibility) in automatic analysis
implemented
The widths, ordering and visibility of all built-in columns in automatic-analysis
is stored between runs.
This works for each operation mode (i.e. scan/backtest/optimization) separately,
so column setup
for scan does not affect stored column order for backtest, as well as state
of columns for optimization does not
affect backtest, etc.
Note also that state of exploration mode is not stored, due to its complete
user-configurability from AFL level.
- Data Window implemented (available from View->Data Window menu)
(if you can not see this menu, you would need to reset the menu using Tools->Customize,
select "Menu Bar" and then press "Reset" button).
If you prefer to use Data Window over data tooltips, you can turn off
data tooltips using Tools->Preferences, "Miscellaneous" tab,
UNCHECK "Price data tooltips" box.
- Home key was working incorrectly when more than one pane was used in
the chart. Fixed
- Implemented simple performance monitor Tools->Performance Monitor
Showing some memory and usage statistics:
- number of symbols in the database
- number of symbols cached in RAM
- quotation data memory usage
- current symbol memory usage
- total chart refresh time
- real-time data stream update frequency
The contents of the window is updated automatically every 3 seconds
This tool is intended to be used now for two purposes:
a) tweaking cache settings for best RAM usage (for example optimizations
will run faster if all quotation data can be kept in RAM)
b) monitoring real-time performance
More uses will probably come in the future.
- Time&Sales window now shows some "recent statistics" regarding
trading
Time&Sales window now shows some "recent statistics" regarding
trading namely:
- number of trades and average # of trades per second
- number of trades and shares traded at ask or above
- number of trades and shares traded at bid or below
- ask minus bid difference expressed in number of trades and shares
- ask minus bid difference expressed as percentage ratio to total trades/total
volume traded
A little background:
Ask minus bid: the positive numbers represent more transactions occuring
on ASK side than on BID side.
This in theory may mean more buying than selling, but in practice things
are largely dependent
on security traded. Esp. dark liquidity pools do not show in order books
and
may report trades to the tape several seconds later thus invalidating relationship
between
bid/ask and actual trade prices.
IMPORTANT:
These are temporary, short-term stats - they cover ONLY trades displayed
in the T&S window since opening of the window OR
resetting stats.
You can reset statistics using right click menu : "Reset Stats"
CHANGES FOR VERSION 5.22.0 (as compared to 5.21.0)
- added ability to extend blank chart area by pressing END key multiple
times (each time 10 blank bars are added) and restoring preferences value
by subsequent pressing of HOME key.
- added option to always require variable declarations (using local/global)
on formula-by-formula basis:
SetOption("RequireDeclarations", True );
global test1;
test1 = 5; // OK variable declared
test2 = 3; // error: assignment without declaration
- added typeof() operator
The typeof operator is used in the following way:
typeof (operand)
The typeof operator returns a string indicating the type of the *unevaluated*
operand. operand is the string, variable, function identifier, or object
for which the type is to be returned.
When supplying identifier, it should be provided alone, without arithmetic
operators, without extra arguments and without braces.
If you want to check the type of value returned by the function, you must
first assign the return value to a variable and then use
typeof( variable ).
Possible return values are:
" undefined" - identifier is not defined
" number" - operand represents a number (scalar)
" array" - operand represents an array
" string" - operand represents a string
" function" - operand is a built-in function identifier
" user function" - operand is a user-defined function
" object" - operand represents COM object
" member" - operand represents member function or property of COM object
" handle" - operand represents Windows handle
" unknown" - type of operand is unknown (should not happen)typeof operator
allows among other things to detect undefined variables in the following way
if( typeof( somevar ) == "undefined" )
{
/// when somevar is undefined the code here will execute
}
The following sample COMMENTARY code shows the output of
typeof in some common situations
x = MACD();
y = LastValue( x );
function testfun() { return 1; };
printf( typeof( test ) + "\n" ); // the undefined variable
printf( typeof( 1 ) + "\n"); // literal number
printf( typeof( "checking" ) + "\n"); // literal string
printf( typeof( x ) + "\n"); // array variable
printf( typeof( y ) + "\n"); // scalar variable
printf( typeof( MACD ) + "\n"); // function identifier
printf( typeof( testfun ) + "\n" ); // user function identifier
- GetSignalQty member function of Backtester object returned zero. Fixed
now
- In the Plot() function Xshift parameter was used as z-order in 5.21 beta.
Fixed now.
- Plot, PlotOHLC and PlotForeign() are no longer limited to -5..+5 zorder
range. You can use any zorder value now.
Note that if you use zorder outside default range -5..+5, you may see performance
degradation for big positive and big negative z-order values.
Approximate performance penalty is 10 milliseconds for 100 z-orders (or 1ms
for 10 z-orders)
- SetChartOptions now adds ability to programmatically extend blank space
on chart-by-chart basis
SetChartOptions( Mode = 0, Flags = 0, gridFlags = chartGridMiddle, ymin =
0, ymax = 0, blankbars = 0 )
New, 6th parameter "blankbars" defines the minimum number of blank
bars for given chart. The default value of zero means no change
(use preferences setting).
if specified value is less than value set in preferences, it is ignored,
so you can not decrease the blank bars below value set in preferences.
if many panes within same chart use this function, then the largest specified
blankbars will be used
Note that you can still extend blank space further using END key.
Special feature - if "blankbars" is negative then extra blank bars
added are equal to absolute value of blankbars parameter plus chart gets
scrolled to rightmost position.
Caveat: forcing custom blankbars via SetChartOptions effectivelly disables
HOME key scroll to begin operation.
- the feature to extend blank area via mouse wheel and > button is removed,
due to complaints received
CHANGES FOR VERSION 5.21.0 (as compared to 5.20.0)
- Added optional data padding for non-trading days (switchable from View->Pad
non-trading days menu) - for daily and higher intervals only (FC#1136,FC#1174)
- All drawing tools now can define Z-order (from -5 to +5).
Z-order.
Imagine that you could see the drawing objects arranged on the chart page
like puzzle pieces on a table. Some objects may appear to be placed one on
top of another, and others may be overlapping.
This third dimension of chart page is known as "Z order." If the
X axis relates to width and the Y axis to height, then the Z order relates
to depth. Although Z order cannot be seen directly, just as can you position
objects along X and Y (horizontal and vertical) axes, you can also position
them in the Z order.
Every object on the page has its Z order, positioned in back to front order,
so that objects at the front will take precedence over objects behind.
Z order gives you the ability to superimpose objects one on top of another.
You can change Z-order parameter using Properties dialog
as well as using Format->Z-Order->Bring Forward / Send Backward menus
(and default keystrokes Shift+Page Up, Shift+Page Down)
Negative values mean BEHIND axis/grid, positive mean above grid.
- Blank area past last available quote can be now enlarged on the fly by
simply using > arrow in the scroll bar or using mouse wheel (just roll
the wheel past the last bar) (FC #430,#1516, #1500, #1239, #982, #808,
#561 )
- CBT: Backtester.GetSignalQty( bar, type ) method implemented (FC#1671)
Backtester object
GetSignalQty( bar, type ) method
- retrieves the number of signals occuring on given bar
type = 0 - both entry and exit signals
type = 1 - only entry signals
type = 2 - only exit signals
Note that AmiBroker to conserve memory keeps track only of 2 * MaxNumberOfPositions
entry signals on any single bar,
however it keeps track of ALL exit signals (because they consume much less
space and at the time of signal collection
it is not known which positions are already open, so all exits must be tracked
to prevent missing an exit)
- E-mail alerts can now be sent through different port than 25 (see Tools->Preferences->Alerts)
(FC#1641)
- Early warning of indicator space running out. At application exit the
message is displayed when less than 10% indicator space is left, plus an
offer to run Indicator Maintenance (FC#1667)
- new AFL functions ColorBlend
ColorBlend( colorFrom, colorTo, factor = 0.5 )
- the function blends (mixes) colorFrom with colorTo with 'factor' proportion
using the following algorithm
RGB = ( 1 - factor ) * RGB(colorFrom) + factor * RGB(colorTo );
So factor = 0 means use colorFrom only, factor = 1 means use colorTo only.
All in-between values
mean create mix of colors. The lower the factor value means more colorFrom.
This function makes it easy to lighten or darken colors like this:
function ColorLighten( color )
{
return ColorBlend( color, colorWhite, 0.5 );
}
function ColorDarken( color )
{
return ColorBlend( color, colorBlack, 0.5 );
}
- Plot, PlotForeign and PlotOHLC now have new parameter zorder which defines
the Z-axis position of given plot. (FC#257)
zorder can be set from -5 to 5.
The default is zero.
Zorder = 0 means also where the "grid" is located.
So if you want to plot BEHIND the grid you need to specify negative zorder
parameter.
Smaller values mean draw first (i.e. BEHIND others), higher values mean draw
later (ON TOP of others).
Plots are drawn in the following order:
- zorder parameter takes precedence over the order of calling Plot()
functions, so if z-order is set, it determines plotting order.
See http://www.amibroker.com/gifs/zorder.gif
- If multiple plots use the same z-order parameter they are plotted in
reverse call order (ones that appear last in the code are plotted first).
This rule can be changed by already existing switch graphzorder = 1 which,
when specified, reverses this behaviour (so plots are drawn in call order).
Please note the above applies to each zorder "layer" separately
(so within same zorder "layer" reverse call rule applies)
This may sound complicated but is required for backward compatibility.
Example:
Bollinger bands with "cloud" fill behind price (zorder = -1)
P = ParamField("Price
field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style")
| styleNoRescale;;
Plot( bbt
= BBandTop(
P, Periods, Width ), "BBTop" + _PARAM_VALUES(),
Color, Style );
Plot( bbb
= BBandBot(
P, Periods, Width ), "BBBot" + _PARAM_VALUES(),
Color, Style );
PlotOHLC(
bbt, bbt, bbb, bbb, "", ColorBlend(
Color, colorWhite, 0.9 ), styleCloud, Null, Null, Null,
-1 );
- Rectangle and Ellipse drawing tool now are by default SOLID, with default
fill color being a blend between background and selected drawing color,
they are use ZOrder = -1 (behind regular plots) by default
- Support for SSL (secure connection) e-mail alerts added, so now you can
use your GMail accounts. (FC#83)
Steps:
1. Download and install AmiBroker 5.21 or higher
2. Download and run SSL add-on from http://www.amibroker.com/bin/SSLAddOn.exe
3. Configure (Tools->Preferences->Alerts) with SSL enabled as shown
in this picture:
http://www.amibroker.com/gifs/gmailalert.gif
- X-Y co-ordinate labels on axes implemented. Can be controlled using View->X-Y
labels menu. (FC#1621, FC#732)
CHANGES FOR VERSION 5.20.0 (as compared to 5.19.0)
- AFL: new function StrCount( "string", "substring" )
Function returns integer which is number of times substring was found in
string. It is case sensitive.
The function can be used for example to count the number of commas in
comma-separated list
tickers = "AAPL,MSFT,INTC";
numtickers = 1 + StrCount( tickers, "," );
- AFL: StrExtract( "string", item ) now accepts negative item
values allowing to address items counting from the END of the list
tickers = "AAPL,MSFT,INTC";
"The last item is " + StrExtract( tickers, -1 );
printf("listing from the end of the list:\n");
for( item = -1; ( sym = StrExtract( tickers, item ) ) != "";
item-- )
{
printf( sym + "\n" );
}
-
minor fixes
CHANGES FOR VERSION 5.19.0 (as compared to 5.18.0)
- Internal log window deletes all items if "!CLEAR!" text is
outputted (FC 1552)
Example:
_TRACE("!CLEAR!"); // this clears the internal log window.
_TRACE("First line after clear");
- SetOption("RefreshWhenCompleted", True) added. This performs
View->Refresh All once AFTER AA operation is completed
Under normal circumstances it is not needed to use that because AmiBroker
refreshes ticker tree if necessary,
for example if use AddToComposite. It may be useful if you however use OLE
automation inside AA and you don't want to trigger too many refreshes using
RefreshAll().
This only works in Automatic Analysis, when used in indicator code it has
no effect.
- Sometimes AddSummaryRows was not working when AB.RefreshAll() was used
in the formula. Fixed now. (FC1550)
- Date time calendar disappeared when streaming update arrived. Fixed now.
(FC 1572)
- Equity ticker symbols (~~~EQUITY, BESTEQUITY, ISEQUITY, OSEQUITY) marked
with special flag so they are not used (skipped) in backtest
- Fib Timezones tool now displays lines 144 and 233 too. (FC20)
- math functions (sin,cos,log, ...) added to profiler reporting (array
versions only)
- RT quote and log window tab sheet drag-drop marker is visible again
- Y-axis scale labels do not overlap even if chart is very compressed
CHANGES FOR VERSION 5.18.0 (as compared to 5.17.1)
- AFL: CategorySetName() function
CategorySetName( name, category, number )
Function sets the name of category (group,market, watch list, industry)
Arguments;
name - a new name for the category (in case of watch lists it has to be
unique)
category - type of category, one of the following: categoryMarket, categoryGroup,
categorySector, categoryIndustry, categoryWatchlist
number - the number (index) of the category 0.255 for market, group industry,
0..32 for sectors, 0...unlimited for watch lists
Please note that the function will also create watch list of given index
if one does not exist.
- Added protection against trying to use 3d graph on non-exhaust optimization
- ParamToggle default value not shown after "Reset all" in AA
[#52129]. Fixed
- added <= 0 check for log10 calls to protect from FPU exceptions when
using log chart scale
- Added error message that prevents from running "Current symbol" backtest
on IS/OOS/Best equity special tickers
- Added symbol validity check in backtest "Apply To: Current symbol"
- In detailed log mode the backtester now reports reason why trade is not
entered
- Line studies were not visible on Yearly and Qtrly charts. Fixed
- Progress window does not steal focus from active window (prevents some
random crashes when "run every" is used)
- When "run every" is used progress window is displayed minimized
when AA is minimized
CHANGES FOR VERSION 5.17.1 (as compared to 5.17.0)
- In 5.17.0 "Current symbol" selection in AA always used first
symbol in the database. Fixed.
CHANGES FOR VERSION 5.17.0 (as compared to 5.16.0)
- Log Window implemented
Log window (View->Log) allows to view:
edit-time errors displayed during formula check
run-time errors that occur when formula is running (not edited)
_trace command output within AmiBroker (without using 3rd party debug view)
To perform tasks such clearing the output, copying, changing settings
use right - mouse click over the log window list.
Double click on the error line brings up the editor, so you can fix the
error easily.
While "edit-time" error list is cleared automatically each time
you check the syntax in the editor, the run-time error list is NOT cleared,
so all errors remain listed, even if they are fixed already, unless you
manually clear the list.
Note that _TRACE output is by default directed to outside debugger (like
DebugView), in order to enable internal display you need to switch appropriate
option in the Tools->Preferences->AFL You can choose to display internally
/ externally or in both places.
Internal _trace has much lower performance penalty (order of magnitude)
than external, but that is achieved by the fact that
internal log window is refreshed only when application is not busy. It
is appropriate for some uses, but you may prefer more immediate
refresh offered by DebugView.
- Zooming via Scroll bar improved. Now it works with wider range of zoom
factors and also does not disable scoll bar when all quotes are visible.
As accessibility feature, you can temporarily DISABLE zoom via scroll bar
by pressing and holding down CTRL key.
- Added extra protection against going out of drawing array bounds in GetNextDrawing
- when broker.master file was loaded, some symbol temporary data were read
from non-zeroed memory, fixed now
- fixed display glitch that occurred on some bars when logarithmic scale
was used and chart was drawn using compression (2x more bars than pixels)
- When application is closed in Minimized state, the x,y co-ords of main
window are not stored
- styleHistogram chart when drawn in compressed mode could fail to display
some negative spikes (below base level) in 5.16. Fixed.
- inQuarterly and inYearly higlighted in AFL editor now
- SetBarFillColor could not make candle with same body and outline color.
Fixed now.
- Fixed handling Null in styleArea chart (Null was ignored in 5.16)
- 32bit AmiBroker is now compiled with LARGEADDRESSAWARE flag, that allows
it to use 3GB on 32 bit Windows versions that have /3GB boot flag enabled
and 4GB on 64 bit Win
- First sorted column is drawn with darker color now (as in Windows explorer)
- Layouts are displayed in alphabetical order now (previously they were
sorted only if files were stored on NTFS partition)
- When from-to range of backtest was small, AB sometimes allocated too
large cache for portfolio backtest than necessary. Now it is fixed and
should provide speed up for short range backtests.
CHANGES FOR VERSION 5.16.0 (as compared to 5.15.0)
- If in-memory cache was too small, it could happen that Walk-Forward kept
old equity values in ~~~BESTEQUITY. Fixed now.
- AFL: Faster LR. Added constant-period version of linear regression calc
- reduces complexitiy from O(N^2) to O(N)
Constant-period LinearReg, LinRegSlope, LinRegIntercept, TSF and StdErr functions
execute now order(s) of magnitude faster.
- AFL: new GetChartBkColor function
Returns RGB color value of chart background. Sample code:
SetChartBkColor( ParamColor("Color", ColorRGB( 255, 255, 255
) ) );
rgb = GetChartBkColor();
red = ( rgb & 255 );
green = floor( (rgb/256) & 255 );
blue = floor( rgb/(256*256) );
Title="R="+ red + " G=" + green + " B=" +
blue;
- Candlestick style switches back to bar chart when number of bars displayed
is twice the number of screen pixels
- eSignal plugin 1.9.0 (fixes to problem with RT update of certain foreign
future markets such as NSF)
- IBController 1.2.0
- following TWS API changes ignoreRth and rthOnly flags are removed
and replaced with single flag: outsideRTH
- IBc now allows to define which error codes should be ignored using
File->Error code ignore list
- upgraded to use latest TWS API 9.41 (tested with latest TWS 885.7,
requires at least 879)
- Improved speed of Day(), Month(), Year(), DaysSince1900(), DayOfWeek(),
DayOfYear() functions on intraday data (upto 20x faster)
- Improved speed of DayOfWeek(), DayOfYear(), DaysSince1900() on EOD data
(upto 2x faster)
- Optimized chart drawing for large number of bars, upto 10x faster when
more than 70000 bars are visible on screen
The drawing algorithm switches to optimized drawing mode when just one line
draw per horizontal pixel is performed if there are 2x or more bars than
screen pixels.
- Say() function has now ability to queue speak requests
Say( "Text", purge = True );
when purge is set to True (the default) - any call to Say() purges all
previous speak requests (queued or in-progress) and speaks
specified text immediatelly.
when purge is set to False - speak request is queued and will be spoken
right after previous requests are done.
Also now Say() function returns the NUMERIC value that indicates how many
speak requests are pending
0 - ERROR - speech engine not installed or not working properly
1 - currently requested text is spoken now (queue was empty)
2 or more - queue was not empty and previous request(s) will be completed
prior to speaking currently specified text
CHANGES FOR VERSION 5.15.0 (as compared to 5.14.0)
- SetForeign called multiple times with "tradeprices" parameter
set to True freed memory only partially. Now fixed.
- Equity() function does not cause exception when running backtest with
QuickAFL enabled
- Equity() function does not require all past bars anymore when used in
AA
- OptimizerSetEngine("") in some circumstances selected random
plugin. Fixed now.
- When user has aborted optimization during in-sample step, the previously
used opt params were not freed. Fixed.
- Implemented command line parameter that allows to specify the database
to load at startup. /database "the path to the database here"
- In some places C-runtime mktime() was used leading to problems with dates
prior to 1970. Fixed now.
- During custom backtester phase the ~~~EQUITY ticker is protected from
flushing out of cache (it could only happen if using OLE to access quotes
inside CB proc)
- Now ~~~BESTEQUITY, ~~~ISEQUITY, ~~~OSEQUITY are not flushed out from
the cache during WF even if cache is small (ensures no missing parts in
IS/OOS chart)
- Single-symbol optimization now also uses QuickAFL (when enabled). Requirements
for the first symbol are calculated in setup phase. To get "most safe" requirement
estimation, the setup phase uses maximum values of opt params.
CHANGES FOR VERSION 5.14.0 (as compared to 5.13.0)
- added support for Quarterly and Yearly intervals in all parts of the
program
- new menu items under View interval
- new AFL constants inQuarterly, inYearly
- Yearly and Quarterly charts compression
- updated TimeFrame functions
- Changes to drawing made in v5.13 caused improper drawing lines located
PAST the last available quote (trendlines and pitchforks) when timestamping
method was "START TIME of interval". This is fixed now.
- Fixed AddSummaryRows so 'onlycols' parameter default (zero) is applied
properly
- Implemeted "Select all" via Ctrl-A keyboard shortcut for all
list (result list in AA for example)
- Mouse cursor shape (moving/sizing) reflects the selected study priority
when more than one study exists under mouse position
- new multiple Volume At Price charts at user-defined points via new PlotVolumeOverlayA
function
PlotVAPOverlayA( segments, lines = 300, width = 80, color = colorLightGrey,
vapstyle = 4);
segmens - is an array which holds 0 and 1 (False/True) values, where 1
indicates starting/ending point of each VAP segment
AmiBroker will draw as many segments as there are '1' in the array. Note
that minimum segment length is 2, so if entire array is filled with 1-s
only,
it won't draw anything. In other words, there must be zeros (at least one)
between 1's.
Simplest example:
Plot(C, "Close", colorBlack, styleCandle );
segments = IIf( Interval() < inDaily, Day(), Month()
); // draw daily or monthly VAP segments depending
on display interval
segments = segments != Ref(
segments , -1 );
PlotVAPOverlayA( segments );
More complex example:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}}
- {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )
) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style")
| GetPriceStyle()
);
_SECTION_END();
_SECTION_BEGIN("VAP");
segments = IIf( Interval() < inDaily, Day(), Month()
);
segments = segments != Ref(
segments , -1 );
PlotVAPOverlayA( segments , Param("Lines", 300, 100, 1000, 1 ), Param("Width", 80, 1, 100, 1 ), ParamColor("Color", colorGold ), ParamToggle("Side", "Left|Right" )
| 2 * ParamToggle("Style", "Fill|Lines", 0)
| 4*ParamToggle("Z-order", "On
top|Behind", 1 )
);
Plot(segments, "", colorLightGrey, styleHistogram | styleOwnScale );
_SECTION_END();
- QuickAFL can now be used in Automatic Analysis (Settings: General: "Use
QuickAFL" - check this box) - this can speed up explorations, scans
and backtests by factor of 2+ if range is less than "all quotations"
More on QuickAFL feature here: http://www.amibroker.com/kb/2008/07/03/quickafl/
- Range Bars compression now uses TickSize as "1R step". TickSize
defined in the Symbol Information, if its value is zero, then 1R would
be equivalent to 0.01 movement (for backward compat)
- selecting date in multiple linked charts is now faster because redraw
is not made when selected line in higher compressed interval remains in
place
- selector line in linked charts works OK now, regardless of selected time
compression timestamping method
- SetBarsRequired accepts now values -2 in special meaning: reference ALL
bars
So
SetBarsRequired( -2, -2 ); // require ALL past and future bars - this turns
OFF quickAFL
(Note that in pre 5.14 versions, such combination does NOTHING, and with
those versions one needed
to write SetBarsRequired( 1000000, 1000000 ) to achieve the same effect)
For readability sbrNoChange (-1) and sbrAll (-2) constants were added
so you can write:
SetBarsRequired( sbrAll, sbrAll );
- Sometimes progress bar did not show the name of optimization engine used.
Now it is fixed
- Status("ActionEx") provides more codes than Status("action")
to detect special executions states
Status("ActionEx") provides more detailed information about action
that triggered AFL execution. Note that 5 first codes are the same as Status("action")
but scope is limited to 'core'
meaning (see notes below).
Possible values
1 - actionIndicator - when indicator is being repainted
2 - actionCommentary (NOTE: commentary only, not interpretaion nor tooltip)
3 - actionScan - when AA Scan is performed
4 - actionExplore - when AA exploration is performed
5 - actionBacktest (NOTE backtest only, no optimization)
8-9 - reserved for future use
10 - actionExAAShowArrows - when AA "Show arrows" command is used
11 - actionExAAParameters - when AA "Parameters" dialog is displayed/updated
12 - actionExEditVerifyFormula - when AFL editor verifies syntax
13 - actionExOptimizeSetup - when Optimize() parameters are read (to setup
optimization engine)
14 - actionExOptimizeBacktest - when Backtest is performed as a part of optimization
process
15- actionExOptimizePortfolio - when portfolio-backtest phase (CUSTOM backtester)
is performed as a part of optimization process
16 - actionExTooltip - when tooltip for given chart is being displayed/updated
17 - actionExInterpret - when the Interpretation window is being updated
18 - actionExInit - when AA needs to initialize QuickAFL bars required information
and/or formula contains functions changing general AA options
NOTE: for backward compatiblity with all formulas you have written already,
the codes for Status("action") did NOT change .
- Streaming chart update could stall if trend line handle was clicked in
attempt to resize and released in the very same position (without moving
the mouse). Now it is fixed.
- TimeFrameMode() now supports mode == 4 - which expresses RANGE bars in
TickSize units (as opposed to mode 3 that uses dollars for backward compatiblity)
- when display chart timing option is turned on and RT stream is active
the application STATUS BAR now displays TOTAL time for all charts, it should
be BELOW 1 second for RT trading
CHANGES FOR VERSION 5.13.0 (as compared to 5.12.2)
- Main app window maximize state on 2nd monitor is saved OK now.
- Trendlines drawn in smaller interval (such as 1-minute), was moved one
bar in higher interval (such as 5 minute) if compressed intraday timestamps
ware set to START time of interval or FIRST tick
- The left-hand handle moved to the next bar when it was off-screen and
right-hand handle was adjusted by the user. Now it is fixed. (FC#890)
- When drawing is clicked without moving the mouse, the co-ordinates stay
untouched ( snap is not activated until you move the mouse)
- AFL: AddSummaryRows changed
AddSummaryRows( flags, format = 0, onlycols = 0, ...)
AddSummaryRows automatically adds "summary" row(s) to the exploration
output.
the flags parameter can be combination of the following
1 - add TOTAL row
2 - add AVERAGE row
4 - add MIN row
8 - add MAX row
16 - add COUNT row
format - defines the numeric formating in WriteVal style so 1.2 for example
means 2 decimal digits.
If default value of zero is used (or parameter not specified) the default
formatting of "maximum precision"
is used - upto 15 digits are printed
onlycols - defines for which columns you want to display summary row values.
Note that if you do not specify any columns - ALL will be printed.
If you are using onlycols, you can define upto 10 columns, columns, like
in SetSortColumns are numbered starting from 1. For example:
AddSummaryRows( 1, 1.2, 3, 5, 7, 9 );
Display sum for columns: 3, 5, 7, and 9.
Generally you should call this funciton only once, using combination of
flags desired.
But it is possible to call AddSummaryRows multiple times and the result
will be "accumulation" (i.e. bitwise OR)
in case of "flag" parameter. format and onlycols are always overwritten
by last call.
Example:
Filter=1;
AddColumn(V, "Volume" );
AddSummaryRows( 31, 1.2 ); // add Total, Average, Min, Max, and Count rows
(1+2+4+8+16)=31 - with two decimal places
summary rows are added at the top of the list
- Handles from selected study line are respected (i.e when study is already
selected, and multiple studies exists under "click" point, the
selection does not change) (FC#726)
- Magnet mode can be asynchronously (temporarily) toggled by holding SHIFT
key while drawing. Toggle means that if you are in magnet mode and hold
down shift it will turn it off and vice versa
- Magnet mode implemented for horizontal price levels and working correctly
now (stay horizontal) (FC#728)
- During optimization Progress bar shows engine ID, opt. target, best value,
step and best combination of parameters found upto "now". These
figures are refreshed every second.
- Optimization (in non-WF mode) results are sorted by optimization target
column (too)
- New optimization engine added: CMAE (Covariance Matrix Adaptation Evolutionary
Strategy) optimizer plug-in
CMA-ES (Covariance Matrix Adaptation Evolutionary Strategy) is state-of-the-art
non-exhaustive optimizer.
For scientific background see:
http://www.bionik.tu-berlin.de/user/niko/cmaesintro.html
According to scientific benchmarks outperforms nine other, most popular evolutionary
strategies (like PSO, Genetic and Differential evolution).
http://www.bionik.tu-berlin.de/user/niko/cec2005.html
The CMAE.DLL plugin implements "Global" variant of search
with several restarts with increasing population size
CMAE.DLL comes with FULL SOURCE CODE (inside "ADK" folder)
By default number of runs (or restarts) is set to 5.
It is advised to leave the default number of restarts.
You may vary it using OptimizerSetOption("Runs", N ) call, where
N should be in range 1..10.
Specifying more than 10 runs is not recommended, although possible.
Note that each run uses TWICE the size of population of previous run so
it grows exponentially.
Therefore with 10 runs you end up with population 2^10 greater (1024 times)
than the first run.
There is another parameter "MaxEval". The default value is
ZERO which means that plugin will automatically calculate MaxEval required.
It is advised to NOT to define MaxEval by yourself as default works fine.
The algorithm is smart enough to minimize the number of evaluations
required and it converges VERY fast to solution point, so usually it
finds solutions way faster than other strategies.
It is normal that the plugin will skip some evaluations steps, if it
detects that solution was found, therefore you should not be surprised
that optimization progress bar may move very fast at some points. The
plugin also has ability to increase number of steps over initially estimated
value if it is needed to find the solution. Due to its adaptive nature,
the "estimated time left" and/or "number of steps" displayed
by the progress dialog is only "best guess at the time" and
may vary during optimization course.
To use CMA-ES optimizer, you just need to add one line to your code:
OptimizerSetEngine("cmae");
This will run the optimization with default settings which are fine
for most cases.
It should be noted, as it is the case with many continouos-space search
algorithms, that decreasing "step" parameter in Optimize()
funciton calls does not significantly affect optimization times. The
only thing that matters is the problem "dimension", i.e. the
number of different parameters (number of optimize function calls). The
number of "steps" per parameter can be set without affecting
the optimization time, so use the finest resolution you want. In theory
the algorithm should be able to find solution in at most 900*(N+3)*(N+3)
backtests where "N" is the dimension. In practice it converges
a LOT faster. For example the solution in 3 (N=3) dimensional parameter
space (say 100*100*100 = 1 million exhaustive steps) can be found in
as few as 500-900 CMA-ES steps.
- New optimization engine added: "Tribes" adaptive PSO optimizer
implemented
Tribes is adaptive, parameter-less version of PSO (particle swarm optimization)
non-exhaustive optimizer.
For scientific background see:
http://www.particleswarm.info/Tribes_2006_Cooren.pdf
In theory it should perform better than regular PSO, because it can automatically
adjust the swarm sizes and algorithm strategy to the problem being solved.
Practice shows that its performance is quite similar to PSO.
To find solutions significantly faster I can recommend CMA-ES (Covariance
Matrix Adaptation Evolutionary Strategy) algorithm instead.
The Tribes.DLL plugin implements "Tribes-D" (i.e. dimensionless)
variant. Based on http://clerc.maurice.free.fr/pso/Tribes/TRIBES-D.zip
by Maurice Clerc. Original source codes used with permission from the author
Tribes.DLL comes with FULL SOURCE CODE (inside "ADK" folder)
Supported parameters:
" MaxEval" - maximum number of evaluations (backtests) per run (default
= 1000).
OptimizerSetOption("MaxEval", 1000 );
You should increase the number of evaluations with increasing number of
dimensions (number of optimization params).
The default 1000 is good for 2 or maximum 3 dimensions.
"Runs" - number of runs (restarts). (default = 5 )
You can leave the number of runs at default value of 5.
By default number of runs (or restarts) is set to 5.
To use Tribes optimizer, you just need to add one line to your code:
OptimizerSetEngine("trib");
OptimizerSetOption("MaxEval", 5000 ); // 5000 evaluations max
CHANGES FOR VERSION 5.12.2 (as compared to 5.12.0)
- In 5.12.0 BETA the walk-forward test was stopping after first in-sample
cycle. Now it is fixed.
- AddSummaryRows total did not include the very first item. Fixed.
CHANGES FOR VERSION 5.12.0 (as compared to 5.11.1)
- ADK: A new interface for external optimization engines, see optimizer.html
- Added two example non-exhaustive optimizers: Standard Particle Swarm
Optimizer (spso), and Monte Carlo (random pick) optimizer( moca)
Note that BOTH optimizers are provided for demonstration purposes.
Particularly Monte Carlo optimizer is meant as a "the most trivial and
simple" or even "dumb" example of optimizer DLL coding.
It works by randomly picking parameter combinations without ANY additional
logic. The results are thus random
and most probably sub-optimum.
On the other hand Standard Particle Swarm Optimizer is based on SPSO2007
code that is supposed to produce
good results provided that correct parameters (i.e. Runs, MaxEval) are
provided for particular problem.
Picking correct options for the PSO optimizer can be tricky therefore results
may significantly vary from case to case.
The source codes for both optimizers are OPEN and provided as illustration
how to implement optimizer engines using
" simple" and "advanced" methods as described in optimizers.html
file. You can find full source codes inside "ADK" subfolder.
In the future, I will provide more robust non-exhaustive optimizers using
various methods.
Example code for Standard Particle Swarm Optimizer:
(finding optimum value in 1000 tests within search space of 10000 combinations)
OptimizerSetEngine("spso");
OptimizerSetOption("Runs", 1 );
OptimizerSetOption("MaxEval", 1000 );
sl = Optimize("s", 26, 1, 100, 1 );
fa = Optimize("f", 12, 1, 100, 1 );
Buy = Cross( MACD( fa, sl ), 0 );
Sell = Cross( 0, MACD( fa, sl ) );
Example Code for Monte Carlo optimizer:
(finding sub-optimum value in 1000 test within search space of 10000 combinations)
OptimizerSetEngine("moca");
OptimizerSetOption("NumSteps", 1000 );
sl = Optimize("s", 26, 1, 100, 1 );
fa = Optimize("f", 12, 1, 100, 1 );
Buy = Cross( MACD( fa, sl ), 0 );
Sell = Cross( 0, MACD( fa, sl ) );
- Increased limit of optimization parameters to 100
- AFL: new OptimizerSetOption("name", value ) function
The function set additional parameters for external optimization engine.
The parameters are engine-dependent.
For example SPSO optimizer supports "Runs" (number of runs) and "MaxEval" (maximum
evaluations (tests)per single run) parameters. Monte Carlo optimizer supports "NumSteps" (number
of steps) parameter.
- AFL: new OptimizerSetEngine("name") function
The function selects external optimization engine defined by name. For demonstration
two engines are provided: Standard Particle Swarm Optimizer ("spso")
and Monte Carlo (random pick) optimizer ("moca")
Example:
OptimizerSetEngine("moca");
- ADK: new example C++ source codes: PSOSample, MOCASample
- AFL: AddSummaryRows( flags )
AddSummaryRows automatically adds "summary" row(s) to the exploration
output.
the flag parameter can be combination of the following
1 - add TOTAL row
2 - add AVERAGE row
4 - add MIN row
8 - add MAX row
16 - add COUNT row
You can call AddSummaryRows multiple times and the result will be "accumulation" (i.e.
bitwise OR)
Example:
Filter=1;
AddColumn(V, "Volume" );
AddSummaryRows( 31 ); // add Total, Average, Min, Max, and Count rows (1+2+4+8+16)=31
summary rows are added at the top of the list
CHANGES FOR VERSION 5.11.1 (as compared to 5.11.0)
- Fixed problem with Walk Forward picking sometimes not the best parameter
when thousand separator was used and metric values were greater than 1000
CHANGES FOR VERSION 5.11.0 (as compared to 5.10.1)
- Backtester: Implemented SeparateLongShortRank
To enable separate long/short ranking use:
SetOption("SeparateLongShortRank", True );
When separate long/short ranking is enabled, the backtester maintains
TWO separate "top-ranked" signal lists, one
for long signals and one for short signals. This ensures that long and
short candidates are independently even if position score
is not symetrical (for example when long candidates have very high positive
scores while short candidates have only fractional negative scores).
That contrasts with the default mode where only absolute value of position
score matters, therefore one side (long/short) may completely dominate
ranking if score values are asymetrical.
When SeparateLongShortRank is enabled, in the second phase of backtest,
two separate ranking lists are interleaved to form final signal list by
first taking top ranked long, then top ranked short, then 2nd top ranked
long, then 2nd top ranked short, then 3rd top ranked long
and 3rd top ranked short, and so on... (as long as signals exist in BOTH
long/short lists, if there is no more signals of given kind, then
remaining signals from either long or short lists are appended)
For example:
Entry signals(score):ESRX=Buy(60.93), GILD=Short(-47.56), CELG=Buy(57.68),
MRVL=Short(-10.75), ADBE=Buy(34.75), VRTX=Buy(15.55), SIRI=Buy(2.79),
As you can see Short signals get interleaved between Long signals even
though their absolute values of scores are smaller than corresponding scores
of long signals. Also there were only 2 short signals for that particular
bar so, the rest of the list shows long signals in order of position score
Although this feature can be used independently, it is intended to be
used in combination with MaxOpenLong and MaxOpenShort options.
- Backtester: MaxOpenLong/MaxOpenShort implemented
MaxOpenLong - limits the number of LONG positions that can be open simultaneously
MaxOpenShort - limits the number of SHORT positions that can be open simultaneously
Example:
SetOption("MaxOpenPositions", 15 );
SetOption("MaxOpenLong", 11 );
SetOption("MaxOpenShort", 7 );
The value of ZERO (default) means NO LIMIT. If both MaxOpenLong and MaxOpenShort
are set to zero (
or not defined at all) the backtester works old way - there is only global
limit active (MaxOpenPositions) regardless of type of trade.
Note that these limits are independent from global limit (MaxOpenPositions).
This means that MaxOpenLong + MaxOpenShort may or may not be equal to MaxOpenPositions.
If MaxOpenLong + MaxOpenShort is greater than MaxOpenPositions
then total number of positions allowed will not exceed MaxOpenPositions,
and individual long/short limits will apply too.
For example if your system MaxOpenLong is set to 7 and maxOpenShort is
set to 7 and MaxOpenPositions is set to 10
and your system generated 20 signals: 9 long (highest ranked) and 11 short,
it will open 7 long and 3 shorts.
If MaxOpenLong + MaxOpenShort is smaller than MaxOpenPositions (but greater
than zero), the system won't be able to
open more than (MaxOpenLong+MaxOpenShort).
Please also note that MaxOpenLong and MaxOpenShort only cap the number
of open positions of given type (long/short).
They do NOT affect the way ranking is made. I.e. by default ranking is
performed using ABSOLUTE value of positionscore.
If your position score is NOT symetrical, this may mean that you are not
getting desired top-ranked signals from one side.
Therefore, to fully utilise MaxOpenLong and MaxOpenShort in rotational
balanced ("market neutral") long/short systems
it is desired to perform SEPARATE ranking for long signals and short signals.
To enable separate long/short ranking use:
SetOption("SeparateLongShortRank", True );
- Added ability to running Walk forward test from OLE, using Optimize(3)
Analysis.Optimize( mode )
when mode == 3 it runs walk forward test
AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;
AA.Optimize(3);
- AFL: DaysSince1900() function
It returns the number of days that passed since January 1st, 1900,
counting from 1. January 1, 1900 is serial number 1, and January
1, 2008 is serial number 39448 because it is 39,448 days after January
1, 1900. Technically is equal to Windows OLEDATE and Excel's DATEVALUE
function.
The function can be used for calculations that involve calendar
days as opposed to trading days and replaces previously proposed
AFL solution
http://www.amibroker.com/kb/2007/03/15/calendar-day-index/
Now RefDays can be implemeted as follows:
SetBarsRequired( 365, 0 );
function RefDays(
Array, Days )
{
td = DaysSince1900();
result = Null;
if( Days < 0 )
{
for( i = BarCount -1;
i >= -Days; i = i - 1 )
{
backday = td[ i ] + Days; // Days is negative
for( j =
-Days/2; j < i; j++ )
{
if( td[
i - j ] <= backday )
{
result[ i ] = Array[ i - j ];
break;
}
}
}
}
return result;
}
Plot( C, "C", colorRed );
Plot( Ref( C,
-252 ), "Close
252 bars back", colorBlue );
Plot( RefDays( C,
-365 ), "Close
365 days back", colorGreen );
CHANGES FOR VERSION 5.10.2 (as compared to 5.10.1)
-
Fixed problem with Walk Forward picking sometimes not the best parameter when thousand separator was used
and metric values were greater than 1000
CHANGES FOR VERSION 5.10.1 (as compared to 5.10.0)
-
Fixed crash @004AB5A1 (when sector ID was invalid > 64)
-
Fixed bug AFL editor Undo @004B2324
-
Fixed bug @004662AD (crash when doing Code Check and Profile while AA running
in background)
CHANGES FOR VERSION 5.10.0 (as compared to 5.09.0)
- Small improvement in axis font positioning - based on TEXTMETRIC
- Removed 1-pixel rendering overlap in multi-colored chart titles when
ClearType was enabled
- Hi-Res (256x256) alpha Vista icon
- Quote array now uses HeapRealloc instead of HeapAlloc/HeapFree
combination
- Fixed rare crash @433F58
- Fixed account manager updating cash after exiting
short trade
- Web Browser window does not flicker anymore when resizing
CHANGES FOR VERSION 5.09.0 (as compared to 5.08.0)
- MDI Tab order is now saved in the layout
- Added interface to BugslayerUtil.dll for optional call stack / symbol
dump report in crash recovery window
Now in the bottom of the crash report there is a detailed call stack and
CPU register state. This should allow quicker/easier fixes of any crashes
- New fields in Status() function: pxchart*
Status("pxchartleft") - returns x-coordinate of top-left corner
of chart area
Status("pxcharttop") - returns y-coordinate of top-left corner
of chart area
Status("pxchartright") - returns x-coordinate of bottom-right corner
of chart area
Status("pxchartbottom") - returns y-coordinate of bottom-right
corner of chart area
Status("pxchartwidth") - returns width chart area (right-left)
Status("pxchartheight") - returns width chart area (bottom-top)
Chart co-ordinates are useful because they automatically take into account
selected axis font size, whenever date axis is on or off
and other settings (New Look chart style)
All co-ordinates are in screen pixels. Note that top, left coordinates may
not be zero as chart rectangle is smaller than underlying window because
there is an extra space (padding) around chart.
// Test code:
Title = StrFormat("left=%g,
top=%g, right=%g, bottom=%g, width=%g, height=%g",
left=Status("pxchartleft"),
top=Status("pxcharttop"),
right=Status("pxchartright"),
bottom=Status("pxchartbottom"),
Status("pxchartwidth"),
Status("pxchartheight")
);
GfxSetOverlayMode(1);
GfxRectangle(Left,top,
right, bottom);
============ Overlay sample ================
_SECTION_BEGIN("GfxOverlaySampleNew");
function GetVisibleBarCount()
{
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
return Min(
Lvb - fvb, BarCount -
fvb );
}
function GfxConvertBarToPixelX(
bar )
{
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxchartleft = Status("pxchartleft");
pxchartwidth = Status("pxchartwidth");
return pxchartleft
+ bar * pxchartwidth / ( Lvb - fvb + 1 );
}
function GfxConvertValueToPixelY(
Value )
{
local Miny,
Maxy, pxchartbottom, pxchartheight;
Miny = Status("axisminy");
Maxy = Status("axismaxy");
pxchartbottom = Status("pxchartbottom");
pxchartheight = Status("pxchartheight");
return pxchartbottom
- floor( 0.5 +
( Value - Miny ) * pxchartheight/ ( Maxy - Miny ) );
}
Plot(C, "Price", colorBlack, styleHistogram );
GfxSetOverlayMode(0);
GfxSelectSolidBrush( colorRed );
GfxSelectPen( colorRed );
AllVisibleBars = GetVisibleBarCount();
fvb = Status("firstvisiblebar");
for( i = 0;
i < AllVisibleBars ; i++ )
{
x = GfxConvertBarToPixelX( i );
y = GfxConvertValueToPixelY( C[
i + fvb ] );
GfxRectangle(
x-1, y-1,
x + 2, y+1 );
}
//SetChartBkGradientFill( ColorRGB(200,200,200),
ColorRGB( 255,255,255) );
_SECTION_END();
- OLE: Name property is now writable, allowing switchin currently selected
symbol for the document
Example (JScript):
AB = new ActiveXObject("Broker.Application");
AB.ActiveDocument.Name = "MSFT"; // change the symbol for current
document to "MSFT"
CHANGES FOR VERSION 5.08.0 (as compared to 5.07.0)
- Walk-Forward: "Easy" mode divided into two submodes: EOD and
Intraday
Easy EOD mode assumes that you are using EOD data for walk-forward.
Easy Intraday mode assumes that you are using Intraday data for walk-forward
The difference is that in EOD mode the END date of previous period and START
date of next period are the same - thus avoiding gap
between periods. Intraday mode set START date of the next period as NEXT
DAY after END of previous period. That guarantees
that boundary day is not counted twice when testing on intraday data.
- SetOption("GenerateReport", value )
New option added to SetOption call
" GenerateReport" - 0/1/2
By default backtest reports are generated ONLY for portfolio backtests and
for individual backtests if individual reporting is turned on in the settings.
Reports are disabled for optimization.
Now with the SetOption() function you can either supress report generation
for backtests or enable report generation during certain optimization steps,
all from code level.
SetOption("GenerateReport", 0 ); // suppress generation of report
SetOption("GenerateReport", 1 ); // force generation of full report
SetOption("GenerateReport", 2 ); // only one-line report is generated
(in results.rlst file) viewable as single line in Report Explorer
- Total chart redraw time is calculated properly if multiple documents
and charts are open that results in smoother performance and no update
lockup
- When custom color palette is changed, any old RGB color that is not present
in changed palette is matched to closest "standard" color
- Bugfix: when crosshair was enabled and moved OUTSIDE chart windows, then
CPU usage was high. Now it is fixed
- Walk-Forward: when starting date is the last day of the month and step
is n-month then it is treated as special case
AmiBroker now detects that start day is the last day of the month and moves
the window to the last day of NEXT month, even if it is shorter.
That addresses the problem when one starts with January 31 and wants to step
by one month - > since there is NO February 31, previous version
moved to March 3rd. Now it detects that it is last day of the month and moves
to Feb 28 (or 29). Then in next step it will move to March 31.
CHANGES FOR VERSION 5.07.0 (as compared to 5.06.0)
- a bugfix in 5.06 affected Foreign() function so it did not load the data
on very first access - now fixed. This fixes also huge drawdown numbers
that occurred on open positions at the end of trade list if cache size
was small
- AFL: SetChartOptions has now 2 more parameters that allow to set custom
scaling
SetChartOptions( Mode = 0, Flags = 0, gridFlags = chartGridMiddle, ymin =
0, ymax = 0 )
new ymin, ymax parameters specify Y-axis minimum and maximum values for custom
scaling.
If you specify any values that meet the condition ymin < ymax, AmiBroker
will turn OFF automatic scaling and use specified min/max values
for Y scale. Note that Mode argument controls when these settings are applied
(0 - only when new chart is created, 1 - always), when modes 2 and 3 are
used - scaling is not changed.
- bugfix: in 5.06.0 deleting the very first symbol raised exception, now
it is fixed
- bugfix: rarely when trade profits gone to absurd levels (for example
if user switched off price checking and used zero as entry price), AmiBroker
would crash when generating profit distribution chart, now it is fixed
- Crosshair moves way faster and flicker is practically eliminated
- Crosshair state is global now and saved between sessions
- Crosshair works now in floating windows and in inactive windows too
- IS, OOS, BEST equity tickers are now put into group 253 and market 253
(composites)
CHANGES FOR VERSION 5.06.0 (as compared to 5.05.1)
- Walk Forward: now you can select "trading days" instead of
calendar days as step unit. Currently it is using simplified method: Mon-Fri
as a trading days
- Walk Forward settings: fixed lockup (due to infinite loop) when step
was set to zero, also added other checks for invalid entries
- RT Quote window: now symbols can be re-arranged by drag-and-drop (simply
click on the symbol, hold and drag to re-arrange order)
- RT Quote window: faster refreshes and multi-step color fading
- RT Quote window: added ability to type-in multiple symbols directly (instead
of selecting one by one or via existing watch list)
- RT Quote window: added ability to insert EMPTY line (to separate symbol
groups)
- Preferences / Currencies: now you can define upto 20 currencies for multiple-currency
backtesting
- New FindSignal function in Backtester object (custom backtester procedure)
allowing fast lookups for signals matching given symbol
bo = GetBacktesterObject();
bo.FindSignal( bar, symbol, type )
where
bar is a bar number
symbol is ticker symbol
type represents type of signal to find: 0 - both entries and exits, 1 -
only entries, 2 - only exits
The function finds for first matching signal that has fPrice != -1 (different
than -1). If 0 is used as type, and entry and exit is on the same bar then
entry signal will be returned. Note: fPrice = -1 is a special marker meaning
that given signal should be ignored.
- Internal symbol pointers stay the same when new symbols are added or
deleted. This addresses exceptions when using AddToComposite during backtests
among other things
This fixes: FC#1101, exceptions when using AddToComposite inside CBT and
exceptions occuring sometimes with COM when adding / removing symbols
- Floating panes are now "sticky" that makes it easier to arrange
the workspace
- Charts: ability to hide vertical quote marker
The control over vertical quote marker is given now via
Parameter dialog -> Axes & Grid -> Vert. quote marker: Show/Hide
And programmatically via SetChartOptions function:
SetChartOptions( 2, chartHideQuoteMarker );
- Bugfix: when "pad and align" was used in AA and reference symbol
did not have all trading days, the data used for very first symbol in the
watch list under test could have been unaligned for the very first AA run,
subsequent runs were OK)
- Alert Output column sizes / layout are now preserved between sessions
- Added two new backtest modes: backtestRegularRaw2 and backtestRegularRaw2Multi
that do not remove excess EXIT signals
The common thing between Raw and Raw2 modes is that they both do NOT remove
excess ENTRY signals.
The difference is that Raw modes remove excess EXIT signals, while Raw2 do
NOT.
In Raw2 modes all exit signals (even redundant ones) are passed
to second phase of backtest just in case that you want implement strategy
that skips first exit. Lets suppose that you want to exit on some condition
from first phase but only in certain hours or after certain numbers of bars
in trade or only when portfolio equity condition is met. Now you can do that
in raw2 modes.
Note that Raw2 modes can get significantly slower when you are using custom
backtester code that iterates thru signals as there can be zillions of exit
signals in the lists even for symbols that never generated any entry signals,
therefore it is advised to use it only when absolutely necessary. Raw2 modes
are also the most memory consuming.
Note also that if you run the system WITHOUT custom backtest procedure
there should be no difference between Raw and Raw2 modes (other than speed & memory
usage) as first matching exit signal is what is used by default.
- 3D chart viewer: process priority is now set to IDLE
- 3D chart viewer: animation is now smoother (upto 100fps vs 25fps)
CHANGES FOR VERSION 5.05.1 (as compared to 5.05.0)
- Walk Forward AA Settings: added error message when start date > end
date
- Walk Forward AA Settings: added "preview" list - showing all
IS and OOS segments with dates
CHANGES FOR VERSION 5.05.0 (as compared to 5.04.2)
- Walk Forward: "Easy" mode in the settings implemented - it
sets "out-of-sample" parameters automatically based on in-sample
settings
- GetCursorMouseButtons new flag = 8 - means that current chart just received
mouse click
/////////////////////////////////////////////////
// Low-level graphic + Interactive GUI control
sample
// This example shows:
// 1. how to draw "buttons"
// 2. how to handle mouse clicks
// 3. how to implement event
call-backs
///////////////////////////////////////////////////
Version( 5.04 ); //
requires 5.04 or higher
////////////////////////////////////////////////////
// Part 1: DRAWING TABLE OF BUTTONS
//////////////////////////////////////////////////
GfxSetOverlayMode( 2 );
// formatted text output sample via low-level
gfx functions
CellHeight = 20;
CellWidth = 100;
GfxSelectFont( "Tahoma",
CellHeight/2 );
GfxSetBkMode( 1 );
function PrintInCell(
string, row, Col )
{
GfxDrawText( string,
Col * CellWidth, row * CellHeight, (Col + 1 )
* CellWidth, (row + 1 )
* CellHeight, 0 );
}
GfxSelectPen( colorBlue );
for( i
= 0; i < 10 && i < BarCount;
i++ )
{
for( k
= 0; k < 5;
k++ )
{
PrintInCell( "Button " +
i + "," + k, i, k );
}
GfxMoveTo( 0,
i * CellHeight );
GfxLineTo( 5 *
CellWidth, i * CellHeight );
}
GfxMoveTo( 0,
i * CellHeight );
GfxLineTo( 5 *
CellWidth, i * CellHeight );
for( Col = 1;
Col < 6; Col++ )
{
GfxMoveTo( Col
* CellWidth, 0);
GfxLineTo( Col
* CellWidth, 10 *
CellHeight );
}
/////////////////////////////////////////////////////////
// Part 2: MOUSE BUTTON CALL BACKS
//////////////////////////////////////////////////////////
Title="";
function DrawButton(
px, py, Clr1, Clr2, text )
{
Col = floor(
px / CellWidth );
Row = floor(
py / CellHeight );
GfxGradientRect(
Col * CellWidth, row * CellHeight, (Col + 1 )
* CellWidth, (row + 1 )
* CellHeight,
Clr1,
Clr2 );
PrintInCell( text + " " +
row + "," + Col, row, Col
);
}
function OnLMouseButton(x,
y, px, py)
{
_TRACE("LButton
x = " + DateTimeToStr(
x ) + " y = " + y );
DrawButton( px, py, ColorHSB( 50, 255, 255 ), ColorHSB( 90, 255, 255 ), "just
clicked" );
}
function OnRMouseButton(x,
y, px, py)
{
_TRACE("RButton
x = " + DateTimeToStr(
x ) + " y = " + y );
}
function OnMMouseButton(x,
y, px, py)
{
_TRACE("MButton
x = " + DateTimeToStr(
x ) + " y = " + y );
}
function OnHoverMouse(x,
y, px, py)
{
_TRACE("LButton
x = " + DateTimeToStr(
x ) + " y = " + y );
DrawButton( px, py, ColorRGB( 230, 230, 230 ), ColorRGB( 255, 255, 255 ), "mouse
over" );
}
function OnLButtonIsDown(x,
y, px, py)
{
_TRACE("LButton
x = " + DateTimeToStr(
x ) + " y = " + y );
DrawButton( px, py, ColorHSB( 190, 255, 255 ), ColorHSB( 210, 255, 255 ), "down" );
}
/////////////////////////////////////////////////////////
// Part 3: GENERAL PURPOSE EVENT HANDLER (reusable!
- may be put into "include" file)
////////////////////////////////////////////////////////
function EventHandler()
{
local b,
x, y, px, py;
b = GetCursorMouseButtons();
// retrieve co-ordinates in date/value units
x = GetCursorXPosition(0);
y = GetCursorYPosition(0);
// retrieve co-ordinates in pixel units
px = GetCursorXPosition(1);
py = GetCursorYPosition(1);
if( b & 8 ) //
flag = 8 is set when window just received mouse click
{
// not-null means clicked in THIS (current)
window
if(
b & 1 ) OnLMouseButton(
x, y, px, py );
if(
b & 2 ) OnRMouseButton(
x, y, px, py );
if(
b & 4 ) OnMMouseButton(
x, y, px, py );
}
else
{
if(
b == 0 ) OnHoverMouse(
x, y, px, py ); // no button pressed
if(
b == 1 ) OnLButtonIsDown(
x, y, px, py ); // button pressed
}
}
EventHandler();
RequestTimedRefresh( 1 );
- GetCursorXPosition/GetCursorYPosition return non-null values when mouse
is over the current chart regardless if it was clicked or not
- BUGFIX: trend line sometimes moved to the right edge when drawing/moving
them while two charts were opened in different periods
- Selector line is not drawn (does not blink) when GfxOverlayMode is set
to 2
- Walk Forward document can now be closed and/or hidden during WF (it is
not re-opened constantly)
CHANGES FOR VERSION 5.04.2 (as compared to 5.04.1)
- New log scale (5.04.1) was not working nicely for small dynamic range
charts - chart looked compressed. Fixed now.
- Chart Periodicity on MDI tab is now updated when switching
- Trendlines work fine with thick and dotted styles again (broken in 5.04)
- AFL: GetCursorXPosition/GetCursorYPosition functions changed
1. The functions now by default return NULL (empty value) if mouse is OUTSIDE
the current window
2. New "mode" parameter controls what values are returned
GetCursorXPosition( mode = 0 )
GetCursorYPosition( mode = 0 )
mode = -1 - (old compatibility mode) - x - value gives X-coordinate
in DateTime format. y - value gives PRICE. Values are reported no matter
where is the mouse (i.e. may refer to window different than current if
mouse is outside current window).
mode = 0 - (default) x - value gives X-coordinate in DateTime format. y
- value gives PRICE. Returns NULL if mouse is outside current window
mode = 1 - x, y - are mouse coordinates expressed in screen PIXELS. Returns
NULL if mouse is outside current window
CHANGES FOR VERSION 5.04.1 (as compared to 5.04.0)
- WF: Settings "Optimization target" combo box shows all built-in
fields now
- WF: now combined in-sample and out-sample equities are available by ~~~ISEQUITY
and ~~~OSEQUITY composite tickers
(consecutive periods of IS and OOS are concatenated and scaled to maintain
continuity of equity line - this approach assumes that you generally speaking
are compounding profits)
To display IS and OOS equity you may use for example this:
PlotForeign("~~~ISEQUITY","In-Sample
Equity", colorRed, styleLine);
PlotForeign("~~~OSEQUITY","Out-Of-Sample
Equity", colorGreen, styleLine);
Title = "{{NAME}}
- {{INTERVAL}} {{DATE}} {{VALUES}}";
- WF: in-sample best uses "first best" result consistenly instead
of quicksort (that did not prevent original order)
- WF: the output window is re-open when user closes it during Walk Forward
optimization
- Log chart scaling enhanced to handle nicely extreme dynamic range
CHANGES FOR VERSION 5.04.0 (as compared to 5.03.0)
- AFL Formula Editor: Copy-paste does not "eat" last character
- AFL Formula Editor: Edit->Prettify Selection function added
- Calling Activate() method of Window object does not maximize MDI window
any more
- Print Preview works fine now with floating windows
- Walk-Forward Optimization implemented (v1)
CHANGES FOR VERSION 5.03.0 (as compared to 5.02.2)
- Fixed: Pane/Template options do not work on floating window
- Added: Interval linking
- New linking settings are now saved in layouts and restored properly
- (re-)added: Cursor linking - selector line moves together in symbol and/or
linked charts
- Removed File->New->Linked chart (new linking replaces this functionality)
- Fixed: Layouts with old-style linked charts are now automatically converted
into new scheme when loading layout
CHANGES FOR VERSION 5.02.2 (as compared to 5.02.1)
- fixed problem with c-like multi-line comments /* */ that appeared in
5.02.1 beta
CHANGES FOR VERSION 5.02.1 (as compared to 5.01.1)
- Implemented Unlimited nesting of #include and #include_once
- True multi-monitor support. Chart windows can now be floated (outside
main application frame) and moved to different monitors
- Implemented new way of symbol-linking of charts (the button next to scrollbar
allows to choose linked group (1-9))
- Fixed crash when attempting to backtest on empty watch list (bug introduced
in 5.01)
- AFL: SetBarFillColor( colorarray ) allows to independently control candlestick,
bar, cloud, and area chart fill color
- OLE: when Broker.Application reference count drops to zero and AB was
not running prior to CreateObject() then the AB is closed
- Implemented workaround to Windows XP list view drawing bug (MS KB813791)
- Floating pane title is synchronized now (5.02.0 fix)
CHANGES FOR VERSION 5.01.1 (as compared to 5.01.0)
- fixed loading of customized toolbars
- toolbar customizations are now stored in Broker.exe-CommandBars51 (number
increased) to isolate new betas and old versions
CHANGES FOR VERSION 5.01.0 (as compared to 5.00.0)
- Tweaks in backtester for improved performance
Portfolio backtester on average 2x faster for both multiple and single-security
tests (some trivial, frequently trading systems may observe upto 5x speedup
on multiple securities during long analysis periods). Note that AFL engine
speed has NOT changed as compared to 5.00. Speed increase comes from backtester
tweaks alone, so the longer AFL code is the less speed-up you will see,
because backtester processing would account for smaller part of overall
execution time.
- Tweaks in quote handling for improved performance
- Code profiler - shows code analysis with detailed per-function timing
report. Available from AFL Editor: Tools->Code Check & Profile menu
CHANGES FOR VERSION 5.00.1 (as compared to 5.00.0)
- Minor corrections to documentation
- Small changes for compatiblity with 64 bit version
- Version number bumped and release marked as official
CHANGES FOR VERSION 5.00.0 (as compared to 4.99.0)
- Database Purify: Date column type in set correctly now so clicking on
column sorts by date instead of by alpha (FC#1130)
- Elapsed/estimated time is updated constantly when running long optimizations
(FC#1107)
- Extra characters in the title occuring when using dynamic color with
Null values in Plot() statements. Fixed. (FC#1129)
- Fixed saving of new commission table (FC#1122)
- In some cases slider did not allow to reach the upper margin of Param()
when step was decimal fraction like 0.1 due to floating point rounding.
Now it addressed. (FC#1155)
- Price Chart Style is now saved in a layout/template (FC#1039)
- When Find/Replace dialog is still open while Formula Editor is closed
it does not cause exception anymore
CHANGES FOR VERSION 4.99.0 (as compared to 4.98.0)
- A warning added when closing the last chart window
- Fixed possible stack overflow when using ASCII importer for files without
extension but with . (dot) in a path (directory) name
- TimeFrameMode(3) (range mode) was not functional in 4.98, now it is fixed
- Fixed calculation of profit of leveraged instruments denominated in non-base
currency when dynamic fx rate was used
- Private heap allocator implemented for quotes and for trading signals
This should resolve problem of getting "out of memory" problem
that could occur during very long optimizations due to poor handling of virtual
memory in Windows.
CHANGES FOR VERSION 4.98.0 (as compared to 4.97.0)
- N-tick intervals from View->Intraday menu are enabled again in tick
databases (were disabled in 4.97 only)
- AFL: Status() function: 2 new fields added
" axisminy" - retrieves the minimum (bottom) value of Y axis (indicators
only)
" axismaxy" - retrieves the maximum (top) value of Y axis (indicators
only)
Example 1:
Title = "Axis
Min Y = " + Status("axisminy")
+ "Axis Max Y = " + Status("axismaxy");
Example 2:
SetChartOptions( 3, 0,
ChartGridMiddle );
axismin = Status("axisminy");
axismax = Status("axismaxy");
Plot( C, "Price", colorBlack, styleBar );
// draw exactly 5 grid lines
for( i = 0;
i < 5; i++ )
{
y = axismin + i * (axismax - axismin)/4;
PlotGrid(
y, colorRed );
}
- HTML export / import now store extra information about the kind of file
exported so when you export optimization result and re-import it later
you will be able to use optimization graph (FC#: 1029)
- HTML import: sometimes when importing large files duplicate rows appeared
at the end - now it is fixed (FC#1024)
- Fixed formatting of numeric values above 100000 after HTML import when
comma used as thousands separator (FC#: 1029)
- Added protection against using file-system reserved characters (*?#:|></"\)
in watch list names
- Implemented 5-tier commission schedule table in backtester (AA->Settings:
Commission table : DEFINE...) (FC#270)
- Account Manager: commission was not subtracted from equity when scaling-in
position that was open in previous amibroker run, now it is fixed
- Fixed problem with "Use only local database for this symbol" being
set to "yes" during loading of the database with absent broker.master
file
CHANGES FOR VERSION 4.97.0 (as compared to 4.96.0)
- Range Bar compression implemented now (FC#: 210, 1041,897,284)
Range Bars are price-driven bars, with each bar having a required minimum
high-low range. Source data are consolidated into one bar until the range
requirement is reached, then a new bar is started. It works best with tick
data that have only one price per data point. You can use it with other base
time intervals as well, but please note that if single source bar H-L range
exceedes desired range, the output will be single bar that has range higher
than requested. In other words source bars exceeding desired range won't
be splitted into several range bars. For example if you use 1 minute bars
and there is $3 dollar movement and you have selected $1 range bars it won't
be splitted into 3 bars. Instead you will get single bar with original $3
range.This is so because AB has no idea what happened *inside* the bar. Prices
could move first downwards and later upwards or opposite or zigzaging several
times or making any other pattern inside bar and this information is not
available from source bar that only has OHLC prices. Note that range bar
compression is not standarised. Some other softwares may attempt to split
to several artificial bars when range is exceeded, but we belive it is wrong
since it is based on assumptions about price action inside bar that may and
usually are wrong.
Range bars can now be selected as custom compression from Tools->Preferences->IntradayRange
bars are also available via TimeFrameMode() function
TimeFrameMode( 3 ); //
turn on range bars
TimeFrameSet( 1.5 ); //
set compression to 1.5$ range bar
- Mersene Twister MT19937 random number generator added
Two new AFL functions:
mtRandom( seed = Null ) - returns single random number (scalar) in the range
[0,1)
mtRandomA( seed = Null ) - returns array of random numbers in the range of
[0,1)
seed is random generator seed value. If you don't specify one, the random
number generator
is automatically initialized with current time as a seed that guarantees
unique sequence
Both functions use Mersene Twister mt19973ar-cok algorithm.
(Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura.)
Mersene Twister is vastly superior to C-runtime pseudo-random generator
available via Random() function.
It has a period of 219973 = approx 2.9*106012 For more information visit:
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
See also:
M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions
on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3--30.
- AFL: PopupWindow() function added (FC#: 840)
SYNTAX:
PopupWindow( bodytext, captiontext, timeout = 5, left = -1, top = -1 );
bodytext - the string containing the text of the window body
caption - the string containing the text of window caption
timeout - auto-close time in seconds (default 5 seconds)
left - top-left corner X co-ordinate (default = -1 -means auto-center)
top - top-left corner Y co-ordinate (default = -1 - means auto-center)
Example code:
if( ParamTrigger("Display
Popup Window", "Press
here" ) )
{
PopupWindow("Current
time is: " + Now(),"Alert", 2, 640*mtRandom(), 480*mtRandom());
}
- ASCII Importer: $TIMESHIFT option added (FC# 1094)
Added ability to time-shift data at the time of the import.
$TIMESHIFT shift_in_hours
For example:
$TIMESHIFT 2
will import with date/time stamps shifted 2 hours forward
$TIMESHIFT -11.5
will import with date/time stamps shifted 11 and half hour backward
Please note that only INTRADAY data (with TIME component provided) are shifted.
EOD data (without time field) are unaffected.]
- AFL: GetPlaybackDateTime() (FC#: 837)
pt = GetPlaybackDateTime(); //
new function to retrieve playback position date/time,
//returns zero if bar replay is NOT active
if( pt )
{
Title = "Playback
time: " + DateTimeToStr(
pt );
}
else
{
Title = "Bar
Replay not active";
}
It returns zero if bar replay is not active.
- Fixed lockup when bar replay was attempted on base time interval = tick
- Fixed passing IDispatch parameters to OLE/COM method calls
- Fixed error message typo in SetCustomBacktestProc (FC: 1085) "exit" vs "exist"
- 3D optimization chart viewer: added 4x4 Full Screen Anti-Aliasing for
beautifully smooth 3D charts and improved readability
4x4 Full-Screen Anti-Aliasing (FSAA) feature is available only on graphic
cards that support this in hardware (all NVidia GeForce cards, and most recent
graphic cards that have 3D acceleration). It is not available for low-end
graphic cards sometimes found in the cheapest notebooks.
If FSAA is not supported by the hardware View->Anti-aliasing menu item
will be disabled (grayed).
If FSAA is supported in hardware then it will be turned on by default.
Note that animation speed with FSAA turned on may be lower on slower graphic
cards. If speed is not acceptable you can turn off anti aliasing by unchecking
View->Anti-aliasing menu (or turning off "A" button in the toolbar)
of 3D chart viewer (O3G.exe).
CHANGES FOR VERSION 4.96.0 (as compared to 4.95.0)
- HTML Import to AA result list implemented (FC#579)
Note that this feature is intended to import only HTML files exported by
AmiBroker. The HTML parser used is specifically written for this particular
purpose and expects certain layout of HTML file. HTML files saved by other
programs can not be imported. Use Automatic Analysis -> File -> Import
to access this feature.
- Account manager: added "per-trade" commission setting (FC#:
973)
- Two new backtester modes that do not remove redundant signals (FC#: 105)
- RAW MODE: signal-based backtest, redundant (raw) signals are NOT
removed, only one position per symbol allowed:
- RAW MODE WITH MULTIPLE POSITIONS - signal-based backtest, redundant
(raw) signals are NOT removed, MULTIPLE positions per symbol will
be open if BUY/SHORT signal is "true" for more than one
bar and there are free funds, Sell/Cover exit all open positions
on given symbol, Scale-In/Out work on all open positions of given
symbol at once.
- AFL: new function SetBacktestMode( mode )
Sets working mode of the backtester:
// default, as in 4.90, regular, signal-based
backtest, redundant signals are removed
SetBacktestMode(
backtestRegular );
// signal-based backtest, redundant (raw)
signals are NOT removed, only one position per symbol allowed
SetBacktestMode(
backtestRegularRaw );
// signal-based backtest, redundant
(raw) signals are NOT removed,
// MULTIPLE positions per symbol will
be open if BUY/SHORT signal is "true" for more than one bar and
there are free funds
// Sell/Cover exit all open positions
on given symbol, Scale-In/Out work on all open positions of given
symbol at once.
SetBacktestMode(
backtestRegularRawMulti );
// rotational trading mode - equivalent
of EnableRotationalTrading() call
SetBacktestMode(
backtestRotational );
- AA window: custom draw buttons (with arrows) are redrawn on killfocus
event to prevent flickering
- Fix: when symbol is deleted from database it is removed from all new
watchlists as well
- Attempt to assign value to the element of the array named the same as
the function inside the function declaration produces error 33 now instead
of crash (FC#: 1011)
- Clicking RMB->Watchlist->Remove inside watch list node was removing
symbol from all watch lists. Now it is fixed.
- Fixed cell text truncation that could happen randomly when using HTML
export
- Position of compound drawings (retracements/cycles) is updated correctly
now when "Properties" dialog was choosen from without selecting
the drawing via LMB click
- Stops were reset to default values (from settings) when custom backtest
routine was stored in separate file (not embedded or included in the formula).
Now it is fixed
CHANGES FOR VERSION 4.95.0 (as compared to 4.94.0)
- Added support for AFL Code Wizard (Analysis->AFL Code Wizard menu
and toolbar button)
AFL Code Wizard is a new add-on for AmiBroker. It allows creation
of trading system formulas without ANY programming experience. It is
available for purchase for $49 one-time fee. Further upgrades are free.
AmiBroker comes with trial version that has all functionality *including*
export of auto-generated AFL formula to AmiBroker. The only missing feature
in trial version of AFL COde wizardis saving the project in .awz format.
To run it select Analysis->AFL Code Wizard menu.
AFL Code Wizard instructional video can be found at: http://www.amibroker.com/video/amiwiz/AFLWiz1.html
- Symbol Tree->Right click->Watch List->Type In works from any
node now (FC#991)
- Filter window supports more than 256 watchlists (FC#1006)
- Aliases are properly recognized when adding symbols to new watchlists
CHANGES FOR VERSION 4.94.0 (as compared to 4.93.0)
- AFL: 23 new low-level graphic functions allowing Windows GDI-like painting
Completely new low-level graphic AFL interface allows complete flexibility
in creating any kind of user-defined display.
The interface mimics closely Windows GDI API, with same names for most functions
for easier use for GDI-experienced programmers. The only differences are:
1. compared to Windows GDI all functions are prefixed with 'Gfx'
2. pen/brush/font creation/selection is simplified to make it easier to use
and you don't need to care about deletion of GDI objects
3. Three overlay modes are available so you can mix low-level graphics with
regular Plot() statements
(mode = 0 (default) - overlay low-level graphic on top of charts, mode =
1 - overlay charts on top of low-level graphic, mode =2 - draw only low-level
graphic (no regular charts/grid/titles/etc))
Low-level graphics tutorial: http://www.amibroker.com/guide/h_lowlevelgfx.html
Available low-level gfx functions (click on the links for detailed explanation):
GfxMoveTo( x, y ) http://www.amibroker.com/f?gfxmoveto
GfxLineTo( x, y ) http://www.amibroker.com/f?gfxlineto
GfxSetPixel( x, y, color ) http://www.amibroker.com/f?gfxsetpixel
GfxTextOut( "text", x, y ) http://www.amibroker.com/f?gfxtextout
GfxSelectPen( color, width = 1, penstyle = penSolid ) http://www.amibroker.com/f?gfxselectpen
GfxSelectSolidBrush( color ) http://www.amibroker.com/f?gfxselectsolidbrush
GfxSelectFont( "facename", pointsize, weight = fontNormal,
italic = False, underline = False, orientation = 0 ) http://www.amibroker.com/f?gfxselectfont
GfxRectangle( x1, y1, x2, y2 ) http://www.amibroker.com/f?gfxrectangle
GfxRoundRect( x1, y1, x2, y2, x3, y3 ) http://www.amibroker.com/f?gfxroundrect
GfxPie( x1, y1, x2, y2, x3, y3, x4, y4 ) http://www.amibroker.com/f?gfxpie
GfxEllipse( x1, y1, x2, y2 ) http://www.amibroker.com/f?gfxellipse
GfxCircle( x, y, radius ) http://www.amibroker.com/f?gfxcircle
GfxChord( x1, y1, x2, y2, x3, y3, x4, y4 ) http://www.amibroker.com/f?gfxchord
GfxArc( x1, y1, x2, y2, x3, y3, x4, y4 ) http://www.amibroker.com/f?gfxarc
GfxPolygon( x1, y1, x2, y2, ... ) http://www.amibroker.com/f?gfxpolygon
GfxPolyline( x1, y1, x2, y2, ... ) http://www.amibroker.com/f?gfxpolyline
GfxSetTextColor( color ) http://www.amibroker.com/f?gfxsettextcolor
GfxSetTextAlign( align ) http://www.amibroker.com/f?gfxsettextalign
GfxSetBkColor( color ) http://www.amibroker.com/f?gfxsetbkcolor
GfxSetBkMode( bkmode ) http://www.amibroker.com/f?gfxsetbkmode
GfxGradientRect( x1, y1, x2, y2, fromcolor, tocolor ) http://www.amibroker.com/f?gfxgradientrect
GfxDrawText( "text", left, top, right, bottom, format
= 0 ) http://www.amibroker.com/f?gfxdrawtext
GfxSetOverlayMode( mode = 0 ) http://www.amibroker.com/f?gfxsetoverlaymode
- AFL: Two new fields in Status() functions: pxwidth and pxheight (
Status("pxwidth") - gives pixel width of chart window (useful for
low level graphics functions that operate on pixels)
Status("pxheight") - gives pixel height of chart window
- Better scaling and no more black rectangle on the bottom in images created
via Edit->Image->Copy / Export
- "New Look" charts (switchable via Tools->Preferences "Charting")
- give cleaner, larger and more readable chart display and printout
- Printing/copy-metafile function uses now Enhanced Metafile format that
handles clipping regions (styleClipMinMax)
CHANGES FOR VERSION 4.93.0 (as compared to 4.92.0)
- Fixed exception that maight occur when copying to clipboard very long
lines from AA result list
- CategoryGetName() now returns empty string for non-existing categories
instead of some uninitialized (random) string
- Fixed exception when trying to apply commentary on blank chart pane
- AFL editor fix: right Alt + z does not trigger 'undo' anymore (allows
to enter Polish z (z-dot-above) letter)
- Fixed exception occuring when Symbol Information was edited at the same
time while first auto-analysis was run
- Fixed bar replay not functioning when viewing interval was the same
as base time interval and set to less than 5 minute, mixed mode was off,
and no afterhours/weekend filtering was enabled (FC#: 899)
- Fix: defined FXRate for the very first symbol in the database is used
correctly now (FC#: 975)
- When LoadFormula() method of Analysis object is called parameters are
reset now (FC#: 958)
- Ability to export Chart in "portable" format so you can distribute
chart templates to others and they will be restored together with all linked
formulas (FC#: 96)
This feature is available from RIGHT CLICK on chartTemplate->Save...Template->Load...
menus.
In addition to old local template format a new one is added with .chart extensionthat
keeps not only window sizes and formula references (paths) but also formulas
themselves,so all you need to do is to save your chart into one file (Chart
Template, Complete *.chart)and copy that file onto different computer and
chart will be recreated with all formulas linked to it.
To Save chart into new format do the following:
1. Click with RIGHT MOUSE button over the chart and select Template->Save...
2. In the file dialog, "Files of type" combo select "Chart
Template, Complete (*.chart)"
3. Type the file name and click Save.
To load previously saved complete chart do the following:
1. Click with RIGHT MOUSE button over the chart and select Template->Load...
2. In the file dialog, select previously saved *.chart file and press "Open"
Note: The procedure AmiBroker does internally is as follows: When you save
the chart into new format it saves XML file with:
a) names of all sheets, panes, their sizes, locations and other settings
b) paths to all formulas used by all panes
c) the text of formulas themselves
When you load the chart in new format AmiBroker:
a) sets up the sheets/panes according to information stored in the file
b) for each formula stored in the file it checks if the same formula exists
already on target computer:
- if it does not exist - it will create one
- if it exists and the contents is identical to the formula stored in .chart
file it will do nothing
- if it exists and the contents is different then it will create NEW formula
filewith _imported.afl suffix (so old file is not touched) and will reference
the pane to the _imported.afl formula instead.
IMPORTANT NOTE: if you use any #include files AmiBroker will store the contentsof
include files as well inside chart file and will attempt to recreate them
on target machine.Please note that in case of includes it will check if it
exists and if it is different.If both conditions are met (different file
exists already) it will ask to replace or not.If you choose to replace -
it will replace and make backup of existing one with .bak extensionIf you
are using any files in "standard include files and include them using <> braces,
AmiBroker will restore files in target machine standard include folder as
well evenif the standard include folder path is different on the source machine).
Note also - that this functionality is a bit experimental and pretty complex
internally. There may be some bugs even though it was tested on number of
different setups. Feedback is welcome. It is intended to be used to port
charts between different computers. For storing layouts/templates on local
computer you should rather use old formats as they consume much less space
(they store only references,not the formulas themselves). One may however
use new format for archiving purposes as itkeeps formulas and all references
in one file that is very convenient for backups.
CHANGES FOR VERSION 4.92.0 (as compared to 4.91.1)
- Watch list tooltips now show WL ordinal number (index), name and symbol
count
- new menu item "WatchLists->Hide Empty watchlists" allows
to show/hide empty watchlists
Note that when you add new watch list AmiBroker will automatically unhide
empty watch lists so you can see newly added list.
- AFL: Category* functions work fine now with more than 256 watch lists
- AFL: new function: CategoryFind() allows to search for category by name
SYNTAX: CategoryFind( "name", category )
RETURNS: number
FUNCTION: It allows to search for category by name. It takes category name
and kind as parameters and returnsINDEX (ordinal number). For example it
allows to find watch list index by name:
wlnumber = CategoryFind("MyWatch
List 1", categoryWatchlist );
mysymbols = CategoryGetSymbols(categoryWatchlist,
wlnumber );
The index (in the above example watch list number) can be later used in functions
thatneed the index (like CategoryGetSymbols).
- AFL: new function: InWatchListName() allows to reference watch list
by name
It is equivalent to InWatchList function except that it takes watch list
name as parameter instead of the index.
SYNTAX InWatchListName( "listname" )
RETURNS NUMBER
FUNCTION Checks if the stock belongs to a watch list having name of listname.
If yes - the function returns 1 otherwise 0.
EXAMPLE
Filter= InWatchListName( "mywatchlist" ) OR InWatchListName( "mysecondwatchlist" );
Note that this function is a bit slower than InWatchList() function.
- Fixed Watch List Export - now exports from selected watch lists (not
only from watch list number zero)
If you select only one watch list to export then original symbol order is
preserved, multiple watch list export uses alphabetical order to prevent
duplicates.
- Fixed Watch List Sorting - now sorts selected watch list (not only watch
list number zero)
CHANGES FOR VERSION 4.91.1 (as compared to 4.91.0)
- fixed symbol tree refresh after Watchlist->Import
CHANGES FOR VERSION 4.91.0 (as compared to 4.90.5)
- AA: new options in the context menu "Replace watch list with the
results/selected results"
This new option empties the watch list before adding results. The order of
symbols in the result list is preserved in the watch list.
- Watchlists: context (right click) menu - now there is no WL selection
dialog displayed
If you select the watch list from symbol tree and click with RIGHT mouse
button to bring up watch list menu the selected watch list is used automatically
and watchlist selector dialog is not displayed.
- Watchlists: redesign - now there is no limit on number of watch lists you
can use
a) watch lists are now stored as text files inside "Watchlists" folder
inside database. The folder contains of any number of .TLS files with watch
lists themselves and index.txt that defines the order of watch lists. You
can add your own .tls file (one symbol per line) and AmiBroker will update
index.txt automatically (adding any new watch lists at the end)The .TLS files
can also be open in AmiQuote.
b) watch lists remember the order in which symbols were added, so for example
if you sort AA result list in some order and then you"add symbols
to watch list" the order will be kept in the watch list.
c) you can now Add/Delete watch lists using Symbol->Watch List-> menu
or from watch list context menuNote that if you have done any customization
to the menu, you may need to go to Tools->Customize, select "Menu
Bar" and press "Reset" button for this new menu items to
appear.
d) you can now alphabetically sort the symbols in the watch list
e) all watch lists are shown in the symbol tree now, even if they are empty.
f) for backward compatibility OLE automation WatchListBits/WatchListBits2
properties of Stock object continue to work for first 64 watch lists
(bit states are transparently emulated)
g) Watch lists created in 4.91 are not visible for older versions
-
When changing selected symbol, the tree is not traversed to the bottom
(root). Instead only current branch is checked and if symbol is selected
only if it is present under this branch (This prevents unnecessary unfolding
of "All" and other branches)
-
AFL Editor: AUTOWORDSELECTION turned off
-
AFL: switch/case statement added (completed: 2007-03-31) (ext.ID: 580).
More information: http://www.amibroker.com/guide/v50/keyword/switch.html
Example:
for(
n = 0; n < 10;
n++ )
{
printf("Current
n = %f\n", n );
switch(n)
{
case 0:
printf("The
number is zero.\n");
break;
case 3:
case 5:
case 7:
printf("n
is a prime number\n");
break;
case 2: printf("n
is a prime number\n");
case 4:
case 6:
case 8:
printf("n
is an even number\n");
break;
case 1:
case 9:
printf("n
is a perfect square\n");
break;
default:
printf("Only
single-digit numbers are allowed\n");
break;
}
-
AFL: break/continue statements added (supported inside for/while/do-while/switch
statements). More information:
http://www.amibroker.com/guide/v50/keyword/break.html
http://www.amibroker.com/guide/v50/keyword/continue.html
Example:
for(i
= 1; i < 1000;
i *= 2 )
{
if(
i > 50 ) break;
printf("%f\n",
i );
}
- AFL: new C-like assignment operators +=, -=, *=, /=, %=, &=, |=
New operators are shortcuts for some common operations.
x += y; is equivalent to x = x + y;
x -= y; is equivalent to x = x - y;
x *= y; is equivalent to x = x * y;
x /= y; is equivalent to x = x / y;
x %= y; is equivalent to x = x % y;
x &= y; is equivalent to x = x & y; // bitwise and
x |= y; is equivalent to x = x | y; // bitwise or
-
Enanced display in Real Time Quote window (dual-step change coloring
- when field changes it is highlighted with bright yellow for 0.25 second
then color changes to pale yellow and after a while to default (white)
background))
CHANGES FOR VERSION 4.90.4 (as compared to 4.90.3)
- PointValue is now automatically set to 1 if FuturesMode is NOT enabled for given backtest (pre-4.90 behaviour)
- Fixed crash @040ecde occuring when user incorrectly specifed NULL as a plot color (this is user error but anyway should not crash) (FC#: 848)
- Fixed problem with data tips non displaying under some rare circumstances(FC#: 844)
- Fixed problem with loading layout that referenced non-existing symbol
- Max Title len increased to 9K characters (FC#: 534)
- Changes made to color/Thickness/Style of LOCKED studies is saved now even if position did not change (FC#: 846)
- Ticker bar now only needs pressing ESC once to lose focus (FC#: 842)
CHANGES FOR VERSION 4.90.3 (as compared to 4.90.2)
- Fixed GIF export from OLE level when bitdepth was not specified (FC#816)
- Notepad DEL key deletes one character now, not two (FC#817)
- MDITab titles are refreshed properly after loading the layout (FC#811)
- Layouts switching is faster
CHANGES FOR VERSION 4.90.2 (as compared to 4.90.1)
-
new account manager: fixed partial scaling out calcs
-
OLE automation server registration checks registry access rights
correctly on Windows Vista now (this prevents "Failed to update
registry. Try using REGEDIT" message on Vista)
-
Setup program now registers OLE servers by itself using elevated
rights on Vista (programs run with ordinary rights do not have access to
OLE
registration
on Vista)
-
AddToComposite: the combination
of atcEnableInIndicator + atcDeleteValues now invalidates cached foreign
data (FC#:
809)
CHANGES FOR VERSION 4.90.1 (as compared to 4.90.0)
-
Fixed exception @00435766 (displaying Interpretation for blank window)
-
Fixed exception @0044F999 (right click on title
bar area on blank chart to delete non existing section)
CHANGES FOR VERSION 4.90.0 (as compared to 4.89.0)
- Fixed problem with information window length constraint being set wrong
sometimes. (for example TickSize in View->Information was limited
to 4 digits after entering Currency field)
- Bar Replay current position static is now updated when changing start
date
- Fixed problem RTQ window stopped updating the symbol when it was listed
twice in different tabs and removed from one (FC#: 439)
- Fixed data tooltip display when xshift != 0 (FC#: 465)
- Fixed vertical grid Z-order when graphgridzorder = 1 (FC#: 377)
- Added "Use as default" box to Horizonal Line properties dialog
- when checked, current drawing "show value" selection is stored
as a default for all newly created horizontal lines (FC#: 389)
- Added File->New->Pane (creates blank pane)
- Added File->New->Blank chart (creates blank chart - you can drag-drop
formulas on it)
- Window->New Linked window menu has been replaced by File->New->Linked
Chart
- #30339 the limit of drawings per symbol has been increased from 5000
to 65000
[And contrary to previous (faulty) behaviour when limit is reached, you don't
lose your previous drawings. Now you just can't save more than 65000 drawings
per one symbol.]
- Renamed Tools->Auto-update quotes (US & Canada) to Auto-update
quotes (AmiQuote only) - new installations only
- Removed Tools->Export to CSV - new installations only
- Clipboard copy/paste now works OK on "Symbol ticker" combo
(in the toolbar)
- Warning message when deleting symbols changed to "Are you sure to
delete current symbol from the DATABASE !"
- Added open interest as a predefined formula
- Account manager: 5-tier commission table added
- Duplicate shortcut Alt+d for Edit / Define removed. Define now uses
'f' shortcut (FC#: 219)
- BarReplay is now paused temporarily when user is drawing objects or
printing
- Thick dotted line is now plotted with geometic pen on Win2000/XP or
higher (FC#: 720)
- Fixed problem with passing HGDI handles when printing
- Account manager cash calculation when scaling in fixed (FC#: 793)
- Added styleNoRescale to Bollinger Bands in Price (all-in-one).afl
- ASCII importer: volume is now NOT to adjusted when ADJCLOSE and CLOSE
is used
[To turn on adjusting (old, pre-4.90 behaviour) you need to add $SPLITADJVOL
1 to command to ASCII importer definition]
- FuturesMode setting set using SetOption #24503 works the same as in the
settings dialog
[The difference was due to the fact that PointValue set in the Information
window was not transfered to the formula when
Futures Mode was NOT set in the Settings dialog (further change by SetOption
did not transfer it).
Now Point Value is transfered always.]
CHANGES FOR VERSION 4.89.0 (as compared to 4.88.0)
- AFL: Static variables are now case insensitive (FC#: 663)
- AFL: SetSortColumns() function (FC#: 607)
SetSortColumns( col1, col2, .... )
sets the columns which will be used for sorting.
col1, col2, ... col10 -Column numbers are ONE-based. Positive number means
sort ASCENDING, negative number means sort DESCENDING. Upto 10 columns can
be specified for multiple-column sort. Each subsequent call to SetSortColumns
overwrites previous one.
Examples:
SetSortColumns( 5 ) - sort by 5th column in ascending order
SetSortColumns( -3 ) - sort by 3rd column in descending order
SetSortColumns( 1, -2 );
- sort by 1st column in ascending order and then by second column in descending
order (multiple-column sort).
- Web Research: Synchronization with currently selected symbol has now
three options:
Don't sync - does not synchronize with currently selected symbol
Sync active - synchronizes only when web research is active (or becomes active
by clicking on it)
Sync always - synchronizes web page always, even if web research window is
not active - warning: resource intensive
- New Account Manager added (completed: 2006-12-19)
Account manager provides ability to track your account portfolio. Account
manager functionality provides superset of features offered by old portfolio
manager, but still some things are left todo namely: multi-currency handling,
more stats (backtest-like), multi-tiered commission schedules etc.
Short Instructions:
CREATE A NEW ACCOUNT:
Use File->New->Account menu to create new account
FUNDING AN ACCOUNT:
Before you do any trading, you have to fund your account. To do so press "FUNDING" button
on the account manager toolbar, then select "Deposit" as operation
type, enter the DATE when you have funded your account and enter the amount.
Note that funding date must PRECEDE any trading, as account manager won't
allow you to trade prior to funding date. Initial deposit will show as "initial
equity" in summary tab.
CHECK THE SETTINGS
It is good idea to go to "Summary tab" and setup commissions and
trading mode. If this account is used for End-of-day trading you should set "EOD
Mode" to YES, otherwise (if you trade intraday) you should set "EOD
Mode" to NO. Depending on this setting Buy/Sell dialogs will allowyou
to enter date and time of the trade or only date.
Commission schedule currently is only one-tier, in the future multiple-tier
commission schedules will be possible.
ENTERING TRADES:
Once you funded an account you can enter trades.To buy (enter long position
or cover short position ) click on "BUY" button.
Then in the Buy dialog you need to select the symbol, the trade date/time.
Once they are entered AmiBroker will display price of given symbol at the
selected date/time (or preceding one if no exact match is found). It will
also calculate maximum possible quantity taking price and available funds
into account.
You can change the price and quantity manually.
All other values (net market valye, commission, market deposit, currency,
fx rate) are calculated or retrieved automatically from Symbol->Information
page. Once values are good, click OK to confirm transaction. If you made
mistake, you can press UNDO (Edit->Undo) to revert last transaction.
Similar procedure is for selling (entering short positions or closing longs)
with the exception that you should press "SELL" button instead.
All transactions that you made are listed in the "Transactions" sheet.
All open positions are listed in "Open Positions" sheet. If you
enter the trade for symbol that has position already open, AMiBroker will
adjust "open positions" accordingly (perform scaling in/out). Once
open position is closed it is removed from "open positions" list
and moved to "Closed trades" sheet.
After each transaction, "Equity history" sheet is updated with
current account equity value and also "Summary" page is updated
with basic open/long/short trade stats.(More stats are to come).
IMPORTANT:
You have to remember that you must enter all transactions in chronological
manner(oldest first, newest last), as account manager won't allow you to
add trades out-of-order. If you make mistake, there is one-level undo that
you can use to revert to state before last transaction. If you made more
mistakes, the only option is to close account without saving and re-open
original file.
SAVING YOUR ACCOUNT DATA:
To save edits made to account use File->Save (or File->Save As to save
under new name). Note that account files are NOT encrypted now, and it is
quite easy to read the file for everyone who has the access to it. So make
sure not to leave your files on some public computer. Password protection/encryption
is planned but NOT implemented yet.
OPENING PREVIOUSLY CREATED ACCOUNT:
To open account file, go to File->Open, in the File dialog,select "Account
(*.acx)" from "Files of type" combo-box, and select the account
file you want to load.
MULTIPLE ACCOUNTS:
You can create/open multiple accounts at once (just use File->New->Account,
File->Open many times).
- Vertical selector line has now user-definable color / bold style and
it is plotted behind all graphs so it does not affect readability
Use Tools->Preferences->Color to adjust selector line color and style
- Charts: by default extra 3% space is added on the top of chart compared
to previous versions (4.88 or earlier)
- printf/strformat are now protected against buffer overrun (1024 bytes)
- Scroll-Bar Zoom feature implemented (dragging left or right edge of
chart scrollbar resizes it allowing to zoom in/out from the scrollbar)
(FC#619)
[To turn it OFF use
Tools->Preferences "Charting" tab:
UNCHECK "Enable Scroll Bar Zoom" box.]
- RequestTimedRefresh() was not always starting up correctly since 4.86
- fixed now.
- Range markers are now green (begin) and red (end) and are plotted with
lines with small 'flag-like' rectangle at the end
- When user types non-existing symbol in ticker box, AmiBroker asks whenever
it should be added or not
This allows very quick adding of new symbols directly from ticker box.
Just type symbol and press ENTER - if it does not exist - it will be added
and backfilled if you use real time data source
- When adding/deleting symbols, charts displayed keep selected symbol
- Added ability to create composites (using AddToComposite) inside indicator
code via new atcFlagEnableInIndicator flag (FC#: 191)
- AA window: now 'Sync chart' box is hidden when result list is maximized
- AFL: Implemented Say("text") function that speaks provided
text (Windows XP, on lower-end Windows you need to install Microsoft Speech
API, voice settings are in Windows Control Panel)
Example:
Say("Testing text to speech engine");
CHANGES FOR VERSION 4.88.0 (as compared to 4.87.1)
- Automatic Analysis window: Added "Sync chart on select" checkbox
when turned ON, selection of any line from result list automatically synchronizes
(displays) relevant chart. Selection can be made not only by mouse but
also by keyboard effectivelly allowing you to scroll through AA result
list using key down button and charts will be switching automatically.
Also when you press SPACE button, the arrows for selected trade/signal
will appear (only after backtest / scan)
- AFL Lexer code optimizations
Removed strncmp() C runtime calls from lexer and replaced it with hand optimized
code, gives on average 15% speed improvement on AFL execution on larger
formulas. NB. multi-line comment handling is speeded up this way as much
as 7 times.
- Bar Replay feature implemented (Tools->Bar Replay)
Bar Replay feature plays back data for ALL SYMBOLS at once. It means that
data for all symbols will end at specified "playback position".This
affects all formulas (no matter if they are used in charts or auto-analysis).
Controls description:
|<< - rewinds back to the beginning
< - one step back
[ ] - stop - turns bar replay OFF (chart are not affected by bar
reply)
|| - pause - pauses current playback or enters pause mode that
allows to manually drag the slider bar and affect chart display - in PAUSE
mode data are internally modified so quotes past selected "playback" position
are invisible to any part of AmiBroker ( charts / automatic analysis ),
except quotation editor
> Play - playback bars history
> - one step forward
>> | - goes to end of selected range
Slider bar - allows to see the playback progress as well as MANUALLY
move back and forward by dragging the slider thumb.
Start/End - controls provide start and end simulation dates. The
playback works so that all data UPTO currently selected "Playback
position" are visible. Data past this position are invisible. "Playback
position" can change from user-defined "Start" to "End"dates.
The small ^ buttons on the right side of Start / End date fields
allow to set Start/End to currently selected date on the chart.
Step interval - defines interval of the step. Recommended setting
is base interval of your database. So if you have 1-minute database, step
interval should be 1 minute. If you have EOD database, step interval should
be daily, however it is allowed to select higher step intervals. Note that
chart viewing interval is independent from that. So you can playback 1
minute database and watch 15 minute bars (they will look like real - building
last "ghost" bar as new data come in)
Speed parameter defines step frequency. It means how many steps
will be played back within one second.Default is 1. Maximum is 5 minimum
is 0.1. If you select 3 for example, AmiBroker will play one step every
0.333 sec giving total of 3 steps per second.
Skip afterhours - when turned on, playback skips hours outside
regular trading hours as defined in File->Database Settings->Intraday
Settings
Skip weekends - when turned on, playback skips Saturdays and Sundays
To ENTER PLAYBACK mode - press PLAY or PAUSE buttons - then data are truncated
at current "playback position")To EXIT PLAYBACK mode - press STOP
button or close Bar Replay dialog - the full data set will be restored.
Note that playback simulation is done internally and the database is kept
untouched in fact (all data are still visible in Quote Editor), so there
is no risk using Bar Reply.
- Added Insert->Select to Tools->Customize->Keyboard command list
to allow customers to add keyboard accelerator to this action
- Fib. TIME extensions , "lock position" now works correcly.
Also "bold" attribute can be now applied
CHANGES FOR VERSION 4.87.1 (as compared to 4.87.0)
- fixed symbol tree, right mouse click on the watch list causing exception
CHANGES FOR VERSION 4.87.0 (as compared to 4.86.0)
- Added "Request data on save" checkbox to File->Database
Settings->Intraday Settings
When this is turned ON, AmiBroker will query data plugin for fresh data when
saving database. This ensures that all collected real time data is transferred
to AmiBroker's own database.
Caveats:
1. if external data source uses automatic backfill - it may cause triggering
backfills during saving 2. turning this feature ON may slightly increase
CPU load
Recommendations:
Generally speaking all data sources with no backfill or slow backfill should
turn ON this feature,others (with fast backfill covering long histories)
should have this turned OFF.
IB plugin: recommended setting: ON
This feature is designed specifically with IB plugin in mind as it has very
limited backfill capabilities and it is good to savedata so it does not need
to be re-filled on next session.
eSignal plugin: recommended setting: OFF
Using eSignal with this feature turned on may cause excessive backfills and
exceeding eSignal symbol limit
IQFeed plugin: recommended setting: OFF
DDE plugin: recommended setting: ON
- Fixed minor save on exit problem
- New menu options
1. File->New -> Default Chart replaces Window->New
2. File->New -> Web Browser - creates new web browser window tab
3. File->New -> Account - creates new account manager window (still
in development, not available now) (Tools->Portfolio manager will soon
become obsolete)
4. File->New -> Database - replaces File-> New database
5. File->Save / Save As.- allows to save current document (such as HTML
page from the browser, or account information (in development))
6. File->Save All - saves ALL modified, open documents including all open
formula files
7. File->Close - closes currently open document (chart, browser or account)
Removed View->Profile menu option as it is now replaced by superior File->New->Web
Research
- Added Web Research window: multi-tab web browser with multiple built-in
financial sites templatized shortcuts
This feature effectively replaces and extends previous View->Profile functionality
that allowed to view single symbol profile web page. Now via File->New
-> Web Research you can open multiple (unlimited) tabbed web browsers
that allow to display unlimited(user configurable in Tools->Customize->Web
Pages. In addition to that the browser now features regular "Address" bar
that allows to type ANY URL address and use it as regular web browser.
" Open in New Window" option available from right click menu now opens
new web browser inside tab.
"
Sync" button when activated synchronizes web page with currently selected
symbol, so you can browse for example profiles of different symbols by
simply switching active symbol from the tree or combo box, without having
to type complex URL addresses.
- Added Customizing of Web Research addresses in Tools->Customize->Web
Pages dialog
Configuration data are stored in webpages.cfg plain text file that holds
any number of URL templates in the form of:
URLTemplate|Description
Description part is optional.URL template may use {t} marker that will be
replaced in runtime with currently selected ticker. For more info see:http://www.amibroker.com/guide/h_profiles.html(note
that old profile window is no longer available however, the URL template
encoding remains the same)
- Added ability to turn off MDI tabs (Tools->Customize->Appearance "Show
MDI tabs") - note however that it is not recommeded to turn them off
since window navigation will be more difficult
- Added Symbol->Next Sibling / Symbol->Prev Sibling commands to
Tools->Customize->Keyboard page (FC#.ID: 550)
This allows to navigate through symbols WITHIN selected category. On NEW
installations it will default to Alt+Shift+Left arrow/Right arrow
- Fixed "Remove" button positioning in Organize assignments
dialog
- Fixed combo box contents when "Indexes" are choosen in Assignment
organizer
- Implemented File->Save All - which saves all open, MODIFIED documents/files,
including AFL formulas
Note that because there is no editing functionality for HTML pages (Web Research
window) they are never in modified state, so they never get saved using "Save
All". To save HTML page you need to manually do Save on selected HTML
doc.
- Pane Up/Pane Down function does not change the original height of panes
moved
CHANGES FOR VERSION 4.86.0 (as compared to 4.85.0)
-
Added 'every tick' RT chart refresh in Professional Edition to already
existing 1-sec and up refresh intervals
To enable 'every tick' chart refresh in Professional Edition, go to Tools->Preferences,
Intraday tab and enter ZERO (0) into "Intraday chart refresh interval" field.
(note Standard Edition won't allow to do that).
Once you enter zero, AmiBroker will refresh all charts with every new
trade arriving provided that the formulasyou use execute fast enough.
If not, it will dynamically adjust refresh rate to maintain maximum possible
refresh rate without consuming more than 50% of CPU (on average). So
for example if your charts take 0.2 sec to execute AmiBrokerwill refresh
them on average 2.5 times per second.
Note: built-in Windows Performance chart shows cumulated CPU consumption
for all processes, to display PER-PROCESS CPU load use SysInternals free
software http://www.sysinternals.com/Utilities/ProcessExplorer.html
-
MDI tabs implemented
-
AFL: Added GetPerformanceCounter( bReset = False ) function
SYNTAX: GetPerformanceCounter( bReset = False )
RETURNS: Number
GetPerformanceCounter retrieves the current value of the high-resolution
performance counter. Returned value is in milliseconds. Resolution is
upto 0.001 ms (1 microsecond).The value of high-resolution counter represents
number of milliseconds from either system start (boot) or from last counter
reset.To reset the counter you need to call GetPerformanceCounter function
with bReset parameter set to True. Note that reseting counters inside
one formula does not affect counters in other formulas.Since returned
values are very large (time in milliseconds since system start is usually
quite large), for precise measurements of single function or small function
block execution times it is strongly recommended to reset counter at
the beginning of the block so floating point resolution (7 digits) does
not affect the precision of measurement. Example:
GetPerformanceCounter(True); //
reset counter to zero
for(
i = 0; i < 1000;
i++ )
{
k = sin( i
);
}
elapsed=GetPerformanceCounter();
"Time [ms] = "+elapsed;
The code above shows that 1000 iterations of sin() calculation takes about
1.7 milliseconds. Note that call to the GetPerformanceCounter() has overhead
of about 0.015 ms (15 microseconds)
GetPerformanceCounter function may also be used to report time since system
start:
elapsed=GetPerformanceCounter();
StrFormat("Time
since system start %.0f days, %.0f hours, %.0f minutes, %.0f seconds,
%.0f milliseconds ",
floor(elapsed/(24*60*60*1000)),
floor( elapsed/(60*60*1000)
) % 24,
floor( elapsed/(60*1000)
) % 60,
floor( elapsed/1000 )
% 60,
elapsed % 1000 );
It can be also used in trading system automation to measure time in
milliseconds between various events (just subtract values returned by
GetPerformanceCounter() during two different events)
Caveat: this function relies on Windows API QueryPerformanceCounter
function and CPU RTDSC instruction and it may yield to inaccurrate results
if you have multiple-core processor and AMD's "Cool and Quiet" enabled
in BIOS or other CPU clock stepping technologies enabled. If this applies
to you, you may check Microsoft hotfix to this problem at: http://support.microsoft.com/?id=896256
-
Fixed crash that sometimes occurred when chart using RequestTimedRefresh()
was closed
-
Added "Cancel" button to "Do you want to save database:
Yes/No" dialog that appears on AB exit when database is modified
-
Added registry key for controlling built-in exception handling.
If you are 3rd party developer working with Visual C++ debugger and
wanting exceptions to be caught by Visual Studio debugger instead of
AmiBroker's built-in crash recovery system contact AmiBroker support
and we will provide instructions how to disable it.
-
AFL: atan2( y, x ) implemented
atan2 returns the arctangent of y/x. If x is 0, atan returns 0. If both
parameters of atan2 are 0, the function returns 0. While atan returns a
value in the range –PI/2 to PI/2 radians; atan2 returns a value in
the range –PI to PI radians, using the signs of both parameters to
determine the quadrant of the return value.
-
AFL: FFT( array, size = 0 ) function implemented
FFT( array, len = 0 )
performs FFT (Fast Fourier Transform) on last 'len' bars of the array,
if len is set to zero, then FFT is performed
on entire array. len parameter must be even.
Result:
function returns array which holds FFT bins for first 'len' bars. There
are len/2 FFT complex bins returned,
where bin is a pair of numbers (complex number): first is real part of
the complex number and second number
is the imaginary part of the complex number.
result = FFT( array, 256 );
where:
0th bin (result[0] and result[1]) represents DC component,
1st bin (result[1 ] and result[2]) represents real and imaginary parts
of lowest frequency range
and so on upto result[ len - 2 ] and result[ len - 1 ]
remaining elements of the array are set to zero.
FFT bins are complex numbers and do not represent real amplitude and
phase. To obtain amplitude and
phase from bins you need to convert inside the formula. The following code
snipplet does that:
ffc = FFT(data,Len);
for( i = 0;
i < Len - 1;
i = i + 2 )
{
amp[ i ] = amp[ i + 1 ]
= sqrt(ffc[ i ]^ 2 + ffc[
i + 1 ]^2);
phase[ i ] = phase[ i + 1 ]
= atan2( ffc[ i + 1],
ffc[ i ] );
}
IMPORTANT note: input array for FFT must NOT contain any Null values.
Use Nz() function to convert Nulls to zeros
if you are not sure that input array is free from nulls.
Example formula:
SetBarsRequired(100000,100000);
Len = Param("FFT
Length", 1024, 64, 10000, 10 );
Len = Min( Len, BarCount );
x = BarIndex();
x1 = x - BarCount +
Len;
input = C;
a = LastValue( LinRegIntercept(
input, Len - 1 )
);
b = LastValue( LinRegSlope(
input, Len - 1 )
);
Lr = a + b * x1;
data = input - Lr;// de-trending
ffc = FFT(data,Len);
for( i = 0;
i < Len - 1; i
= i + 2 )
{
amp[ i ] = amp[ i + 1 ]
= sqrt(ffc[ i ]^ 2 + ffc[
i + 1 ]^2);
phase[ i ] = phase[ i + 1 ]
= atan2( ffc[ i + 1],
ffc[ i ] );
}
auto = ParamToggle("Auto
dominant cycle", "No|Yes", 1 );
sbar = Param( "Which
FFT bin", 1, 0, 50 );
skipbin1 = ParamToggle("Skip
1st FFT bin", "No|Yes", 1 );
if(
auto )
{
sbar = int( LastValue(ValueWhen(
amp == LastValue(Highest( IIf(
skipbin1 AND x < 4, 0 ,
amp ) )), x / 2 )) );
}
fv = Status("firstvisiblebar");
thisbar = Ref( int(x/2)
== sbar, -fv);
Plot( Ref(amp,-fv),
"amplitude (bin " + Ref( int(x/2),
-fv ) +")", IIf(
thisbar, colorRed, colorBlack ),styleArea);
Plot( IIf( BarCount - BarIndex() < Len,
data, Null )
,
"de-trended input ("+Len+" bars)", colorOrange, styleLeftAxisScale );
Plot( cos(
phase[ sbar * 2 ]
+ (sbar) * x1 * 2 * 3.1415926 /
Len ),
"
dominant cycle "+ Len/(sbar) + "(" +
sbar + " bin) bars", colorBlue, styleOwnScale );
GraphZOrder=1;
GraphXSpace = 10;
-
Fixed: pre-defined color table in broker.prefs sometimes got corrupted
-
Repainting of RT quote window is now flicker-free on Windows XP and
higher
-
Symbol->Organize assignments, added ability to remove multiple symbols
at once from watch list, index and favourite categories
CHANGES FOR VERSION 4.85.0 (as compared to 4.84.0)
- AFL: Added DateTimeConvert function (FC#: 297)
DateTimeConvert( format, date, time = Null )
The function allows to convert from DateTime format to DateNum and TimeNum
and vice versa.
format parameter controls the direction of conversion:
format = 0 - converts DateTime format to DateNum format, example
mydatenum = DateTimeConvert( 0, DateTime()
);// - this returns DateNum
date argument should be in datetime formattime argument in this case should
not be used
format = 1 - converts DateTime format to TimeNum format, example:
mytimenum = DateTimeConvert( 1, DateTime()
); // - returns timenum
date argument should be in datetime formattime argument in this case should
not be used
format = 2 - converts from DateNum and optionally TimeNum to DateTime format,
example:
mydatetime = DateTimeConvert( 2, DateNum(), TimeNum()
);
date argument should be in datenum formattime argument (optional) should
be in timenum format. In case of EOD data you can skip time argument:
mydatetime = DateTimeConvert( 2, DateNum()
);
- K-ratio is now reported with 4 decimal places (FC#: 357)
- Added 'left side' display option to horizontal line labels and fixed
problem with label sometimes disappearing (completed: 2006-08-15) (FC#:
342)
- AFL: fgetstatus( filename, what, format = 0 )
Implemented
fgetstatus( filename, what, format = 0 )
function that retrieves file properties/status.
Returns NUMBER or STRING depending on format parameter
If file does not exist it returns Null.
Parameters:
filename - the name of the file (with or without full path) to query
what - specifies what file property to retrieve, allowable values
0 - the date/time the file was created
1 - the date/time the file was last modified
2 - the date/time the file was last accessed for reading
3 - the file size in bytes
4 - attribute byte of the file
format - specifies return format of date/time values (format specifications
are the same as in Now() function):
allowed values:
0 - returns string containing date/time formatted according to system settings
1 - returns string containing date only formatted according to system settings
2 - returns string containing time only formatted according to system settings
3 - returns DATENUM number with date
4 - returns TIMENUM number with time
5 - returns DATETIME number with date/time
6 - returns date DAY (1..31)
7 - returns date MONTH (1..12)
8 - returns date YEAR (four digit)
9 - returns date DAY OF WEEK (1..7, where 1=Sunday, 2=Monday, and so on)
10 - returns date DAY OF YEAR (1..366)
Note that Windows supports only 2 second resolution of file date/time stamps.
Example:
// get modification
date string of portfolio.afl file
fgetstatus("formulas\\Equity\\portfolio.afl",1,0);
- AFL: GetTradingInterface uses WaitForInputIdle now instead of fixed
interval wait when launching IB interface
- Disabled snapping to pixel resolution after manual editing of drawings
#32071
CHANGES FOR VERSION 4.84.0 (as compared to 4.83.1)
- Added GradientFillSlow code to support gradients on printers and metafiles
which do not support them natively (completed: 2006-07-28)
- Added GraphGridZOrder variable to control when grid lines are plotted
(completed: 2006-07-31) (ext.ID: 351)
When you specify
GraphGridZOrder = 1;
then grid lines are plotted on top of any charts
- AFL: new function RequestTimedRefresh( interval, onlyvisible = True )
(completed: 2006-08-06)
RequestTimedRefresh( interval, onlyvisible = True )
- causes given indicator window to refresh automatically every <interval> seconds
regardless of data source used or connection state.
interval parameter defines timeout in seconds between refreshes.
AmiBroker attempts to align refreshes to second boundaryso if you call
it RequestTimedRefresh( 5 ) you should get refreshes at 0, 5, 10, 15, 20,
25, 30, 35, 40, 45, 50 and 55 second of the minute.Due to the way how regular
(low overhead) timers are implemented in Windows they have accurracy of
+/-55ms providedthat CPU is not very busy. Don't expect to get first line
of your code to execute exactly at .000 milliseconds. This varies depending
on machine load, number of quotes, system time slice and tens of other
factors.Usually (on my testing machines) the first line of the code executes
anywhere in the first 100 ms of the second, provided that other processes
do not interfere. Windows is not real-time operating system and it does
not guarantee any fixed execution/reaction times.
onlyvisible parameter set to True (default value) means that refreshes
are triggered only for visible and not minimised windows. This applies
also to main AmiBroker window - when it is minimised charts are NOT refreshed
by default. To force refreshes when window is minimised you need to set
this parameter to False. Note that this visibility applies to mostly to
'minimised' state or the situation when you move chart outside the boundary
of physical screen so it is not visible to an eye but still open. It does
not apply to chart windows that are on placed on inactive sheets, as they
do not really exist until they are shown (this way AmiBroker conserves
memory and CPU) and as non-existing, can not be refreshed.
Example:
RequestTimedRefresh( 5 ); // automatically refresh this particular chart
every 5 seconds
Hint: to detect whenever given refresh comes from timer or user action you
can use Status("redrawaction") function. It returns 0 for regular
refresh (user action) and 1 for timer-refresh
- AFL: Status("redrawaction") added (completed: 2006-08-06)
Status function now supports new field: redrawaction
Status("redrawaction")
It returns 0 (zero) for regular refreshes, and 1 for refreshes triggered
via RequestTimedRefresh(). Note that in the future more return values can
be added.
Example:
if( Status("redrawaction")
==1 )
{
_TRACE("\nTIMED
REFRESH"+Now());
}
RequestTimedRefresh(1);
- CreateStaticObject() actually calls internal CreateStaticObject :-)
- for some reason it was calling regular CreateObject() instead. (completed:
2006-07-27)
- Fixed problem with HoldMinDays sometimes allowing exit too soon (completed:
2006-07-29)
- Fixed: Custom metric sort problem in optimization result list (occurred
in 4.83 only) (completed: 2006-07-29) (ext.ID: 345)
- Pane resizing algorithm changed so if you drag the divider between panes
only neighbouring panes are resized (others remain unchanged)
- Real time quote parent window has WS_CLIPCHILDREN style in order to
fix some minor redraw issue (completed: 2006-07-31)
CHANGES FOR VERSION 4.83.1 (as compared to 4.83.0)
- Fix to FC#302 caused problems with calling COM properties with parameters.
This is now fixed.
CHANGES FOR VERSION 4.83.0 (as compared to 4.82.0)
- Added detection of multiple copies of plugins for the same data source
(completed: 2006-07-26)
This (multiple copies of the plugins for same data source) was causing problems
and lots of support issues because people were using old plugins even if
they installed (newer) copy of the plugin. This was so becasue AB always
used first one encountered in given directory and it usually was the oldest
one. Now AB displays warning message that there are multiple copies of the
same plugin and then they must be renamed or removed.
- Added HoldMinDays and EarlyExitDays options to SetOption() (completed:
2006-07-27)
In addition to already exitsing functionality of HoldMinBars / EarlyExitBars,
new options to specify min hold/penalty period in CALENDAR DAYS (as opposed
to bars).
SetOption("HoldMinDays", 30 ); //
set minimum holding period to 30 calendar days
SetOption("EarlyExitDays", 90 ); //
set penalty period to 90 calendar days
Note that you can use one or another (not both at the same time) for one
parameter, so you can specify minimum holding period in either days or bars
(but not both at the same time). The same with EarlyExit period. You may
however use different specifications (i.e. days/bars) for EarlyExit and HoldMin
(they are independent from each other).
- Added scoreExitAll constant that causes rotational mode backtester
to exit all positions regardless of HoldMinBars (completed: 2006-07-27)
Note that this is global flag and it is enough to set it for just any single
symbol to exit all currently open positions, no matter on which symbol you
use scoreExitAll (it may be even on symbol that is not currently held). By
setting PositionScore to scoreExitAll you exit all positions immediatelly
regardless of HoldMinBars setting.
Example:
PositionScore = ..your normal score..
// if market timing signal goes negative close
all posiitons
PositionScore = IIf(
MarketTimingSignal < 0, scoreExitAll, PositionScore );
NOTE: This flag works ONLY in rotational trading mode (in regular mode it
is easy to generate such global exit by ORing sell signal with global sell
signal).
- CBT: Added ExitReason property to Trade object (completed: 2006-07-18)
(FC#: 88)
- Chart Tree - RMB - Edit - now restores and focuses to already opened
formula editor (if it is during editing) (completed: 2006-07-24) (FC#:
300)
Note that you can still open NEW instance of the editor with the very same
file (for comparison and to see the original contents) by holding down SHIFT
key when choosing "EDIT" menu.
- Eliminated extra unnecessary refreshes of commentary window when new
symbol was picked from ticker selector (completed: 2006-07-24)
- Fixed calling parameter-less JScript functions from AFL level via GetScriptObject()
(completed: 2006-07-19) (FC #: 302)
- Fixed: wrong estimated time in progress dialog when number of steps
is greater than 2^32 (4294967296) (allocated to: 4.80.2) (completed: 2006-07-24)
- AFL: Added Gradient background coloring (SetChartBkGradientFill function)
(completed: 2006-07-26)
Gradient fill of chart interior is now available via SetChartBkGradientFill
function.
Please note that this is independent from chart background color (background
color fills entire pane, gradient fill is only for actual chart interior,
so axes area is not affected by gradient fill)
SetChartBkGradientFill( topcolor, bottomcolor, titlebkcolor =
default )
topcolor - specifies top color of the gradient fill
bottomcolor - specifies bottom color of the gradient fill
titlebkcolor - (optional) the background color of title text. If not specified
then top color is automatically used for title background.
Example:
SetChartBkGradientFill( ParamColor("BgTop", colorWhite),ParamColor("BgBottom", colorLightYellow));
- Multiple tabs in RTQ window (completed: 2006-07-18) (FC#: 22)
RT quote window tabs behave the same as chart tabs: can be renamed with right
mouse button and dragged from one place to another.
20 tabs are currently available.
- Non-numeric custom trade metrics are not formatted with thousands separators
anymore (completed: 2006-07-21) (FC#: 314)
- now Tools->Preferences->Misc "Decimal places in RT quote window" allows
to specify upto 6 decimal places. (completed: 2006-07-25)
- OLE: Fixed default property (Item) marker for Windows collection (completed:
2006-07-18)
- Progress dialog: now estimated time is displayed in years/days if it
is large enough (completed: 2006-07-24)
CHANGES FOR VERSION 4.82.0 (as compared to 4.81.1)
CHANGES FOR VERSION 4.81.1 (as compared to 4.81.0)
- fixed problem with some of the watch lists not showing up in 4.81.0
CHANGES FOR VERSION 4.81.0 (as compared to 4.80.2)
- Database structure changed to hold new fundamental data - quarterly EAT/EBT/Sales
figures, Code and Nominal value have been replaced by new fields.
Despite these changes files are still backward and forward compatible - so
it can be read by any other AB version, the only minor inconvenience is that
if you load new file into old version (pre-4.81) of AmiBroker you will see
weird numbers in old "Finances" dialog as well as in "Shares
out." and "Book Value" fields.
- Implemented new View->Information property page featuring extra fundamental
data fields
-
OLE: added new fundamental data fields to Stock object
Stock object has now the following properties:
string Ticker;
Collection Quotations;
string FullName;
boolean Index;
boolean Favourite;
boolean Continuous;
long MarketID;
long GroupID;
float Beta;
float SharesOut;
float BookValuePerShare;
float SharesFloat;
string Address;
string WebID;
string Alias;
boolean IsDirty;
long IndustryID;
long WatchListBits;
long DataSource;
long DataLocalMode;
float PointValue;
float MarginDeposit;
float RoundLotSize;
float TickSize;
long WatchListBits2;
string Currency;
string LastSplitFactor;
DATE LastSplitDate;
float DividendPerShare;
DATE DividendPayDate;
DATE ExDividendDate;
float PEGRatio;
float ProfitMargin;
float OperatingMargin;
float OneYearTargetPrice;
float ReturnOnAssets;
float ReturnOnEquity;
float QtrlyRevenueGrowth;
float GrossProfitPerShare;
float SalesPerShare;
float EBITDAPerShare;
float QtrlyEarningsGrowth;
float InsiderHoldPercent;
float InstitutionHoldPercent;
float SharesShort;
float SharesShortPrevMonth;
float ForwardDividendPerShare;
float ForwardEPS;
float EPS;
float EPSEstCurrentYear;
float EPSEstNextYear;
float EPSEstNextQuarter;
float OperatingCashFlow;
float LeveredFreeCashFlow;
-
AFL: new function GetFnData() - allows accessing fundamental data
SYNTAX: GetFnData("field")
RETURNS: number
"field" can be one of the following:
"EPS"
"EPSEstCurrentYear"
"EPSEstNextYear"
"EPSEstNextQuarter"
"PEGRatio"
"SharesFloat"
"SharesOut"
"DividendPayDate"
"ExDividendDate"
"BookValuePerShare"
"DividendPerShare"
"ProfitMargin"
"OperatingMargin"
"OneYearTargetPrice"
"ReturnOnAssets"
"ReturnOnEquity"
"QtrlyRevenueGrowth"
"GrossProfitPerShare"
"SalesPerShare"
"EBITDAPerShare"
"QtrlyEarningsGrowth"
"InsiderHoldPercent"
"InstitutionHoldPercent"
"SharesShort"
"SharesShortPrevMonth"
"ForwardDividendPerShare"
"ForwardEPS"
"OperatingCashFlow"
"LeveredFreeCashFlow"
"Beta"
"LastSplitRatio"
"LastSplitDate"
-
ASCII importer: added support for new fundamental data fields :
$FORMAT command now supports additional fields:
DIV_PAY_DATE
EX_DIV_DATE
LAST_SPLIT_DATE
LAST_SPLIT_RATIO
EPS
EPS_EST_CUR_YEAR
EPS_EST_NEXT_YEAR
EPS_EST_NEXT_QTR
FORWARD_EPS
PEG_RATIO
BOOK_VALUE (requires SHARES_OUT to be specified as well)
BOOK_VALUE_PER_SHARE
EBITDA
PRICE_TO_SALES (requires CLOSE to be specified as well)
PRICE_TO_EARNINGS (requires CLOSE to be specified as well)
PRICE_TO_BV (requires CLOSE to be specified as well)
FORWARD_PE (requires CLOSE to be specified as well)
REVENUE
SHARES_SHORT
DIVIDEND
ONE_YEAR_TARGET
MARKET_CAP (requires CLOSE to be specified as well - it is used to calculate
shares outstanding)
SHARES_FLOAT
SHARES_OUT
PROFIT_MARGIN
OPERATING_MARGIN
RETURN_ON_ASSETS
RETURN_ON_EQUITY
QTRLY_REVENUE_GROWTH
GROSS_PROFIT
QTRLY_EARNINGS_GROWTH
INSIDER_HOLD_PERCENT
INSTIT_HOLD_PERCENT
SHARES_SHORT_PREV
FORWARD_DIV
OPERATING_CASH_FLOW
FREE_CASH_FLOW
BETA
(see Formats\aqfe.format and Formats\aqfn.format files for example usage)
-
Removed Stock->Information and Stock->Finances dialogs (this
functionality is replaced by View->Information - new dockable property
window)
-
AFL: new function StrReplace( string, oldsubstring, newsubstring
)
-
Fixed crash occuring sometimes if "Symbol->Watch List->Type-in" symbol
was longer than maximum allowable length (allocated to: 4.80.2)
-
Foreign() function changed. Now by default missing data bar OHL
fields are filled using previous bar Close and volume is set to zero.
It is possible to turn old behaviour (filling missing bar OHL fields
using previous bar OHL fields and copying previous bar volume) if you
use
Fixup parameter set to 2.
Foreign("MSFT","O", 2 ); // old-style (pre-4.81)
fill
-
Scaling-in profit% calculations modified to use total cost instead
of max. pos value
-
ships with AmiQuote 1.90 featuring automatic download and import
of fundamental data from Yahoo Finance. See AmiQuote\ReadMe2.html for
the details.
CHANGES FOR VERSION 4.80.2 (as compared to 4.80.1)
-
Changed %profit calculation when scaling-in is used to use maximum
number of shares ever held as a “base” of %profit calculation
- this leads to “most conservative” % figures, compared to
using just initial entry value.
-
Prec() function improved so it does not show rounding errors when
working on integer
CHANGES FOR VERSION 4.80.1 (as compared to 4.80.0)
- fixed problem with Easy Alert window not accepting new alerts in some
circumstances
- included new IB plugin version 1.6.2 (FC issue #54)
CHANGES FOR VERSION 4.80.1 (as compared to 4.80.0)
- fixed problem with Easy Alert window not accepting new alerts in some circumstances
- included new IB plugin version 1.6.2 (FC issue #54)
CHANGES FOR VERSION 4.80.0 (as compared to 4.79.0)
-
Added extra information to "detailed log" to show commissions
charged during scaling and both average and current exit price
-
Partial exit (scale-out) profits are included now in trade stats
-
Fix EOD missing Friday if "Filter weekedns" is turned
ON and Daily compression uses Night / Day session settings (#28659)
-
AFL Editor: Added F1 handling of for/while/do-while/if-else
-
"SCAN" now displays prices using 4 decimal places
-
Fixed problem with progress bar locking active window instead of
AA window when in run-every mode
-
Fixed: Layouts messed up with multiple instances running (ext.ID:
3)
-
"Margin requirement" in the AA settings renamed to "ACCOUNT
margin" to clearly show that it is NOT futures margin
-
Eliminated resource leak in ExportImage OLE function
-
Fixed potential thread interlock in Indicator Maintenance wizard
(should prevent hangup especially on multi-CPU/core machines)
-
Indicator tables are written to file (broker.newcharts) after each
chart insert, before and after Ind. Maintenance just to prevent data loss
if AB is not closed properly
-
Symbol->Watch List->Import refreshes entire symbol tree,
not only watch list leaf
- added few new formulas into Formulas\Indicators folder
CHANGES FOR VERSION 4.79.0 (as compared to 4.78.1)
- Added HoldMinBars feature that disables exit during user-specified number
of bars even if signals/stops are generated during that period
Please note that IF during HoldMinBars period ANY stop is generated it is
ignored. Also this period is ignored when it comes to calculation of trailing
stops (new highest highs and drops below trailing stops generated during
HoldMinBars are ignored).This setting, similar to EarlyExitFee/EarlyExitBars
is available on per-symbol basis (i.e. it can be set to different value for
each symbol)
Example:
SetOption("HoldMinBars", 127 );
Buy=BarIndex()==0;
Sell=1;
// even if sell signals are generated each day,
//they are ignored until bar 128
- additional checks added to ensure proper operation of individual equity
chart
AA window generates error if it can not write LastBacktestFormula to the
registry AA complains with error message when individual equity formula does
not contain #include @LastBacktestFormula statement that is required for
proper operation
(it includes the formula used in last backtest so Equity() function can process
it)
- AFL formula editor toolbar / menu is now customizable
Asc() function for converting first character of the string to the ASCII
code
Asc( string, pos = 0 )
Returns the ANSI character code corresponding to the first letter in a string
(if position is not specified) or code of character at specified position.
If you don't specify position (pos argument) then first character is used.
Negative values of pos reference characters counting from the end of string.
Useful for creation of exploration that displays single letters for signals
instead of numbers.
Buy = Cross(MACD(),Signal());
Sell = Cross(Signal(),MACD());
Filter = Buy OR Sell;
AddColumn( IIf( Buy,
Asc("B"), Asc("S")), "Signal", formatChar );
- Changed EarlyExitFee functionality so it does NOT affect equity (and
stats like drawdowns) if position is not liquidated during early bars
- Chart sheet tabs improvements: added drag-drop moving, quick selection
menu, home/end buttons
- Fix: double click on Y axis does not turn <> range markers anymore
(allocated to: 4.79.0)
- Fix: Param slider, when step =2 and start is odd (for example 3 ) then
subsequent values were even (they should be odd 3, 5, 7,...) now it is
fixed
- Fixed handling of mixed color encodings in AddColumn (pre-defined color
constants did not work together with ColorRGB / ColorHSB, now it is fixed)
Example of code that did not work correctly in 4.78.1 and earlier but now
works fine.
Filter = 1;
AddColumn(Close, "Close", 1.2, colorDefault, ColorRGB(255, 0, 0)
); // this
works
AddColumn(Close, "Close", 1.2, ColorRGB(0, 0, 255), ColorRGB(255, 0, 0)); // this
works
AddColumn(Close, "Close", 1.2, colorBlue, ColorRGB(255, 0, 0)); //
this works in 4.79, but didn't in previous versions
AddTextColumn(" ", " ");
AddColumn(Close, "Close", 1.2, ColorRGB(255, 0, 0), colorDefault); // this
works
AddColumn(Close, "Close", 1.2, ColorRGB(255, 0, 0), ColorRGB(0, 0, 255)
); // this
works
AddColumn(Close, "Close", 1.2, ColorRGB(255, 0, 0), colorBlue); //
this works in 4.79, but didn't in previous versions
- Fractional increments on Y axis: added 1/320 increment (to use for example
with ZT contract) and changed display method so integer part is separated
from fractional part by ^ character
- Implemented easy real-time alerts (allocated to: 4.79.0)
"easy alerts" are available from RTquote window context menu.
(Click on Real Time Quote window with RIGHT mouse button and select "Easy
Alerts" option
- then define alerts you want to generate using real time streaming quotes).
If you add any alerts, please note that symbols used in alerts add up to
total number of streaming symbols, so if you have 50 symbol limit on your
data source and have 40 symbols in your real time quote window you will be
able to setup alerts for only 10 extra symbols (if you use the same symbols
as in real time quote window then it does not add up to the total count)
- OLE: added ability to control sorting in AA window from OLE level
Object:
Analysis
New method:
SortByColumn( iColumn, bAscending, bMultiMode )
where iColumn - is zero-based column index to sort bybAscending - true/false
decides the order we wantbMulti - if set to false - it means that we want
to sort by single column or we define starting column for multi-column sortif
set to true - it means that we are defining additional columns for multiple-column
sort.So to sort by many columns you need to call SortByColumn once with bMulti
set to false and then call SortByColumn for all remaining sort columns with
bMulti set to true.
Example (multiple column sort by column 1 and 2):
AB = new ActiveXObject("Broker.Application");AA
= AB.Analysis;
// sort by date/time column
AA.SortByColumn( 1, False, False );
// add secondary sort column (see last argument
= True)
AA.SortByColumn( 2, False, True );
- OLE: added Application.Visible property
AB = new ActiveXObject("Broker.Application");
AB.Visible = True;
WScript.Sleep(1000);
AB.Visible = False;
WScript.Sleep(1000);
AB.Visible = True;
WScript.Sleep(1000);
AB.Quit();
- OLE: when AmiBroker is created from OLE, it loads default layout now
(previous versions did not
- Scaling in/out fixes: added extra checks not to exceed available cash
(scaling-in) and not to drop below zero shares (scaling out)
- Time&sales now allows the user to disable display of bid/ask and/or
trades
By default both trades and bidl/ask quotes are shown, but now you can decide
to turn off either one or both by clicking with RIGHT mouse button over Time&Sales
window and checking/unchecking "Show Trades" and "Show Bid
/ Ask Quotes"
menu items.
- Tools: Preferences: Misc, renamed "Save on exit" to "Auto-save" and
changed auto-save logic, so layouts are saved on each change
When Auto-save: Layouts is turned ON, currently loaded layout is saved on
change (i.e. when another layout is loaded, previously selected layout changes
are saved first), the same with database load - if you load different database
then recently used layout is stored automatically. IMPORTANT: changes are
saved now to most recently loaded layout (not to 'default' one as it was
before). So default layout is NOT affected by auto-save if you manually loaded
different layout.
CHANGES FOR VERSION 4.78.1 (as compared to 4.78.0)
- atcFlagEnableInPortfolio now works fine with atcFlagCompositeGroup flag.
Previously using atcFlagCompositeGroup (or atcFlagDefaults) prevented creation
of composite in custom backtest procedure (even if atcFlagEnableInPortfolio
was specified). atcFlagEnableInPorfolio worked only without it. Now it
is fixed (works fine with or without atcFlagCompositeGroup)
- AFLEditor: Edit->Replace fixed
- HTMLExport: fixed crash occuring sometimes when lots of columns were
used
- HTMLExport: fix: colorDefault is not BLACK for background (bgcolor in <TD> tag
is skipped) [(this also reduces file size)
- HTMLExport: header row is in separate line (CR at the end)
- backward compatiblity fix for ExportImage() function (when width and
height are not provided then default - current window size - is used)
(NOTE: this also fixes Edit->Image->Export )
CHANGES FOR VERSION 4.78.0 (as compared to 4.77.0)
- AA: HTML export added that supports FULL COLOR output
To export to HTML just click "EXPORT" button in AA window and select "HTML
files" from "Files of type" combo box in file dialog.
You can also use OLE interface Export method - if EXTENSION provided in the
file name is .html then AmiBroker will output HTML file,
otherwise it will output CSV (text) file. If you want colorful output in
Excel, just EXPORT the file to HTML and load it into Excel (or drag-drop
to excel).
Please note that Excel color palette is limited (not all 16 million colors
available in AmiBroker can be represented in Excel) Example colorful test
exploration:
Filter=1;
for( i = 0;
i < 256; i = i
+ 16 )
AddColumn( C, "C"+i, 1.2, colorDefault, ColorHSB(
( BarIndex() + i )
% 256, 255-i, 255 )
);
- List control code reviewed for better 64bit compatibility
- List selection is maintained after sorting
- Multiple column sort implemented in AA result list (and other list controls
as well)
To sort by more than one column:
a) click the FIRST column then
b) SHIFT-click second, third, fourth column ... and so on (upto 40 columns
can be sorted at once)
(to SHIFT-click means to click with left mouse button while having SHIFT
key pressed down)
c) to change the Asc/Desc order click on the same column again
To restart sorting, release SHIFT key and click on column (it will become
first).
Subsequent columns (in the order you have clicked on them) are marked with
1, 2, 3, 4, 5, 6, 7, 8, 9 numbers
(if you select more than 10 columns, then all columns above 10th will be
marked with '...')
- Backtester: added EarlyExitBars/EarlyExitFee functionality (not supported
by old (v.4.4) backtester)
Early exit (redemption) fee is charged when trade is exited during first
N bars since entry.
The fee is added to exit commission and you will see it in the commissions
reported for example in detailed log. It is also reflected in the portfolio
equity (so for first N bars since entry portfolio equity is lower by early
exit fee).
// these two new
options can be set on per-symbol basis
// how many bars (trading days)
// an early exit (redemption) fee is applied
SetOption("EarlyExitBars", 128 );
// early redemption fee (in percent)
SetOption("EarlyExitFee", 2 );
(note 180 calendar days is 128 or 129 trading days)
// how to set it up on per-symbol basis?
// it is simple - use 'if' statement
if( Name()
== "SYMBOL1" )
{
SetOption("EarlyExitBars", 128 );
SetOption("EarlyExitFee", 2 );
}
if( Name()
== "SYMBOL2" )
{
SetOption("EarlyExitBars", 25 );
SetOption("EarlyExitFee", 1 );
}
- AA: "Scan every" feature has been renamed to "Run every" and
allows automatic repeat of scan or exploration (new feaeture) it allows
also shorter intervals
Run every intervals can now be defined in MINUTES (default) or SECONDS.
To enter run-every interval in seconds simply add "s" or "sec" at
the end of interval value, for example:
10 sec - for run every 10 seconds
5 s - for run every 5 seconds
13 min - for run every 13 minutes
35 m - for run every 35 minutes
7 - for run every 7 minutes (if time unit is not specified then by default
minutes are used)
- OLE: ExportImage() now supports Width and Height parameters
ExportImage function that now allows to specify width and height.
So to export say 640x480 gif image you need to write:
AB = new ActiveXObject("Broker.Application");
Win = AB.ActiveWindow;
Win.ExportImage( "test.gif", 640, 480 );
and you will get perfect image with no jagginess or any scaling artifacts.
And it works independently of your current window size and it does NOT affect
your current window size.
- fix: customColor1 can be selected again using color picker
CHANGES FOR VERSION 4.77.0 (as compared to 4.76.0)
- styleDashed now uses correct background color when it is modified using
SetChartBkColor
- AFL Editor: when there is nothing more to undo/redo beep sound is produced
- AFL: OBV() and AccDist() now work correctly with TimeFrameSet (#26768)
- AFL Editor: Edit->Replace implemented (Ctrl+H shortcut)
- CBT: AddCustomMetric now has new parameter that controls number of decimal
places used to display custom metric
Trade.AddCustomMetric( "Name", value, [optional] decplaces = 2
);
Backtester.AddCustomMetric( "Name", Value, [optional] LongOnlyValue
= Null, [optional] ShortOnlyValue = Null, [optional] decplaces = 2 );
where
decplaces defines how many decimal places are used to display given metric
in the report.If not specified it defaults to 2 decimal places.
Example code:
bo.AddCustomMetric( "Somestat", 100*kr, Null, Null, 4 ); //
5th parameter controls number of decimal places
- Tooltip "value" field now uses Prefs setting (Tools->Preferences->Misc: "Decimal
places in chart titles/tools") + 1 digit decimal points
- All Fibonbacci tools now use user-defined number of decimal places (Tools->Preferences->Misc: "Decimal
places in chart titles/tools").
Note that this setting applies to NEWLY drawn or MODIFIED fibonacci retracements.
Already existing ones won't be affected until you modify/move them.
- Added new submenu under "Symbol": "Real Time Quote" with
3 new options: Add selected symbol / Add watch list / Remove all symbols
IMPORTANT NOTE: to see new menu you need to go to Tools->Customize, select "MENU" bar
and press "RESET" button
- AFL: PlotText("Text", x, y, color, bkcolor = colorDefault )
New AFL function:
PlotText( "text", x, y, color, bkcolor = colorDefault )
Writes text in specified co-ordinates
where
x - is x-coordinate in bars (like in LineArray)
y - is y-coordinate in dollars
color is text color
bkcolor is background color
If bkcolor is NOT specified (or equal to colorDefault) text is written with
TRANSPARENT background
any other value causes solid background with specified background color
Example:
Plot(C,"Price", colorBlack, styleLine );
Plot(MA(C,20),"MA20", colorRed );
Buy=Cross( C, MA(C,20 )
);
Sell= Cross( MA( C, 20 ), C );
dist = 1.5*ATR(10);
for( i = 0;
i < BarCount;
i++ )
{
if( Buy[i]
) PlotText( "Buy\n@" + C[
i ], i, L[
i ]-dist[i], colorGreen );
if( Sell[i]
) PlotText( "Sell\n@" + C[
i ], i, H[
i ]+dist[i], colorRed, colorYellow );
}
PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed )
);
- AFL: VarGetText
New function
VarGetText( "varname" )
the same as VarGet but always returns always string values
(if underlying variable has different type it is converted to string)
Allows for example appending to text variable no matter if it is defined
earlier or not:
Title = VarGetText("Title") + "something"; // this will
work correctly regardless of whenever title was defined earlier or not]
- VarSetText
New function
VarSetText( "varname", "value" )
the same as VarSet but operates on string values.
- Auto-analysis backtest result summary modified (added row count and removed
wordwrap)
- Enlarged "Additional commands" field in ASCII Import Wizard
- CBT: Fixed "Out of range" message generated by OLE wrappers
when GetValue method of CBT Metrics object returned infinite value (for
example as result of division by zero)
- Fixed handling of CLICK - DRAW - CLICK drawing mode (#26994) during RT
refresh
- Fixed incorrect candle color occuring sometimes when candle body was
only 1-pixel high
- Fixed potential crash occuring sometimes when RTQ window was never shown
but RT update arrived
- Fixed problem with double arrows appearing on chart with ID == 1
- Fixed problem with selected date in Print/PrintPreview/Image copy
- RTQ context menu "Delete symbol" renamed to "Remove symbol"
- UI: simplification, Removed (default) from File->Database Settings
Base Time interval Combo and "(default)" from local data storage
and removed "IMPORTANT ..." static
CHANGES FOR VERSION 4.76.0 (as compared to 4.75.2)
- Renamed "Number of bars to load" to just "Number of bars"
- Fixed problem with weird Time&sales background colors (bug introduced
in 4.75.x)
- Fixed 1.#INF in P/E colum (RT quote window)
- Editor: fixed actionBacktest / actionExplore mix in auto-complete dropdown
- Chart Y-axis can now be displayed as fractions (1/4, 1/8, 1/16, 1/32,
1/64, 1/128) - to switch this use Parameters -> GRID -> FORMAT
- CBT: Trade object has now "Handle" property that can be passed
to ExitTrade and ScaleTrade methods instead of symbol to allow control
over exiting/scaling multiple positions of the same symbol
// This is sample formula that allows
// to open multiple, separate positions on the
same symbol
// without averaging effect (i.e. each position
on the same
// symbol is completely independent).
//
// Sample code is provided for trading one symbol
// Enter symbol you want to trade below
Symbol = "MSFT";
Buy=Sell=Short=Cover=0; //
real rules are defined inside custom backtest proc
SetCustomBacktestProc(""); //
enable custom backtest
if( Status("action")
== actionPortfolio )
{
// actual backtest routine
// (low-level)
bo = GetBacktesterObject();
SetForeign(
Symbol );
// make sure to calculate actual buy
and buyprice arrays for symbol we need to backtest
Buy = 1; //
For testing purposes just enter new position every bar
BuyPrice = Open;
RestorePriceArrays();
// actual backtest loop
bo.PreProcess();
for(
i = 1; i < BarCount;
i++ )
{
// first update
backtest stats and handle stops
bo.UpdateStats( i, 0 );
bo.HandleStops( i );
bo.RawTextOutput("Bar " +
i );
if( Buy[
i - 1 ] ) //
if buy signal in previous bar
{
bo.EnterTrade( i, Symbol, True, BuyPrice[
i ], 500 /*
$5000 into one trade */);
}
for(
OpenPos = bo.GetFirstOpenPos(); OpenPos; OpenPos = bo.GetNextOpenPos() )
{
//
exit positions if their age is > 5 bars and they are profitable
if(
OpenPos.BarsInTrade > 5 AND OpenPos.GetProfit() > 0 )
{
//
HERE IS A NEW PART !!!
//
WE ARE PASSING HANDLE instead of ticker symbol
//
THIS ENSURES PROPER OPERATION even if we have multiple positions of the same
//
stock
bo.ExitTrade(
i, OpenPos.Handle, OpenPos.GetPrice( i, "O" )
);
}
}
bo.RawTextOutput("Number
of open positions: " + bo.GetOpenPosQty() );
bo.UpdateStats( i, 2 );
}
bo.PostProcess();
}
- CBT: Small fix for low-level CBT backtest - internal current bar counter
is set now via UpdateStats
- ASCII import wizard: Additional commands field accepts "ENTER" key
alone (previously one needed CTRL+ENTER to create new line)
- ASCII importer limits the volume to 2147483647 so after convertion to
32bit integer it never becomes negative
- Added parameter list to backtest report (Settings page)
CHANGES FOR VERSION 4.75.2 (as compared to 4.75.1)
- when no data we available chart background is correct now (it was black
instead of one choosen in prefs in 4.75.x)
- Added ability to disable fixed ruin stop
When you add
SetOption("DisableRuinStop", True);
to your formula the backtester will not use built in 99.96% loss stop (ruin)
Note: it is recommended NOT to use it unless you really have to.
- added new option to SetOption:
SetOption("EveryBarNullCheck", True)
SetOption("EveryBarNullCheck", True)- allows to turn on checking
for Nulls in arithmetic operations on every bar in the array(by default it
is OFF - i.e. AmiBroker checks for nulls that appear in the beginning of
the arrayand in the end of the array and once non-null value is detected
it assumes no further holes (nulls) in the middle). Turning "EveryBarNullCheck" to
True allows to extend these checks to each and every barwhich is the way
4.74.x and earlier versions worked.
Note however that turning it on gives huge performance penalty (arithmetic
operations are performed even 4x slower when this option is ON, so don't
use it unless you really have to).
- Added small result summary after backtest in the status line
- Fixed problem with plotting xshifted charts occuring when formula referenced
future bars
- logical (boolean) operators check for nulls on every bar and treat null
as "false" to maintain backward compatibility with formulas written
for previous versions
- Modified file dialog buffer size from 262144 (0x40000) bytes to 262143
(0x3FFFF) to workaround 16 bit (64KB) buffer limit of Windows 95/98/NT4
(yes surprisingly NT4 is limited to 64K buffer in file dialogs)
16-bit windows (95/98) and NT4 were treating 0x40000 as 0 (zero) because
only lower 16 bits were interpreted. Thanks to move to 0x3FFFF it is now
interpreted as 0xFFFF on 16 bit windows.
- Potential crash fixed when formula using AddToComposite atcEnableInBacktest
is verified in the AFL editor
- Added XShift parameter to PlotOHLC and PlotForeign functions
- fixed re-mapping of built-in and custom colors in grid color picker
CHANGES FOR VERSION 4.75.1 (as compared to 4.75.0)
- ParamColor now accepts 24 bit colors without crashing
- Null values appearing at the end of data series (array) are handled
appropriately (propagate through arithmetic operators)
This fixes problem that 4.75.0 had with "trendline" formulas that
used Null values put into the array at the end of the data series.
- Most recently picked drawing tool color is preserved between runs
- EncodeColor was not handling all 24 bit color combinations correctly.
Fixed now.
- Chart tree fix: Moving or renaming formula in charts tree now updates
all paths in indicators that use this formula
CHANGES FOR VERSION 4.75.0 (as compared to 4.74.6)
- New chart style (styleCloud) to be used to create "cloud" chart
as in Ichimoku charts. Also useful for indicator charts like MACD.
This style fills non-rectangular (free shaped) area between HIGH and LOW
arrays provided
by PlotOHLC function. Open and Close arrays are not relevant for plotting
however Close
is used as usual to display value label and title. So recommended use is
to use "upper" bounding value
in Open and High arrays and "lower" bounding value in "Low" and "Close" arrays
Sample Ichimoku cloud:
SL = ( HHV( H, 26 )
+ LLV( L, 26)
)/2;
TL = ( HHV( H, 9 )
+ LLV( L, 9 )
)/2;
DL = Ref( C, 25 );
Span1 = Ref( ( SL
+ TL )/2, -25 );
Span2 = Ref( (HHV( H, 52)
+ LLV(L, 52))/2,
-25);
Plot( C, "Price", colorBlack, styleCandle );
Plot( SL, "SL", colorRed, styleThick );
Plot( TL, "TL", colorGreen, styleThick );
PlotOHLC( 0,
span1, span2, span2, "Cloud", colorLightOrange, styleCloud );
Simple MACD cloud:
m = MACD();
Plot( Signal(), "Signal", colorBlue, styleThick );
PlotOHLC( m,m,0,m, "MACD", IIf(
m > 0, colorGreen, colorRed ), styleCloud );
Another MACD cloud (difference):
m = MACD();
s = Signal();
Plot( s, "Signal", colorBlue);
Plot( m, "MACD", colorRed );
PlotOHLC( m,m,s,m, "MACD", IIf(
m > s, colorLime, colorLightOrange), styleCloud );
- when File->Open database or MRU list is choosen then old database is
saved first
- When default database is deleted, AB now asks for new default database
folder, instead of re-creating it
- when database is deleted from the outside and user picks it via MRU list
-then gets removed from MRU list and is not recreated anymore
- When AmiBroker is launched with incorrect "Start in" (working directory)
then it automatically switches to "last good" path
"
Last good" path is saved in the registry HKEY_CURRENT_USER\TJP\Broker\Defaults\LastGoodPath,
during successful launch in correct directory (whenever working directory
is correct or not it is determined by checking for presence of Broker.chm
file (help file))
Using correct working directory is important because AmiBroker uses relative
paths to most components.
- AFL: new function: StaticVarRemove()
StaticVarRemove("varname")
removes static variable and releases associated memory
- Start-up time decreased significantly by implementation of on-demand
loading of formulas
(on slow, low-end machines loading time decreases from 10 seconds to just
0.5 second)
- printf/StrFormat/SelectedValue functions no longer affect number of extra
future bars calculated by QuickAFL
- Minor plugin status change (as in IB backfill) does not cause sound (only
tooltip is displayed)
- Increased the limit of files that can be selected using Windows file
dialog
Now import wizard and ascii importer file dialogs use 256KB buffer for file
names that on average should allow 20000 files to be selected at once.
- Further speed improvements by rewriting chart ID lookup routine (GetChartInfoByID)
- Chart title string is clipped so Y axis is never obscured
- Chart title can be automatically wrapped now
Use 'Parameters' window,
" Axes & Grid" tab,
Miscellaneous->Wrap title: YES
If you want to set it programmatically from the formula use
SetChartOptions( 2, chartWrapTitle );
- Auto-hide panes slide slightly faster
- All basic array arithmetic and logical operators inlined and hand optimized
on assembly level for speed, gives upto 450% speed increase in basic array
calculations
Example speed increases:
a) purely "theoretical" example
million iterations of array addition
for(
i = 0; i < 1000;
i++ )
for(
k = 0; k < 1000;
k++ )
Sumh = H + L;
runs 4.8 times (+480%) faster (5 seconds in 4.75 compared to 24 seconds in
4.74 and older, Athlon64@2GHz)
2000 data bars.
This gives ( 2000 * 1000000 additions ) / 5 sec = 400 MEGAFLOPS (millions
of floating point operations per second) AFL array-based AFL execution speed.
b) "real-world" examples:
" Projection Oscillator"
http://www.amibroker.com/library/detail.php?id=344
single security optimization runs 85% faster
(13 seconds (4.75) compared to 24 seconds (4.74 or older) )
" RSIS"
http://www.amibroker.com/library/detail.php?id=153
single-security optimization 5000 iterations runs 21% faster
(28 seconds (4.75) compared to 34 seconds (4.74 or older))
NOTE: Performance increase depends on complexity of the formula. Biggest
gains can be observed for formula doing LOTS of mathematical calculations
on arrays (using lots of +, -, *, /, ^, %, comparisions <, >, ==, !=, <=, >=,
etc).
- AFL: new function: SetChartBkColor( color )
sets chart background to user-specified color
- Added View->Time & Sales menu back
- Added chart timing display (you can turn it on via Tools->Preferences->Display
chart timing)
when turned on, in the bottom of each chart the following information is
displayed:
Total time X sec, AFL exec time Y sec (Z %), # extra bars back Q, fwd R
where
X - is total time in second spent during chart refresh ( this includes AFL
execution and actual screen painting/drawing, grid / scale calculations,
etc)
Y - is time spent in chart AFL execution only (without any actual screen
painting, grid / scale calcs)
Z - is percentage of time that AFL execution takes compared to total time
required for refresh
Q - is a number of previous bars (before first visible bar) that are needed
to calculate the indicator (QuickAFL estimation)
R - is the number of future bars (after last visible bar) that are needed
to calculate the indicator (QuickAFL estimation)
- Added asin/acos to the AFL function reference
- AFL: 24-bit (16 million) truecolor support for indicators and exploration
output.
- new ColorRGB() and ColorHSB functions to access full 24 bit palette
ColorRGB( red, green, blue )
returns color value to be used in Plot/PlotOHLC/AddColumn/AddTextColumn
red, green, blue - represent color component values in range 0..255 each
For more information about RGB color model please read:
http://en.wikipedia.org/wiki/RGB_color_model
ColorHSB( hue, saturation, brightness )
returns color value to be used in Plot/PlotOHLC/AddColumn/AddTextColumn
hue - represents gradation of color within the optical spectrum (as in rainbow)
saturation represents "vibrancy" of the color
brightness represents brightness.
Each parameter ranges from 0 to 255, where 0 represents 0% saturation/brightness
or 0 degree hue in HSV color wheel,
and 255 represents 100% saturation/brightness or 360degrees hue in HSV color
wheel
When you modify hue from 0 to 255 you will see consecutive
rainbow colors starting from red, through yellow and green to blue and violet.
For more information about HSB color space please read:
http://en.wikipedia.org/wiki/HSB_color_space
Example MA rainbow chart (bring up parameters dialog and play with it):
side = 1;
increment = Param("Increment",2, 1, 10, 1 );
for( i = 10;
i < 80; i = i +
increment )
{
up = MA( C,
i );
down = MA( C,
i + increment );
if( ParamToggle("3D
effect?", "No|Yes" )
)
side = IIf(up<=down AND Ref(
up<=down, 1 ), 1, 0.6 );
PlotOHLC(
up,up,down,down, "MA"+i, ColorHSB( 3*(i
- 10),
Param("Saturation", 128, 0, 255 ),
side * Param("Brightness", 255, 0, 255 )
), styleCloud | styleNoLabel );
}
///////
Color-parade exploration
Filter=1;
for( i = 0;
i < 256; i = i + 16 )
AddColumn( C, "C", 1.2, colorDefault, ColorHSB(
( BarIndex() +
i ) % 256, 255-i, 255 )
);
CHANGES FOR VERSION 4.74.6 (as compared to 4.74.5)
- Fixed problem with RTQuote failing to load symbol list during first
show
- Fixed problem in AA-Apply To-Date that was introduced because of tab
order change
CHANGES FOR VERSION 4.74.5 (as compared to 4.74.4)
- Toolbar theme was reset when entering Formula Editor, now it is fixed
- Quote Editor list now remembers columns size and order between runs
- Keyboard shortcut editor now allows using punctation characters like
Ctrl+[, Ctrl+], - =, etc
- Automatic Analysis: Pick button now has shortcut on Alt+I to avoid conflict
with Alt+P (Parameters), also fixed tab order
- Fixed ParamDate to return DateNum instead of YYYYMMDD (4 digit year)
CHANGES FOR VERSION 4.74.4 (as compared to 4.74.3)
- New "Appearance" tab in Tools->Customize, allowing to select
menu/toolbar/docking pane themes and tab location
- Layout and Symbol trees are marked for refresh when database is changed
and refreshed when user brings them up
- Fixed exception that occurred after customization when ticker bar was
removed from all toolbars
- Fixed ticker bar losing focus when Shift/Insert/CapsLock/NumLock pressed
- Real-time Quote column order/size is remembered correctly again
CHANGES FOR VERSION 4.74.3 (as compared to 4.74.2)
- Fixed losing focus by ticker combobox when Shift, CapsLock, NumLock,
Insert keys were pressed
CHANGES FOR VERSION 4.74.2 (as compared to 4.74.1)
- Ticker combo is now correctly refreshed on database change even if moved
to other toolbar than default
- Previously when Reset was used on Ticker toolbar it became blank - now
it is fixed, ticker combo is refilled after closing customization mode
- Edit field in Ticker combobox does not scroll horizontally now when
edited text is too long
- Numeric keypad keys now work with File MRU menu (most recently used files)
- Global shortcuts continue to work when focus is inside ticker combo
- "Profile" button in View toolbar works correctly now
CHANGES FOR VERSION 4.74.1 (as compared to 4.74.0)
- Fixed incorrect message displayed in the progress window during some
longer explorations
CHANGES FOR VERSION 4.74.0 (as compared to 4.73.0)
- New user interface: fully user-customizable advanced docking panes/toolbars/menus.
New UI features:
- Tear-Off Tabs
- Nested docking pane grouping
- WYSIWYG docking
- sliding auto-hide pinnable windows
- modern "Whidbey" look
- Tear-Off menus and toolbars
- Add/copy/Delete/Modify/drag-drop commands
- User-defined toolbars
For a little video presentation see: http://www.amibroker.com/video/uicustomize.htmlNote:
toolbar and keyboard customizations made in old versions need to be re-done
because they can not be imported by new system due to fundamental differences
(I am sorry about that)]
- GroupID(), IndustryID(), SectorID, MarketID(), InWatchList(), IsIndex()
and IsContinuous() functions are now affected by SetForeign
- Removed debug messages cluttering DebugView output (that appeared in
4.73)
- Changed the way drawing color picker is working: now it works like in
Word (or other text editor) - keeps selected color even if drawing with
different color is clicke
- Fixed false message "The note has been modified outside the notepad
editor." occuring when file did not exist
- OLE: Changed Window.LoadTemplate to return FALSE when file can not be
found
- OLE: Window.LoadTemplate now refreshes display so it is not necessary
to use SelectedTab = 0
- Removed constant RT refreshes in interpretation window when text does
not change
- ZoomToRange: last selected bar in range is visible after zooming now
CHANGES FOR VERSION 4.73.0 (as compared to 4.72.1)
- OLE: Window object, new method ZoomToRange( From, To )
ZoomToRange( From, To )
From and To parameters are of any type that can be converted to date(you
can use string or OLE date for example).
Example code (JScript):
AB=new ActiveXObject("Broker.Application");
AW = AB.ActiveWindow;
if( AW.ZoomToRange( "2005-04-01", "2005-08-01" ) )
{
WScript.Echo("Zoom successfull" );
}
- Fixed: Chart got shrinked a bit with each overlaid plot, now the Y scale
does not change (unless really needed)
- Fixed: XShift now works correctly with styleOwnScale and styleLeftScale
- Fixed: Volume chart overlaid on price chart in log scale (overlay) was
compressed to flat line, now it is fixed (volume chart overlay uses linear
scale always)
[#22262]
- AFL: Added AlmostEqual function (completed: 2005-09-16)
AlmostEqual( x, y, ulps = 5 )
this is a helper function for comparing floating point numbers.It returns
True if x and y are equal or almost equal upto defined accurracy (ulps).It
is recommended to use this function instead of equality check (==) as itleads
to more reliable comparisons and less headache caused by IEEE floating pointacurracy
issues.
Parameters:x, y - the numbers or arrays to be compared,Ulps stands for "units
in last place" and represents maximum relative error of the comparison.
Since 32 bit IEEE floating point numbers have accurracy of 7 significant
digits, 1 unit in last place(ulp) represents relative error of 0.00001 %.
The default value of ulps parameter is 5 which gives roughtly 0.00005% "comparison
sensitivity".
Example code:
if( 1/3 == 0.3333333 )
{
printf("32-bit Floating point IEEE exact equality\n");
}
if( AlmostEqual( 1/3, 0.3333333 ) )
{
printf("Numbers are almost equal\n");
}
Thanks to Bruce Dawson for his fast routine.
- Optimize() function now checks if min < max, step > 0 and checks
if parameter name is not empty
- Made Time&Sales case insensitive (when "case sensitive tickers" option
is turned off")
- OBV/AccDist/Chaikin functions adjusted to be SetForeign-aware
- OLE: Application object new methods
BOOL LoadLayout( filename )
BOOL SaveLayout( filename )
AB = new ActiveXObject("Broker.Application");
AB.LoadLayout("C:\\Program Files\\AmiBroker\\Data\\Layouts\\Default.awl");
- OLE: Window object new property: SelectedTab
AB = new ActiveXObject("Broker.Application");
AW = AB.ActiveWindow;
tabindex = AW.SelectedTab; // read selected tab
AW.SelectedTab = 3; //switch to tab 3
AW.SelectedTab = tabindex; // restore originally selected tab
- Fixed: Exception was generated when GetRTDataForeign was called with
non-existing ticker
- OLE: Window object new methods: LoadTemplate, SaveTemplate
AB = new ActiveXObject("Broker.Application");
AW = AB.ActiveWindow;
AW.SaveTemplate("Test.abt");
AW.LoadTemplate("Test.abt");
CHANGES FOR VERSION 4.72.1 (as compared to 4.72.0)
- fixed out-of-memory problem sometimes occuring during scan of large (>512MB)
databases
CHANGES FOR VERSION 4.72.0 (as compared to 4.71.1)
- " Currency" field support in ASCII importer
added command:
$CURRENCY USD
and field:
$FORMAT Name,Currency$OVERWRITE 1$AUTOADD 1]
- Added "Additional commands" field in the Import wizard for
typing any extra $- commands that are not available via checkboxes
- Added parameter to AddColumn/AddTextColumn to control column width
AddColumn( ARRAY, "Caption", format = 1.2, color = colorDefault,
bgcolor = colorDefault, width = -1);
AddTextColumn( "Text", "Caption", format = 1.2, color
= colorDefault, bgcolor = colorDefault, width = -1 );
- AddToComposte new flag to work when Status("action")== actionPortfolio
(completed: 2005-09-09)
new flag is called atcEnableInPortfolio
Example:
if( Status("action" ) == actionPortfolio )
{
... Custom backtest mode here ....
AddToComposite( some_array, "~COMPOSITE", "X", atcFlagEnableInPortfolio
| atcFlagDefaults );
}
- AFL added: tanh(), sinh(), cosh() functions
Hyperbolic tangent, sine and cosine function
- AFL functions: StrToUpper and StrToLower
- Fixed: Tick ASCII import: last tick of previous import was deleted on
subsequent import, now it is corrected
- Function to detect mouse button state
GetCursorMouseButtons() returns mouse button state at the time when chart
formula is executed
0 - if no mouse button is pressed
1 - if left mouse button is pressed
2 - if right mouse button is pressed
4 - if middle mouse button is pressed
plus combinations:3 - left + right5 - left + middle6 - right + middle 7 -
left + right + middle]
- GetRTDataForeign (retrieving values for other symbols)
GetRTDataForeign( "field", "symbol")
- Pane is not deleted if shrinked down to zero (prevents from accidential
deletion of panes)
- Plot function now has xshift parameter that allows to visually shift
the chart past the last bar
Example 20-bar Moving average shifted 10 bars into the future past the last
bar:
Plot(Close,"Close",colorBlack,styleCandle);Plot(MA(Close,20), "Shifted
MA", colorRed, styleLine, Null, Null, 10 );
Note that shift occurs during plotting and does not affect source array
- Removed data source selection from preferences because it caused user
confusion way too often
- Stock.Currency available via OLE
- Title variable now supports new special token {{OHLCX}} which is replaced
at runtime by string "Open ..., Hi .... Lo ... Close (...%)" showing
current price
This way it is possible to implement formula that will show OHLC prices with
number of decimal places set in the preferences.
Example:
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = "{{NAME}} - {{INTERVAL}} {{DATE}} {{OHLCX}} {{VALUES}}" );
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle
| ParamStyle("Style") | GetPriceStyle() );
- user-definable number of decimal places in chart titles (completed:
2005-09-09)
Number of decimal places displayed in default chart title is now user-definable
inTools->Preferences->Miscellaneous"Decimal places in chart titles".
Allowable values:
-1 - dynamic mode (number of decimal places automatically adjusted)
0..6 - fixed number of decimal places
- QuoteArray resizing now uses heuristic algorithm to minimize memory
fragmentation and increase performance
- atcFlagDeleteValues now highlighted properly in the AFL editor
CHANGES FOR VERSION 4.71.1 (as compared to 4.71.0)
- fixed compatibility problem with AmiQuote (due to changed order of OLE
properties/method while AmiQuote was using old ones)
- now ASCII importer in $TICKMODE does not delete quotes older than oldest
(first) record in the imported file, so you can safely import tick data
from subsequent files (older first, newest later)
CHANGES FOR VERSION 4.71.0 (as compared to 4.70.5)
- AFL: added GetCursorXPosition() and GetCursorYPosition() functions
Functions return current mouse cursor position.
Values returned are equal to those visible in the status bar, and these functions
require status bar to be visible. Returned values represent cursor position
at the formula execution time (or few milliseconds before it) and accurracy
is subject to pixel resolution of the screen (first cursor position is read
in screen pixels (integer) and then converted to actual value therefore for
example when screen resolution is 1024x768 maximum obtainable resolution
in X direction is 0.1% and in Y direction 0.13%), also X values are snap
to datetime of nearest data bar.
It only makes sense to use these functions in indicator/interpretation code.
Using them in AA window may yield random values.GetCursorXPosition() function
returns X position in DateTime format (the same as used by DateTime() function).You
can convert it to string using DateTimeToStr() function.GetCursorYPosition()
returns Y position (as displayed in Y axis of the chart).
Example:
ToolTip="X="+DateTimeToStr(GetCursorXPosition()) +"\nY="+GetCursorYPosition();
-
AFL: added DateTimeToStr() and StrToDateTime() functions
These functions allow to convert string to datetime format and vice versa.
Example:
ToolTip="X="+DateTimeToStr(GetCursorXPosition()) +"\nY="+GetCursorYPosition();]
-
Added ability to store charts as .GIF (in addition to PNG)
-
ASCII importer maximum supported line length is increased to 2048 characters
-
Fixed: .aflsafe files didn't get deleted automatically
- Added N-volume bars charts and timeframe support.
Custom N-volume bar intervals are definable (as usual) in Tools->Preferences->Intraday.
TimeFrame functions were also extended to support N-volume bars using new
TimeFrameMode() function calling
TimeFrameMode( 0 );
- switches time frame functions to time-based operation (the default)
TimeFrameMode( 1 );
- switches time frame functions to N-tick operation (positive values passed
to TimeFrameSet are treated now as N-tick)
TimeFrameMode( 2 );
- switches time frame functions to N-volume bar operation (positive values
passed to TimeFrameSet are treated nowas N-volme bars)
Example:
TimeFrameMode( 2 );
TimeFrameSet( 50000 ); // 50'000 share bars..
...do something ...
TimeFrameRestore();
Note: N-volume bars are somewhat weird (compression of data to N-volume
bar may actually deliver MORE output bars - for example if one tick is
1000 shares and you have specified 100V bars then single tick will be
expanded to TEN 100V bars - ten times original size)
TimeFrame functions are protected against array overrun and will not decompress
beyond original array size (you will get an "Error 47. N-volume bar
compressed data longer than base time frame").
Also switching main time frame to some weird N-volume bar value will result
in limiting the output to maximum twice original data size(without error
message).
You should keep that in mind and avoid using too small N-volume bar intervals
that could lead to such condition.
Also due to the nature of N-volume bars the only TimeFrameSet() function
will yield correct N-volume bar values, TimeFrameGetPrice() may give slightly
distorted results.
It is also possible to use n-volume bars in TimeFrame functions without
calling TimeFrameMode() - it is then necessary to specify n-volume bars
as negative number offset by -1000000 (minus one million):
TimeFrameSet( -1000000 - 2000 );
// gives 2000V barsSimilarly formatted negative numbers will be reported
by Interval() function when n-volume bars are selected.
-
OLE: Save As PNG / GIF callable from automation
Example script:
AB = new ActiveXObject("Broker.Application");
AB.ActiveWindow.ExportImage("Test.png");
-
Plugin is not called when GetExtraData is used for symbol that has "use
only local database" flag turned on, and NULL is returned instead
of an error
-
Protected against changing application's current working directory
by printing to file
-
Toolbar does not get wrapped when main frame window is resized
-
OLE: Analysis object has new method MoveWindow( x, y, width, height)
that allows to control position and size of automatic analysis window
AB = new ActiveXObject("Broker.Application");
AB.Analysis.MoveWindow( 10, 10, 200, 200 );
It has some restrictions on size: specified size can not besmaller than
10x10 pixels and can not be bigger than entire screen dimensions.
Also when "No minimum size for resizing dialogs" box in UNCHECKED
in Tools->Prefs->Misc it won't shink AA window below default size
necessary to fully display all controls.
-
ASCII importer: added ability to import tick data from text files
ASCII importer now allows tick data files to be imported.
Tick data files consist of several records having the same timestamp.This
makes it impossible to use normal import mode which assumes different
(unique) timestampsfor each data row (when same timestamp is found then
new data overwrites old).
To turn on TICK mode you need to add manually
$TICKMODE 1
line to ASCII importer definition file.
$TICKMODE is a special mode of importer that allows to import quotes that
haveduplicate time stamps.
It makes two assumptions:
a) input data should come in the ascending time order (i.e. OLDER records
first, LATEST records last)
b) input data should consist of entire tick history because importer will
DELETE any existing quotes (to avoid creating multiple copies of the same
ticks).
Once again: Turning on
$TICKMODE 1
will DELETE ANY QUOTES that already exist in the database and then will
import all ticks from input data file.
You have been warned.
For example data files like this:
MOL,0,20050606,162959,16400.0000,16400.0000,16400.0000,16400.0000,2MOL,0,20050606,162959,16400.0000,16400.0000,16400.0000,16400.0000,11MOL,0,20050606,162959,16400.0000,16400.0000,16400.0000,16400.0000,40
Can be imported using the following definition file:
$FORMAT Ticker, Skip, Date_YMD, Time, Open, High, Low, Close, Volume
$SKIPLINES 1
$SEPARATOR ,
$CONT 1
$GROUP 255
$AUTOADD 1
$DEBUG 1
$TICKMODE 1
Sometimes it happens that input files have invalid timestamps (seconds > 59).
For example:
MOL,0,20050606,162970,16400.0000,16400.0000,16400.0000,16400.0000,2
Please take a closer look at first line shown in this example it has time:16:29:70
(you see 70 seconds !)
So I had to add a special flag to the importer that works around such
data errors.
It is called $ALLOW99SECONDS 1 and will convert all records with invalid
seconds (i.e greater than 59)to 59s.
So record stamped 16:29:70 will be treated as 16:29:59
Now for tick mode to work with such incorrect records you would need
to add two lines to ASCII importer definition:
$TICKMODE 1
$ALLOW99SECONDS 1
CHANGES FOR VERSION 4.70.5 (as compared to 4.70.4)
-
Fixed problem with Indicator Maintenance wizard not
reading certain layouts correctly, thus deleting indicators that were
in fact in use (allocated to: 4.70.5) (completed: 2005-05-08)
-
Custom backtester: EnterTrade method uses RoundLotSize
parameter from the AA settings if none is specified in function call
and RoundLotSize field in Symbol->Information is set to zero (allocated
to: 4.70.5) (completed: 2005-05-04)
-
StaticVarSet - increased resolution to maximum supported
by 32-bit IEEE (allocated to: 4.70.5) (completed: 2005-05-08)
-
When trade size limit expressed as % of bar volume shrinks
down the trade below "MinPosValue" then such trade is not
entered (allocated to: 4.70.5) (completed: 2005-05-04)
CHANGES FOR VERSION 4.70.4 (as compared to 4.70.3)
-
Closing editor window while AA operation is running
does not result in crash if formula generates error (allocated to:
4.70.4) (completed: 2005-05-01)
-
When margin requirement was set to 100 (no margin) then
very small artifacts (0.0000000000001) were displayed as margin loan, this
is now corrected (allocated to: 4.70.4) (completed: 2005-05-01)
-
Added message "Formula execution halted because
of an error - no chart to display" instead of "black pane" (allocated
to: 4.70.4) (completed: 2005-04-30)
-
AFL Editor: Fixed problem with errorneous horizontal
scrolling when editing lines longer than 256 characters (allocated to: 4.70.4)
(completed: 2005-04-19)
-
Default layout is saved automatically when Tools->Indicator
Wizard menu is selected (allocated to: 4.70.4) (completed: 2005-04-30)
-
Fixed styleThick and styleLine small 'dash' artifact
(allocated to: 4.70.4) (completed: 2005-04-30)
-
Setup: Mixed mode EOD/Intraday is selected in demo eSignal
database (allocated to: 4.70.4) (completed: 2005-04-30)
-
Time-compressed N-minute bars are no longer reset on
USA EST 00:00:00 when align to session times is turned on (allocated to:
4.70.4) (completed: 2005-04-21)
-
Time-compression of bars: open interest is now correctly
using "last" value (allocated to: 4.70.4) (completed:
2005-04-15)
-
Tools->Indicator Wizard keeps old built-in indicator slots untouched
CHANGES FOR VERSION 4.70.3 (as compared to 4.70.1)
-
Added "TIME" control to Text study properties (allocated to:
4.70.3) (completed: 2005-03-24)
-
Assigning hyper-long strings to Title variable does not cause program
termination anymore (allocated to: 4.70.3) (completed: 2005-03-18)
- Modified daily time compression and weekend filtering when daily bars
are set to use day/night session start/end times (allocated to: 4.70.3)
(completed: 2005-03-24)
[Now it works so that if day/night session is enabled then weekend begins with
the start of Friday night session and ends with the beginning of Sunday night
session]
- "Filter weekends" option added to View->Intraday menu,
so now it is not necessary to go to File->Database Settings->Intraday
settings to change it (allocated to: 4.70.3) (completed: 2005-03-24)
- "Override weekly/monthly bars use date of last trade" Preferences
setting was affecting daily charts too. Now it is fixed (only weekly
and monhtly charts are affected) (allocated to: 4.70.3) (completed:
2005-03-24)
- Exception when using a left open Param window after the indicator has
been closed (allocated to: 4.70.3) (status: fixed) (completed: 2005-03-21)
[now if Param window is closed if corresponding indicator pane is closed]
- Fixed crash occuring sometimes when #included file was missing (allocated
to: 4.70.3) (completed: 2005-03-21)
- Fixed crash occuring when run-time or syntax error occurred in the #included
file that was longer than 16000 characters (allocated to: 4.70.3) (completed:
2005-03-24)
- Fixed GetCommission() method in Trade object not to ignore bInclExit
parameter (allocated to: 4.70.3) (completed: 2005-03-24)
- Control over tooltip text from AFL formula level (allocated to: 4.70.3)
(completed: 2005-03-24)
[available now via new reserved variable called TooltipTooltip = "My Tooltip
text shows Close " + Close;note that X/Y coords are displayed in the
tooltip anyway and that custom tooltip text length is limited to 1000 characters.]
- GetPositionValue() method of Trade object returned entry value instead
of current value. Now it is fixed (i.e. CURRENT value is returned) (allocated
to: 4.70.3) (completed: 2005-03-24)
- Implemented "Min. pos value" in addition to "Min. shares" (allocated
to: 4.70.3) (completed: 2005-03-24)
[This sets global minimum on position (trade) size. Backtester will
not open trades below this limit. Default value is zero (no minimum
trade size).The
setting is available via: AA, Settings: Min. Pos. Value field, and via SetOption("MinPosValue",
... )]
- Updated "READ ME" and some minor corrections in the User's
Guide (allocated to: 4.70.3) (completed: 2005-03-24)
- "Max. trade drawdown" for short trades was incorrect, now
fixed (allocated to: 4.70.3) (completed: 2005-03-24)
CHANGES FOR VERSION 4.70.1 (as compared to 4.70.0)
-
Updated old parts of the User's Guide to present current status-quo.
-
First
trade exit price was sometime reported as -1#QNAN, this should be fixed
now (allocated
to:
4.70.1)
(completed:
2005-03-16)
-
"Delete indicator" in CONTEXT (chart) menu (allocated to:
4.70.1) (completed: 2005-03-10)
-
Add ownStyle scaling factor so it is not necessary to use Highest(V) in
volume chart (allocated to: 4.70.1) (completed: 2005-03-15)
-
Added Help->AFL functions by name, Help->AFL functions by category,
Help->AFL reference menu items to AFL editor (allocated to: 4.70.1)
(completed: 2005-03-15)
-
added maskAll, maskDefault, maskPrice maskHistogram, chartShowDates, chartLogarithmic,
chartShowArrows constants to syntax-colorizer def (allocated to: 4.70.1)
(completed: 2005-03-12)
-
Adjusted formatting of param window min/max values so it does not use engineering
notation (xEy) for numbers smaller than 1e8 (100 million) (allocated to:
4.70.1) (completed: 2005-03-12)
-
BUG: Applying preferences resets price style to candlesticks even if
something different is selected in View->Price chart style (allocated
to: 4.70.1) (status: fixed) (completed: 2005-03-15)
-
BUG: Choosing File->Print and then pressing "CANCEL" button
blocked further RT refreshes, now fixed. Also now page count is set to 1
(avoid "Next page") (allocated to: 4.70.1) (status: fixed)
(completed: 2005-03-15)
-
BUG: GetPriceStyle() included styleDots even if currently selected style
was candlestick or bar (allocated to: 4.70.1) (status: fixed) (completed:
2005-03-15)
-
BUG: RT Quote, Context menu -> HIDE - does not shrink the panel
(allocated to: 4.70.1) (status: fixed) (completed: 2005-03-15)
-
Change default include directory to "Formulas\Include" (allocated
to: 4.70.1) (completed: 2005-03-15)
-
Display chart ID in Axes/Grid: Misc: part of parameters dialog and adjust
description of Study() (allocated to: 4.70.1) (completed: 2005-03-12)
-
Make IDR_BROKERTYPE and IDR_MAINFRAME menus the same (allocated to: 4.70.1)
(completed: 2005-03-15)
-
Modify registration checking to allow only licenses 4.20 and above (allocated
to: 4.70.1) (completed: 2005-03-15)
-
New version of IB plugin: 1.3.6 - max. number of streaming symbols increased
to 100 (allocated to: 4.70.1) (completed: 2005-03-02)
-
Pressing 'X' button in the main frame during Print preview closes print
preview only instead of exiting application (allocated to: 4.70.1) (completed:
2005-03-15)
-
Quotes for symbols beginning with non-US characters are not saved (should "land" in
'_' folder but they don't) (allocated to: 4.70.1) (completed: 2005-03-12)
-
Replaced IQFeed plugin with smaller (release) version (allocated to: 4.70.1)
(completed: 2005-03-12)
-
Symbol->Categories, "This group uses own intraday settings" checkbox
and button are now repositioned correctly when dialog is resized (allocated
to: 4.70.1) (completed: 2005-03-12)
CHANGES FOR VERSION 4.70.0 (as compared to 4.69.8)
- Rewriten all price formulas to use GetPriceStyle()
- _DEFAULT_NAME() uses indicator title if there is no _SECTION defined
- Changed default background color for the charts
- Removed obsolete color pickers from preferences
- when styleOwnScale is selected and min scale value is <= 0 then logarithmic
scaling is turned off for this particular plot
- data plugin interface adjusted back to allow NULL RecentInfo pointer even
if ticker is not null
- Removed all obsolete specialized drawing routines for old built-in charts
- Syntax highlighting: default text and number color changed from pink to
violet (easier for the eyes)
- Hiding chart pane causes auto-arrange (if selected in preferences)
- Chart panes with date axis displayed take more space than panes without
axis if auto-arrange selected
- fixed problem with handling scripting parts written in language that is
new-line sensitive (VBScript)
- Changed "cyclic" colors in ParamColor
- fixed display of negative parameter values in Param dialog
- Fixed "scale shrinking" effect when no plot is drawn
- ParserCleanup is called when exception occurs inside interpretation
- if no GraphXSpace variable is defined then default 2% extra space is added
- support for TWS API 8.30 - add primaryExchange=Exchange = "SMART" (or "BEST")
CHANGES FOR VERSION 4.69.8 (as compared to 4.69.0)
- Added copying error message in AFL editor (Edit->Copy Error Message)
- New column in AA Trade List report: Scale In/Out - showing the number
of scale-in and scale-out operations within given trade
- Added protection against re-opening the same formula in multiple editor
windows via "Edit Formula"
- Price chart style switchable from the menu
- new AFL function:
GetPriceStyle() returns price chart style value
to be used in Plot statement
Returned value depends on selection in View->Price chart style menu
- added View->Price chart style->Line with dots
- IB plugin auto-refresh configurable via File->Database Settings->Configure, "Force
instant quote retrieval for all symbols"
- Fold/unfold directory in Chart tree causes inserting chart (fix double
click handler)
- Fixed 1-tick interval handling when mixed eod/intraday data was enabled
- Fix toolbar display problem when manually sizing down the editor window
to zero, closing and re-opening the editor
- Bar requirements were not recalculated after modifying formula since
introduction of drag-drop. Fixed now.
- Added: You are about to save the file that is located in hidden drag-drop
folder, do you want to move it to Custom folder so it is visible in the
chart tree?" message
- Plot() function protected against specifying negative color
- Indicator exception handler calls now CleanupParser when exception occurred
outside parser but still somewhere inside drawing routine so other indicators
continue to work even if fatal exception occurred during drawing
- added #include_once preprocessor command
- When a formula was drag-and-dropped from the Chart tree on to the AA
window, the formula loaded, but all the parameters were not reset from
the previous formula. Fixed now.
- ApplyStop changes: Fixed problem with trailing stop and exitatstop=2
in regular mode. Also better consistency of trailing stops between "Allow
same day stop" mode set to true and false
- action* constants now highlighted by AFL editor
- additional PositionSize methods
New SetPositionSize function:
SetPositionSize( size, method )
'size' and 'method' parameters are ARRAYS:
'method' can be one of:
spsValue (=1) - dollar value of size (as in previous versions)
spsPercentOfEquity (=2) - size expressed as percent of portfolio-level equity
(size must be from ..100 (for regular accounts) or .1000 for margin accounts)
spsShares (=4) - size expressed in shares/contracts (size must be > 0
)
spsPercentOfPosition (=3) - size expressed as percent of currently open position
(for SCALING IN and SCALING OUT ONLY)
For example to liquidate 50% of position simply use
SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleOut ) );
spsNoChange (=0) - don't change previously set size for given bar (allows
to write constructs like that):
SetPositionSize( 100, spsShares ); // 100 shares by default
SetPositionSize( 50, IIF( buy == sigScaleOut, spsPercentOfPosition, spsNoChange
) ); // for scale-out use 50% of current position size
New SetPositionSize function automatically encodes new methods of expressing
position size into old "positionsize" variable as follows:
values below -2000 encode share count,
values between -2000 and -1000 encode % of current position
values between -1000 and 0 encode % of portfolio equity
values above 0 encode dollar value
Although it is possible to assign these values directly to old-style PositionSize
variable, new code should use SetPositionSize function for clarity.
Example of code that exits 50% on first profit target, 50% on next profit
target and everything at trailing stop:
Buy = Cross( MA( C, 10 ), MA( C, 50 )
);
Sell = 0;
// the system will exit
// 50% of position if FIRST PROFIT TARGET stop
is hit
// 50% of position is SECOND PROFIT TARGET stop
is hit
// 100% of position if TRAILING STOP is hit
FirstProfitTarget = 10; //
profit
SecondProfitTarget = 20; //
in percent
TrailingStop = 10; //
also in percent
priceatbuy=0;
highsincebuy = 0;
exit = 0;
for( i = 0;
i < BarCount;
i++ )
{
if(
priceatbuy == 0 AND Buy[
i ] )
{
priceatbuy = BuyPrice[
i ];
}
if(
priceatbuy > 0 )
{
highsincebuy = Max( High[
i ], highsincebuy );
if(
exit == 0 AND
High[
i ] >= ( 1 + FirstProfitTarget
* 0.01 ) * priceatbuy )
{
//
first profit target hit - scale-out
exit = 1;
Buy[
i ] = sigScaleOut;
}
if(
exit == 1 AND
High[
i ] >= ( 1 + SecondProfitTarget
* 0.01 ) * priceatbuy )
{
//
second profit target hit - exit
exit = 2;
SellPrice[
i ] = Max( Open[
i ], ( 1 + SecondProfitTarget
* 0.01 ) * priceatbuy );
}
if( Low[
i ] <= ( 1 - TrailingStop
* 0.01 ) * highsincebuy
)
{
//
trailing stop hit - exit
exit = 3;
SellPrice[
i ] = Min( Open[
i ], ( 1 - TrailingStop
* 0.01 ) * highsincebuy
);
}
if(
exit >= 2 )
{
Buy[
i ] = 0;
Sell[
i ] = exit + 1; //
mark appropriate exit code
exit = 0;
priceatbuy = 0; //
reset price
highsincebuy = 0;
}
}
}
SetPositionSize( 50, spsPercentOfEquity );
SetPositionSize( 50, spsPercentOfPosition *
( Buy == sigScaleOut )
); // scale out 50% of position
- Change default value of "stop parsing at first error" pref
switch to FALSE
- Context-sensitive help system (press F1, and help page relevant to current
dialog / menu is brought up)
Note that help itself is from version 4.60, so some topics may be missing
yet, but it will be all updated with official release 4.70 as it will come
with a new Users Guide.
- Fixed bug: Drag-drop from one editor instance to another sometimes generated
random characters in source editor
- Added "Error 46. Missing comma" error message to the error
list
CHANGES FOR VERSION 4.69.0 (as compared to 4.68.2)
- Extended error information available now by pressing F1 key after highlighting
error line
- "Syntax error" message improved
[Now the parser attempts to tell you what is the exact reason of the error,
so it may tell you for example that:a) there is probably missing semicolon
in the previous lineb) that it is expecting '{' at the beginning of function
bodyc) that it expects ( after "if" , "for" and "while"etc,
etc.]
- "Missing comma" error message added if there is no comma in
variable declaration list or formal parameter list of the function
- Error line position calculated correctly even if using #include in the
formula
- Word wrap feature removed (as it caused problems with reporting line
number on syntax errors)
- Fixed handling of "Parameter" dialog inside Auto-Analysis
- Empty block statement allowed {}
- Edit button in AA window has now Alt-D shortut instead of Alt-E (no
conflict with &Exploration)
CHANGES FOR VERSION 4.68.2 (as compared to 4.68.1)
- Improved syntax checking so it points to correct row/col even if case
of block statements (completed: 2005-01-25)
[also with "bad arguments" error message arguments are now counted
from 1 (instead of 0).]
- AFL editor now highlights with yellow color the line in which error
occurred (Win XP, Win 2000 only) (completed: 2005-01-25)
[(there is a setting that allows to turn of this feature in Tools->Preferences->Editor "Highlight
error line")]
- Error list in AFL editor (completed: 2005-01-25)
[All error messages are now displayed in the listbox beneath AFL editor.
When you click on each error message, appropriate code line in the editor
is localized.]
- Improved handing of "stop on first error" flag (completed:
2005-01-25)
[Previously only syntax errors were terminating parsing, now also run time
errors terminate parsing on first error (when "stop on first error" flag
is set)]
- Added protection against parser re-entry during formula execution (completed:
2005-01-25)
- ListTrades method of Backtester object now produces output only when "Trade
List" mode is selected in the settings (completed: 2005-01-25)
[In previous versions (4.68.x) this method listed trades regardless of output
mode selected causing misaligned output when "summary" mode was
selected or optimization was run]
- Summary mode shows backtester metrics again (somehow it got broken in
4.68.1) (completed: 2005-01-25)
CHANGES FOR VERSION 4.68.1 (as compared to 4.68.0)
- When re-displaying resizable window its stored size and position is now
adjusted to fit on screen, also maximized state is stored separately (category:
UI - General) (status: fixed) (completed: 2005-01-23)
[(sometimes users moved windows outside desktop and had trouble getting them
back)]
- The reminder message about "Show trade arrows" working in
trade list mode is shown only once per session (category: UI - General)
(status: changed) (completed: 2005-01-23)
- Allow custom metrics to work with 3D optimization charts (category:
AFL - Backtester) (status: fixed) (completed: 2005-01-23)
CHANGES FOR VERSION 4.68.0 (as compared to 4.67.0)
- added: Default Custom backtest proc file path setting in the AA Settings
-allows to define external formula that will be default user-defined backtester
applied to all formulas that do not use its own procedure
- added: SetCustomBacktestProc function to allow changing custom backtest
procedure file from formula level
SetCustomBacktestProc( "filename", enable = True )
filename parameter instructs backtester to use external formula file as custom
backtest procedure
if empty - it means use current formula
enable = True (default) - enables custom backtesting procedure (the same
as SetOption("UseCustomBacktestProc", True );
enable = False - disables custom proc
- added: new ListTrades method of Backtest object and NoTradeList optional
parameter in Backtest method
This allows easier implementation of custom per-trade metrics. One can use
Backtest( 1 ) to disable default listing of trades then iterate via position
and trade list and then call ListTrades method. This is somewhat simpler
then implementing entire backtest loop just to add few per-trade metrics.
- added: Per-trade metrics
Trade object now features AddCustomMetric method.
Note that in contrast to Backtest.AddCustomMetric method that is usually
called after PostProcess, the Trade.AddCustomMetric should be called before
PostProcess call because PostProcess lists trades. Using Trade.AddCustomMetric
after PostProcess gives no result, because trades are already listed.
- added: new field suppoted by SetOption(): PortfolioReportMode
0 - trade list
1 - detailed log
2 - summary
3 - no output (custom only)
- Fixed crash occuring when trying to display error message about COM
exception and COM
- Fixed "Reverse signal forces exit" handled incorrectly in
4.67.0
- changed: BarsInTrade in Trade object should start from 1, not from 2
BarsInTrade property of Trade object is now zero-based. Note however that
the value of zero is available only when trade is just opened in "low-level" approach,
so normally you would see numbers >= 1 (all other reporting in AB remains
as it was, so enter today and exit tommorrow counts as 2-bar trade)
- fixed: click on "NEW" button in Formula editor should generate
new file name in the toolbar
- fixed: Re-enable SAVE button when formula name changes
- added: Raw text output (allocated to: 4.68)
Backtester object features now RawTextOutput method that just outputs any
string to the backtest result list at the time of the call. The user can
output text formatted in multiple columns using \t (tab) character.
- quick access to price arrays of open positions in Trade object (GetPrice
method)
GetPrice( Bar, Field ) method of Trade object retrieves the values of the
following fields:
O (Open)
H (High)
L (Low)
C (Close)
F (Fx currency rate)
NOTES:
1. GetPrice function is available only for OPEN POSITIONS, when called on
closed trade returns Null value
2. Open interest field is not available GetPrice
3. Bar must be between 0..BarCount-1, otherwise exception will occur
CHANGES FOR VERSION 4.67.0 (as compared to 4.66.2)
- when copy-paste results from Exploration, color codes appeared in Excel
as "square" characters. Now it is fixed.
- Automation interface change:
_Item (default property) with id of zero added to Stock.Quotations collection
Old Item() property remains with id of 5. This should ensure backward-compatibility.
- removed FreeExtra function to avoid possible memory fragmentation caused
by constant growing/shrinking memory when accessing data from RT sources
when requested bar count was twice as much as retrieved.
- added error message when the plugin returns incorrect size of quote
array
- removed requesting of quotes from RT data plugins during database save
(this should address exceeding symbol count when saving large databases
running with eSignal plugin)
- new method of Analysis OLE automation object:
Edit( [optional] ForceReload = False )
- displays AFL Editor window for currently loaded formula in AA window, optional
ForceReload parameter (default=false) allows to force AFL edito to reload
the formula from the file.
AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis.
AA.LoadFormula("myFormula.afl");
AA.Edit( 1 ); // force reload
- new method of Analysis OLE automation object:
ShowWindow( nShowCmd ) - allows to show/minimize/maximize/restore AA window
nShowCmd uses standard WinAPI values, few most popular:
SW_HIDE 0
SW_SHOWNORMAL 1
SW_SHOWMINIMIZED 2
SW_SHOWMAXIMIZED 3
SW_RESTORE 9
- Scaling-in and scaling-out (pyramiding) is now supported by the backtester.
Two special constants: sigScaleIn / sigScaleOut added to provide means to
tell the backtester when you want to scale-in/out
All you have to do to implement pyraminding is to:
- Assign sigScaleIn to BUY/SHORT variable if you want to scale-in (increase
size of) LONG/SHORT position
- Assign sigScaleOut to BUY/SHORT variable if you want to scale-out (decrease
size of) LONG/SHORT position
Scaling size is defined by PositionSize variable which in case of scaling
defines not absolute positionsize but dollar increase or decrease.
IMPORTANT: Please note that backtester treats trade that you scale-in/out
as SINGLE trade (i.e. will show single row in trade list). The only difference
versus plain trade is that it will calculate average entry price (and avg.
entry fx rate) based on all partial entries and average exit price (and avg.
exit fx rate) based on all parial exits and will show average prices in entry/exit
price field. The commission is of course applied correctly to each (partial)
entry/exit depending on partial buy/sell size.
If you want to see details about scaling you have to run backtest in "DETAIL
LOG" mode as only then you will see how scaling-in /out works and how
average prices are calculated.
Note also that scaling-in/-out and multiple-currency support is available
only in portfolio backtester. Old backtester as well as Equity() function
do NOT handle scaling-in/out nor multiple currencies (they simply ignore
scaling commands).
Easy examples:
a) dollar-cost averaging (each month you buy stocks for fixed dollar amount)
FixedDollarAmount = 500;
MonthBegin = Month()
!= Ref( Month(),
-1 );
FirstPurchase = Cum(
MonthBegin ) == 1;
Buy = IIf(
FirstPurchase, 1, //
True (or 1) represents regular buy signal
IIf(
MonthBegin, sigScaleIn, //
each month increase position
0 )
); // otherwise no signal
Sell = 0; //
we do not sell
PositionSize =
FixedDollarAmount;
b) dollar-cost averaging
(simplified formula because AB treats first sigScaleIn as buy anyway)
FixedDollarAmount = 500;
MonthBegin = Month()
!= Ref( Month(),
-1 );
FirstPurchase = Cum(
MonthBegin ) == 1;
Buy = IIf(
MonthBegin, sigScaleIn, 0 ); //
each month increase position
Sell = 0; //
we do not sell
PositionSize =
FixedDollarAmount;
c) increasing position when profit generated by trade without pyramiding
becomes greater than 5% and decreasing position when loss is greater than
-5%
// percent equity change threshold when pyramiding
is performed
PyramidThreshold = 5;
// regular trading rules (no pyramiding)
Buy = Cross( MACD(), Signal()
);
Sell = Cross( Signal(), MACD()
);
e = Equity(1); //
generate equity without pyramiding effect
PcntProfit = 100 *
( e - ValueWhen( Buy,
e ) )/ValueWhen( Buy,
e );
InTrade = Flip( Buy, Sell );
// ExRem is used here to ensure that scaling-in/out
occurs
// only once since trade entry
DoScaleIn = ExRem(
InTrade AND PcntProfit > PyramidThreshold, Sell );
DoScaleOut = ExRem(
InTrade AND PcntProfit < -PyramidThreshold, Sell );
// modify rules to handle pyramiding
Buy = Buy + sigScaleIn *
DoScaleIn + sigScaleOut *
DoScaleOut;
PositionSize = IIf(
DoScaleOut, 500, 1000 ); //
enter and scale-in size $1000, scale-out size: $500
- fixed appearent hang occuring on rare occassions when backtesting very
large symbol set with trade size limit and round lot sizes enabled. Under
such conditions the price cache that backtester uses could fill up due
to the delayed release when limit of trade volume was hit and round lot
size or min. shares setting did not allow to enter smaller trade.
- AFL editor changes:
- added separate menu
- auto-saving of formula when user triggers analysis from AA window
instead of AFL editor
- when analysis is triggered from AA window and editor window is
open then any parsing error brings editor to the top
- AFL OLE support extended to allow SETTING OLE properties (previously
only calling methods and getting properties was possible)
Now AFL supports setting/getting properties in usual (brace-less) way:
For example:
AB = CreateObject("Broker.Application");
Stock = AB.Stocks("MSFT");
Stock.FullName = "Microsoft"; //
setting OLE property
- (for advanced users only, work in progress)
implemented new interface allowing to control 2nd phase of portfolio backtest
This allows multitude of applications including, but not limited to:
a) position sizing based on portfolio-level equity
b) implementing advanced rotational systems (you have now access to ranking
arrays and can decide what trades to take after knowing which symbols scores
best on bar-by-bar basis)
c) adding your custom metrics to backtest and optimization statistics
d) implementing custom formulas for slippage control
e) advanced scaling-in/-out based on portfolio equity and other run-time
stats
f) advanded trading systems that use portfolio-level statistics evaluated
on bar-by-bar basis to decide which trades to take
Full documentation on this new interface will be posted in a separate document.
Note: this interface is work-in-progress and any documentation is preliminary
and subject to change
- logical operators between number and dispatch (OLE) objects are performed
OK now. Also dispatch objects may be used in conditional expressions.
CHANGES FOR VERSION 4.66.2 (as compared to 4.66.1)
- Custom Tools menu re-enabled again (it was disabled in 4.66.0 and 4.66.1)
CHANGES FOR VERSION 4.66.1 (as compared to 4.66.0)
- fixed problem with duplicate chart sheets (which appeared in 4.66.0)
CHANGES FOR VERSION 4.66.0 (as compared to 4.65.2)
- Multiple-currency support in backtester.
Now backtester allows to backtest systems on securites denominated in different
currencies. It includes ability to use historical (variable) currency rates.
Currency rates are definable in "Currencies" page in the preferences.
The currency in which given symbol is denominated in can be entered in
Symbol->Information page
- "Currencies" page in Preferences - allows to define base currency
and exchange rates (fixed or dynamic)
for different currencies. This allows to get correct backtest results when
testing securities denominated in different currency than your base portfolio
currency.
- (for advanced users only, beginners should leave it untouched)
ability to change AFL formula root folder. Tools->Preferences->AFL
This not only changes preferences setting but also moves all formula files
from old location to new one and
re-links all charts to files in new location. If you specify new folder please
make sure to create an empty one. Do NOT use root directories like 'C:\'
(Please use this feature with caution, as it may cause problems if you have
more than one copy of AmiBroker installed in different directories, and upgrade
scripts may not find your new formula folder automatically, thus formulas
shipped with AB may not be updated on next installation *)
* - actually I will make installers aware of new folder location but this
will only work if you have one installation or if multiple installations
use the same formula folder.
- Custom indicator storage increased to 3000 slots
- Tools->Preferences->Data, new settings
"In-memory cache size max MegaBytes" -
now allows to limit the in-memory cache size to certain amount of megabytes
(in addition to limiting number of symbols). The default value is 20% of
physical RAM size (calculated by AB at first run)
- Indicator Maintenance Wizard (in Tools menu)
"Indicator Maintenance Wizard" scans all your hard drives for layout
files, then reads them all and checks which indicators are in use, then presents
you with a list of files that are not in-use and can be
deleted. Folders in drag-drop folder are automatically marked for deletion,
the other can be marked manually. And with one click you can delete unused
ones. The wizard can be run on whenever you need.
- new Interactive Brokers plugin (1.3.0) that collects data for all symbols
in RT quote window and forces AB to retrieve collected data even if no
chart is displayed for given symbol nor any scan is run
(note this feature requires not only new plugin but also AmiBroker 4.66.0
or higher)
CHANGES FOR VERSION 4.65.2 (as compared to 4.65.1)
- AFL Formula Editor: toolbar truncation problem solved
- AFL Formula Editor: new "Analysis" button with submenu allows
launching AA Scan/Exploration/Backtest/Optimize directly from the editor.
Subsequent clicks on "Analysis" button repeat last selected action.
- Automatic Analysis window redesigned:
- removed formula edit field - replaced by common editor that is
accessible via "Edit" button,
- changing active formula via "Pick" button
- layout modifed - now more space for result list
- additional button ^ allows to extend result list to cover entire
area of Auto-Analysis window.
- Now it is easy to have the same formula for indicator and AA. Just
edit the formula and insert chart and use the very same formula in
AA. Now when you modify the formula and save it - the changes will
be immediatelly applied to both AA and IB.
- Analysis menu accessible from Formula tree allows to load any formula
from tree directly to AA window.
AA window is also drag-drop target window so you can load the formula to
it via drag-drop too.
CHANGES FOR VERSION 4.65.1 (as compared to 4.65.0)
- fixed unexpected exit of AmiBroker that happened when your formula had
SetChartOptions() call and AFL Editor-> Verify or Insert chart was used
- added automatic saving of fail-safe copy before "Verify" in
AFL editor. Fail-safe copy is saved with .aflsafe extension. The copy is
automatically deleted if check was OK and no crash occurred. In case of
crash you can load the backup file to AFL editor (change "Files of
type" combo to "Fail-safe AFL backup" in the Open File dialog)
CHANGES FOR VERSION 4.65.0 (as compared to 4.64.3)
- AFL formula tree fold/unfold state restoring works with unlimited nesting
levels
- files and entire folders can be now moved using drag & drop mechanism
in AFL formula tree. To MOVE files/folders drag them with RIGHT MOUSE BUTTON,
to overlay on indicators - drag them using LEFT mouse button
- unnecessary formula tree refreshes removed
- multiple-level UNDO in AFL editor
- multiple-level REDO in AFL editor
- other minor 'undo' feature improvements (entering new line character
triggers undo)
- fixed crash when clicked AA->Parameters->Reset All
- Formula Editor has now "Formula name" field that allows to
specify file name quickly and save it without need to open "Save As" dialog
Files are stored by default in Formulas\Custom folder
- Save As... toolbar icon replaced by Save drop down menu
- Save function now uses "formula name" field (no need to open
file dialog)
- Scaling Min/Max properties now use plain edit fields (no sliders)
- Negative custom scale works again
- Numeric parameter editing enhanced:
- if you click on left-side part of the parameter value field then regular
edit field is displayed
- if you click on right-side part of the parameter value field then slider
control is displayed
- when "Step" argument in Param() function call is equal to zero,
then slider is disabled and parameter is editable only via regular edit control
- Formula Editor now features "Apply indicator" button that
works like old "Apply"
(i.e. checks syntax, saves and inserts ONCE) as well as "Insert indicator" (available
from submenu) that allows to insert multiple chart panes linked to the same
formula
- Formula Editor now has "Verify AFL" button that allows to
verify syntax of your AFL
formula without saving
- Automatic Analysis -> Individual Equity and Portfolio Equity now link
directly to
"Formulas\Equity\Individual.afl" and "Formulas\Equity\Portfolio.afl" files.
If you want to have your own customized equity chart you can modify those files
(remember that they will be overwritten by setup program). You can also have
unlimited number of your own equity charts defined as custom indicators.
- Portfolio equity chart allows to turn on/off cash/drawdown/bars since
last high/lin reg parts using Parameter dialog (by default they are all
off)
CHANGES FOR VERSION 4.64.3 (as compared to 4.64.2)
- fixed broker.newcharts file saving routine (should solve 'black panes'
problem that appeared in 4.64.0)
CHANGES FOR VERSION 4.64.2 (as compared to 4.64.1)
- during Layout/Template save, all currently used formulas are marked
as 'used' so they do not get deleted if the user closes the pane using
the same formula in some other layout. (Should solve 'black panes' problem
that appeared in 4.64.0)
- when choosing "Delete" option from the formula tree AmiBroker
displays the warning message that the formula may be in used in some indicators
if the formula was 'linked' to some pane at least once.
CHANGES FOR VERSION 4.64.1 (as compared to 4.64.0)
- formula tree is refreshed after using "Save As..." function
in Formula editor (to show any newly created files)
- "Parameters" menu option is turned on always
CHANGES FOR VERSION 4.64.0 (as compared to 4.63.1)
- QuickAFL is turned ON always
(it does not affect regular AFL code, only may affect some loops and/or plugins
but a graceful period of almost 2 years was given to every user to get
used to it and adjust the code if necessary, note: if particular formula
needs all bars use SetBarsRequired function)
- Quick built-in charts is turned ON always
- Y-axis drag area is now thinner (to make de-selecting date easier)
- resizing dialogs remember not only size but also position
- time&sales windows remember size and positions separately for each
symbol
- time&sales window now uses TimeShift setting from "Intraday
Settings" screen
- max. trade drawdown stat figure is now also updated at exit price of
the max. loss stop
- on startup all formulas (built-in and custom) that were stored in broker.charts
/ broker.bcharts files are now automatically converted to individual AFL
files and stored under: Formulas\Old\Built-in
and Formulas\Old\Custom
- found and fixed few byte memory leak when using #include
- #include can now read from registry using @ character
#include @LastBacktestFormula
will include the formula that was used in last backtest run (useful for custom
equity formulas)
- Workspace tab control now sizes down without displaying tab scroll bar
- all TimeFrame* AFL functions extended to work with N-tick bars too.
N-tick intervals are specified by NEGATIVE numbers passed in 'interval'
parameter.
So for example:
TimeFrameSet( -10 ); // switch to 10-tick interval
- Workspace -> Charts tree now supports file deletion, renaming, creation
of new files and folders plus more via Right-mouse button (RMMB) menu.
Options available from RMB menu:
- Insert - creates a copy of the selected file,
insert _SECTIONS if necessary and inserts charts into new pane
- Insert Linked - just inserts chart into new pane
- the pane links directly to selected formula (so if you have more
than one pane using the same formula, modifying it will modify the
chart in all panes linked to it)
- Overlay - overlays selected formula onto "active" pane.
Active pane is the pane you have clicked on recently
- Edit - opens Formula Editor and loads selected
file for editing
- Rename - allows to rename formula file
- Delete - deletes the formula (permanently !)
- charts panes linked to it will become black
- New->Formula - creates new formula file
- New->Folder - creates new folder
- Refresh - refreshes directory/file tree
- Indicator builder removed and replaced by "Formula Editor"
- you can now control axis and grid settings from "Parameters" dialog
- "Main" chart, "Indicators" and "Other indicators" preference
pages removed. Now all charts use new drag & drop system
CHANGES FOR VERSION 4.63.1 (as compared to 4.63.0)
- fixed one more multiple-monitor problem with color popup control
- Parameters dialog works again in Automatic-Analysis window
- new AFL function: ParamTrigger
ParamTrigger( "Name", "Button text")
- to be used in indicator builder - to create triggers (buttons).
If you place ParamTrigger in the indicator code it will create a "button" in
Parameter dialog that can be pressed.
Normally ParamTrigger will return zero (0) but when button in the param window
is pressed then it will refresh the chart and ParamTrigger will return 1
(one) for this single execution (further refreshes will return zero, until
the button is pressed again)
Example:
trigger = ParamTrigger("Place
Order", "Click here
to place order");
if( trigger
)
{
// your one-shot
code here
}
- new AFL function: ParamList
ParamList( "Name", "Values", default = 0 )
- generates the parameter that consist of the list of choices (specified
in "values" parameter - | or comma separated). default parameter
defines ordinal position of the default string value specified in "values" parameter.
Returned value is a STRING representing choosen item.
Example:
OrderType = ParamList("Order
Type", "MKT|LMT|STP" );
CHANGES FOR VERSION 4.63.0 (as compared to 4.62.1)
- 6th parameter for the Param() - sincr - now has correct default value
of zero.
- trading arrows are correctly aligned again - there was a problem introduced
in 4.62.1 with arrows alignment
- fixed redraw problem of layers list
- new AFL function added:
GetTradingInterface("Name")
- retrieves OLE automation object to automatic trading interface. "Name" is
the interface name. You have to have trading interface installed separately
to make it work otherwise you will get the error message attempting to use
this function. Trading interface for Interactive Brokers will be released
separately.
- layer list item width is adjusted automatically now when sizing the
workspace pane
- colour-popup is aware of multiple-monitor configurations now and opens
up on correct monitor.
- 'Arrange' works properly now after 'pane maximize'
- added warning message when dropping files to AFL formula window.
- added realtime Time&Sales window (View->Time & Sales, or
right click over real time quote window)
Standard Edition: only one time & sales window open
Professional Edition: no limits on simultaneously open Time & Sales windows
Note that Time & Sales window requires true tick-by-tick streaming data
source (like eSignal) to operate properly. Certain feeds may not provide
enough information to allow time&sales window operation. eSignal has
been tested and it works fine, as for the others - there will be 'compatibility
guide' published soon.
- added automatic marking on "show arrows" flag for old-style
Price chart
- new AFL function (advanced users only)
SetChartOptions( Mode = 0, Flags = 0, gridFlags = chartGridMiddle )
allows to set/clear/overwrite/set defaults for chart pane options
- Mode - specifies how options are set:
- 0 - set only the DEFAULT values for new chart. Defaults are
applied only once when chart is inserted in a new pane, so later
you can modify any option using Indicator Builder
- 1 - overwrite - the values specified in 2nd and 3rd argument
overwrite any previously set values
- 2 - set flag - flags specified in 2nd and 3rd parameter are
binary-ORed with the current values, so effectively these options
are set while remaining are unchanged
- 3 - reset flag - flags specified in 3nd and 3rd parameter are
cleared while the others remain unchanged.
- Flags - allowable flags are:
chartShowDates, chartLogarithmic, chartShowArrow
- gridFlags - (for internal AmiBroker use - do not use it in your own
coding as this parameter will be eventually removed) allowable values
are: chartGridDiv100, chartGridPercent, chartGridDiv1000, chartGridMargins
chartGridMiddle, chartGrid0, chartGrid30, chartGrid70, chartGrid10, chartGrid90,
chartGrid50,chartGrid100,chartGrid20,chartGrid80,chartGrid1
Example:
to mark "Show arrows" by default in a new chart use
SetChartOptions( 0, chartShowArrows );
CHANGES FOR VERSION 4.62.1 (as compared to 4.62.0)
- new AFL function
ParamStyle("name", default = styleLine, mask = maskDefault ) -
allows to select the styles applied to plot
- new constants:
styleHidden - a combination of styleNoDraw | styleNoRescale
styleDashed - dashed line
to be used with ParamStyle
maskDefault - show thick, dashed, hidden, own scale styles (this is default
mask for ParamStyle)
maskAll - show all style flags
maskPrice - show thick, hidden, own scale, candle, bar
maskHistogram - show histogram, thick, hidden, own scale, area
- colorCycle - accepted only by ParamColor function as default value,
causes that default color cycles through red, blue, green, turquoise, gold,
violet, bright green, dark yellow
- added new setting in Preferences->Charting "Ask for parameters
of newly inserted indicators"
(default = TRUE) ensures that AmiBroker displays parameter dialog when inserting
or dropping new indicators
- removed obsolete "max number of custom indicators" setting
- Param() function accepts 6 parameters now
Param("name", defvalue, min = 0, max = 100, step = 1, sincr = 0
);
(Only for advanced users)
a new parameter sincr is defines the increase of default value when more
than one section of the same kind is inserted (dropped) onto the chart
For example:
Periods = Param("Periods", 15, 2, 200, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle
), ParamStyle("Style") );
now when more than one moving average is dropped onto the chart then subsequent
moving averages default to 15, 25, 35, 45, ... and so on (starting value
is 15, increase per new section is 10)
CHANGES FOR VERSION 4.62.0 (as compared to 4.61.0)
- implemented indicator drag and drop mechanism. See video tutorial: http://www.amibroker.net/video/dragdrop1.html
- new "Chart" tab in the workspace window (lists all AFL files
and directories from "Formulas" subfolder)
- Automatic Analysis formula window is now drag&drop target too (you
can drag formulas and AFL files onto it)
- new AFL special functions used to automatically create formulas from
code snipplets dragged onto the the indicator pane.
_SECTION_BEGIN, _SECTION_END, _SECTION_NAME, _DEFAULT_NAME, _PARAM_VALUES
- new styleNoTitle causing that given Plot name and values are not included
in the title bar of the indicator
- new ParamField function allowing to pick price field
- new ParamToggle function allowing for boolean (Yes/No) parameters
- In Tools->Preferences , Keyboard you can how define single key shortcut
for maximizing and restoring chart pane via View : PaneToggle
- "Allow mixed EOD/intraday data" switch does not affect N-day
bars anymore
- Parameters are not reset to default values when changing the formula-
user-edited values are kept
- new parameters dialog allowing using sections (for example from drag&drop
generated code)
- parameters dialog displays the items in the order as they appear in
the formula
- fixed Y-axis scale shrinking problem occuring when styleOwnScale was
used for all plots
- Insert->Standard Charts, Insert->Custom Indicators menu options
removed (now everything is handled by drag & drop) (You can still insert
old indicators from Indicator Builder dialog though)
CHANGES FOR VERSION 4.61.0 (as compared to 4.60.4)
- custom time interval support extended to N-day bars.
Now you can define N-day bars in Preferences (Intraday tab) as well as you
can use N-day bars via TimeFrame functions. For example
TimeFrameSet( 3 * inDaily ); // switch to 3-day time frame
VERY IMPORTANT:
inWeekly constant is now 432001 ( 5*inDaily + 1 ) - in previous version it
was 432000
inMonthly constant is now 2160001 ( 25*inDaily + 1 ) - in previous version
it was 2160000
It is changed because now N-day custom intervals are supported and they will
interfere with weekly/monthly.
Note that 5*inDaily is now DIFFERENT than inWeekly. 5*inDaily creates 5-day
bars that DO NOT necesarily cover Monday-Friday
while inWeekly ALWAYS creates bars that begin on Monday and end on Friday.
Also 25*inDaily creates 25-day bars that DO NOT necesarily represent full
month, while inMonthly always begins with first day of the month and ends
at the last day of the month
CAVEAT:
if your code uses hard-coded numbers like 432000 for weekly and 2160000 for
monthly then you MUST change your code to use inWeekly constant and inMonthly
constant instead.
- Study properties dialog has now new checkbox
"Lock position" - when checked study can not be moved or re-sized
- ExitAtStop has a new meaning for N-BAR stop type.
If ExitAtStop = 0 then N-bar stop has the lowest priority (so if for example
profit target stop is hit on the same bar then profit target is evaluated
first)
If ExitAtStop = 1 then N-bar stop has highest priority and it is evaluated
before all other stops.
The same effect is obtained by checking "Has priority" box in AA
Settings window.
- new maximizing/restoring chart pane functionality available via:
View->Pane->Maximize
View->Pane->Restore
as well as via right click menu.
Remember that you can assign your own keyboard shortcuts for that using Tools->Preferences->Keyboard
- New drawing tool: Arrow
- draws a line that ends with an arrow
- New drawing tool: zig-zag line
draws a series of connected trend lines (Hint: press ESC key to finish the
series)
- new File functions in AFL:
- fdelete( "filename" ) - deletes file
"filename" is path to the file name (relative or full path).
If just file name without path is specified then AmiBroker directory
is used, returns TRUE if file successfully deleted, FALSE otherwise
- fmkdir( "dirname" ) - creates (makes)
a directory
"dirname" specifies path of the directory to be created. Please note
that this function creates only ONE directory at a time.
So if you want to create nested directory tree you have to call it multiple
times, for example to create C:\MyDirectory\MySubDirectory folder you
have to call it twice:
fmkdir( "C:\\MyDirectory" );
fmkdir( "C:\\MyDirectory\\MySubDirectory" );
Note also that it is safe to call it even if directory already exists
(then no change to file system is applied)
Returns TRUE if directory successfully created, FALSE otherwise
- frmdir( "dirname" ) - removes a directory
"dirname" specifies path of the directory to be removed. Please note
that this function removes only ONE directory at a time.
So if you want to remove nested directory tree you have to call it multiple
times, for example:
fmkdir( "C:\\MyDirectory\\MySubDirectory" ); //
delete nested subdir first
fmkdir( "C:\\MyDirectory" );
Note that directory must be empty before removing it otherwise it will
not be possible to remove it.
Returns TRUE if directory successfully removed, FALSE otherwise
CHANGES FOR VERSION 4.60.3 (as compared to 4.60.2)
-
third point in 3-point drawing tools like triangle, pitchfork
and fib extensions is now snapped precisely when snap-to-price is enabled
-
user can override the maximum number of bars per symbol that AB allows
CHANGES FOR VERSION 4.60.2 (as compared to 4.60.1)
- october appears on date axis on weekly charts
- fixed small issue with returning global variables from functions (problem
appeared in 4.60.1 only)
- zero level in performance grid is plotted with default grid color
- fixed adding separator characted when percent scale is used
- fixed problem with N/A results occuring when trade size limit by symbol
volume was hit and round lot size was set to zero.
- Title variable templates: making Title statements easy.
Now you can embed special tokens in Title variable
that are replaced by appropriate values at run-time.
if you use {{VALUES}} inside Title string
it will be replaced by automatic-values generated by Plot function calls.
if you use {{NAME}} it will be replaced by ticker symbol.
if you use {{DATE}} it will be replaced by selected date
if you use {{INTERVAL}} it will be replaced by name of the interval
Example:
Title = "{{NAME}} - {{INTERVAL}} {{DATE}} - MyChart : {{VALUES}}";
- added information about the length of the cycle (in bars) when using
cycle drawing tool
CHANGES FOR VERSION 4.60.1 (as compared to 4.60.0)
- AA->Settings->Portfolio "Disable trade size limit if data
bar has the volume of zero" (true by default). When it is turned ON
and the entry bar volume is zero
the backtesterwill not apply the "limit trade size as % of entry bar
volume"- this is to allow backtesting mutual funds that come with zero
volume data When it is OFF and entry bar volume is zero then backtester will
not allow to enter the trade on such bar.
- AA->Settings->Portfolio "Use Previous Bar Equity For Pos Sizing" and
new field supported by SetOption/GetOption:
"UsePrevBarEquityForPosSizing"
Affects how percent of current equity position sizing is performed.
False (default value) means: use current (intraday) equity to perform position
sizing,
True means: use previous bar closing equity to perform position sizing
- cosmetic issues:
- replaced "stock" with "symbol" in some strings
- fixed minor painting problem occuring with cycle study drawn on intraday
charts
- using SelectedValue function does not grow future bar requirements anymore
- added StaticVarGetText to make using text static variables easier
http://www.amibroker.com/f?staticvargettext
- new built-in chart: Relative Performance - use right-click "Parameters" to
change the ticker list.
- ATR uses more bars now when quickafl is on
- scoreNoRotate is now highlighted in AFL editor
- fixed problem with access violations occuring sometimes when calling
the same function many times in single line and return statement in the
form: return varname;
- Status function supports now
"firstvisiblebar", "lastvisiblebar", "firstvisiblebarindex", "lastvisiblebarindex"
CHANGES FOR VERSION 4.60.0 (as compared to 4.59.0)
- fixed problem with not displaying 3D charts when profit was >1000%
(comma used as a thousand separator was causing problems - now the separator
is removed from the data file)
- O3G 3D graphing program improvements:
- optional flat orthogonal view
- translucent water level surface. You can move water level using
PageUp/PageDown keys and/or toolbar buttons Thanks to Mark Feierstein
for suggesting this.
- sizing and centering works much better now
- better font spacing/sizing
- you can now view the 3D chart of ANY statistic from optimization
results just CLICK on the list column HEADER you wish to chart and
then choose Report->3D graph and you will see the chart of selected
metric.
- charting improvements
- when text tool is active, selecting other tool automatically accepts
the text tool entry (no need for additional click on a chart to accept).
(You can of course abandon edits by pressing ESC key)
- trend-line bug (affecting other drawing tools) eliminated. (sometime
on multi-chart and multi-symbol setups the trendline randomly become
almost horizontal, now it is fixed)
- new drawing tool: CYCLE study
- pick start and end points and AmiBroker will plot 30 equally-spaced
cycles toward the past and 30 cycles towards the future
- new drawing tool: Fibonacci Extensions (Price)
- pick start and end point of the controlling trend line, then pick THIRD
point where extension lines will start
- new drawing tool: Fibonacci Time Extensions
- pick start and end point and AmiBroker will plot time cycle lines that
will represent fibonacci ratios multiplied by the number of bars between
start and end point
- drawing three point objects (triangle, pitchfork, and Fib Extensions)
simplified(now you can just click in three places - it is easier
for the beginners than clicking, holding down and dragging as it
worked previously. Old mode of operation works too)
- minor other fixes
- % sign appears again on grids using percent style
CHANGES FOR VERSION 4.59.0 (as compared to 4.58.0)
- added 3D, animated surface graph showing 2-parameter optimization results
(Automatic Analysis, Optimize button menu -> View 3D optimization graph
O3G - the 3D graphing program is pretty self-explaining.
Please note that you can move/rotate/animate the surface plot by mouse, keyboard
and toolbar buttons.
Mouse controls:
- to Rotate - hold down LEFT mouse button and move in X/Y directions
- to Zoom-in, zoom-out - hold down RIGHT mouse button and move in X/Y directions
- to Move (translate) - hold down LEFT mouse button and CTRL key and move
in X/Y directions
- to Animate - hold down LEFT mouse button, drag quickly and release button
while dragging
Keyboard controls:
SPACE - animate (auto-rotate)
LEFT ARROW KEY - rotate vert. left
RIGHT ARROW KEY - rotate vert. right
UP ARROW KEY - rotate horiz. up
DOWN ARROW KEY - rotate horiz. down
NUMPAD + (PLUS) - Near (zoom in)
NUMPAD - (MINUS) - Far (zoom out)
NUMPAD 4 - move left
NUMPAD 6 - move right
NUMPAD 8 - move up
NUMPAD 2 - move down
You can also copy the image as bitmap using Edit->Copy image
- intraday bar's portfolio equity (IBPE) is calculated from current bar
open price (IBPE is used only to calculate position size values when %
of portfolio is specified and reported only in 'detail log' mode). end-of-bar
equity (reported by equity chart) is calculated from close price (as it
always was)
- status bar is automatically shown when Crosshair tool is turned on
CHANGES FOR VERSION 4.58.0 (as compared to 4.57.0)
- 9 new AFL functions:
NoteGet( "Symbol" );
- retrieves note linked to "symbol". If symbol is "" (empty
string) then current symbol is used
NoteSet( "Symbol", "Text..." );
- sets text of the note linked to "symbol".
If symbol is "" (empty string) then current symbol is used.
If you overwrite note from AFL level that is opened at the same time in Notepad
editor the editor will ask you (when you switch the focus to it) if it should
reload new text or allow to save your manually entered text.
Example:
NoteSet("AMD", "Jun
15, 2004: AMD will deliver its first multi-core processors next year");
ClipboardSet( "Text" );
- copies the "text" to the Windows clipboard
ClipboardGet()
- retrieves current contents of Windows clipboard
// this can be used
to put dynamically-constructed texts into
// clipboard
//
ClipboardSet( "The
price of " + FullName()
+ " is " + Close );
VarSet( "varname", value )
- sets the value of dynamic variable*
VarGet( "varname" )
- gets the value of dynamic variable*
StaticVarSet( "varname", value )
StaticVarSetText( "varname", "value" )
- sets the value of static variable**
StaticVarGet( "varname" )
- gets the value of static variable**
* Dynamic variables are variables that are named dynamically, typically
by creating a variable name from a static part and a variable part. For example,
the following example dynamically constructs the variable name from a variable
prefix and a static suffix.
for(
i = 1; i < 10;
i++ )
{
VarSet( "C"+i, Ref( C,
-i ) );
}
// creates variables C1, C2, C3, C4, ...., C10
equal to Ref( C, -1 ), Ref( C, -2 ), ..., Ref( C, -10
)
// respectively
** Static variable - the variable has static duration (it is allocated
when the program begins and deallocated when the program ends)
and initializes it to Null unless another value is specified. Static variables
allow to share values between various formulas.
Only NUMBER and STRING static variables are supported now (not ARRAYS).
- new Preferences: Intraday setting
"Override: Weekly/monthly bars use day of last trade"
when checked (default) then weekly/monthly charts always use timestamp of
the day of last trade within a week/month (may not be Friday or last day
of the month) regardless of what is set in "Time stamp of compressed
intraday bars shows" radio buttons
If you uncheck this box and "time stamp of compressed intraday bar" is
set to END TIME of the interval, then weekly bars will be time-stamped with
last day of the week (sunday) and monthly bars will be time-stamped with
last day of the month regardless if trading has occured on that day or not.
- AddToComposite now by default deletes all previous data instead of setting
existing fields to zero at the start of the scan.
The flag default flag 1 has now the name of atcFlagDeleteValues the old flag
(now optional) atcFlagResetValues now has value of 32. Most formulas using
ATC should not be affected by that change.
- AA: Settings: "Pad and align to reference symbol" is now available
for all AA modes (not only portfolio backtest).
This allows for example to turn on aligning when running scans with AddToComposite
and thus ensuring that data holes do not generate valleys in composites.
This is useful to create intraday composites when data holes/misalignment
is often. (when creating intraday composites it is now recommended to check
alignining as well as changing "Time compressed bars use START (or END)
time of interval" in Tools->Preferences->Intraday)
CHANGES FOR VERSION 4.57.0 (as compared to 4.56.1)
- profit distribution chart took a bit long when profits were extremely
large - now it is fixed
- changed vertical line selection code to prevent line disappearing after
RT update
- vertical line selection is now working fine in multiple linked windows
displaying different time frames
- chart panes can be now moved up/down using View->Pane->Move Up/Down
without need to re-insert everything to change the order
- fixed 'approx. X days' text in the "Database Settings" window
that reported wrong values in versions 4.53..4.56
- when "show arrows" option is selected in AA window then correct
interval is selected in the chart (it was not functioning properly for
beta versions 4.53..4.56 and intraday data)
- added Notepad window (View->Notepad) that allows to store free-text
notes about particular security. Just type any text and it will be automatically
saved / read back as you browse through symbols. Notes are global and are
saved in "Notes" subfolder as ordinary
text files.
- implemented browser-like history Back/Forward in menu View->History
and in the toolbar,(keyboard shortcuts Back: Ctrl+Alt+LEFT, Forward: Ctrl+Alt+RIGHT,
you can change it in Tools->Prefs->Keyboard) Please note that due
to customization features of the toolbar on old installations the Back/Forward
buttons will not appear unless added manually (click with RIGHT mouse button
over standard toolbar, select "CUSTOMIZE" menu and add Back/Forward
buttons.)
CHANGES FOR VERSION 4.56.1 (as compared to 4.56.0)
- fixed crash at address: 0x474f54
- fixed K-ratio calculation. Now follows exactly corrected Excel sheet
from page 89 of "Quantitative Trading Strategies" by Lars Kestner
(published 2003).
- because of many people not reading the comment regarding new "Limit
trade size as % of entry bar volume" setting, implemented checking
for volume = 0 in data files. If volume is equal to 0 in your data file
then this trade size limit does not apply.
CHANGES FOR VERSION 4.56.0 (as compared to 4.55.1)
- fixed crash when RT quote window ticker list contained symbol that did
not exist in the database
- added Toolbar customization:
right-click over any toolbar and choose "CUSTOMIZE" menu to add/remove/arrange
toolbar buttons. You can also press ALT key and move/arrange buttons within
one toolbar without needing to open "customize" dialog
- eSignal plugin 1.7.1: fixed problem with zero data when the user selected
not enough bars to load (mixed mode requires a bit more bars)
CHANGES FOR VERSION 4.55.1 (as compared to 4.55.0)
- implemented workaround to Windows XP status bar display problem causing
plugin status indicator not 'disappearing' sometimes
- fixed problem with crash sometimes occuring when calling Import() OLE
automation method
when AB was not running.
Versions 4.54-4.55 are localization-enabled and month names are localized
too, localized strings have to be setup at the start of the program, but
this was working correctly only if GUI was launched. When creating AB OLE
object without GUI month name string were not
set-up correctly and this caused problems. (This fixes problems with CSI/UA
export as well as AQ trying to import to non-existing instance of AB)
- fputs/fgets/fclose/feof file functions are now protected against using
null file handle
(common coding error among AFL users)
- Parameter names are not truncated in the parameter list
CHANGES FOR VERSION 4.55.0 (as compared to 4.54.0)
- Median and Percentile calculations include current bar
- new symbols added via CategoryAddSymbol trigger workspace ticker list
refresh
- calling COM methods returning nothing (void) does not cause "type
mismatch" message
- duplicate parameters are no longer produced when user specifies parameter
names with trailing/leading spaces in Param()/ParamStr()/ParamColor()
- now it is safe to call AB.RefreshAll() from inside of AmiBroker because
this method is protected against locking up / looping by not allowing consequent
refresh if previous refresh occured in less than one second
- Parameters window now is resizable
- Parameters window now support date and time parameters.
Corresponding new AFL functions are:
ParamDate( "Name", "Default date", format = 0 );
where:
"Name" is a string holding parameter name
"Default date" is a string holding date in any any format:
YYYY-MM-DD
MM/DD/YY
DD-MM-YY
etc, etc.
format - defines return value format, allowable values are:
0 - return value is a NUMBER and holds DateNum. Ie: 990503 for May 3, 1999,
1 - return value is a STRING formatted holding date according to your windows
regional settings
ParamTime( "Name", "Default time", format = 0 );
where:
"Name" is a string holding parameter name
"Default time" is a string holding date in any of the following formats:
HH:MM:SS
HH:MM
format - defines return value format, allowable values are:
0 - return value is a NUMBER and holds TimeNum. Ie: 133515 for 13:35:15
1 - return value is a STRING formatted holding time according to your windows
regional settings
Examples:
Title = WriteVal( ParamDate("ParamDateAsDateNum","2004-05-14"),
7.0 );
Title = ParamDate("ParamDateAsString","2004-05-17",1);
- portfolio/individual backtester/optimizer, new setting in AA->Settings->Portfolio:
"Limit trade size as % of entry bar volume" (default = 10%)
This prevents from entering the trades greater than given percentage of entry
bar's volume.
For example if backtesting daily data and today's volume for thinly traded
stock is 177,000 shares, setting this to 10% will limit the maximum trade
size to 17,700 shares (10% of total daily volume). This prevents from 'affecting
the market'
by huge orders.
IMPORTANT NOTE:
Some instruments like MUTUAL FUNDS come without VOLUME data. To backtest
such instruments please set this field to ZERO (0). This effectively turns
OFF this feature. Otherwise you won't be able to enter any trade at all.
Suggestions are welcome how to handle this problem automatically (maybe just
detect if bar's volume is ZERO and then allow entering any size?)
- K-ratio calculation changed following the change made by its creator,
Mr. Lars Kestner.
Quoting from the book "Quantitative Trading Strategies" from 2003
by Lars Kestner:
[ - - - ]
" The K-ratio is a unitless measure of performance that can be compared
across markets and time periods. [ - - - ] Traders should
search for strategies yielding K-ratios greater than +0.50. Together, the
Sharpe ratio and K-ratio are the most important
measures when evaluating trading strategy performance. Note: When I created
the K-ratio in 1996, I thought I had created a
robust measure to evaluate performance. In mid-2000, trader Bob Fuchs brought
a small error to my attention regarding the
scaling of the K-ratio. He was correct in his critique and I have corrected
the error in this text. Publications prior to 2002 will
show a different formula for the K-ratio. The updated formula in this book
is correct."
Mr Lars Kestner has corrected his formula based on this critique:
K-ratio = slope / ( sterr * per )
slope: Linear regression slope of equity line
sterr: Standard error of slope
per: Number of periods in the performance test
Special thanks to Jeremy Berkovits who brought that to my attention.
CHANGES FOR VERSION 4.54.0 (as compared to 4.53.1)
- "Allow mixed EOD/intraday data" mode added (controllable from
File->Database Settings->Intraday, checkbox with the same name) it
allows to work with database that has a mixture of intraday and EOD data
in one data file. If this is turned on then in intraday modes EOD bars
are removed on-the-fly and in daily mode EOD bars are displayed instead
of time compressed intraday or if there is no EOD bar for corresponding
day then intraday bars are compressed as usual.
This mode works in conjunction with new versions of plugins that
allow mixed data. Mixed mode is now supported by MarketCast plugin
(1.1 or higher)(Australia) and eSignal plugin (1.7.0 or higher) only.
Mixed mode allows intraday plus very long daily histories in one
database.
Note that this is EXPERIMENTAL feature.
+ Real-Time quote window enhanced
Now only fields that are changed change the background to 'yellow' and
if the value in given field increases then it is displayed in green if
decreases then is displayed in red. This allows easy identification of
movement.
+ all strings in the program moved to resources for easy localization
+ fixed problem with SetForeign()+FullName() returning symbol instead
of full name of foreign security.
+ added new AFL function IsContinuous() to check if "continuous" flag
is turned on in Symbol->Information window
+ OLE properties can be retrieved (DISPATCH_PROPERTYGET) directly
from AFL now using parameterless function syntax. This allows reading
values exposed by OLE automation directly from AFL code. Example:
AB = CreateObject("Broker.Application");
Stocks = AB.Stocks(); // get collection
Stock = Stocks.Item( Name()
); // currently selected
"FullName : " +
Stock.FullName();
"Alias : " + Stock.Alias();
"Address : " +
Stock.Address();
"Shares: " + Stock.Issue();
"Book value: " +
Stock.BookValue();
"Market : " + Stock.MarketID();
"WebID : " + Stock.WebID();
You can check if OLE object is valid by calling IsNull() function,
example:
AB = CreateObject("Broker.Application");
Stocks = AB.Stocks(); // get collection
Stock = Stocks.Item( "INTC" );
if( IsNull(
Stock ) )
{
printf("COM
object invalid (Null) - symbol does not exist\n");
}
else
{
printf("COM
object valid - you can access its methods\n");
}
+ IsEmpty/IsNull and IsTrue functions operate with scalars and OLE
dispatches without upsizing them to array
CHANGES FOR VERSION 4.53.1 (as compared to 4.53.0)
- addressed problem with broker.layers file. Now version 4.53.1 correctly
reads broker.layers file saved with older versions however note that old
versions are not compatible with new format.
- layer properties dialog provides more comfortable setting of layer visibility
- other minor fixes
CHANGES FOR VERSION 4.53.0 (as compared to 4.52.0)
- per-group intraday settings (filtering/daily compression) Use Symbol->Categories: "GROUP" -> Use
own intraday settings, click
on "Intraday settings" button to define intraday settings specific
to given group.
- intraday settings now allow to specify separate day (RTH) and night (ETH)
sessions
- time filtering now allows to display:
a) 24 hours trading (no filtering)
b) day session only
c) night session only
d) day and night sessions only
- new intraday time compression mode: Day/Night - shows two bars (day and
night) per day
- daily compression can be now based on
a) exchange time (available since 4.00)
b) local time (available since 4.50)
c) day/night session times definable by the user (new)
- when "activatestopsimmediately" is turned ON then cash from
stopped out positions is NOT available to enter trades the same day
- easy access to selected category settings from Symbol->Information
window.
- Workspace tree supports in-place editing of market, group, sector, industry
and watch list names. Single click on category name and just enter the
name
CHANGES FOR VERSION 4.52.0 (as compared to 4.51.1)
- fixed problem with fixup=0 and handling multiple data holes in a row
- added new commands to ASCII format definitions:
$MINTICKERLEN <number> - defines minimum accepted length of the ticker
symbol
$MAXTICKERLEN <number> - defines maximum accepted length of the ticker
symbol
For example ASX users may wish to use
$MAXTICKERLEN 3
to make sure that ASCII importer accepts only symbols that have no more than
3 characters (this excludes ASX options and warrants)
- fixed problem with incorrect very first value of the array returned by
variable-period version of HHV/LLV
- fixed Procedure/function parameter overwrite issue when using built-in
price arrays and variable overwrite issue
- memory allocated for return value is marked for earlier freeing so calling
user-defined functions inside loops should consume less memory
- Interval() function enhanced. Now accepts format parameter:
Interval( format = 0 );
possible values:
format = 0 - returns bar interval in seconds
format = 1 - as above plus TICK bar intervals are returned with negative
sign
so Interval() function applied to 10 tick chart will return -10
format = 2 - returns STRING with name of interval such as "weekly/monthly/daily/hourly/15-minute/5-tick"
- vertical quote selection line in linked windows is now independent
- changing "same day stops" via SetOption("ActivateStopsImmediately")
in portfolio backtest mode has an effect now (previously reacted only on
manual settings)
- SetOption("CommissionMode", mode ) works now in portfolio
mode too (previously worked
in old backtest mode only)
- SetOption("CommissionAmount", amount ) works now in portfolio
mode too (previously worked
in old backtest mode only)
- $SEPARATOR command in ASCII importer definitions now allows to import
files that have fields separated by more than one separator characters
Separator string (array of characters) must be enclosed in quotation marks.
If there is only one separator character (as in old versions) then quotation
marks are needed.
For example files with joined date and time
$SEPARATOR ", "
$FORMAT DATE_YMD,TIME,OPEN,HIGH,LOW,CLOSE
will be able to import file like this:
2004-02-04 12:30,3.41,3.44,3.40,3.42
(note date and time field are separated by space not by comma)
- Import wizard now supports new separators 'comma or space', 'semicolon
or space' and 'tab or space'
- ASCII importer and Quote Editor properly
distinguish records with time specified as 00:00:00 from EOD records (without
time)
CHANGES FOR VERSION 4.51.1 (as compared to 4.51.0)
- OLE interface methods numbering adjusted to maintain backward compatibility
with previous versions and other programs referring to old OLE interface
CHANGES FOR VERSION 4.51.0 (as compared to 4.50.10)
- OLE automation interface changes:
Analysis.Backtest and Analysis.Optimize now support new "Type" parameter.
Type can be one of the following values:
0 : portfolio backtest/optimize
1 : individual backtest/optimize
2 : old backtest/optimize
For backward compatibility Type parameter is optional and defaults to 2
(old backtest/optimize)
Example code:
AB = new ActiveXObject("Broker.Application");
AB.Analysis.Backtest( 0 ); // perform portfolio backtest
AB.Analysis.Optimize( 0 ); // perform portfolio optimize
-
OLE automation interface new object: "Commentary"
This object has 5 methods:
- BOOL LoadFormula( STRING pszFileName ) - loads the formula
- BOOL SaveFormula( STRING pszFileName ) - saves the formula
- void Apply() - displays the commentary
- BOOL Save( STRING pszFileName ); - saves commentary output (result) to
the file (use after call to Apply())
- void Close() - closes the commentary window
Commentary object is accessible from Broker.Application object via
Commentary property:
Example code:
AB = new ActiveXObject("Broker.Application");
AB.Commentary.LoadFormula("C:\\Program Files\\AmiBroker\\AFL\\MACD_c.afl");
AB.Commentary.Apply();
AB.Commentary.Save("Test.txt");
AB.Commentary.SaveFormula("MACDTest.afl");
//AB.Commentary.Close();
-
AFL function Now( format = 0 ) accepts new parameter values
Returns current date / time in numerous of formats:
// formats supported by old versions
format = 0 - returns string containing current date/time formatted according
to system settings
format = 1 - returns string containing current date only formatted according
to system settings
format = 2 - returns string containing current time only formatted according
to system settings
format = 3 - returns DATENUM number with current date
format = 4 - returns TIMENUM number with current time
format = 5 - returns DATETIME number with current date/time
// new formats available from version 4.51
format = 6 - returns current DAY (1..31)
format = 7 - returns current MONTH (1..12)
format = 8 - returns current YEAR (four digit)
format = 9 - returns current DAY OF WEEK (1..7, where 1=Sunday, 2=Monday,
and so on)
format = 10 - returns current DAY OF YEAR (1..366)
-
Custom indicators:
If plot name is empty the value of such plot does not appear in the title
and does not appear in the data tool tip
Plot( C, "Price", colorWhite, styleCandle );
Plot( MA( C, 10 ), "", colorRed ); // NOTE that this plot name/value
will NOT appear in the title
Plot( MA( C, 20 ), "MA20", colorGreen );
-
SetOption( "field", value )
accepts new fields:
"CommissionMode" -
0 - use portfolio manager commission table
1 - percent of trade
2 - $ per trade
3 - $ per share/contract
"CommissionAmount" - amount of commission in modes 1..3
"MarginRequirement" - account margin requirement (as in settings),
100 = no margin
"ReverseSignalForcesExit" - reverse entry signal forces exit
of existing trade (default = True )
-
new AFL function: GetOption( "field" ) - retrieves the settings,
accepted fields the same as in SetOption.
Example:
PositionSize = -100 / GetOption("MaxOpenPositions");
-
new AFL function: GetRTData( "field" )
- retrieves the LAST (the most recent) value of the following fields
reported by streaming real time data source )
(Note 1: this function is available ONLY in PROFESSIONAL edition,
calling it using Standard edition will give you NULL values for all fields)
(Note 2: works only if data source uses real time data source (plugin)
)
(Note 3: availablity of data depends on underlying data source
- check the real-time quote window to see if given field is available )
(Note 4: function result represents the current value at the time of the
call
/formula execution/, and they will be refreshed depending on chart or commentary
refresh interval
/settable in preferences/. Built-in real time quote window is refreshed
way more often (at least 10 times per second) )
Supported fields:
"Ask" - current best ask price
"AskSize " - current ask size
"Bid" - current best bid price
"BidSize " - current bid size
"52WeekHigh" - 52 week high value
"52WeekHighDate" - 52 week high date (in datenum format)
"52WeekLow" - 52 week low value
"52WeekLowDate" - 52 week low date (in datenum format)
"Change" - change since yesterdays close
"Dividend" - last dividend value
"DivYield" - dividend yield
"EPS" - earnings per share
"High" - current day's high price
"Low" - current day's low price
"Open" - current day's open price
"Last" - last trade price
"OpenInt" - current open interest
"Prev" - previous day close
"TotalVolume" - total today's volume
"TradeVolume" - last trade volume
"ChangeDate" - datenum (YYYMMDD) of last data change
"ChangeTime" - timenum (HHMMSS) of last data change
"UpdateDate" - datenum (YYYMMDD) of last data update
"UpdateTime" - timenum (HHMMSS) of last data update
"Shares" - total number of shares
Example:
"Bid = "+GetRTData("Bid");
"Ask = "+GetRTData("Ask");
"Last = "+GetRTData("Last");
"Vol = "+GetRTData("TradeVolume");
"EPS = "+GetRTData("EPS");
"52week high = "+GetRTData("52weekhigh");
-
Custom indicators:
Default names and graph values appear in the title
when using old-style graph0, graph1, graph2 statements in the custom indicators
CHANGES FOR VERSION 4.50.5 (as compared to 4.50.4)
-
very minor fixes and cosmetics
CHANGES FOR VERSION