Highlights of version 5.00
Highlights of version 4.90:
For more information about new features please check USAGE NOTES ON NEW FEATURES.
CHANGES FOR VERSION 5.00.0 (as compared to 4.99.0)
CHANGES FOR VERSION 4.99.0 (as compared to 4.98.0)
CHANGES FOR VERSION 4.98.0 (as compared to 4.97.0)
Title = "Axis
Min Y = " + Status("axisminy")
+ "Axis Max Y = " + Status("axismaxy"); 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 );
}
CHANGES FOR VERSION 4.97.0 (as compared to 4.96.0)
TimeFrameMode( 3 ); //
turn on range bars
TimeFrameSet( 1.5 ); //
set compression to 1.5$ range bar
if( ParamTrigger("Display
Popup Window", "Press
here" ) )
{
PopupWindow("Current
time is: " + Now(),"Alert", 2, 640*mtRandom(), 480*mtRandom());
}
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";
}
CHANGES FOR VERSION 4.96.0 (as compared to 4.95.0)
// 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 );
CHANGES FOR VERSION 4.95.0 (as compared to 4.94.0)
CHANGES FOR VERSION 4.94.0 (as compared to 4.93.0)
CHANGES FOR VERSION 4.93.0 (as compared to 4.92.0)
CHANGES FOR VERSION 4.92.0 (as compared to 4.91.1)
wlnumber = CategoryFind("MyWatch
List 1", categoryWatchlist );
mysymbols = CategoryGetSymbols(categoryWatchlist,
wlnumber );Filter= InWatchListName( "mywatchlist" ) OR InWatchListName( "mysecondwatchlist" );CHANGES FOR VERSION 4.91.1 (as compared to 4.91.0)
CHANGES FOR VERSION 4.91.0 (as compared to 4.90.5)
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 );
}
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.0 (as compared to 4.89.0)
CHANGES FOR VERSION 4.89.0 (as compared to 4.88.0)
CHANGES FOR VERSION 4.88.0 (as compared to 4.87.1)
CHANGES FOR VERSION 4.87.1 (as compared to 4.87.0)
CHANGES FOR VERSION 4.87.0 (as compared to 4.86.0)
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)
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)
mydatenum = DateTimeConvert( 0, DateTime()
);// - this returns DateNum mytimenum = DateTimeConvert( 1, DateTime()
); // - returns timenum mydatetime = DateTimeConvert( 2, DateNum(), TimeNum()
); mydatetime = DateTimeConvert( 2, DateNum()
);// get modification
date string of portfolio.afl file
fgetstatus("formulas\\Equity\\portfolio.afl",1,0);CHANGES FOR VERSION 4.84.0 (as compared to 4.83.1)
Status("redrawaction")if( Status("redrawaction")
==1 )
{
_TRACE("\nTIMED
REFRESH"+Now());
}
RequestTimedRefresh(1);
CHANGES FOR VERSION 4.83.1 (as compared to 4.83.0)
CHANGES FOR VERSION 4.83.0 (as compared to 4.82.0)
SetOption("HoldMinDays", 30 ); //
set minimum holding period to 30 calendar days
SetOption("EarlyExitDays", 90 ); //
set penalty period to 90 calendar daysPositionScore = ..your normal score..
// if market timing signal goes negative close
all posiitons
PositionScore = IIf(
MarketTimingSignal < 0, scoreExitAll, PositionScore ); SetChartBkGradientFill( ParamColor("BgTop", colorWhite),ParamColor("BgBottom", colorLightYellow));CHANGES FOR VERSION 4.82.0 (as compared to 4.81.1)
outBuffer = ""; // global output string buffer
function output( string )
{
outBuffer = outBuffer + string + "\n";
}
AB = new ActiveXObject( "Broker.Application");
Docs = AB.Documents;
DocsQty = Docs.Count;
for( i = 0; i < DocsQty; i++ )
{
Doc = Docs( i );
output( "Document " + i + " name : " + Doc.Name );
Windows = Doc.Windows;
WinsQty = Windows.Count;
for( j = 0; j < WinsQty; j++ )
{
Win = Windows( j );
output( " Window " + j + " Selected tab " + Win.SelectedTab );
}
}
WScript.echo( outBuffer );
WScript.echo( "Now will add one window" );
Doc = Docs( 0 );
Windows = Doc.Windows;
NewWindow = Windows.Add();
WScript.echo( "and close it" );
NewWindow.Close();
CHANGES FOR VERSION 4.81.1 (as compared to 4.81.0)
CHANGES FOR VERSION 4.81.0 (as compared to 4.80.2)
CHANGES FOR VERSION 4.80.2 (as compared to 4.80.1)
CHANGES FOR VERSION 4.80.1 (as compared to 4.80.0)
CHANGES FOR EARLIER VERSIONS ARE DOCUMENTED IN RELEASE NOTES DOCUMENT THAT YOU CAN FIND IN AMIBROKER INSTALLATION FOLDER.