March 25, 2006 20:11
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT BUGS !!!
Backup your data files and entire AmiBroker folder
first!
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.79.0 beta" written in the About box.
UPGRADE ALERT
Version 4.75.x beta requires license for v4.30 or higher. Users
who registered before March 5th, 2003 (version 4.20 or older) need to purchase
upgrade - in such case you will see "LICENSE EXPIRED" message in
the About box.
See CHANGE LOG below for detailed list of changes.
CHANGE LOG
CHANGES FOR VERSION 4.79.0 (as compared to 4.79.0)
SetOption("HoldMinBars", 127 );
Buy=BarIndex()==0;
Sell=1;
// even if sell signals are generated each day,
//they are ignored until bar 128
Buy = Cross(MACD(),Signal());
Sell = Cross(Signal(),MACD());
Filter = Buy OR Sell;
AddColumn( IIf( Buy,
Asc("B"), Asc("S")), "Signal", formatChar );
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
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 );
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();
CHANGES FOR VERSION 4.78.1 (as compared to 4.78.0)
CHANGES FOR VERSION 4.78.0 (as compared to 4.77.0)
Filter=1;
for( i = 0;
i < 256; i = i + 16 )
AddColumn( C, "C"+i, 1.2, colorDefault, ColorHSB(
( BarIndex() + i ) % 256, 255-i, 255 )
);
// 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 );
// 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 );
}
CHANGES FOR VERSION 4.77.0 (as compared to 4.76.0)
bo.AddCustomMetric( "Somestat", 100*kr, Null, Null, 4 ); //
5th parameter controls number of decimal places
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 )
);
CHANGES FOR VERSION 4.76.0 (as compared to 4.75.2)
// 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();
}
CHANGES FOR VERSION 4.75.2 (as compared to 4.75.1)
CHANGES FOR VERSION 4.75.1 (as compared to 4.75.0)
CHANGES FOR VERSION 4.75.0 (as compared to 4.74.6)
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 );
for(
i = 0; i < 1000;
i++ )
for( k
= 0;
k < 1000; k++
)
Sumh = H + L;
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 );
}
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)
CHANGES FOR VERSION 4.74.5 (as compared to 4.74.4)
CHANGES FOR VERSION 4.74.4 (as compared to 4.74.3)
CHANGES FOR VERSION 4.74.3 (as compared to 4.74.2)
CHANGES FOR VERSION 4.74.2 (as compared to 4.74.1)
CHANGES FOR VERSION 4.74.1 (as compared to 4.74.0)
CHANGES FOR VERSION 4.74.0 (as compared to 4.73.0)
CHANGES FOR VERSION 4.73.0 (as compared to 4.72.1)
CHANGES FOR VERSION 4.72.1 (as compared to 4.72.0)
CHANGES FOR VERSION 4.72.0 (as compared to 4.71.1)
CHANGES FOR VERSION 4.71.1 (as compared to 4.71.0)
CHANGES FOR VERSION 4.71.0 (as compared to 4.70.5)
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
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