12 WU_CrossOverStrat strat = (WU_CrossOverStrat)strat_;
23 if (isnan(short_val) || isnan(long_val)) {
26 if ((short_val > long_val * (1.0 + strat->threshold)) &&
29 }
else if ((short_val < long_val * (1.0 - strat->threshold)) &&
37 WU_CrossOverStrat strat = (WU_CrossOverStrat)strategy;
46 strat->base.update =
update;
47 strat->base.delete =
delete;
54 strat->threshold = threshold;
static WU_Signal * update(WU_Strategy strat_, const void *inputs[])
static WU_Signal signal_buffer[NUM_OUTPUTS]
static const WU_DataType input_types[]
WU_CrossOverStrat wu_crossover_strat_new(int short_window, int long_window, double threshold)
static double update(WU_EMA ema, double value)
#define wu_indicator_delete(indicator)
Delete the indicator and free any resources allocated by it.
#define wu_indicator_update(indicator, value)
Header file for technical indicators.
WU_SMA wu_sma_new(int window_size)
Creates a new WU_SMA (Simple Moving Average) indicator with the specified window size.
WU_CrossOverStrat is a simple crossover strategy that generates buy and sell signals based on the cro...
WU_Signal represents a trading signal generated by a strategy.
WU_Single represents a single value with a timestamp, which can be a price, an indicator value,...
WU_DataType
WU_DataType represents the type of input data, which can be a candle, a trade, or a single value.
@ WU_DATA_TYPE_SINGLE_VALUE