PureBytes Links
Trading Reference Links
|
Hello,
A new beta version (4.38.0) of AmiBroker has just been
released.
It is available for registered users only from the members
area at:
<FONT
size=2>http://www.amibroker.com/members/bin/ab4380beta.exe
If you forgot your user name / password to the members
area
you can use automatic reminder service at: <A
href=""><FONT
size=2>http://www.amibroker.com/login.html
Short list of changes in
this beta (read change log in the "read me" below for the
details)
send e-mails with charts directly from AmiBroker: Edit->Image->Send by
email and File->Send chart via e-mail
added export chart image to PNG (portable network graphics) file:
Edit->Image->Export to PNG file
new setting for candlestick appearance: Tools->Preferences->Charting,
"Use distinct color for" : "None, up candle hollow" - it plots entire candle
with one color but leaves interior of UP candle body hollow.
fixed positioning of arrows in image copies (Edit->Image->Copy)
fixed crash occurring when printer device context did not support bit blit
copies. added very simple arrow line drawing for that case (will be improved in
future releases)
fixed bug in handling Null with new constructs: if, while and for.
numbers (floats) are now automatically 'upsized' to arrays on first use of
l-value array subscript operator without causing error.
.Best regards,Tomasz
Janeczkoamibroker.com
AmiBroker 4.38.0 Beta Read Me
May 20, 2003 1:11
THIS IS AN EARLY BETA VERSION OF THE SOFTWARE. EXPECT BUGS
!!!
AGAIN: THIS IS AN EARLY 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.30 first.
Just run the installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 4.38.0 beta" written in the
About box.
See CHANGE LOG below for detailed list of changes.
HELP ON NEW FEATURES
USER-DEFINABLE FUNCTIONS, PROCEDURES, LOCAL/GLOBAL VARIABLES (4.34 or
higher)
Here is a sample code showing user-defined function:
// the following function is 2nd order smoother
function IIR2( input, f0, f1, f2 ){ result[ 0 ] =
input[ 0 ]; result[ 1 ] = input[ 1 ];
for( i = 2; i < BarCount; i++
) { result[ i ] = f0 * input[ i ] +
f1 * result[ i - 1 ] +
f2 * result[ i - 2 ]; }
return result;}
Plot( Close, "Price", colorBlack, styleCandle );Plot( IIR2( Close,
0.2, 1.4, -0.6 ), "function example", colorRed );
In this code IIR2 is a user-defined function. input, f0, f1,
f2 are formal parameters of the functions.At the time of function call
the values of arguments are passed in these variables. Formal parameters behave
like local variables.Later we have result and i which are
local variables. Local variables are visible inside function only. If any other
function uses the same variable name they won't interfere between each
other.
Due to the fact that AFL does not require to declare variables the decision
whenever given variable is treated as local or global is taken depends on where
it is FIRST USED.
If given identifier appears first INSIDE function definition - then it is
treated as LOCAL variable.If given identifier appears first OUTSIDE function
definition - then it is treated as GLOBAL variable.
This default behaviour can be however overriden using global and
local keywords (introduced in 4.36) - see example 2.
Example (commentary):
k = 4; // this is GLOBAL variable
function f( x ){ z = 3; // this is LOCAL
variable return z * x * k; // 'k' here references
global variable k (first used above outside
function)}
z = 5; // this is GLOBAL variable with the same name as local variable
in function f
"The value of z before function call :" + WriteVal( z );
// Now even if we call function // the value of our global variable
z // is not affected by function call because// global variable z and
local variable z are separate and // arguments are passed by value (not by
reference)
"The result of f( z ) = " + WriteVal( f( z ) );
"The value of z after function call is unchanged : " + WriteVal( z
);
Example 2: Using local and global keywords to override default visibility
rules:
VariableA = 5; // implict global variablefunction
Test(){ local VariableA; // explicit local variable with the
same identifier as global global VariableB; // explicit global
variable not defined
earlier //
may be used to return more than one value from the
function VariableA = 99; VariableB = 333;}
VariableB = 1; // global variable
"Before function call";"VariableA = " + VariableA;"VariableB =
" + VariableB;
Test();
"After function call";"VariableA = " + VariableA + " (not affected
by function call )";"VariableB = " + VariableB + " (affected by the function
call )"
At the end of the function we can see 'return' statement that is used to
return the result to the caller. Note that currently return statement must be
placed at the very end of the function.
It is also possible to write a procedure (a function that returns nothing
(void))
procedure SinePlotter( Freq, ColorIndex ){ pname =
"Line"+WriteVal(ColorIndex,1.0); array = sin( Cum( Freq * 0.01 )
); Plot( array, pname , colorRed + ColorIndex, styleThick
);}
for( n = 1; n < 10; n++ ){ SinePlotter(
n/2+Cum(0.01), n );}
Note that although there are two separate keywords 'function' and 'procedure'
AmiBroker currently treats them the same (they both accept return values but not
require them), but in the future the rules maight get enforced to usereturn
statement ONLY in conjunction with function keyword. So it is advised to use
function keyword in case when your function returns any value and procedure
keyword otherwise.
Note also that recursion (having a function call itself from within itself)
is NOT supported as for now.
FLOW CONTROL AND LOOPING
(4.31 or higher)
do-while Statement
The do-while statement lets you repeat a statement or compound
statement until a specified expression becomes false.
Syntax
do statement while ( expression )
;
The expression in a do-while statement is evaluated after the
body of the loop is executed. Therefore, the body of the loop is always executed
at least once.
The expression must have numeric or boolean type. Execution proceeds
as follows:
The statement body is executed.
Next, expression is evaluated. If expression is false, the
do-while statement terminates and control passes to the next statement
in the program. If expression is true (nonzero), the process is
repeated, beginning with step 1.
This is an example of the do-while statement:x=100;
do
{
y = sin( x );
x--;
} while ( x > 0 );
In this do-while statement, the two statements y = sin( x
); and x--; are executed, regardless of the initial value of
x. Then x > 0 is evaluated. If x is
greater than 0, the statement body is executed again and x > 0
is reevaluated. The statement body is executed repeatedly as long as
x remains greater than 0. Execution of the do-while
statement terminates when x becomes 0 or negative. The body of the
loop is executed at least once.
while Statement
The while statement lets you repeat a statement until a specified expression
becomes false.
Syntax
while ( expression ) statement
The expression must have arithmetic (numeric/boolean) type.
Execution proceeds as follows:
The expression is evaluated.
If expression is initially false, the body of the while
statement is never executed, and control passes from the while
statement to the next statement in the program.
If expression is true (nonzero), the body of the statement
is executed and the process is repeated beginning at step 1.
This is an example of the while statement: i = 10;while( i < 20 ){ Plot( MA( Close, i ), "MA" + WriteVal( i, 0 ), colorBlack + i ); i = i + 1;}
The example plots 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 -
bar moving averages.
for Statement
The for statement lets you repeat a statement or compound statement a
specified number of times. The body of a for statement is executed zero
or more times until an optional condition becomes false.
Syntax
for ( init-expression ; cond-expression
; loop-expression ) statement
Execution of a for statement proceeds as follows:
The init-expression, is evaluated. This specifies the
initialization for the loop. There is no restriction on the type of
init-expression.
The cond-expression, is evaluated. This expression must have
arithmetic type. It is evaluated before each iteration. Three results are
possible:
If cond-expression is true (nonzero), statement is
executed; then loop-expression, if any, is evaluated. The
loop-expression is evaluated after each iteration. There is no
restriction on its type. Side effects will execute in order. The process
then begins again with the evaluation of cond-expression.
If cond-expression is false (0), execution of the for
statement terminates and control passes to the next statement in the
program.
This example illustrates the for statement: myema[ 0 ] = Close[ 0 ];for( i = 1; i < BarCount; i++ ){ myema[ i ] = 0.1 * Close[ i ] + 0.9 * myema[ i - 1 ];}This example iterates all bars of close array to calculate exponential moving average
if, else Statements
if( expression )statement1 [else
statement2]
The if keyword executes statement1 if expression is true
(nonzero); if else is present and expression is false (zero), it
executes statement2. After executing statement1 or
statement2, control passes to the next statement.
Example 1if ( i > 0 )
y = x / i;
else
{
x = i;
y = abs( x );
}
In this example, the statement y = x/i; is executed if
i is greater than 0. If i is less than or equal to 0,
i is assigned to x and <FONT
face="Courier New">abs( x ) is assigned to y.
Note that the statement forming the if clause ends with a semicolon.
When nesting if statements and else clauses, use braces to
group the statements and clauses into compound statements that clarify your
intent. If no braces are present, the compiler resolves ambiguities by
associating each else with the closest if that lacks an
else.
Example 2if ( i > 0 ) /* Without braces */
if ( j > i )
x = j;
else
x = i;
The else clause is associated with the inner if statement in
this example. If i is less than or equal to 0, no value is assigned
to x.
Example 3if ( i > 0 )
{ /* With braces */
if ( j > i )
x = j;
}
else
x = i;
The braces surrounding the inner if statement in this example make the
else clause part of the outer if statement. If i is
less than or equal to 0, i is assigned to x.
CHANGE LOG
CHANGES FOR VERSION
4.38.0 (as compared to 4.37.0)
new setting for candlestick
appearance:Tools->Preferences->Charting"Use distinct color for"
: "None, up candle hollow" - it plots entire candle with one color but
leaves interior of UP candle body hollow.
added export chart image to PNG (portable network graphics)
fileEdit->Image->Export to PNG file (Please don't ask me to add
GIF support. GIF is patented and requires $3500 license fee for Unisys. PNG is
free, supported by all browsers, smaller and better )
added 'send chart by e-mail' feature Edit->Image->Send by
emailandFile->Send chart via e-mail
fixed positioning of arrows in image copies (Edit->Image->Copy)
fixed crash occurring when printer device context did not support bit blit
copies. added very simple arrow line drawing for that case (will be improved
in future releases)
fixed bug in handling Null with new constructs: if, while and for.In
pre-4.38 versions Null used in if, while for was treated as True, which was
wrongif( Null ) _TRACE("WRONG");else
_TRACE("CORRECT");Now Null in if, while, for is treated as False.
numbers (floats) are now automatically 'upsized' to arrays on first use of
l-value array subscript operator without causing error. Also r-value
subscript can be applied to numbers and return the number itself without
causing error, but the underlying variable remains just a single
number.This allows to easily intialize arrays to any value without
need to write loops.Example 1:in previous versions you would need
to write:for( i = 0; i < BarCount; i++ ) myarray[ i ] = 0 ;
// fill with zerosmyarray[ 5 ] = 6; // write value to 5th element of the
arraynow you can write simply:myarray = 3; //
initialize, at this moment myarray is just a numbermyarray[ 5 ] = 6; //
write value to 5th element of the array, the variable is automatically//
upsized to array and all elements are filled with a numeric value // that
was originally placed in myarray variable/* myarray is holds now the
array filled with values of 3 except element 5 that has value of 6
*/mynumber = 5;test = mynumber[ 7 ]; // previous versions would
give an error message here// now subscript operator for r-value numeric
variable // is allowed and returns just the number // and variable is
not upsized to array unless appears on left side// of assignment
(l-value)/* mynumber variable here is still a number */WriteVal( test
);
CHANGES FOR VERSION
4.37.0 (as compared to 4.36.0)
printing improved, now all open indicator panes are printed and resolution
is increased
Edit->Copy As Image and Edit->Copy As Metafile now generate an image
consisting of all indicator panes (not just one)
fixed problem with non-resetting sort arrows in AA window
fixed sometimes occuring crash Signal() function
increased size of error message text buffer to prevent overflow when
reporting syntax errors in formulas having long unwrapped lines.
grid lines are drawn with fine dots instead of small dashes (screen output
only)
new AFL functions:GetCategorySymbols( category, index ) -
retrieves comma-separated list of symbols belonging to given
categorysupported categories:categoryMarket categoryGroup
categorySector categoryIndustry categoryWatchlistcategoryFavorite
categoryIndex index = (market/group/industry/sector/watchlist
number)0..255 for categoryMarket, categoryGroup, categoryIndustry0..63
for categorySector, categoryWatchlistignored for categoryFavorite,
categoryIndexStrExtract( list, item )- extracts given item
(zero-based) from comma-separated string.Example:StrExtract(
"MSFT,AAPL,AMD,INTC", 2 ) will return AMD StrExtract(
"MSFT,AAPL,AMD,INTC", 0 )will return MSFTStrExtract(
"MSFT,AAPL,AMD,INTC", 200 ) will return empty string ""+ other
minor fixesExample code for GetCategorySymbols and
StrExtract:/* note: if given watch list contains lots of symbols
** performance may be poor */function CreateAverageForWatchList(
listnum ){ // retrive comma-separated list of symbols in watch
list list = GetCategorySymbols( categoryWatchlist, listnum
); Average = 0; // just in case there are no watch list
members for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++
) { f = Foreign( sym, "C"
); if( i == 0 ) Average = f; else
Average = Average + f; } return Average / i; // divide
by number of components}Plot( CreateAverageForWatchList( 1 ), "Avg
of WL 1", colorGreen );
CHANGES FOR VERSION
4.36.0 (as compared to 4.35.0)
fixed problem with affecting 2 or more identifiers referencing the same
array when using l-value subscript operator []. Thanks Herman for pointing
this out
global and local keywords - for explicit visibility/scope declarations
Allow to override default scope rules that assume that variables defined
outside function are global, while those identifiers that appear for the first
time inside functions are local.
Syntax:
local var1 [, var2, ... ] ;global var1 [, var2, ... ]
;
(as you can see you can declare more than one variable in one line.
Note: using these keywords outside function definition has no
meaning(global scope is used).
Example:
VariableA = 5; // implict global variablefunction
Test(){ local VariableA; // explicit local variable with
the same identifier as global global VariableB; // explicit global
variable not defined
earlier //
may be used to return more than one value from the
function VariableA = 99; VariableB = 333;}
VariableB = 1; // global variable
"Before function call";"VariableA = " + VariableA;"VariableB
= " + VariableB;
Test();
"After function call";"VariableA = " + VariableA + " (not
affected by function call )";"VariableB = " + VariableB + " (affected by
the function call )";
syntax highligting modified so keywords: #include, if, else, while, do,
function, procedure, global, local, return are colorised differently than
built-in constants or functions. Corresponding color/style setting added to
Preferences->Editor
#pragma nocache pre-processor command added to switch off #include
file caching mechanism.Note: between '#pragma' and 'nocache' there must be
exactly SINGLE spaceNote 2: disabling caching may slow down execution of
the formula (especiallyin indicators)Note 3: #pragma nocache must be
placed before #includesExample:
#pragma nocache#include <myfile.afl>
single line comments now work with #includes (and #pragma too) so you can
comment out include in regular way://#include <something> - will not
include
changed error message from "unknown identifier" to "Variable 'name' used
without having been initialized." which better decribes the problem.
For example:
function Test( ){ global x; x =
3;}
WriteVal( x ); // variable used without having been
initialized,// although declared inside Test() function
body
Test( ); // during function call the value of 3 is assigned to
variable x
WriteVal( x ); // and now no error is reported
implemented shortcut evaluation of logical operators
The operands of logical-AND and logical-OR expressions are evaluated from
left to right. Now if the value of the first operand is sufficient to
determine the result of the operation, the second operand is not evaluated.
This is called “short-circuit evaluation.” The left operand of the
logical-AND operator is completely evaluated and all side effects complete
before continuing. If the left operand evaluates to false (0), the other
operand is not evaluated.The left operand of the logical-OR operator
is completely evaluated and all side effects complete before continuing.
If the left operand evaluates to true (nonzero), the other operand is not
evaluated.
(The above description applies to operands that evaluate to single boolean
value, it does not apply to arrays. Operands that evaluate to arrays are
evaluated always )
Example:for( i = -3; i < BarCount; i++ ){ //
using old versions of AMiBroker you would get subscipt out of
range // but now // the second operand (C[ i ] > C[ i - 1
]) is evaluated // ONLY if first operand ( i >= 1 ) evaluates to
TRUE
if( i >= 1 && C[ i ] > C[ i - 1 ]
) { _TRACE("TEST " + i);
}}
CHANGES FOR VERSION
4.35.0 (as compared to 4.34.2)
do-while loop implemented:Syntax:do statement
while ( expression ) ;The expression in a do-while
statement is evaluated after the body of the loop is executed. Therefore,
the body of the loop is always executed at least once.
Example:i=0;do{ i++;}while(
i < 100 );WriteVal( i );
it is now allowed to 'add' (or rather concatenate) string to a number /
array. This saves quite a bit of typing. This works as in JScript. The
left-hand operand of '+' has to be a string. The right-hand operand may be
string, number or array. Numbers are coerced to strings using %g sprintf
formatting (prints out decimal point only when necessary) and then
concatenated. In case of arrays SELECTED VALUE is coerced to string and then
concatenated.So now instead of i = 100;"Value is " +
WriteVal( i );"Close : " + WriteVal( Close ) + ", Open : " + WriteVal(
Open ) + ", High : " + WriteVal( High );you can
write:i = 100;"Value is " + i;"Close : " + Close + ",
Open : " + Open + ", High : " + High;Note
that"Test " + 100 + 1;will give you "Test 1001"
because statements are parsed from left to right."Test " is added first to
"100" giving "Test 100" and then to "1" giving"Test 1001". If you want to
perform numeric adding first please use braces:"Test " + ( 100 +
1 );- this will give you "Test 101"
additional tweaks in AFL engine & garbage collection, futher speed up
of execution of very long loops
more error checking in AFL engine - will report using uninitialized
variables that were accepted silently in 4.31.x - 4.34.x
#include now accepts new way of specifying file names to
include:#include <filename.afl>(note <
> braces instead of " " ) if you specify the file name this way AmiBroker
will look forthe file in "standard include path" that is definable using
new prefs setting in Tools->Preferences->AFLIt makes much shorter to
write includes and you can move include folder now without changing all AFL
codes using #includes.For example if you have set standard include
path to "C:\AFL\MyIncludes" and write in your formula:#include
<common.afl>AmiBroker will look for
C:\AFL\MyIncludes\common.afl fileAlso now #include
reports file(s) not found in regular error message box.
IIf/Min/Max are now overloaded functions (have two variants each)IIF(
Condition_ARRAY, True_Array, False_Array ) (old one)IIF( BoolValue,
TrueValue, FalseValue )Min( array1, array2 ) (old one)Min(
number1, number2 ) Max( array1, array2 ) (old one)Max( number1,
number2 ) The second one is choosen when all arguments are numbers and
it is much much faster and returns number so LastValue() call is not
neccessary anymore.Example:// much faster
and does not require LastValue()period = IIF( name() ==
"MSFT", 5, 10 );result = Min( 7, 3 ); // (result is still
a number not array as in previous versions)
added 'endless loop detection threshold' setting to Preferences "AFL" tab.
Recommended value 100000 or higher.
fixed parameter counting in CallFunction plugin callback in case of
overloaded functions
fixed problem with premature freeing of arrays passed in default
parameters fields (causing for example problem with color exploration output -
introduced in 4.32)
CHANGES FOR VERSION
4.34.2 (as compared to 4.34.0)
improved crash recovery dialog to include AFL engine state information and
(in some cases) the source line of the formula that causes an exception
added ability to catch all exceptions in indicators and commentaries
(switchabel via Tools->Preferences->AFL, "catch system exceptions...",
ON by default) - allows you to continue to work even in case of serious
problem
loop break by Shift+BREAK is now more sensitive
now you can control how often Shift+BREAK key is checked during formula
execution (Tools->Preferences->AFL, "check SHIFT+Break every" (1..100,
default = 50) (note that specifying low values may degrade performance
slightly)
tweaked AFL memory allocator hash tables to get more speed for large
looping formulas
although I never reproduced this problem I made some changes so 'TAB' key
should not wipe the contents of AFL editor anymore
CHANGES FOR VERSION
4.34.0 (as compared to 4.33.0)
user-definable functions
and procedures with parameters and local variables
'A' is NO LONGER
predefined symbol. I decided to remove it because people tend to use A as
user-variable forgetting the fact that it was build-in array holding typical
price (H+L+C)/3. Use 'Avg' instead.
indicator list column width increased in Indicator Builder
DayOfYear - returns the calendar day number counting from beginning of the
year January 1st is 1. Maximum number returned is 366
CHANGES FOR VERSION
4.33.0 (as compared to 4.32.2)
Database purify tool implemented (available via Tools->Database
Purify)allows to detect missing/extra quotes, possible splits, invalid
OHLC relationshipApply to/range settings similar to AA window. You can
also right click over result list to add symbols to watch list and copy the
list to the clipboard (and paste it later to any other program for futher
use)
further improvements to AFL garbage collector, now looping regardless of
loop count requires the same amount of memory as just single pass of the code
(no growing allocated memory during loops).This enormously lowered memory
consumption for some formulas and increased the speed of some loops 3..4
times.
added variable period support to the following
functions:LinRegSlope,LinearReg,LinRegIntercept,StdErr,TSF
Sample code:
Plot( Close, "Test", colorBlack );
range = 15 * MA( ATR( 15 ), 50 ) / ATR( 15 );
//Plot( range, "range", colorBlue, styleOwnScale );Plot( LinearReg(
Close, range ), "Test", colorRed );
fixed sometimes incorrect output of variable-period version of LLV/HHV
fixed crash occuring when bad arguments were passed to the function (bug
introduced in 4.32.x).
CHANGES FOR VERSION
4.32.2 (as compared to 4.32.1)
second bug in experimental garbage collector fixed.
CHANGES FOR VERSION
4.32.1 (as compared to 4.32.0)
garbage collector was releasing memory too soon in some cases, now fixed.
CHANGES FOR VERSION
4.32.0 (as compared to 4.31.1)
added type check in IF/ELSE statements
added type check in array element assignment
error messages now numbered and display changed slightly
you can break running loop by pressing Shift+BREAK (Pause) key combination
calling COM objects works again (was broken in 4.31.x)
changed slightly the way TAB works in editor, if TAB is pressed any
selection is deselected to avoid accidential deletion of text
experimental: added 'agressive garbage collector' that extremely
decreases the amountof memory required to run AFL formula by releasing the
memoryused for temporary variables as soon as possible
(previouslytemporary memory was released at the end of formula
execution).A side-effect of new garbage collector is some speed up in
formula execution.
new tab in preferences for AFL engine settings
experimental feature, NOT for beginners, may be removed/modified in
future releases: new _TRACE( "string" ) AFL function addedthat
allows to write debug messages from AFL code to system debug viewer.(it
calls internally OutputDebugString Win API function).To view debug
messages you have to run DebugView freeware program from
http://www.sysinternals.com/
CHANGES FOR VERSION
4.31.1 (as compared to 4.31.0)
fixed bug introduced in 4.31.0 causing no text output in
commentary/interpretation
CHANGES FOR VERSION
4.31.0 (as compared to 4.30.0)
Workspace window uses "icon font" set in the Windows settings instead of
hard coded Tahoma 8
for better readability and ClearType(tm) compatibility on WinXP, all
dialog windows use now 'MS Shell Dlg' face name that maps to standard MS Sans
Serif on Win 9x/Me/NT and Tahoma on Win 2K and XP.
rewritten AFL parser, now formula is parsed and coverted to syntax tree
and then interpreted. This would allow further improvements including
compilation. This allowed also to add loops/if-else statements.
implemented IF/ELSE statement, WHILE and FOR loops:The same basic
'for' loop in AFL is 2..3 times faster than in JScriptSyntax follows
C++/JScript style:
while( conditional_expression ) statement;
for( initializer_part; conditional_expression; iterator_part )
statement;
if( conditional_expression ) statement;
if( conditional_expression )
statement;elsestatement;
implemented compound statements: these are blocks of statements
enclosedin opening and closing curly brace
{statement1;statement2;...statementN;}
compound statement can appear anywhere when simple statement can.
For example:
i = 10;while( i < 20 ){Plot( MA( Close, i ), "MA" +
WriteVal( i, 0 ), colorBlack + i );i = i + 1;}
implemented C-style postfix and prefix increment/decrement operators
i = 10;WriteIf( i++ );WriteIf( ++i );WriteIf( i
);
implemented array element access (subscript) operator []:
WriteVal( Close[ 0 ] ); // prints the first bar of close
array
/* a sample low-level implementation of exponential moving average in
AFL */
myema[ 0 ] = Close[ 0 ];
for( i = 1; i < BarCount; i++ ){myema[ i ] = 0.1 * Close[
i ] + 0.9 * myema[ i - 1 ];}
added built-in constant 'BarCount' that returns number of bars available in
arrays (the number of elements of array)When QuickAFL is turned on it may
be less than true number of bars because QuickAFL feature attempts to use only
visible bars (and few before). You can control how many bars the formula
requires using SetBarsRequired() function
implemented infinite-loop protection. Nice if you forgot to increment
counter variable in 'for' loop :-)
tab key now works without need to press ALT/CTRL in AFL editors
added C-like synonyms for logical ADD/OR/NOT: &&, ||, !
/* a sample low-level implementation of Profit-target stop in
AFL: */
Buy = Cross( MACD(), Signal() );
priceatbuy=0;
for( i = 0; i < BarCount; i++
){ if( priceatbuy == 0 && Buy[ i
] ) priceatbuy = BuyPrice[ i ];
if( priceatbuy > 0 &&
SellPrice[ i ] > 1.1 * priceatbuy
) { Sell[
i ] = 1; SellPrice[ i ] = 1.1 *
priceatbuy; priceatbuy =
0; } else Sell[
i ] = 0;}
/* sample EMA rainbow */
Plot( Close, "Price", colorBlack, styleCandle );for( Range = 15;
Range < 100; Range++ ) Plot( EMA( Close, Range ),
"MA"+WriteVal(Range,0), colorRose + Range % 8, styleNoLabel );
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 <A
href="">bugs@xxxxxxxxxxxxx
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|