use crate::candle_indicators::{
common::{cdl_wick_length, SHORT},
pattern_test::EmaState,
registry::CandleBits,
types::{CandleInfo, ForecastType},
};
use tulip_rs_macros::pattern_template;
use super::FIRST;
pub fn info() -> CandleInfo {
CandleInfo {
name: "takuriline",
full_name: "Takuri Line",
forecast: ForecastType::BullishReversal,
extended_pattern: None,
bars: 1,
japanese_name: "takuri",
}
}
#[pattern_template(
name = "TakuriLine",
forecast = "BullishReversal",
prev_bar(trend = "DOWN")
bar(
body_height = "SHORT",
line_height = "LONG",
upper_wick_lt_body = "TRUE",
lower_wick_2x = "TRUE",
candle_type = "!Doji(Doji | LongLeggedDoji | DragonflyDoji | GravestoneDoji | FourPriceDoji)"
)
)]
pub fn calc(
inputs: (&[f64], &[f64], &[f64], &[f64]),
state: &EmaState,
_bars: &[CandleBits],
) -> bool {
let (open, _, low, close) = inputs;
if cdl_wick_length((open[FIRST], close[FIRST]), low[FIRST], Some(3.0)) == SHORT {
return false;
}
if !(state.get_ema() > close[FIRST] && state.get_ema() > open[FIRST]) {
return false;
}
true
}