June 21, 2015 17:13

__THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT
BUGS !!!__

**Backup your data files and entire AmiBroker folder
first! **

**INSTALLATION INSTRUCTIONS**

Just run the installer and follow the instructions.

Then run AmiBroker. You should see "AmiBroker 6.00.0 BETA" written in the About box.

**See CHANGE LOG below for detailed list of changes. **Note that only changes
that affect end-user directly are listed here. Internal code changes/refactoring
is usually not mentioned.

**CHANGE LOG**

**CHANGES FOR VERSION 6.00.0 (as compared to 5.99.0)**

- AFL Editor: Preferences: the default value for "Auto-complete" changed to "Immediate"
- AFL: MxGetSize( matrix, dim ) - get matrix size in
given dimension

where

matrix argument is matrix to query for the sizes

dim argument is 0 or 1. 0 gets number of rows, 1 gets number of columns.MxGetSize( matrix, 0 ) - gives number of rows

MxGetSize( matrix, 1 ) - gives number of columns - AFL: MxIdentity( size ) - creates an indentity matrix of defined size (square matrix with rows and columns equal to size argument filled with ones on the main diagonal and zeros elsewhere)
- AFL: MxTranspose( matrix ) - creates transpose of an input matrix
- AFL: Warning 506 is suppressed when formating
is 1.0 (integer)

**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 10z = 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 matrixfor( 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

- ActivateStopImmediatelyand 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 characterThis 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 17Example 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 versionbi = 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 RateCurrent 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 date2. 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):

Bar style is useful for displaying probability distribution charts`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**) );

}

- 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

**HOW TO REPORT BUGS**

If you experience any problem with this beta version please send detailed description of the problem (especially the steps needed to reproduce it) to support at amibroker.com