# Sample Scripts

This section contains a number of popular indicators written in BullScript. All these indicators are provided by BullScript, but sample formulae are provided here to demonstrate how BullScript may be used to construct indicators.

The examples below have been coloured in the same way that the BullScript syntax highlighter would colour them.

Sample Scripts

This section contains a number of popular indicators written in BullScript. All these indicators are provided by BullScript, but sample formulae are provided here to demonstrate how BullScript may be used to construct indicators.

The examples below have been coloured in the same way that the BullScript syntax highlighter would colour them.

Exponential Moving Average
An 18% exponential moving average could be constructed in BullScript using the formula:

percent := 0.18;
C*(1-percent) + previous*percent

Gap Up
A gap up occurs when the low price of the current candlestick is higher than the high price of the previous candlestick.

low > hist(high,1)

Simple Moving Average
A 14-period simple moving average could be calculated by dividing the sum of close prices for the last 14 periods by 14.

sum(C,14)/14

Typical Price
The typical price is the average of the high, low and close.

(H+L+C)/3

Weighted Close
(high+low+close*2)/4