Commodity Channel Index #
The cci
tool calculates the Commodity Channel Index (CCI) indicator’s value
and compares it to the target value that is specified in the configuration.
More information about the Commodity Channel Index indicator:
The cci
tool can be backtested. More information about strategy
backtesting can be found here.
Configuration #
{
"type": "cci",
"context_id": "cci-id-123",
"description": "a simple tool",
"ma": "simple",
"field": "close",
"length": 20,
"offset": 1,
"condition": {
"type": "constant",
"target": "20.5",
"operator": "equal"
}
}
-
type
- string
The type of the tool configuration.Tool configuration types are described in detail here.
-
context_id
- string (optional; default: unused)
The ID of the tool that is used when inserting data into the context store.The context data store and its IDs are described in detail here.
-
description
- string (optional; default: unused)
The description of the tool and its purpose. -
ma
- string (enum)
The type of moving average to use when calculating the indicator’s value. Possible values:double-exponential
exponential
hull
simple
weighted
-
field
- string (enum)
The field of each selected candle that is used when calculating the indicator’s value. Possible values:-
open
The opening price of a candle’s period. -
high
The highest price of a candle’s period. -
low
The lowest price of a candle’s period. -
close
The closing price of a candle’s period. -
volume
The trading volume of a candle’s period. -
typical-price
The typical price of a candle’s period, it is calculated as follows:(High + Low + Close) / 3
.
-
-
length
- unsigned int
The number that determines how many data points are used when calculating the indicator’s value. It must be greater than 0. -
offset
- unsigned int (optional; default: 0)
The number that determines how many candles are skipped until the first candle is selected. Note that the candles are ordered from the latest to the oldest, which means that if the offset is set to zero, the latest candle is used as the first one. -
condition
- object
The condition that is used when checking the indicator’s value.-
type
- string (enum)
The type of the condition that determines what additional properties are required and how the target value is formed. Possible types are as follows:constant
When this type is active, the target value that is specified in the configuration is used as the condition’s target value. The additional properties of this type are the following:target
- string (decimal)
The target value that is used without any additional processing.
-
operator
- string (enum)
The operator that is used when comparing the indicator’s value to the condition’s target value. Possible values:-
equal
,eq
,==
The equality operator checks if the indicator’s value is equal to the condition’s target value. -
greater-than
,gt
,>
The greater than operator checks if the indicator’s value is greater than the condition’s target value. -
less-than
,lt
,<
The less than operator checks if the indicator’s value is less than the condition’s target value. -
greater-than-or-equal
,ge
,>=
The greater than or equal operator checks if the indicator’s value is greater than or equal to the condition’s target value. -
less-than-or-equal
,le
,<=
The less than or equal operator checks if the indicator’s value is less than or equal to the condition’s target value. -
not-equal
,ne
,!=
The inequality operator checks if the indicator’s value is not equal to the condition’s target value.
-
-
Report #
{
"type": "cci",
"permit": true,
"value": "20.5",
"condition": {
"type": "constant",
"result": true
}
}
-
type
- string
The type of the tool report.Tool report types are described in detail here.
-
permit
- boolean
The property that determines whether the tool gave its permission to continue strategy execution or not.The tool execution flow is described in detail here.
-
value
- string (decimal)
The indicator’s value that was calculated from the candle data and compared to the condition’s target value. -
condition
- object
The report of the condition that was used when checking the indicator’s value.-
type
- string (enum)
The type of the condition that determines what additional properties are included in the report. Possible types are as follows:constant
When this type is processed, no additional properties are added.
-
result
- boolean
The property that determines whether the comparison was successful or not.
-
If an error occurs during thecci
tool’s execution, onlytype
anderror
properties are added to the report. Theerror
property is described in detail here.
Context #
The objects that the cci
tool inserts into the context
store are as follows:
-
tools.<context-id>.permit
- boolean
The object that determines whether the tool gave its permission to continue strategy execution or not. -
tools.<context-id>.value
- string (decimal)
The indicator’s value that was calculated from the candle data and compared to the condition’s target value. -
tools.<context-id>.condition
- map
The results of the condition that was used when checking the indicator’s value.-
The type of the condition determines what additional objects are inserted into the context store. The types and their objects are as follows:
constant
When this type is processed, no additional objects are inserted into the context store.
-
tools.<context-id>.condition.result
- boolean
The object that determines whether the comparison of the indicator’s value and the condition’s target value was successful or not.
-
If an error occurs during thecci
tool’s execution, only thetools.<context-id>.error
object is inserted into the context store. This context data object is described in detail here.