APPL (Avasaram Platform Programming Language) is
a powerful language used to extend the built in functionalities of the Avasaram
platform. It could be used to create advanced filters and advanced
display columns. Language syntax for APPL is very similar to the
popular language JAVA.

APPL scripts must start with a curly brace ”{”
and end with a curly brace “}”. All the statements in the script must
end with a semicolon “;”.

A sample script for APPL filters to find stocks
with last traded price greater than 10.

{

stock.getLast() > 10;

}

A sample script to add an APPL display column of
maximum return probability.

{

strategy.getMaxReturnProbability();

}

APPL Core Objects and Classes

Object/Class

Description

strategy

The
strategy object which contains information about the strategy being accessed.

Example to get the ticker
symbol of the underlying stock.

strategy.getTicker()

stock

The
underlying object for the strategy.

Example to get the last
traded price.

stock.getLast()

longLegOne

The first
long leg associated with the strategy. In case of a married put strategy this
is the put option purchased to protect the stock. Presence of this object
depends on the strategy that is being accessed.

Example to get the option
symbol.

longLegOne.getOptionSymbol()

shortLegOne

The first
short leg associated with the strategy. In case of a covered call strategy
this is the call option sold against the stock. Presence of this object
depends on the strategy that is being accessed.

Example to get the option
symbol.

shortLegOne.getOptionSymbol()

longLegTwo

The
second long leg associated with the strategy. Presence of this object
depends on the strategy that is being accessed. This is usually present in a
multi leg strategy like butterflies and condors.

Example to get the option
symbol.

shortLegOne.getOptionSymbol()

shortLegTwo

The
second short leg associated with the strategy. Presence of this object
depends on the strategy that is being accessed. This is usually present in a
multi leg strategy like butterflies and condors.

Example to get the option
symbol.

shortLegOne.getOptionSymbol()

Util

This
is a utility class containing commonly used methods.

Math

Utility
class containing mathematical functions.

Example to get the square
root.

Math.sqrt(4)

TA

Technical
Analysis class containing TA specific functions.

Example
to
check for existence of Bullish DOJI Pattern in last 20 days

TA.hasPattern(CandleStickPattern.DOJI,
Bias.BULLISH,20);

Filters using APPL script

Advanced filters could be made using APPL scripts. The
APPL expression used for building the filter must evaluate to a Boolean value.
To add a new APPL filter click on the “Add APPL Filter” button from the
custom screener. See the figure below.

After entering the script click the validate button to
check for any error. After validation click save to add the filter to your screener.

Examples

1.Filter
to retrieve strategy data which has its stock with last traded price between 10
and 50.

{

stock.getLast()
> 10 && stock. getLast() < 50;

}

2.Filter to retrieve a stock which has an occurrence of Candle stick
pattern “Two Crows” in last 20 days.

{

TA.hasPattern(CandleStickPattern.TWO_CROWS,Bias.BEARISH,20);

}

3.Filter to find a Delta Neutral position for calendar spread.

{

shortDelta
= shortLegOne.getDelta();

longDelta
= longLegOne.getDelta();

netDelta
= longDelta - shortDelta;

netDelta
< 0.02;

}

Display Column using APPL script

Display columns could be added to the screener results
easily by creating an APPL script. Click on the “Add APPL Column” to
create a new display column. See the figure below.

After entering the script click the “validate and
preview” button to check for any errors and preview results. After
validation click “save” to add the display column to your screener.
Unlike the filters the script for the display column does not have to evaluate
to boolean.

A statement can be the empty statement, the semicolon (;) ,
block, assignment or an expression. Statements are optionally terminated with
a semicolon.

Block

A block is simply multiple statements inside curly braces ({, }).

Assignment

Assigns the value of a variable (var =
'a value')

Method calls

Calls a method of an object, e.g.

Math.sqrt(4)

will call the sqrt method from Math
object.

Literals

Item

Description

Integer Literals

1 or more digits from 0 to 9

Floating point Literals

1 or more digits from 0 to 9,
followed by a decimal point and then one or more digits from 0 to 9.

String literals

Can start and end with "
delimiters, e.g.

"Hello
world"

The
escape character is \; it only escapes the string delimiter

Boolean literals

The literals true and false can
be used, e.g.

val1
== true

Null literal

The null value is represented as in java using the literal null, e.g.

val1 == null

Array literal

A [ followed by one or more expressions separated by , and
ending with ], e.g.

[ 1,
2, "three" ]

This syntax creates an Object[].

APPL will attempt to strongly
type the array; if all entries are of the same class or if all entries are
Number instance, the array literal will be an MyClass[] in
the former case, a Number[] in the latter case.

Furthermore, if all entries
in the array literal are of the same class and that class has an equivalent
primitive type, the array returned will be a primitive array. e.g. [1, 2,
3] will be interpreted as int[].

Disclaimer
The information contained in this website is provided to you "as is," for your
informational purposes only, without any representation or warranty of accuracy
or completeness of information or other warranty of any kind. In no event will
avasaram.com be liable to any party for any direct, indirect, incidental,
special or consequential damages for use of this website or reliance upon any
information or material accessed via it or any other hyperlinked website
including, but not limited to, damages arising from loss of profits, business
interruption, or loss of data.