An indicator written in Indie is executed after it is added to a candle chart. The symbol and time frame of the instrument serves as the primary data source bound to theDocumentation Index
Fetch the complete documentation index at: https://takeprofit.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Main context of the indicator. It is
possible to request additional instrument data in the indicator. For that purpose there are @sec_context decorator and
indie.SecContext class in combination with Context.calc_on() function.
@sec_context() and Context.calc_on()
Decorator @sec_context is a syntactic sugar that can be applied to a function definition which is an equivalent of
writing a class inherited from indie.SecContext (more about the mechanics how this works can be found
here). The
body of such a decorated function becomes an entry point for calculation when a data update occurs on the
corresponding additional instrument. Function call of Context.calc_on creates a connection between the Main context
and the secondary one.
Here is an example of an indicator that requests one additional instrument:
Context.calc_on function is called from __init__ constructor method of a main or secondary
context.

- main context
Mainwhich is executed every time a data update on the main instrument AAPL 15m happens and - secondary context
SecMainwhich is executed every time a data update on the secondary instrument AAPL 1D happens.
Context.calc_on function accepts more parameters in addition to sec_context and time_frame. Here is its signature:
exchange, ticker and time_frame are not given, then the corresponding values are taken from the current
instrument.