Hello,
> I understand the below explanation to mean
that " ULPS=9" would be roughly 0.00009%
accurate.
> Therefore, it is my understanding that 0.00009% accuracy is
the LARGEST difference that
> AlmostEqual( x, y, ulps = 9 )
will allow.
> I would appreciate
hearing if this a correct understanding of this new AlmostEqual
function? Ron D
Yes, that's correct.
As I mentioned earlier, you don't need to specify
formal parameter name when calling the function,
just pass the value.
So intstead of:
AlmostEqual( x, y, ulps = 9 )
just call it this way:
AlmostEqual( x, y, 9 )
Best regards, Tomasz
Janeczko amibroker.com
----- Original Message -----
Sent: Saturday, September 17, 2005 3:24
AM
Subject: Re: [amibroker] AmiBroker 4.73.0
BETA released
I origionally sent this post under a new title of "AlmostEqual( x,
y, ulps = 5 )" , and I received the following message:
"We are unable to deliver the message from < mrdavis9@xxxxxxxxxx> to <amibroker
@yahoogroups.com>.Your message was sent to a group that does not
exist. Please check to make sure you spelled the group name
correctly."
This happens every once in a while. Does
this sometimes happen to others on this board?
============================================================
I understand the below explanation to mean that "
ULPS=9" would be roughly 0.00009% accurate.
Therefore, it is my understanding that 0.00009% accuracy is
the LARGEST difference that AlmostEqual( x, y, ulps = 9 ) will
allow. I would appreciate hearing if this a correct
understanding of this new AlmostEqual function? Ron D
================================================================
AlmostEqual( x, y, ulps = 5 ) 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".
----- Original Message -----
Sent: Friday, September 16, 2005 5:42
PM
Subject: [amibroker] AmiBroker 4.73.0
BETA released
Hello,
A new beta version (4.73.0) of AmiBroker has
just been released.
Best regards, Tomasz
Janeczko amibroker.com
AmiBroker 4.73.0 Beta Read Me
September 17, 2005 0:36
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT BUGS !!!
Backup your data files and entire AmiBroker folder
first! IMPORTANT NOTE: This version uses new system to store indicators
(in separate files), so old versions will not automatically "see" indicators
created with new version.
INSTALLATION INSTRUCTIONS
IMPORTANT: This archive is update-only. You have to install full
version 4.70 first.
Just run the installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 4.73.0 beta" written in the
About box.
Many thanks to all providing detailed descriptions how to reproduce given
bug.
See CHANGE LOG below for detailed list of changes.
CHANGE LOG
- 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
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
bugs at
amibroker.com
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|