Quick Start
Introduction
This page is a quick start guide on generating your first technical indicator using Hexital, as well as using it to generate a set of technical indicators with some useful common situations and features.
Creating Candles
Hexital use's it's own Candle object used for generating technical indicator readings, these are a core part of Hexital and can therefore be created in several different ways.
To simplify the process of converting your data into Candle objects used by Hexital the Indicator objects can accept a variety of formats and convert them for you. The format's it can accept are Lists
, Dicts
which are also explained here.
You can create a Candle instance by providing its required attributes: open
, high
, low
, close
, and volume
.
You can use the from_list class method to create a Candle from a list containing the following attributes in order:
[timestamp (optional), open, high, low, close, volume, timeframe (optional)]
from_lists
Another method called from_lists which accept's a list of list's to convert, returning a List[Candle].
You can create a Candle instance from a dictionary by using the from_dict class method. This is especially useful when working with JSON data or API responses.
!!! info "from_dicts" Another method called from_dicts which accept's a list of dict's to convert, returning a List[Candle].
Panda dataframes can be converted using dataframes to_dict
⧉ method and feeding the result into the Candle from_dicts class method.
EMA Indicator
The purpose of Hexital is to incrementally create technical indicator readings, therefore it's made to be relatively simple.
Below is example's of using Hexital to create an EMA indicator from a list of dict
Candles. As well as some common and useful configurations.
EMA period
In the given example the length/period of the EMA indicator is 3. This is of course configurable.
Appending new Candle
Hexital is designed to be constantly receiving and updating it's Candle list and TA readings, therefore they can easily append new candles in a variety of formats; As explained in the Candle section.
Auto calculation
We dont need to call calculation method as it's done automatically on append.
Indicator candle_life
All indicators have the configuration option candle_life
, this is optional configuration which is useful for very large everygrowing set of Candle's. This attribute will automatically cull the list of Candle's it stores based on it's age, in this case once a Candle is 2 hours old it will be removed.
Candle life
Extremely useful for managing memory constraints, but note you will also lose the TA readings alongside the Candle's.
EMA Indicator name
We manually selected the Indicator name, this is optional, however recommended when dealing with many indicators, the default naming is generated based on the TA name and the period set. E.G EMA_3
would otherwise be generated.
Analysis EMA for rising trend
You can also directly use one of Hexital's built in analysis functions to handle simple movements calculations, for example to check if the EMA value we are generating is rising or falling.
Hexital - Indicator Grouping
A single indicator is useful but no trading strategy is built using a single one, to avoid haivng to create and manage and appending to several indicators. Therefore Hexital library has the Hexital object, which is designed for managing multiple indicators easily, by having one set of candle's which is used for multiple indicator's they will all automatically be given new Candle and re-calculated; as if managing one Indicator.
This example is using Hexital to manage WMA and EMA in one Hexital object, updating and calculating both indicators from appending a single Candle.
All the configuration that is available to the EMA
indicator is still available while being used within the Hexital object.
EMA naming
EMA was not given a specific name, the name is therefore generated based of the Indicator name(EMA) and Period(3).
Which us why in strategy
it's called as EMA_3
. This changes if the period changes.
Appending new Candle
We can append a Candle
to Hexital which is then used for all Indicator's, the EMA and WMA value's are again automatically calculated on append.
Auto calculation
We dont need to call calculation method as it's done automatically on append.
Hexital's own configuration (candle_life)
Notice that the Hexital object has it's own candle_life
attribute. The purpose of this is a global way to set configurations within the Hexital Indicators. Therefore all indicators that exist within this strategy object will inherit a candle_life
value of 2 hours. However the EMA TA has it's own candle_life
attribute which will take precedence over the Hexital's.
The purpose is you can set a global configuration for all indicators without having to add it to each TA manually.
Analysis for EMA and WMA Crossing
You can also pass the Hexital object into one of Hexital's built in analysis functions, for example to check if the EMA value we are generating has crossed over the WMA.
EMA Name
The EMA_3 name is the generated name, if you decide to alter to period of this EMA to say 6; the name would change to match resulting in these call's failing. This is why it's best practice to manually choose a name when creating a indicator.
Analysis methods
We can replace cross
with crossover
or crossunder
for specific direction.