[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Using PlotText() with RT trading



PureBytes Links

Trading Reference Links

d, sorry for the delay... This is not the best example but may do for starters. I am still playing with it and the display varies depending on the system's state. I set Blank Bars to the Right of the chart to 2 to give space for text beyond the last bar.  Using "\n" I concatenate various Status msgs I want to see, then display that with one PlotText(). Typically i would like to know the states of my next trade or the trade in progress: qualifiers, stops and limits, etc. Global system status is displayed in the title, not shown here. I trade 1 minute RT.

I sure find it easier to trade having all relevant information around the last bar...

best regards,

herman






// On Chart Bar info
LMsg =
//"Ask:"+PadStringL(NumToStr(AskPrice,1.2),8)+"\n"+
WriteIf( IBPosSize>0," LONG \n"+" "+PadStringL(NumToStr(IBPosSize,1.0,False),6)+" \n","")+
//WriteIf( RTBuy," "+ORderType+" \n","")+
WriteIf( LastValue(LQualifier1), " Q1True \n","")+
WriteIf( LastValue(LQualifier2), " Q2True \n","")+
WriteIf( LastValue(LBreakOut), "BreakOut\n","")+
WriteIf( LastValue(LQualifier1) AND LastValue(LQualifier2) AND LastValue(LBreakOut)," BUY \n","")+
WriteIf( IBPosSize>0, "PT: "+NumToStr(LongPTPrice,1.2),"");
SMsg=
WriteIf( IBPosSize<0," SHORT \n"+" "+PadStringL(NumToStr(abs(IBPosSize),1.0,False),6)+" \n","")+
//WriteIf( RTShort," "+ORderType+" \n","")+
WriteIf( LastValue(SQualifier1), " Q1True \n","")+
WriteIf( LastValue(SQualifier2), " Q2True \n","")+
WriteIf( LastValue(SBreakOut), "BreakOut \n","")+
WriteIf( LastValue(SQualifier1) AND LastValue(SQualifier2) AND LastValue(SBreakOut)," SELL \n","")+
WriteIf( IBPosSize<0, "PT:"+NumToStr(ShortPTPrice,1.2),"");
PlotText( LMsg, BarCount, LastValue(O)+0.03, 5, 1);
PlotText( SMsg, BarCount, LastValue(O)-0.03, 4, 1);
PlotShapes(IIf(LastBar,shapeHollowSquare,shapeNone),1,0,C,0);
//PlotText( " Bid \n"+NumToStr(BidPrice,1.2), BarCount+3, Max(AskPrice+0.02,BidPrice), 5);
//PlotText( " Ask \n"+NumToStr(AskPrice,1.2), BarCount+3, Min(askPrice,BidPrice-0.02), 4);
PlotText( NumToStr(LongLimitPrice,1.2), BarCount-2, LongLimitPrice+0.01, 5);
PlotText( NumToStr(ShortLimitPrice,1.2), BarCount-2, ShortLimitPrice-0.02, 4);


If you get a chance could take a pic of this and send it?  And a code snippet of how you do this would be great!!

d




From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman van den Bergen
Sent: Wednesday, February 15, 2006 7:20 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] AmiBroker 4.77.0 BETA released


Hi Chuck,

Normally i display Trading and System stats (Recent Trades, Equity, Critical Param, etc. ) in table format in the Chart Title. I also displayed there action information on the current trade, such as various levels of Trade entry, partials fills, order status, etc. I know you can use the interpretation screen for this but i prefer all the "action" in one window. The problem is that in Real-Time trading the tile is far removed from the action at the last bar and one tends to miss events because of the continual refocusing that is required.

The new PlotText() allows me to show all the "action" information right above/below the last bar in nice colors, now I only have to pay attention to a few square inches of the chart during trading, instead of two opposite corners of the monitor. Much more relaxing, no more eye fatigue :-)

best regards,
herman


-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf Of cstrader
Sent: Tuesday, February 14, 2006 8:12 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] AmiBroker 4.77.0 BETA released


Herman.  What do you mean by this:

....working on code to move trade-stats from the Title to the RT bar.

Thanks!

----- Original Message -----
From: Herman van den Bergen
To: amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, February 14, 2006 7:33 PM
Subject: RE: [amibroker] AmiBroker 4.77.0 BETA released


Thank you Tomasz, some great new features!

I love the PlotText and i am already working on code to move trade-stats from the Title to the RT bar. Also, now RT trading information can be placed right at the last bar for easy viewing. Good stuff!!!

best regards,
herman




-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf Of Tomasz Janeczko
Sent: Tuesday, February 14, 2006 5:07 PM
To: amibroker@xxxxxxxxxxxxxxx; amibroker-beta@xxxxxxxxxxxxxxx; amibroker-news@xxxxxxxxxxxxxxx
Subject: [amibroker] AmiBroker 4.77.0 BETA released



Hello,

A new beta version (4.77.0) of AmiBroker has just been released.

It is available for registered users only from the members area at:
http://www.amibroker.com/members/bin/ab4770beta.exe

(File size: 1 093 693 bytes, 1 MB)

If you forgot your user name / password to the members area
you can use automatic reminder service at: http://www.amibroker.com/login.html

The instructions are available below and in the "ReadMe" file
( Help->Read Me menu from AmiBroker )

IMPORTANT NOTES:



If you are using Firewall you may need to check if it did not block Broker.EXE file after upgrade. (It happened to some users that firewall blocked AmiBroker after upgrade and they could not connect to RT data sources due to that)

Best regards,
Tomasz Janeczko
amibroker.com

AmiBroker 4.77.0 Beta Read Me
February 14, 2006 22:51
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.77.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.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@xxxx)
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


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


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 Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software



YAHOO! GROUPS LINKS

 Visit your group "amibroker" on the web.

 To unsubscribe from this group, send an email to:
 amibroker-unsubscribe@xxxxxxxxxxxxxxx

 Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



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
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS