TakeProfit logo CommunityPlatform

Request additional instruments


@ctx_func() and Context.calc_on()

Minimal example:

# indie:lang_version = 2
from indie import indicator, ctx_func, param

@ctx_func
def main2(ctx):
    return ctx.high[0], ctx.low[0]

@indicator('Minimal calc_on example', overlay_main_pane=True)
@param.time_frame('sec_time_frame', default='1D')
def main(ctx, sec_time_frame):
    sec_high, sec_low = ctx.calc_on(time_frame=sec_time_frame, ctx_func=main2)
    return sec_high[0], sec_low[0]
Figure 1. Minimal ctx.calc_on() and @ctx_func example.
Figure 1. Minimal ctx.calc_on() and @ctx_func example.

This indicator requests high and low prices of the same instrument but of a 1D time frame. Make sure this indicator is added on an intraday chart.