CC Fisher — Cyber Cycle Fisher¶
Applies the Fisher Transform to the normalised Cyber Cycle oscillator, converting cycle measurements into a near-Gaussian probability distribution; signal is the one-bar-lagged fisher value.
Inputs: [real] | Options: [alpha] | Outputs: [fisher, signal] | Optional: [trendmode, cycle, peak]
Minimum bars
This indicator requires approximately 56 bars of input before producing meaningful output. Use at least 80 bars for reliable results. Pass alpha = 0.0 to let the indicator choose the smoothing factor automatically.
Basic¶
use tulip_rs::indicators::ccfisher::{Ccfisher, Indicator, TIndicatorState};
let close = vec![
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00_f64,
];
// alpha = 0.0 to use automatic smoothing
let (outputs, _state) = Ccfisher::indicator(&[close.as_slice()], &[0.0], None).unwrap();
println!("Fisher: {:?}", outputs[0]);
println!("Signal: {:?}", outputs[1]);
// State continuation
let n = close.len() - 5;
let partial = close[..n].to_vec();
let (outputs2, mut state) = Ccfisher::indicator(&[partial.as_slice()], &[0.0], None).unwrap();
println!("Partial Fisher: {:?}", outputs2[0]);
let rest = close[n..].to_vec();
let continued = state.batch_indicator(&[rest.as_slice()], None).unwrap();
println!("Continued Fisher: {:?}", continued[0]);
println!("Continued Signal: {:?}", continued[1]);
#include "tulip_rs_ffi.h"
double close[] = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00};
double options[CCFISHER_OPTIONS] = {0.0}; // alpha
const double *inputs[CCFISHER_INPUTS] = {close};
/* Full computation (check r.error == C_INDICATOR_ERROR_OK in real code) */
CIndicatorResult r = ccfisher_indicator(inputs, 70, options, NULL, 0);
/* r.outputs[0] -> fisher, r.outputs[1] -> signal */
tulip_ffi_result_free(r);
ccfisher_state_free(r.state);
/* Partial computation + state continuation */
CIndicatorResult p = ccfisher_indicator(inputs, 65, options, NULL, 0);
double new_close[] = {92.80, 93.10, 92.50, 93.20, 93.50};
const double *new_inputs[CCFISHER_INPUTS] = {new_close};
CBatchResult b = ccfisher_batch(p.state, new_inputs, 5, NULL, 0);
/* b.outputs[0] -> fisher for the 5 new bars */
tulip_ffi_batch_result_free(b);
tulip_ffi_result_free(p);
ccfisher_state_free(p.state);
import "github.com/me60732/tulip_rs_go/indicators"
close := []float64{81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00}
options := []float64{0.0} // alpha
// Full computation — Rows are zero-copy views, valid until Close.
res, st, _ := indicators.Ccfisher.Indicator(close, options, nil)
fmt.Println(res.Rows[0]) // fisher values
fmt.Println(res.Rows[1]) // signal values
res.Close()
st.Close()
// Partial computation + state continuation.
res2, st2, _ := indicators.Ccfisher.Indicator(close[:65], options, nil)
res2.Close() // outputs consumed or closed; state stays live
batch, _ := st2.Batch(close[65:], nil)
fmt.Println(batch.Rows[0]) // continued fisher values
fmt.Println(batch.Rows[1]) // continued signal values
batch.Close()
st2.Close()
import org.tuliprs.*;
import org.tuliprs.indicators.Ccfisher;
double[] close = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00};
double[] options = {0.0}; // alpha
// Full computation — output rows are zero-copy views, valid until close().
Outcome oc = Ccfisher.indicator(new double[][] {close}, options);
try (Result res = oc.result(); State st = oc.state()) {
System.out.println(java.util.Arrays.toString(res.toDoubleArray(0))); // fisher values
System.out.println(java.util.Arrays.toString(res.toDoubleArray(1))); // signal values
}
// Partial computation + state continuation.
Outcome p = Ccfisher.indicator(
new double[][] {java.util.Arrays.copyOfRange(close, 0, 65)}, options);
try (Result pr = p.result(); State st = p.state()) {
Result br = st.batch(new double[][] {java.util.Arrays.copyOfRange(close, 65, 70)});
try (br) {
System.out.println(java.util.Arrays.toString(br.toDoubleArray(0))); // continued fisher values
System.out.println(java.util.Arrays.toString(br.toDoubleArray(1))); // continued signal values
}
}
import numpy as np
import tulip_rs
close = np.array([
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00,
], dtype=np.float64)
# alpha = 0.0 to use automatic smoothing
outputs, state = tulip_rs.indicators.ccfisher.indicator([close], [0.0])
print("Fisher:", outputs[0])
print("Signal:", outputs[1])
# State continuation
partial = close[:-5]
outputs2, state = tulip_rs.indicators.ccfisher.indicator([partial], [0.0])
rest = close[-5:]
continued = state.batch_indicator([rest])
print("Continued Fisher: ", continued[0])
print("Continued Signal: ", continued[1])
import * as ti from 'tulip-rs-node';
const close = Float64Array.from([
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00,
]);
// alpha = 0.0 to use automatic smoothing
const [outputs, state] = ti.ccfisher.indicator([close], [0]);
console.log('Fisher:', outputs[0]);
console.log('Signal:', outputs[1]);
// State continuation
const [, state2] = ti.ccfisher.indicator([close.slice(0, -5)], [0]);
const continued = state2.batchIndicator([close.slice(-5)]);
console.log('Continued Fisher:', continued[0]);
console.log('Continued Signal:', continued[1]);
import { init } from 'tulip-rs-wasm';
import * as ti from 'tulip-rs-wasm';
await init(); // bundler resolves the WASM asset automatically
const close = [
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00,
];
// alpha = 0.0 to use automatic smoothing
const [outputs, state] = ti.ccfisher.indicator([close], [0]);
console.log('Fisher:', outputs[0]);
console.log('Signal:', outputs[1]);
// State continuation
const [, state2] = ti.ccfisher.indicator([close.slice(0, -5)], [0]);
const continued = state2.batchIndicator([close.slice(-5)]);
console.log('Continued Fisher:', continued[0]);
console.log('Continued Signal:', continued[1]);
Optional Outputs¶
ccfisher exposes 3 optional outputs: trendmode, cycle, peak. Pass a boolean mask as the third argument — one bool per optional output, in order.
use tulip_rs::indicators::ccfisher::{Ccfisher, Indicator, TIndicatorState};
let close = vec![
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00_f64,
];
let mask = [true, true, true]; // one per optional output
let (outputs, _state) = Ccfisher::indicator(&[close.as_slice()], &[0.0], Some(&mask)).unwrap();
let fisher = &outputs[0]; // fisher (primary)
let signal = &outputs[1]; // signal (primary)
let trendmode = &outputs[2]; // trendmode (optional — requested)
let cycle = &outputs[3]; // cycle (optional — requested)
let peak = &outputs[4]; // peak (optional — requested)
ccfisher exposes 3 optional outputs: trendmode, cycle, peak. Pass a boolean mask as the third argument.
#include "tulip_rs_ffi.h"
double close[] = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00};
double options[CCFISHER_OPTIONS] = {0.0}; // alpha
const double *inputs[CCFISHER_INPUTS] = {close};
bool optional_outputs[3] = {true, true, true}; // trendmode, cycle, peak
CIndicatorResult r = ccfisher_indicator(inputs, 70, options, optional_outputs, 3);
/* r.outputs[0] -> fisher (primary) */
/* r.outputs[1] -> signal (primary) */
/* r.outputs[2] -> trendmode (optional — requested) */
/* r.outputs[3] -> cycle (optional — requested) */
/* r.outputs[4] -> peak (optional — requested) */
tulip_ffi_result_free(r);
ccfisher_state_free(r.state);
ccfisher exposes 3 optional outputs: trendmode, cycle, peak. Pass a boolean mask as the third argument.
import "github.com/me60732/tulip_rs_go/indicators"
close := []float64{81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00}
options := []float64{0.0} // alpha
mask := []bool{true, true, true} // trendmode, cycle, peak
res, st, _ := indicators.Ccfisher.Indicator(close, options, mask)
fisher := res.Rows[0] // fisher (primary)
signal := res.Rows[1] // signal (primary)
trendmode := res.Rows[2] // trendmode (optional — requested)
cycle := res.Rows[3] // cycle (optional — requested)
peak := res.Rows[4] // peak (optional — requested)
fmt.Println(fisher)
fmt.Println(signal)
fmt.Println(trendmode)
fmt.Println(cycle)
fmt.Println(peak)
res.Close()
st.Close()
ccfisher exposes 3 optional outputs: trendmode, cycle, peak. Pass a boolean mask as the third argument.
import org.tuliprs.*;
import org.tuliprs.indicators.Ccfisher;
double[] close = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00};
double[] options = {0.0}; // alpha
boolean[] mask = {true, true, true}; // trendmode, cycle, peak
// Full computation — output rows are zero-copy views, valid until close().
Outcome oc = Ccfisher.indicator(new double[][] {close}, options, mask);
try (Result res = oc.result()) {
System.out.println(java.util.Arrays.toString(res.toDoubleArray(0))); // fisher (primary)
System.out.println(java.util.Arrays.toString(res.toDoubleArray(1))); // signal (primary)
System.out.println(java.util.Arrays.toString(res.toDoubleArray(2))); // trendmode (optional — requested)
System.out.println(java.util.Arrays.toString(res.toDoubleArray(3))); // cycle (optional — requested)
System.out.println(java.util.Arrays.toString(res.toDoubleArray(4))); // peak (optional — requested)
}
oc.state().close();
import numpy as np
import tulip_rs
close = np.array([
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00,
], dtype=np.float64)
outputs, state = tulip_rs.indicators.ccfisher.indicator(
[close], [0.0],
optional_outputs=[True, True, True],
)
fisher = outputs[0] # fisher (primary)
signal = outputs[1] # signal (primary)
trendmode = outputs[2] # trendmode (optional — requested)
cycle = outputs[3] # cycle (optional — requested)
peak = outputs[4] # peak (optional — requested)
ccfisher exposes 3 optional outputs: trendmode, cycle, peak.
The WASM API is identical to Node.js — pass the boolean mask as the third argument.
SIMD¶
By assets — same alpha applied to 4 assets in parallel:
use tulip_rs::indicators::ccfisher::{Ccfisher, Indicator, TIndicatorState};
let a1 = vec![81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36_f64];
let a2 = vec![86.59, 86.06, 87.87, 88.00, 88.61, 88.15, 87.84, 88.99, 89.55, 89.36_f64];
let a3 = vec![78.59, 78.06, 79.87, 80.00, 80.61, 80.15, 79.84, 80.99, 81.55, 81.36_f64];
let a4 = vec![83.22, 82.68, 84.53, 84.66, 85.28, 84.81, 84.50, 85.67, 86.24, 86.05_f64];
let inputs: [&[&[f64]; 1]; 4] = [
&[a1.as_slice()],
&[a2.as_slice()],
&[a3.as_slice()],
&[a4.as_slice()],
];
let results = Ccfisher::indicator_by_assets::<4>(&inputs, &[0.0], None).unwrap();
for (i, asset_outputs) in results.iter().enumerate() {
println!("Asset {} Fisher: {:?}", i + 1, asset_outputs[0]);
println!("Asset {} Signal: {:?}", i + 1, asset_outputs[1]);
}
By options — same asset, 4 different alpha values in parallel:
use tulip_rs::indicators::ccfisher::{Ccfisher, IndicatorByOptions};
let close = vec![81.59, 81.06, 82.87, 83.00, 83.61,
83.15, 82.84, 83.99, 84.55, 84.36_f64];
let opts: [&[f64; 1]; 4] = [&[0.0], &[0.1], &[0.2], &[0.3]];
let results = Ccfisher::indicator_by_options::<4>(&[close.as_slice()], &opts, None).unwrap();
for (i, opt_outputs) in results.iter().enumerate() {
println!("Alpha set {} Fisher: {:?}", i + 1, opt_outputs[0]);
println!("Alpha set {} Signal: {:?}", i + 1, opt_outputs[1]);
}
By assets — same alpha applied to 4 assets in parallel:
#include "tulip_rs_ffi.h"
double a1[] = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36};
double a2[] = {86.59, 86.06, 87.87, 88.00, 88.61, 88.15, 87.84, 88.99, 89.55, 89.36};
double a3[] = {78.59, 78.06, 79.87, 80.00, 80.61, 80.15, 79.84, 80.99, 81.55, 81.36};
double a4[] = {83.22, 82.68, 84.53, 84.66, 85.28, 84.81, 84.50, 85.67, 86.24, 86.05};
const double *asset1[CCFISHER_INPUTS] = {a1};
const double *asset2[CCFISHER_INPUTS] = {a2};
const double *asset3[CCFISHER_INPUTS] = {a3};
const double *asset4[CCFISHER_INPUTS] = {a4};
const double *const *const simd_inputs[4] = {asset1, asset2, asset3, asset4};
CSimdResult r = ccfisher_simd_by_assets(simd_inputs, 4, 10, options, NULL, 0);
for (uintptr_t i = 0; i < r.num_results; i++) {
/* r.outputs[i][0] -> asset i's fisher series */
ccfisher_state_free(r.states[i]);
}
tulip_ffi_simd_result_free(r);
By options — same asset, N different alpha values in one call:
#include "tulip_rs_ffi.h"
#include "tulip_rs_ffi_counts.h"
double close[] = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36};
const double *inputs[CCFISHER_INPUTS] = {close};
/* Tile the series 20x so longer-period option sets have enough data */
#define EXPANDED_LEN (10 * 20)
static double close_expanded[EXPANDED_LEN];
for (size_t i = 0; i < 20; i++) {
for (size_t j = 0; j < 10; j++) {
close_expanded[i * 10 + j] = close[j];
}
}
const double *expanded_inputs[CCFISHER_INPUTS] = {close_expanded};
static const double o1[CCFISHER_OPTIONS] = {0.0};
static const double o2[CCFISHER_OPTIONS] = {0.1};
static const double o3[CCFISHER_OPTIONS] = {0.2};
static const double o4[CCFISHER_OPTIONS] = {0.3};
const double *const simd_opts[4] = {o1, o2, o3, o4};
CSimdResult r = ccfisher_simd_by_options(expanded_inputs, EXPANDED_LEN, simd_opts, 4, NULL, 0);
for (uintptr_t i = 0; i < r.num_results; i++) ccfisher_state_free(r.states[i]);
tulip_ffi_simd_result_free(r);
By assets — same alpha applied to 4 assets in parallel (lane counts 2/4/8/16):
import "github.com/me60732/tulip_rs_go/indicators"
a1 := []float64{81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36}
// Reuse the same data for assets 2–4 in this example
a2, a3, a4 := a1, a1, a1
options := []float64{0.0} // alpha
assets := [][indicators.CcfisherInputs][]float64{{a1}, {a2}, {a3}, {a4}}
sim, _ := indicators.Ccfisher.SimdByAssets(assets, options, nil)
for i, lanes := range sim.Results {
fmt.Printf("Asset %d Fisher: %v\n", i+1, lanes[0])
fmt.Printf("Asset %d Signal: %v\n", i+1, lanes[1])
}
sim.Close() // frees every lane state, then the SIMD buffers
By options — same asset, 4 different alpha values in parallel:
import "github.com/me60732/tulip_rs_go/indicators"
close := []float64{81.59, 81.06, 82.87, 83.00, 83.61,
83.15, 82.84, 83.99, 84.55, 84.36}
options := [][]float64{{0.0}, {0.1}, {0.2}, {0.3}}
sim, _ := indicators.Ccfisher.SimdByOptions(close, options, nil)
for i, lanes := range sim.Results {
fmt.Printf("Alpha set %d Fisher: %v\n", i+1, lanes[0])
fmt.Printf("Alpha set %d Signal: %v\n", i+1, lanes[1])
}
sim.Close()
By assets — same alpha applied to 4 assets in parallel (N must be 2, 4, 8, or 16):
import org.tuliprs.*;
import org.tuliprs.indicators.Ccfisher;
double[] a1 = {81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36};
// Reuse the same data for assets 2–4 in this example
double[] a2 = a1;
double[] a3 = a1;
double[] a4 = a1;
double[] options = {0.0}; // alpha
// One entry per asset; each asset lists its INPUTS series.
double[][][] assets = {{a1}, {a2}, {a3}, {a4}};
try (SimdResult sim = Ccfisher.simdByAssets(assets, options, null)) {
for (int i = 0; i < sim.numResults(); i++) {
System.out.printf("Asset %d Fisher: %s%n", i + 1,
java.util.Arrays.toString(sim.toDoubleArray(i, 0)));
System.out.printf("Asset %d Signal: %s%n", i + 1,
java.util.Arrays.toString(sim.toDoubleArray(i, 1)));
}
} // frees every lane state, then the SIMD buffers (contractual order)
By options — same asset, 4 different alpha values in parallel:
import org.tuliprs.*;
import org.tuliprs.indicators.Ccfisher;
double[] close = {81.59, 81.06, 82.87, 83.00, 83.61,
83.15, 82.84, 83.99, 84.55, 84.36};
try (SimdResult sim = Ccfisher.simdByOptions(new double[][] {close},
new double[][] {{0.0}, {0.1}, {0.2}, {0.3}}, null)) {
for (int i = 0; i < sim.numResults(); i++) {
System.out.printf("Alpha set %d Fisher: %s%n", i + 1,
java.util.Arrays.toString(sim.toDoubleArray(i, 0)));
System.out.printf("Alpha set %d Signal: %s%n", i + 1,
java.util.Arrays.toString(sim.toDoubleArray(i, 1)));
}
}
By assets — same alpha applied to N assets in parallel (must be 2, 4, 8, or 16):
import numpy as np
import tulip_rs
close = np.array([
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00,
], dtype=np.float64)
simd_inputs = [[close], [close + 5.0], [close - 3.0], [close * 1.02]]
outputs_list, states = tulip_rs.indicators.ccfisher.simd_by_assets(simd_inputs, [0.0])
for i, out in enumerate(outputs_list):
print(f"Asset {i + 1} Fisher: {out[0]}")
print(f"Asset {i + 1} Signal: {out[1]}")
By options — same asset, N different alpha values in parallel:
import numpy as np
import tulip_rs
close = np.array([
81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36,
85.53, 86.54, 86.89, 87.77, 87.29, 87.50, 88.10, 88.50, 87.90, 88.20,
88.80, 89.10, 88.70, 89.30, 89.70, 90.10, 89.50, 90.20, 90.80, 91.10,
90.50, 91.20, 91.80, 92.10, 91.50, 92.20, 92.80, 93.10, 92.50, 93.20,
93.50, 94.10, 94.80, 95.20, 95.70, 96.30, 96.80, 97.10, 97.60, 98.20,
98.70, 99.10, 99.80, 100.20, 100.70, 101.30, 101.80, 102.10, 102.60, 103.20,
103.70, 104.10, 104.80, 105.20, 105.70, 106.30, 106.80, 107.10, 107.60, 108.20,
108.70, 109.10, 109.80, 110.20, 110.70, 111.30, 111.80, 112.10, 112.60, 113.00,
], dtype=np.float64)
simd_options = [[0.0], [0.1], [0.2], [0.3]]
outputs_list, states = tulip_rs.indicators.ccfisher.simd_by_options([close], simd_options)
for i, out in enumerate(outputs_list):
print(f"Alpha set {i + 1} Fisher: {out[0]}")
print(f"Alpha set {i + 1} Signal: {out[1]}")
By assets — same alpha applied to 4 assets in parallel:
const simdInputs = [
[close.slice()],
[close.map(v => v + 5.0)],
[close.map(v => v - 3.0)],
[close.map(v => v * 1.02)],
];
const [results] = ti.ccfisher.simdByAssets(simdInputs, [0]);
results.forEach((out, i) => console.log(`Asset ${i + 1} Fisher:`, out[0], 'Signal:', out[1]));
By options — same asset, 4 different alpha values in parallel: