AmiBroker 6.25.0 BETA released


#1

A new beta version (6.25.0) of AmiBroker, with lots of new AFL functionality has been released.

32-bit version:
http://www.amibroker.com/members/bin/ab6250beta.exe
(2 259 152 bytes)

64-bit version:
http://www.amibroker.com/members/bin/AmiBroker6250x64.exe
(10 690 248 bytes)

DevLog announcement:
http://www.amibroker.com/devlog/2017/07/24/amibroker-6-25-0-beta-released/

Read Me:
http://www.amibroker.com/devlog/wp-content/uploads/2017/07/readme6250.html

UPGRADE POLICY
This version is a free upgrade only for users who registered AmiBroker after July 24, 2015. Users who registered earlier, would need to purchase license upgrade. To find out the version you currently have use Account Information page at http://www.amibroker.com/members/info.php

CHANGES FOR VERSION 6.25.0 (as compared to 6.22.0)

  1. 64-bit: In 6.22 the array division could produce 1ulp (units at least place) rounding errors due to too excessive new VC++2017 compiler optimizations. Workaround implemented to avoid that.
  2. Added support for formatDateTimeISON (ISO format NO dashes: YYYYMMDD for end of day and YYYYMMDD HHMMSS for intraday)
  3. AFL Editor: added one-time message “In the Debug mode number of bars is limited to 200 bars. You can change it in Tools->Preferences, Debugger tab” because users don’t read docs
  4. AFL: ApplyStop now has 8th argument: ActivationFloor that defines the amount of profit (in dollars or percents, according to stopmode) that must be exceeded before stop is activated
  5. AFL: Gui* – controls are created in the order of occurence in AFL formula (instead shuffled or reverse as in previous version)
  6. AFL: Gui* – keyboard navigation is now enabled (you can tab between controls and use arrows to navigate control groups such as radio boxes)
  7. AFL: IsNull() accepts matrix input and returns 0 (False), i.e. “variable is not null” if variable is of matrix type
  8. AFL: math functions such as sin(), sqrt(), etc can now be applied to matrices (element-wise operation) (previously such attempt resulted in access violation)
  9. AFL: New feature: Passing arguments as reference (allows modification of arguments passed – easy way to return multiple values), to pass by reference use & (address-of) operator before variable identifier
  10. AFL: new function GuiCheckBox – creates check box
  11. AFL: new function GuiGetCheck( id ) – gets ‘checked’ or “ON” state of toggle, checkbox and radio buttons
  12. AFL: new function GuiRadio – creates radio button
  13. AFL: new function GuiSetCheck( id, checked ) – sets ‘checked’ or ‘ON’ state of toggle, checkbox and radio buttons
  14. AFL: new function GuiSetFont( “fontface”, size )
  15. AFL: new function GuiToggle – creates toggle button (like normal button but it toggles between “on” and “off” state with each click)
  16. AFL: SetOption(“OptimizeSaveParams”, True ); – turns on generation of AFL file that contains values of optimization parameters producing best result. The generated file has the same name as formula run but has .opt.afl extension
  17. AFL: When using TimeFrame functions, QuickAFL now uses ratio of requested_interval/current_interval multipled by 30 to better estimate required bars
  18. Analysis: Detailed log displays information about ignored ScaleIn/Outs because of insufficient funds or trade size constraints
  19. Analysis: Detailed log now displays all warnings about skipped/ignored signals in RED color so they are easier to spot
  20. Data: when performing X:Y split and X or Y exceeded 255 the factor was incorrectly displayed (negative) in the Symbol window. Fixed.
  21. formatDateTimeISO and formatDateTimeISON added to syntax highlighter definitions
  22. Scheduler: Repeat “Daily” mode repeated batch run every day even if some days were unchecked. Fixed.
  23. UI: Place Order dialog – allows typing stop distances smaller than 0.1 now
  24. UI: Prefs/Charting: Turning on “Collapse parameter sections” option causes all sections in Parameter window to be collapsed (NOT good idea for newbies as they wont see the controls !)
  25. Web Research: many HTML5 pages did not display properly because of the fact that web browser used old IE7 mode. Now browser uses IE11 mode at minimum for proper HTML5 rendering
  26. 64-bit version ships with brand new AmiQuote 3.22 already (compiled with Visual C++ 2017)

Break Even - simple solution
New Radio Buttons
Can't start the new ver 6.25 64bit
GuiButton used together with Insert => Trendline
Can't change variable passed by reference
Swing High / Swing Low AFL Code
Parameters - Section Minimize
Swing High / Swing Low AFL Code
#2

#8

@Tomasz Thank you for some nice features in this beta.

May I ask for clarification of the pass-by-reference behavior in these use-cases:

function assignElement(array)
{
    array[BarCount-1] = 0;
}

function assignArray(array)
{
    zeroArray = BarIndex() && 0;
    array = zeroArray;
}

function assignScalar(array)
{
    zeroScalar = 0;
    array = zeroScalar;
}

function assignString(array)
{
    array = "my string";
}

oneArray = BarIndex() || 1;

assignElement(&oneArray);
assignArray(&oneArray);
assignScalar(&oneArray);
assignString(&oneArray);

#9

hi Tomasz, thanks for the new features.

I am playing around with the new buttons. I got the GuiToggle and the GuiCheckBox working.

  1. I am having problems with the GuiRadio. Maybe you can comment how to use that.
  2. The text next to the radio and checkbox buttons . How does one control the color and background colors. Seems to be only black. In code below I use GuiSetColors but does not seem to have an effect.

below the test code I am using where I am making an attempt to use the new buttons.

thank you

_SECTION_BEGIN( "Buttons Test" );

ZTCellHeight = Param( "ZT Cell Height", 20, 5, 200, 1 );
ZTCellWidth = Param( "ZT Cell Width", 60, 5, 200, 1 );
ZTCellXSpace = Param( "ZT Cell X Space", 5, 0, 50, 1 );
ZTCellYSpace = Param( "ZT Cell Y Space", 5, 0, 50, 1 );
ZTtransx = Param( "ZT Move Button Pack (X-Axis)", 0, 0, 2000, 1 );
ZTtransy = Param( "ZT Move Button Pack (Y-Axis)", 0, 0, 2000, 1 );
ZTCellXPosition = Param( "ZT Cell X Position", 0, 0, 60, 1 );
ZTCellYPosition = Param( "ZT Cell Y Position", 0, 0, 60, 1 );
ZTFontPointsize = Param( "ZT Font Pointsize", 10, 1, 50, 1 );
ZTFontWeight = Param( "ZT Font Weight", 700, 100, 1000, 50 );
ZTFontPosition = Param( "ZT Font Position", 0, 0, 860, 10 );
ZTFontType = ParamList( "ZT Font Type", "Tahoma|Helvetica|Arial|Verdana|Courier New", 4 );
ZTButtonBorderWidth = Param( "ZT Button Border Width", 1, 0, 5, 1 );
ZTZoomButtonclrText = ParamColor( "ZT Zoom Button Text Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrBack = ParamColor( "ZT Zoom Button Back Color", ColorRGB( 0, 0, 250 ) );
ZTZoomButtonclrBorder = ParamColor( "ZT Zoom Button Border Color", ColorRGB( 150, 150, 150 ) );
ZTZoomButtonclrSelText = ParamColor( "ZT Zoom Button Select Text Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrSelBack = ParamColor( "ZT Zoom Button Select Back Color", ColorRGB( 0, 0, 250 ) );
ZTZoomButtonclrSelBorder = ParamColor( "ZT Zoom Button Select Border Color", ColorRGB( 150, 150, 150 ) );
ZTZoomButtonclrHoverText = ParamColor( "ZT Zoom Button Hover Text Color", ColorRGB( 200, 200, 200 ) );
ZTZoomButtonclrHoverBack = ParamColor( "ZT Zoom Button Hover Back Color", ColorRGB( 0, 0, 200 ) );
ZTZoomButtonclrHoverBorder = ParamColor( "ZT Zoom Button Hover Border Color", ColorRGB( 250, 250, 0 ) );
ZTZoomButtonclrDisText = ParamColor( "ZT Zoom Button Disabled Text Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrDisBack = ParamColor( "ZT Zoom Button Disabled Back Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrDisBorder = ParamColor( "ZT Zoom Button Disabled Border Color", ColorRGB( 250, 250, 250 ) );

id = GuiGetEvent( 0, 0 );
event = GuiGetEvent( 0, 1 ); 
x0 = ZTtransx;
y0 = ZTtransy;

GuiSetFont( ZTFontType, ZTFontPointsize );

GuiToggle( "Toggle", 34,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ZTCellYPosition, ZTCellWidth, ZTCellHeight, 1 );

GuiCheckBox( "Chk1", 36,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 2 ), ZTCellWidth, ZTCellHeight, 1 );
GuiCheckBox( "Chk2", 38,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 3 ), ZTCellWidth, ZTCellHeight, 1 );

GuiRadio( "Rad1", 40,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 5 ), ZTCellWidth, ZTCellHeight, 1 );
GuiRadio( "Rad2", 42,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 6 ), ZTCellWidth, ZTCellHeight, 1 );
GuiRadio( "Rad3", 44,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 7 ), ZTCellWidth, ZTCellHeight, 1 );

GuiSetColors( 34, 44, ZTButtonBorderWidth,
              ZTZoomButtonclrText, ZTZoomButtonclrBack, ZTZoomButtonclrBorder,
              ZTZoomButtonclrSelText, ZTZoomButtonclrSelBack, ZTZoomButtonclrSelBorder,
              ZTZoomButtonclrHoverText, ZTZoomButtonclrHoverBack, ZTZoomButtonclrHoverBorder,
              ZTZoomButtonclrDisText, ZTZoomButtonclrDisBack, ZTZoomButtonclrDisBorder );


checked = 1;
unchecked = 0;

if( id == 40 AND event == 1 )
{
    GuiSetCheck( 40, checked );
    GuiSetCheck( 42, unchecked );
    GuiSetCheck( 44, unchecked );
}

if( id == 42 AND event == 1 )
{
    GuiSetCheck( 40, unchecked );
    GuiSetCheck( 42, checked );
    GuiSetCheck( 44, unchecked );
}

if( id == 44 AND event == 1)
{
    GuiSetCheck( 40, unchecked );
    GuiSetCheck( 42, unchecked );
    GuiSetCheck( 44, checked );
}

"Toggle: " + GuiGetCheck( 34 );

"CheckBox 1: "
+ GuiGetCheck( 36 );

"CheckBox 2: "
+ GuiGetCheck( 38 );

"Radio 1: "
+ GuiGetCheck( 40 );

"Radio 2: "
+ GuiGetCheck( 42 );

"Radio 3: "
+ GuiGetCheck( 44 );

_SECTION_END();

#10

@empottasch - I should have mentioned in the read me but this is a “feature” of Windows XP and higher

Microsoft in its infinite stupidity decided to stop supporting changing text and colors in WM_CTLCOLOR message in Windows XP and higher so you simply can NOT get any other colors than “regular” (standard), unless you stop using Windows OS and draw every pixel yourself.

This is how GuiButton and GuiToggle are drawn - once you set custom colors Windows OS is COMPLETELY BYPASSED and every pixel is drawn by the application.

But for checkbox and radio we are using Windows OS. And that means seeing the limitation of Windows.
I could re-implement yet another part of OS, but should I really?
Microsoft having hordes of programmers can’t do basic things. In fact these things were working pre-Windows XP. Why should individual fix all the wrong doings of big corporations (Microsoft, Yahoo, Google). Funny thing is that Microsoft is NOT using their own OS functions (controls) in their OWN products (MS office). Instead of fixing the OS, they re-implement in the Office large portions of what should be working in OS.

As to Radio button controls, in order for them to create a GROUP you need to use CONSECUTIVE IDs. Your IDs are incorrect, they are using 40, 42, 44 while you should be using consecutive numbers (40, 41, 42)

// working example:
GuiRadio( "Rad1", 40, 10, 10, 100, 20, 0 );
GuiRadio( "Rad2", 41, 10, 30, 100, 20, 0 );
GuiRadio( "Rad2", 42, 10, 50, 100, 20, 0 );

#11

thanks for your reply. I will check how I can setup my Amibroker colors using the Windows Standard.

and thanks for the help with the radio buttons, will check it out.


#12

@Steve I am not sure what your question is?

If you are asking about using subscript operator on reference

function myfun( var_passed_by_ref )
{
 var_passed_by_ref[ subscript ] = 1; // can't do subscripts on references yet
}
myfun( &x ); // pass reference

function myfunOK( var_passed_by_ref )
{
 for( i = 0; i <BarCount; i++ ) x[ i ] = i;
 var_passed_by_ref = x; // assignment of array to reference works just fine
}

myfunOK( &x ); // pass reference, function can modify x

then subscript operator can’t be applied on references as of now. If you want to use references, you want to pass data back you need to do normal assignment, like in your assignVarray, assignScalar, assignString.

Using subscript on references will be allowed in next version.


#13

using a gfx rectangle to set the background color work very good for the radio/checkbox buttons, see example

_SECTION_BEGIN( "Buttons Test" );

RequestMouseMoveRefresh();

ZTCellHeight = Param( "ZT Cell Height", 20, 5, 200, 1 );
ZTCellWidth = Param( "ZT Cell Width", 60, 5, 200, 1 );
ZTCellXSpace = Param( "ZT Cell X Space", 5, 0, 50, 1 );
ZTCellYSpace = Param( "ZT Cell Y Space", 5, 0, 50, 1 );
ZTtransx = Param( "ZT Move Button Pack (X-Axis)", 0, 0, 2000, 1 );
ZTtransy = Param( "ZT Move Button Pack (Y-Axis)", 0, 0, 2000, 1 );
ZTCellXPosition = Param( "ZT Cell X Position", 4, 0, 60, 1 );
ZTCellYPosition = Param( "ZT Cell Y Position", 0, 0, 60, 1 );
ZTFontPointsize = Param( "ZT Font Pointsize", 10, 1, 50, 1 );
ZTFontWeight = Param( "ZT Font Weight", 700, 100, 1000, 50 );
ZTFontPosition = Param( "ZT Font Position", 0, 0, 860, 10 );
ZTFontType = ParamList( "ZT Font Type", "Tahoma|Helvetica|Arial|Verdana|Courier New", 4 );
ZTButtonBorderWidth = Param( "ZT Button Border Width", 1, 0, 5, 1 );
ZTBackgroundBoxColor = ParamColor( "ZT Background Box Color", ColorRGB( 250, 250, 150 ) );
ZTZoomButtonclrText = ParamColor( "ZT Zoom Button Text Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrBack = ParamColor( "ZT Zoom Button Back Color", ColorRGB( 0, 0, 250 ) );
ZTZoomButtonclrBorder = ParamColor( "ZT Zoom Button Border Color", ColorRGB( 150, 150, 150 ) );
ZTZoomButtonclrSelText = ParamColor( "ZT Zoom Button Select Text Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrSelBack = ParamColor( "ZT Zoom Button Select Back Color", ColorRGB( 0, 0, 250 ) );
ZTZoomButtonclrSelBorder = ParamColor( "ZT Zoom Button Select Border Color", ColorRGB( 150, 150, 150 ) );
ZTZoomButtonclrHoverText = ParamColor( "ZT Zoom Button Hover Text Color", ColorRGB( 200, 200, 200 ) );
ZTZoomButtonclrHoverBack = ParamColor( "ZT Zoom Button Hover Back Color", ColorRGB( 0, 0, 200 ) );
ZTZoomButtonclrHoverBorder = ParamColor( "ZT Zoom Button Hover Border Color", ColorRGB( 250, 250, 0 ) );
ZTZoomButtonclrDisText = ParamColor( "ZT Zoom Button Disabled Text Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrDisBack = ParamColor( "ZT Zoom Button Disabled Back Color", ColorRGB( 250, 250, 250 ) );
ZTZoomButtonclrDisBorder = ParamColor( "ZT Zoom Button Disabled Border Color", ColorRGB( 250, 250, 250 ) );

id = GuiGetEvent( 0, 0 );
event = GuiGetEvent( 0, 1 ); 
x0 = ZTtransx;
y0 = ZTtransy;
GfxSetZOrder( 0 ); 
GfxSelectSolidBrush( ZTBackgroundBoxColor ); 
x1 = x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 1.9 );
x2 = x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 3.0 );
y1 = y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 1.8 );
y2 = y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 8 );
GfxRectangle( x1, y1, x2, y2 );

GuiSetFont( ZTFontType, ZTFontPointsize );

GuiToggle( "Toggle", 34,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ZTCellYPosition, ZTCellWidth, ZTCellHeight, 1 );

GuiCheckBox( "Chk 1", 36,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 2 ), ZTCellWidth, ZTCellHeight, 1 );
GuiCheckBox( "Chk 2", 38,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 3 ), ZTCellWidth, ZTCellHeight, 1 );

GuiRadio( "Rad 1", 40,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 5 ), ZTCellWidth, ZTCellHeight, 1 );
GuiRadio( "Rad 2", 41,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 6 ), ZTCellWidth, ZTCellHeight, 1 );
GuiRadio( "Rad 3", 42,  x0 + ( ZTCellWidth + ZTCellXSpace ) * ( ZTCellXPosition + 2 ), y0 + ( ZTCellHeight + ZTCellYSpace ) * ( ZTCellYPosition + 7 ), ZTCellWidth, ZTCellHeight, 1 );

GuiSetColors( 34, 42, ZTButtonBorderWidth,
              ZTZoomButtonclrText, ZTZoomButtonclrBack, ZTZoomButtonclrBorder,
              ZTZoomButtonclrSelText, ZTZoomButtonclrSelBack, ZTZoomButtonclrSelBorder,
              ZTZoomButtonclrHoverText, ZTZoomButtonclrHoverBack, ZTZoomButtonclrHoverBorder,
              ZTZoomButtonclrDisText, ZTZoomButtonclrDisBack, ZTZoomButtonclrDisBorder );

"id: " + id;
"event: " + event;

checked = 1;
unchecked = 0;

if( id == 40 AND event == 1 )
{
    GuiSetCheck( 40, checked );
    GuiSetCheck( 41, unchecked );
    GuiSetCheck( 42, unchecked );
}

if( id == 41 AND event == 1 )
{
    GuiSetCheck( 40, unchecked );
    GuiSetCheck( 41, checked );
    GuiSetCheck( 42, unchecked );
}

if( id == 42 AND event == 1)
{
    GuiSetCheck( 40, unchecked );
    GuiSetCheck( 41, unchecked );
    GuiSetCheck( 42, checked );
}


"Toggle: " + GuiGetCheck( 34 );

"CheckBox 1: "
+ GuiGetCheck( 36 );

"CheckBox 2: "
+ GuiGetCheck( 38 );

"Radio 1: "
+ GuiGetCheck( 40 );

"Radio 2: "
+ GuiGetCheck( 41 );

"Radio 3: "
+ GuiGetCheck( 42 );

GraphXSpace = 5;
SetChartBkColor( ColorBlack );
SetChartOptions( 0, chartShowDates );
SetBarFillColor( IIf( C > O, ColorRGB( 0, 75, 0 ), IIf( C <= O, ColorRGB( 75, 0, 0 ), colorLightGrey ) ) );
Plot( C, "\nPrice", IIf( C > O, ColorRGB( 0, 250, 0 ), IIf( C <= O, ColorRGB( 250, 0, 0 ), colorLightGrey ) ), 64, Null, Null, 0, 0, 1 );

_N(Title = "Buttons test");

_SECTION_END();

#14

@Tomasz Thank you, the pass by reference behavior is clear now. I was wondering about possible restrictions.


#15

Wow! It really is much faster. Thanks for all your great work @Tomasz .


#16

Question to anyone using new 6.22/6.25 beta 64-bit version, which Windows exact version are you running?

I am asking because from the reports it seems that code compiled with new Visual C++ 2017:

  • works on all releases and service packs of Windows 7 and Windows 8 and 8.1
  • works only on certain combination/version of Windows 10

And I am trying to find pattern/version number/service pack that causes problems


#17

Amibroker Pro 64-bit 6.25 Beta running on Windows 7 Pro Service Pack 1.

Having no issues.


#18

for me 6.25 seems to be working, (except for some issues with the new buttons but that is as explained Windows related)

comp1: Windows 10, version 1703, Build 15063.483

comp2: Windows 10, version 1703, Build 15063.483


#19

Thanks. As I thought, no clear pattern.
Windows 10 version 1703 was causing problem on one customer computer generally works for others.
And by “working” I mean “starting”. When the problem occurs it simply stops at certain stage with splash screen being displayed ‘for ever’, so it is pretty obvious to notice.


#20

Tomasz. I did get this yesterday when I was playing with Windows colors.

I went to 1) Windows settings, then 2) Personal settings, then 3) Colors then I went to 4) settings for “high contrast” (not sure if this is the correct translation, because mine is in Dutch). Then you can chose from 4 themes. When I chose 1, then Amibroker wouldn’t start. But it looked horrible anyways so I went back quickly to the default.


#21

6.25 working fine
Win 10 Pro Build 14393


#22

it’s working on my testing machine machine:

Windows 10, version 1703, Build 16251.0


#23

Fantastic! You get :1st_place_medal: @empottasch - thanks a lot for this info! Indeed changing to High Contrast #1 scheme seems to trigger some Windows bugs. Even some parts of Windows settings stop working and apparently Windows theming support suffers too (is switched OFF) that probably is the source of problems.

This helped a lot as I was scratching my head why it worked on fine 98% of Win 10 installations including all my testing setups. But I never ever used those horrible :mushroom: high contrast settings.


#24

Keyboard shortcuts seem to not work, pressing CTRL+R does not pop the parameters window. I have windows 10 version 1703, build 15063.483


#25

Keyboard shortcuts WORKS for me with a similar system spec’s, pressing the CTRL+R does pop the parameters window open.

I have Windows 10 “Pro” Version 1703, OS Build 15063.483 (64-bit)