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

Version 3.52 beta - a new functions in AFL


  • To: "AmiBroker Mailing List" <amibroker@xxxxxxxxxxxxxxx>
  • Subject: Version 3.52 beta - a new functions in AFL
  • From: "Tomasz Janeczko" <tj@xxxx>
  • Date: 24 Mar 2001 20:13:44 -0000

PureBytes Links

Trading Reference Links

Hello,

The next issue of the newsletter will cover all new functions in AFL but
let me now explain shortly a couple of them:

NOTE: all these functions are available ONLY in v 3.52 (and above :-))
=====================================================

StrLen( String ) function 
====================
- calculates the length of the string.
This function could be used for (for example) filtering out only 3 letter stock codes:

buy = something AND strlen( name() ) == 3;


AMA( Array, SmoothingFactor ) function
=============================
- calculates adaptive moving average - simliar to EMA but
smoothing factor could be time-variable (array).
The example of volatility-weighted adaptive moving average formula:

graph0 = ema( close, 15 );
fast = 2/(2+1);
slow = 2/(30+1);
dir=abs(close-ref(close,-10));
vol=sum(abs(close-ref(close,-1)),10);
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2;

graph0 = ama( close, sc );


Study( StudyID, ChartID = 1 ) function
=======================
- generates an array equivalent to a trendline study drawn
by the user - allows detecting trendline breakouts from AFL
- more details will be given in a newsletter


ExRem( Array1, Array2 ) function
========================
- removes excessive signals:
returns 1 on the first occurence of "true" signal in Array1
then returns 0 until Array2 is true even if there are "true" signals in Array1

Example:
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );


Flip( Array1, Array2 ) function
======================
- works as a flip/flop device (electronic/electric engineers will know what I mean)
- returns 1 from the first occurence of "true" signal in Array1
until a "true" occurs in Array2 which resets the state back to zero
unil next "true" is detected in Array1...

IsEmpty( Array ) function
===================
- returns 1 (or 'true') when given point in array is {empty}
Note: {empty} value is used internaly by AFL to mark
bars when the value is not available - for example for the first
20 bars the value of 20-day simple moving average is not available
({empty})


IsTrue( Array ) function
==================
returns 1 (or 'true') when given point is not {empty} AND not zero


Foreign( Ticker, DataField ) 
=====================
- allows referencing other (than current) tickers in the AFL formulas.
Allowable data fields: "open", "close", "high", "low", "volume", "interest" 
Provides an easy way to implement overlays, as shown in the
following code:

/* Red line - current security price */
/* Blue line -overlaid index chart (scaled to fit) */

graph0 = close;
graph1 = foreign( "XAO", "Close" ) ; 
/* replace "XAO" by your index, or any other ticker to graph along with you stock */

graph1 = lastvalue( highest( graph0 ) )/ lastvalue( highest( graph1 ) ) * graph1;



Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com