Skip to main content

htf_region

Function htf_region 

Source
pub fn htf_region<C: Condition>(
    interval: Interval,
    region: Region,
    cond: C,
) -> HtfCondition<C>
Expand description

Wrap a condition to be evaluated on a higher-timeframe candle series, with bucket boundaries aligned to the exchange’s local calendar.

Weekly and monthly boundaries are shifted by region.utc_offset_secs() so that, for example, a Tokyo-listed stock’s “Monday” starts at the correct local midnight rather than UTC midnight.

§Arguments

  • interval – Target higher timeframe (e.g. Interval::OneWeek)
  • region – Exchange region used to derive the UTC offset
  • cond – Any condition to evaluate on the HTF candles

§Example

use finance_query::backtesting::refs::*;
use finance_query::{Interval, Region};

let weekly_trend = htf_region(Interval::OneWeek, Region::Japan, price().above_ref(sma(20)));