From 8f7925715594bf20fef75428e89279d3a6db0aa9 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Thu, 12 Mar 2026 19:37:50 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 0606491 --- lib/channels/aberr/tests/Aberr.Tests.cs | 2 +- lib/channels/accbands/tests/AccBands.Tests.cs | 36 ++++++------- .../tests/AccBands.Validation.Tests.cs | 16 +++--- .../tests/apchannel.Validation.Tests.cs | 1 - lib/channels/apz/tests/Apz.Tests.cs | 2 +- .../apz/tests/Apz.Validation.Tests.cs | 2 +- .../tests/AtrBands.Validation.Tests.cs | 4 +- lib/channels/bbands/tests/Bbands.Tests.cs | 2 +- .../jbands/tests/Jbands.Quantower.Tests.cs | 6 +-- lib/channels/jbands/tests/Jbands.Tests.cs | 2 +- lib/channels/maenv/tests/Maenv.Tests.cs | 2 +- .../maenv/tests/Maenv.Validation.Tests.cs | 4 +- .../tests/Regchannel.Quantower.Tests.cs | 8 +-- .../regchannel/tests/Regchannel.Tests.cs | 12 ++--- .../tests/Regchannel.Validation.Tests.cs | 6 +-- .../tests/Sdchannel.Quantower.Tests.cs | 8 +-- .../sdchannel/tests/Sdchannel.Tests.cs | 2 +- .../tests/Sdchannel.Validation.Tests.cs | 6 +-- .../tests/Starchannel.Validation.Tests.cs | 2 +- lib/channels/stbands/tests/Stbands.Tests.cs | 2 +- .../ttm_lrc/tests/TtmLrc.Quantower.Tests.cs | 8 +-- lib/channels/ttm_lrc/tests/TtmLrc.Tests.cs | 22 ++++---- .../ttm_lrc/tests/TtmLrc.Validation.Tests.cs | 12 ++--- .../ubands/tests/Ubands.Validation.Tests.cs | 2 +- .../tests/Uchannel.Quantower.Tests.cs | 4 +- .../tests/Vwapbands.Quantower.Tests.cs | 2 +- .../vwapbands/tests/Vwapbands.Tests.cs | 6 +-- .../tests/Vwapbands.Validation.Tests.cs | 4 +- .../vwapsd/tests/Vwapsd.Quantower.Tests.cs | 4 +- lib/channels/vwapsd/tests/Vwapsd.Tests.cs | 6 +-- .../vwapsd/tests/Vwapsd.Validation.Tests.cs | 4 +- .../tests/Midpoint.Quantower.Tests.cs | 8 +-- lib/core/tbarseries/tests/TBarSeries.Tests.cs | 12 ++--- lib/core/tests/BiInputIndicatorBase.Tests.cs | 16 +++--- lib/core/tseries/tests/TSeries.Tests.cs | 1 - .../tests/Wclprice.Validation.Tests.cs | 2 +- lib/cycles/ccor/tests/Ccor.Quantower.Tests.cs | 2 +- lib/cycles/ccor/tests/Ccor.Tests.cs | 2 +- lib/cycles/ccyc/tests/Ccyc.Quantower.Tests.cs | 2 +- lib/cycles/ccyc/tests/Ccyc.Tests.cs | 4 +- .../ccyc/tests/Ccyc.Validation.Tests.cs | 12 ++--- lib/cycles/cg/tests/Cg.Quantower.Tests.cs | 2 +- lib/cycles/cg/tests/Cg.Tests.cs | 6 +-- lib/cycles/cg/tests/Cg.Validation.Tests.cs | 20 +++---- lib/cycles/dsp/tests/Dsp.Quantower.Tests.cs | 2 +- lib/cycles/dsp/tests/Dsp.Tests.cs | 6 +-- lib/cycles/dsp/tests/Dsp.Validation.Tests.cs | 8 +-- lib/cycles/eacp/tests/Eacp.Quantower.Tests.cs | 6 +-- lib/cycles/eacp/tests/Eacp.Tests.cs | 10 ++-- lib/cycles/ebsw/tests/Ebsw.Quantower.Tests.cs | 6 +-- lib/cycles/ebsw/tests/Ebsw.Tests.cs | 10 ++-- .../ebsw/tests/Ebsw.Validation.Tests.cs | 10 ++-- .../homod/tests/Homod.Quantower.Tests.cs | 4 +- lib/cycles/homod/tests/Homod.Tests.cs | 10 ++-- .../homod/tests/Homod.Validation.Tests.cs | 10 ++-- .../tests/HtDcperiod.Quantower.Tests.cs | 4 +- .../ht_dcperiod/tests/HtDcperiod.Tests.cs | 16 +++--- lib/cycles/ht_phasor/tests/HtPhasor.Tests.cs | 6 +-- .../ht_sine/tests/HtSine.Quantower.Tests.cs | 6 +-- lib/cycles/ht_sine/tests/HtSine.Tests.cs | 16 +++--- .../ssfdsp/tests/Ssfdsp.Quantower.Tests.cs | 2 +- lib/cycles/ssfdsp/tests/Ssfdsp.Tests.cs | 6 +-- .../ssfdsp/tests/Ssfdsp.Validation.Tests.cs | 4 +- .../tests/Alligator.Validation.Tests.cs | 2 +- lib/dynamics/amat/tests/Amat.Tests.cs | 8 +-- .../amat/tests/Amat.Validation.Tests.cs | 2 +- lib/dynamics/chop/tests/Chop.Tests.cs | 2 +- .../chop/tests/Chop.Validation.Tests.cs | 4 +- .../ht_trendmode/tests/HtTrendmode.Tests.cs | 20 +++---- .../tests/Ichimoku.Quantower.Tests.cs | 2 +- lib/dynamics/ichimoku/tests/Ichimoku.Tests.cs | 32 ++++++------ lib/dynamics/qstick/tests/Qstick.Tests.cs | 4 +- .../qstick/tests/Qstick.Validation.Tests.cs | 2 +- .../ttm_squeeze/tests/TtmSqueeze.Tests.cs | 48 ++++++++--------- .../tests/TtmTrend.Quantower.Tests.cs | 4 +- .../ttm_trend/tests/TtmTrend.Tests.cs | 4 +- .../tests/TtmTrend.Validation.Tests.cs | 4 +- lib/dynamics/vortex/tests/Vortex.Tests.cs | 12 ++--- lib/errors/huber/tests/Huber.Tests.cs | 14 ++--- lib/errors/logcosh/tests/LogCosh.Tests.cs | 2 +- lib/errors/mae/tests/Mae.Tests.cs | 12 ++--- lib/errors/mapd/tests/Mapd.Tests.cs | 8 +-- lib/errors/mape/tests/Mape.Tests.cs | 6 +-- lib/errors/mase/tests/Mase.Tests.cs | 2 +- lib/errors/me/tests/Me.Tests.cs | 12 ++--- lib/errors/mrae/tests/Mrae.Tests.cs | 10 ++-- lib/errors/mse/tests/Mse.Tests.cs | 12 ++--- .../pseudohuber/tests/PseudoHuber.Tests.cs | 2 +- .../quantileloss/tests/QuantileLoss.Tests.cs | 2 +- lib/errors/rae/tests/Rae.Tests.cs | 2 +- lib/errors/rmse/tests/Rmse.Tests.cs | 16 +++--- lib/errors/rmsle/tests/Rmsle.Tests.cs | 2 +- lib/errors/rse/tests/Rse.Tests.cs | 6 +-- lib/errors/rsquared/tests/Rsquared.Tests.cs | 12 ++--- .../tests/TukeyBiweight.Tests.cs | 2 +- lib/errors/wrmse/tests/Wrmse.Tests.cs | 22 ++++---- lib/filters/agc/tests/Agc.Tests.cs | 1 - lib/filters/agc/tests/Agc.Validation.Tests.cs | 4 +- .../alaguerre/tests/ALaguerre.Tests.cs | 2 +- .../tests/ALaguerre.Validation.Tests.cs | 4 +- .../baxterking/tests/BaxterKing.Tests.cs | 2 +- .../butter2/tests/Butter2.Validation.Tests.cs | 2 +- .../butter3/tests/Butter3.Validation.Tests.cs | 6 +-- .../cfitz/tests/Cfitz.Validation.Tests.cs | 2 +- .../tests/Elliptic.Validation.Tests.cs | 2 +- lib/filters/gauss/tests/Gauss.Tests.cs | 2 +- .../gauss/tests/Gauss.Validation.Tests.cs | 2 +- lib/filters/hp/tests/Hp.Validation.Tests.cs | 8 +-- lib/filters/hpf/tests/Hpf.Tests.cs | 1 - lib/filters/hpf/tests/Hpf.Validation.Tests.cs | 2 +- .../kalman/tests/Kalman.Validation.Tests.cs | 2 +- .../tests/Laguerre.Validation.Tests.cs | 4 +- lib/filters/lms/tests/Lms.Validation.Tests.cs | 2 +- lib/filters/modf/tests/Modf.Tests.cs | 8 +-- lib/filters/nw/tests/Nw.Tests.cs | 6 +-- lib/filters/nw/tests/Nw.Validation.Tests.cs | 4 +- .../oneeuro/tests/OneEuro.Validation.Tests.cs | 12 ++--- lib/filters/rls/tests/Rls.Validation.Tests.cs | 2 +- lib/filters/sak/tests/Sak.Tests.cs | 2 +- lib/filters/sak/tests/Sak.Validation.Tests.cs | 2 +- lib/filters/sgf/tests/Sgf.Validation.Tests.cs | 6 +-- .../ssf3/tests/Ssf3.Validation.Tests.cs | 4 +- lib/filters/usf/tests/Usf.Validation.Tests.cs | 2 +- lib/filters/voss/tests/Voss.Tests.cs | 4 +- lib/filters/wavelet/tests/Wavelet.Tests.cs | 8 +-- .../wavelet/tests/Wavelet.Validation.Tests.cs | 10 ++-- .../wiener/tests/Wiener.Validation.Tests.cs | 2 +- .../bias/tests/Bias.Validation.Tests.cs | 4 +- lib/momentum/cmo/tests/Cmo.Tests.cs | 6 +-- lib/momentum/macd/tests/Macd.Tests.cs | 4 +- lib/momentum/mom/tests/Mom.Quantower.Tests.cs | 12 ++--- lib/momentum/mom/tests/Mom.Tests.cs | 2 +- lib/momentum/pmo/tests/Pmo.Quantower.Tests.cs | 8 +-- lib/momentum/pmo/tests/Pmo.Tests.cs | 10 ++-- .../pmo/tests/Pmo.Validation.Tests.cs | 4 +- lib/momentum/ppo/tests/Ppo.Quantower.Tests.cs | 16 +++--- lib/momentum/ppo/tests/Ppo.Tests.cs | 12 ++--- lib/momentum/prs/tests/Prs.Tests.cs | 14 ++--- lib/momentum/roc/tests/Roc.Quantower.Tests.cs | 12 ++--- lib/momentum/roc/tests/Roc.Tests.cs | 2 +- .../rocp/tests/Rocp.Quantower.Tests.cs | 12 ++--- lib/momentum/rocp/tests/Rocp.Tests.cs | 2 +- .../rocr/tests/Rocr.Quantower.Tests.cs | 12 ++--- lib/momentum/rocr/tests/Rocr.Tests.cs | 2 +- lib/momentum/sam/tests/Sam.Quantower.Tests.cs | 8 +-- lib/momentum/sam/tests/Sam.Tests.cs | 24 ++++----- .../sam/tests/Sam.Validation.Tests.cs | 4 +- lib/momentum/tsi/tests/Tsi.Quantower.Tests.cs | 2 +- lib/momentum/tsi/tests/Tsi.Tests.cs | 22 ++++---- .../tsi/tests/Tsi.Validation.Tests.cs | 6 +-- lib/numerics/betadist/tests/Betadist.Tests.cs | 2 +- .../tests/Betadist.Validation.Tests.cs | 2 +- .../binomdist/tests/Binomdist.Tests.cs | 2 +- .../change/tests/Change.Validation.Tests.cs | 4 +- lib/numerics/cwt/tests/Cwt.Tests.cs | 2 +- lib/numerics/dwt/tests/Dwt.Tests.cs | 2 +- lib/numerics/expdist/tests/Expdist.Tests.cs | 2 +- lib/numerics/fdist/tests/Fdist.Tests.cs | 2 +- .../fdist/tests/Fdist.Validation.Tests.cs | 2 +- lib/numerics/fft/tests/Fft.Tests.cs | 6 +-- .../gammadist/tests/Gammadist.Tests.cs | 2 +- lib/numerics/ifft/tests/Ifft.Tests.cs | 12 ++--- .../ifft/tests/Ifft.Validation.Tests.cs | 4 +- lib/numerics/jerk/tests/Jerk.Tests.cs | 2 +- .../tests/Lineartrans.Validation.Tests.cs | 8 +-- .../lognormdist/tests/Lognormdist.Tests.cs | 2 +- .../tests/Normalize.Validation.Tests.cs | 6 +-- lib/numerics/normdist/tests/Normdist.Tests.cs | 2 +- .../poissondist/tests/Poissondist.Tests.cs | 2 +- .../slope/tests/Slope.Validation.Tests.cs | 2 +- lib/numerics/tdist/tests/Tdist.Tests.cs | 2 +- .../tdist/tests/Tdist.Validation.Tests.cs | 4 +- .../weibulldist/tests/Weibulldist.Tests.cs | 2 +- lib/oscillators/ac/tests/Ac.Tests.cs | 2 +- .../bbi/tests/Bbi.Quantower.Tests.cs | 2 +- lib/oscillators/bbi/tests/Bbi.Tests.cs | 2 +- lib/oscillators/bbs/tests/Bbs.Tests.cs | 36 ++++++------- .../brar/tests/Brar.Quantower.Tests.cs | 2 +- .../coppock/tests/Coppock.Quantower.Tests.cs | 2 +- .../coppock/tests/Coppock.Tests.cs | 2 +- .../coppock/tests/Coppock.Validation.Tests.cs | 4 +- lib/oscillators/crsi/tests/Crsi.Tests.cs | 2 +- lib/oscillators/cti/tests/Cti.Tests.cs | 2 +- lib/oscillators/deco/tests/Deco.Tests.cs | 2 +- .../deco/tests/Deco.Validation.Tests.cs | 4 +- .../dem/tests/Dem.Quantower.Tests.cs | 2 +- lib/oscillators/dosc/tests/Dosc.Tests.cs | 10 ++-- lib/oscillators/dpo/tests/Dpo.Tests.cs | 2 +- .../dymoi/tests/Dymoi.Quantower.Tests.cs | 4 +- lib/oscillators/dymoi/tests/Dymoi.Tests.cs | 2 +- lib/oscillators/er/tests/Er.Tests.cs | 4 +- .../er/tests/Er.Validation.Tests.cs | 2 +- .../fi/tests/Fi.Validation.Tests.cs | 2 +- lib/oscillators/fisher/tests/Fisher.Tests.cs | 10 ++-- .../fisher/tests/Fisher.Validation.Tests.cs | 2 +- .../fisher04/tests/Fisher04.Tests.cs | 10 ++-- .../tests/Fisher04.Validation.Tests.cs | 2 +- lib/oscillators/imi/tests/Imi.Tests.cs | 26 +++++----- .../imi/tests/Imi.Validation.Tests.cs | 2 +- .../inertia/tests/Inertia.Tests.cs | 2 +- .../inertia/tests/Inertia.Validation.Tests.cs | 8 +-- lib/oscillators/kdj/tests/Kdj.Tests.cs | 14 ++--- .../kdj/tests/Kdj.Validation.Tests.cs | 2 +- lib/oscillators/kri/tests/Kri.Tests.cs | 6 +-- .../kri/tests/Kri.Validation.Tests.cs | 4 +- .../kst/tests/Kst.Quantower.Tests.cs | 2 +- lib/oscillators/kst/tests/Kst.Tests.cs | 2 +- .../kst/tests/Kst.Validation.Tests.cs | 4 +- .../lrsi/tests/Lrsi.Quantower.Tests.cs | 6 +-- lib/oscillators/lrsi/tests/Lrsi.Tests.cs | 2 +- .../mstoch/tests/Mstoch.Quantower.Tests.cs | 4 +- .../mstoch/tests/Mstoch.Validation.Tests.cs | 4 +- .../pgo/tests/Pgo.Validation.Tests.cs | 6 +-- lib/oscillators/psl/tests/Psl.Tests.cs | 6 +-- lib/oscillators/reflex/tests/Reflex.Tests.cs | 8 +-- .../reverseema/tests/ReverseEma.Tests.cs | 6 +-- .../rvgi/tests/Rvgi.Quantower.Tests.cs | 2 +- .../rvgi/tests/Rvgi.Validation.Tests.cs | 4 +- .../squeeze/tests/Squeeze.Quantower.Tests.cs | 2 +- .../stc/tests/Stc.Quantower.Tests.cs | 2 +- .../trendflex/tests/Trendflex.Tests.cs | 8 +-- .../trix/tests/Trix.Validation.Tests.cs | 4 +- .../ttm_wave/tests/TtmWave.Quantower.Tests.cs | 6 +-- .../chandelier/tests/Chandelier.Tests.cs | 4 +- lib/reversals/ckstop/tests/Ckstop.Tests.cs | 4 +- .../fractals/tests/Fractals.Tests.cs | 2 +- .../pivot/tests/Pivot.Quantower.Tests.cs | 2 +- lib/reversals/pivot/tests/Pivot.Tests.cs | 8 +-- .../pivot/tests/Pivot.Validation.Tests.cs | 9 ++-- .../tests/Pivotcam.Quantower.Tests.cs | 2 +- .../pivotcam/tests/Pivotcam.Tests.cs | 32 ++++++------ .../tests/Pivotcam.Validation.Tests.cs | 17 +++--- .../tests/Pivotdem.Quantower.Tests.cs | 2 +- .../tests/Pivotdem.Validation.Tests.cs | 13 +++-- .../tests/Pivotext.Quantower.Tests.cs | 2 +- .../pivotext/tests/Pivotext.Tests.cs | 16 +++--- .../tests/Pivotext.Validation.Tests.cs | 16 +++--- .../tests/Pivotfib.Quantower.Tests.cs | 2 +- .../tests/Pivotfib.Validation.Tests.cs | 9 ++-- .../tests/Pivotwood.Quantower.Tests.cs | 2 +- .../tests/Pivotwood.Validation.Tests.cs | 11 ++-- lib/reversals/psar/tests/Psar.Tests.cs | 10 ++-- lib/reversals/swings/tests/Swings.Tests.cs | 2 +- .../swings/tests/Swings.Validation.Tests.cs | 4 +- .../ttm_scalper/tests/TtmScalper.Tests.cs | 2 +- lib/statistics/acf/tests/Acf.Tests.cs | 2 +- .../acf/tests/Acf.Validation.Tests.cs | 2 +- lib/statistics/beta/tests/Beta.Tests.cs | 2 +- .../beta/tests/Beta.Validation.Tests.cs | 4 +- .../tests/Cointegration.Tests.cs | 14 ++--- .../tests/Cointegration.Validation.Tests.cs | 52 +++++++++---------- .../tests/Correlation.Validation.Tests.cs | 26 +++++----- .../covariance/tests/Covariance.Tests.cs | 2 +- .../entropy/tests/Entropy.Validation.Tests.cs | 2 +- .../geomean/tests/Geomean.Validation.Tests.cs | 2 +- lib/statistics/granger/tests/Granger.Tests.cs | 2 +- .../granger/tests/Granger.Validation.Tests.cs | 14 ++--- .../harmean/tests/Harmean.Validation.Tests.cs | 2 +- .../hurst/tests/Hurst.Validation.Tests.cs | 1 - lib/statistics/jb/tests/Jb.Tests.cs | 2 +- lib/statistics/pacf/tests/Pacf.Tests.cs | 2 +- .../pacf/tests/Pacf.Validation.Tests.cs | 4 +- .../polyfit/tests/Polyfit.Validation.Tests.cs | 2 +- .../tests/Spearman.Validation.Tests.cs | 2 +- lib/statistics/stderr/tests/Stderr.Tests.cs | 6 +-- .../stderr/tests/Stderr.Validation.Tests.cs | 10 ++-- .../sum/tests/Sum.Validation.Tests.cs | 4 +- .../variance/tests/Variance.Tests.cs | 4 -- .../zscore/tests/Zscore.Validation.Tests.cs | 2 +- lib/trends_FIR/blma/tests/Blma.Tests.cs | 2 - .../crma/tests/Crma.Validation.Tests.cs | 6 +-- lib/trends_FIR/fwma/tests/Fwma.Tests.cs | 2 +- lib/trends_FIR/hamma/tests/Hamma.Tests.cs | 2 +- .../hamma/tests/Hamma.Validation.Tests.cs | 12 ++--- lib/trends_FIR/hend/tests/Hend.Tests.cs | 12 ++--- .../hend/tests/Hend.Validation.Tests.cs | 12 ++--- lib/trends_FIR/ilrs/tests/Ilrs.Tests.cs | 4 +- lib/trends_FIR/lsma/tests/Lsma.Tests.cs | 4 +- lib/trends_FIR/nlma/tests/Nlma.Tests.cs | 30 +++++------ .../nlma/tests/Nlma.Validation.Tests.cs | 28 +++++----- .../qrma/tests/Qrma.Validation.Tests.cs | 4 +- .../rain/tests/Rain.Validation.Tests.cs | 2 +- lib/trends_FIR/rwma/tests/Rwma.Tests.cs | 4 +- .../rwma/tests/Rwma.Validation.Tests.cs | 6 +-- lib/trends_FIR/sgma/tests/Sgma.Tests.cs | 4 +- .../sgma/tests/Sgma.Validation.Tests.cs | 2 +- .../sinema/tests/Sinema.Validation.Tests.cs | 4 +- lib/trends_FIR/sp15/tests/Sp15.Tests.cs | 16 +++--- .../sp15/tests/Sp15.Validation.Tests.cs | 22 ++++---- lib/trends_FIR/swma/tests/Swma.Tests.cs | 1 - .../trima/tests/Trima.Validation.Tests.cs | 2 +- lib/trends_FIR/tsf/tests/Tsf.Tests.cs | 4 +- .../adxvma/tests/Adxvma.Quantower.Tests.cs | 2 +- lib/trends_IIR/adxvma/tests/Adxvma.Tests.cs | 2 +- .../adxvma/tests/Adxvma.Validation.Tests.cs | 4 +- .../tests/Decycler.Validation.Tests.cs | 16 +++--- lib/trends_IIR/dema/tests/Dema.Tests.cs | 2 +- .../dema/tests/Dema.Validation.Tests.cs | 2 +- lib/trends_IIR/hwma/tests/Hwma.Tests.cs | 2 +- .../hwma/tests/Hwma.Validation.Tests.cs | 12 ++--- lib/trends_IIR/jma/tests/Jma.Tests.cs | 2 +- lib/trends_IIR/ltma/tests/Ltma.Tests.cs | 2 +- .../ltma/tests/Ltma.Validation.Tests.cs | 2 +- lib/trends_IIR/mama/tests/Mama.Tests.cs | 2 +- lib/trends_IIR/mavp/tests/Mavp.Tests.cs | 4 +- lib/trends_IIR/mcnma/tests/Mcnma.Tests.cs | 6 +-- .../mcnma/tests/Mcnma.Validation.Tests.cs | 12 ++--- lib/trends_IIR/nma/tests/Nma.Tests.cs | 2 +- .../nma/tests/Nma.Validation.Tests.cs | 2 +- lib/trends_IIR/trama/tests/Trama.Tests.cs | 2 +- .../vama/tests/Vama.Quantower.Tests.cs | 4 +- .../vama/tests/Vama.Validation.Tests.cs | 4 +- .../vidya/tests/Vidya.Validation.Tests.cs | 2 +- lib/volatility/atrn/tests/Atrn.Tests.cs | 2 +- .../atrn/tests/Atrn.Validation.Tests.cs | 6 +-- .../bbw/tests/Bbw.Quantower.Tests.cs | 2 +- lib/volatility/bbw/tests/Bbw.Tests.cs | 4 +- .../bbwn/tests/Bbwn.Quantower.Tests.cs | 2 +- .../bbwp/tests/Bbwp.Quantower.Tests.cs | 2 +- .../bbwp/tests/Bbwp.Validation.Tests.cs | 2 +- .../ccv/tests/Ccv.Quantower.Tests.cs | 2 +- lib/volatility/ccv/tests/Ccv.Tests.cs | 2 +- .../ccv/tests/Ccv.Validation.Tests.cs | 4 +- lib/volatility/cv/tests/Cv.Quantower.Tests.cs | 2 +- lib/volatility/cv/tests/Cv.Tests.cs | 8 +-- .../cv/tests/Cv.Validation.Tests.cs | 12 ++--- .../cvi/tests/Cvi.Quantower.Tests.cs | 4 +- lib/volatility/cvi/tests/Cvi.Tests.cs | 10 ++-- .../cvi/tests/Cvi.Validation.Tests.cs | 12 ++--- lib/volatility/ewma/tests/Ewma.Tests.cs | 2 +- .../ewma/tests/Ewma.Validation.Tests.cs | 6 +-- .../gkv/tests/Gkv.Quantower.Tests.cs | 2 +- .../gkv/tests/Gkv.Validation.Tests.cs | 12 ++--- .../hlv/tests/Hlv.Quantower.Tests.cs | 2 +- .../hlv/tests/Hlv.Validation.Tests.cs | 4 +- lib/volatility/hv/tests/Hv.Quantower.Tests.cs | 16 +++--- .../hv/tests/Hv.Validation.Tests.cs | 2 +- .../jvolty/tests/Jvolty.Quantower.Tests.cs | 2 +- .../jvoltyn/tests/Jvoltyn.Quantower.Tests.cs | 4 +- .../rsv/tests/Rsv.Quantower.Tests.cs | 4 +- .../rsv/tests/Rsv.Validation.Tests.cs | 6 +-- lib/volatility/rv/tests/Rv.Quantower.Tests.cs | 18 +++---- .../rv/tests/Rv.Validation.Tests.cs | 2 +- .../rvi/tests/Rvi.Quantower.Tests.cs | 16 +++--- lib/volatility/ui/tests/Ui.Quantower.Tests.cs | 12 ++--- lib/volatility/ui/tests/Ui.Tests.cs | 2 +- .../ui/tests/Ui.Validation.Tests.cs | 4 +- .../vov/tests/Vov.Quantower.Tests.cs | 18 +++---- lib/volatility/vov/tests/Vov.Tests.cs | 6 +-- .../vov/tests/Vov.Validation.Tests.cs | 10 ++-- lib/volatility/vr/tests/Vr.Quantower.Tests.cs | 12 ++--- lib/volatility/vr/tests/Vr.Tests.cs | 4 +- .../vr/tests/Vr.Validation.Tests.cs | 4 +- .../yzv/tests/Yzv.Quantower.Tests.cs | 16 +++--- lib/volatility/yzv/tests/Yzv.Tests.cs | 4 +- .../yzv/tests/Yzv.Validation.Tests.cs | 16 +++--- lib/volume/adosc/tests/Adosc.Tests.cs | 4 +- lib/volume/eom/tests/Eom.Tests.cs | 5 +- .../evwma/tests/Evwma.Validation.Tests.cs | 4 +- lib/volume/iii/tests/Iii.Tests.cs | 6 +-- lib/volume/kvo/tests/Kvo.Tests.cs | 12 ++--- lib/volume/mfi/tests/Mfi.Tests.cs | 4 +- lib/volume/nvi/tests/Nvi.Tests.cs | 4 +- lib/volume/pvd/tests/Pvd.Quantower.Tests.cs | 4 +- lib/volume/pvd/tests/Pvd.Tests.cs | 10 ++-- lib/volume/pvd/tests/Pvd.Validation.Tests.cs | 2 +- lib/volume/pvi/tests/Pvi.Tests.cs | 4 +- lib/volume/pvo/tests/Pvo.Quantower.Tests.cs | 2 +- lib/volume/pvo/tests/Pvo.Tests.cs | 10 ++-- lib/volume/pvr/tests/Pvr.Tests.cs | 2 +- lib/volume/pvt/tests/Pvt.Validation.Tests.cs | 4 +- lib/volume/twap/tests/Twap.Quantower.Tests.cs | 4 +- lib/volume/va/tests/Va.Quantower.Tests.cs | 2 +- lib/volume/va/tests/Va.Validation.Tests.cs | 2 +- lib/volume/vf/tests/Vf.Quantower.Tests.cs | 4 +- lib/volume/vo/tests/Vo.Quantower.Tests.cs | 10 ++-- lib/volume/vo/tests/Vo.Tests.cs | 4 +- lib/volume/vo/tests/Vo.Validation.Tests.cs | 4 +- lib/volume/vroc/tests/Vroc.Quantower.Tests.cs | 6 +-- lib/volume/vroc/tests/Vroc.Tests.cs | 8 +-- .../vroc/tests/Vroc.Validation.Tests.cs | 6 +-- .../vwad/tests/Vwad.Validation.Tests.cs | 2 +- .../vwap/tests/Vwap.Validation.Tests.cs | 8 +-- .../vwma/tests/Vwma.Validation.Tests.cs | 8 +-- 384 files changed, 1197 insertions(+), 1215 deletions(-) diff --git a/lib/channels/aberr/tests/Aberr.Tests.cs b/lib/channels/aberr/tests/Aberr.Tests.cs index 67e21d5b..48d41e39 100644 --- a/lib/channels/aberr/tests/Aberr.Tests.cs +++ b/lib/channels/aberr/tests/Aberr.Tests.cs @@ -608,7 +608,7 @@ public class AberrTests var series = new TSeries(); for (int i = 0; i < 10; i++) { - series.Add(DateTime.UtcNow, 100 + i * 10); // 100, 110, 120, ... + series.Add(DateTime.UtcNow, 100 + (i * 10)); // 100, 110, 120, ... } // Multiplier 1.0 diff --git a/lib/channels/accbands/tests/AccBands.Tests.cs b/lib/channels/accbands/tests/AccBands.Tests.cs index 8b23f083..06ddd2ef 100644 --- a/lib/channels/accbands/tests/AccBands.Tests.cs +++ b/lib/channels/accbands/tests/AccBands.Tests.cs @@ -179,8 +179,8 @@ public class AccBandsTests // SMA(3) of adjLow: (54 + 58.80952 + 63.63636) / 3 ≈ 58.81529 // SMA(3) of Close: (100+105+110)/3 = 105 - double expectedUpper = (154.0 + 115.0 * (1.0 + 4.0 * 20.0 / 210.0) + 120.0 * (1.0 + 4.0 * 20.0 / 220.0)) / 3.0; - double expectedLower = (54.0 + 95.0 * (1.0 - 4.0 * 20.0 / 210.0) + 100.0 * (1.0 - 4.0 * 20.0 / 220.0)) / 3.0; + double expectedUpper = (154.0 + (115.0 * (1.0 + (4.0 * 20.0 / 210.0))) + (120.0 * (1.0 + (4.0 * 20.0 / 220.0)))) / 3.0; + double expectedLower = (54.0 + (95.0 * (1.0 - (4.0 * 20.0 / 210.0))) + (100.0 * (1.0 - (4.0 * 20.0 / 220.0)))) / 3.0; Assert.Equal(105.0, accBands.Last.Value, 1e-10); Assert.Equal(expectedUpper, accBands.Upper.Value, 1e-10); @@ -399,8 +399,8 @@ public class AccBandsTests // adjLow = 100*(1-4*0.090909) = 100*0.636364 ≈ 63.63636 accBands.Update(new TBar(DateTime.UtcNow, 110, 120, 100, 110, 1000)); Assert.Equal(110.0, accBands.Last.Value, 1e-10); - Assert.Equal(120.0 * (1.0 + 4.0 * 20.0 / 220.0), accBands.Upper.Value, 1e-10); - Assert.Equal(100.0 * (1.0 - 4.0 * 20.0 / 220.0), accBands.Lower.Value, 1e-10); + Assert.Equal(120.0 * (1.0 + (4.0 * 20.0 / 220.0)), accBands.Upper.Value, 1e-10); + Assert.Equal(100.0 * (1.0 - (4.0 * 20.0 / 220.0)), accBands.Lower.Value, 1e-10); } // ============== Span API Tests ============== @@ -496,12 +496,12 @@ public class AccBandsTests // Bar 2: H=120, L=100 => w=20/220, adjH=120*(1+4*20/220), adjL=100*(1-4*20/220) // SMA(3) of Close: (100+105+110)/3 = 105 - double adjH0 = 110.0 * (1.0 + 4.0 * 20.0 / 200.0); - double adjH1 = 115.0 * (1.0 + 4.0 * 20.0 / 210.0); - double adjH2 = 120.0 * (1.0 + 4.0 * 20.0 / 220.0); - double adjL0 = 90.0 * (1.0 - 4.0 * 20.0 / 200.0); - double adjL1 = 95.0 * (1.0 - 4.0 * 20.0 / 210.0); - double adjL2 = 100.0 * (1.0 - 4.0 * 20.0 / 220.0); + double adjH0 = 110.0 * (1.0 + (4.0 * 20.0 / 200.0)); + double adjH1 = 115.0 * (1.0 + (4.0 * 20.0 / 210.0)); + double adjH2 = 120.0 * (1.0 + (4.0 * 20.0 / 220.0)); + double adjL0 = 90.0 * (1.0 - (4.0 * 20.0 / 200.0)); + double adjL1 = 95.0 * (1.0 - (4.0 * 20.0 / 210.0)); + double adjL2 = 100.0 * (1.0 - (4.0 * 20.0 / 220.0)); Assert.Equal(105.0, middle[2], 1e-10); Assert.Equal((adjH0 + adjH1 + adjH2) / 3.0, upper[2], 1e-10); @@ -657,12 +657,12 @@ public class AccBandsTests // Bar 2: H=120,L=100,C=110 -> w=20/220, adjH=120*(1+80/220), adjL=100*(1-80/220) // Bar 3: H=125,L=105,C=115 -> w=20/230, adjH=125*(1+80/230), adjL=105*(1-80/230) // Bar 4: H=130,L=110,C=120 -> w=20/240, adjH=130*(1+80/240), adjL=110*(1-80/240) - double adjH2 = 120.0 * (1.0 + 4.0 * 20.0 / 220.0); - double adjL2 = 100.0 * (1.0 - 4.0 * 20.0 / 220.0); - double adjH3 = 125.0 * (1.0 + 4.0 * 20.0 / 230.0); - double adjL3 = 105.0 * (1.0 - 4.0 * 20.0 / 230.0); - double adjH4 = 130.0 * (1.0 + 4.0 * 20.0 / 240.0); - double adjL4 = 110.0 * (1.0 - 4.0 * 20.0 / 240.0); + double adjH2 = 120.0 * (1.0 + (4.0 * 20.0 / 220.0)); + double adjL2 = 100.0 * (1.0 - (4.0 * 20.0 / 220.0)); + double adjH3 = 125.0 * (1.0 + (4.0 * 20.0 / 230.0)); + double adjL3 = 105.0 * (1.0 - (4.0 * 20.0 / 230.0)); + double adjH4 = 130.0 * (1.0 + (4.0 * 20.0 / 240.0)); + double adjL4 = 110.0 * (1.0 - (4.0 * 20.0 / 240.0)); Assert.Equal(115.0, accBands.Last.Value, 1e-10); Assert.Equal((adjH2 + adjH3 + adjH4) / 3.0, accBands.Upper.Value, 1e-10); @@ -672,8 +672,8 @@ public class AccBandsTests accBands.Update(new TBar(DateTime.UtcNow, 125, 135, 115, 125, 1000)); // New window: bars [3,4,5] // Bar 5: H=135,L=115,C=125 -> w=20/250, adjH=135*(1+80/250), adjL=115*(1-80/250) - double adjH5 = 135.0 * (1.0 + 4.0 * 20.0 / 250.0); - double adjL5 = 115.0 * (1.0 - 4.0 * 20.0 / 250.0); + double adjH5 = 135.0 * (1.0 + (4.0 * 20.0 / 250.0)); + double adjL5 = 115.0 * (1.0 - (4.0 * 20.0 / 250.0)); Assert.Equal(120.0, accBands.Last.Value, 1e-10); Assert.Equal((adjH3 + adjH4 + adjH5) / 3.0, accBands.Upper.Value, 1e-10); diff --git a/lib/channels/accbands/tests/AccBands.Validation.Tests.cs b/lib/channels/accbands/tests/AccBands.Validation.Tests.cs index 8da2a831..033589a9 100644 --- a/lib/channels/accbands/tests/AccBands.Validation.Tests.cs +++ b/lib/channels/accbands/tests/AccBands.Validation.Tests.cs @@ -63,12 +63,12 @@ public sealed class AccBandsValidationTests : IDisposable var accBands = new AccBands(3, 4.0); var (middle, upper, lower) = accBands.Update(series); - double adjH0 = 12.0 * (1.0 + 4.0 * 4.0 / 20.0); - double adjH1 = 14.0 * (1.0 + 4.0 * 4.0 / 24.0); - double adjH2 = 16.0 * (1.0 + 4.0 * 4.0 / 28.0); - double adjL0 = 8.0 * (1.0 - 4.0 * 4.0 / 20.0); - double adjL1 = 10.0 * (1.0 - 4.0 * 4.0 / 24.0); - double adjL2 = 12.0 * (1.0 - 4.0 * 4.0 / 28.0); + double adjH0 = 12.0 * (1.0 + (4.0 * 4.0 / 20.0)); + double adjH1 = 14.0 * (1.0 + (4.0 * 4.0 / 24.0)); + double adjH2 = 16.0 * (1.0 + (4.0 * 4.0 / 28.0)); + double adjL0 = 8.0 * (1.0 - (4.0 * 4.0 / 20.0)); + double adjL1 = 10.0 * (1.0 - (4.0 * 4.0 / 24.0)); + double adjL2 = 12.0 * (1.0 - (4.0 * 4.0 / 28.0)); Assert.Equal(12.0, middle.Last.Value, 1e-10); Assert.Equal((adjH0 + adjH1 + adjH2) / 3.0, upper.Last.Value, 1e-10); @@ -106,8 +106,8 @@ public sealed class AccBandsValidationTests : IDisposable double l = c - 5; double denom = h + l; double w = (h - l) / denom; - sumAdjH += h * (1.0 + 4.0 * w); - sumAdjL += l * (1.0 - 4.0 * w); + sumAdjH += h * (1.0 + (4.0 * w)); + sumAdjL += l * (1.0 - (4.0 * w)); } Assert.Equal(sumAdjH / 5.0, upper.Last.Value, 1e-10); Assert.Equal(sumAdjL / 5.0, lower.Last.Value, 1e-10); diff --git a/lib/channels/apchannel/tests/apchannel.Validation.Tests.cs b/lib/channels/apchannel/tests/apchannel.Validation.Tests.cs index 60af7a5a..ac130851 100644 --- a/lib/channels/apchannel/tests/apchannel.Validation.Tests.cs +++ b/lib/channels/apchannel/tests/apchannel.Validation.Tests.cs @@ -39,7 +39,6 @@ public sealed class ApchannelValidationTests : IDisposable /// we validate against mathematical correctness by comparing the span and streaming results /// with manually calculated EMA values for high and low prices. /// - [Fact] public void Validate_AllModes_ProduceSameResult() { diff --git a/lib/channels/apz/tests/Apz.Tests.cs b/lib/channels/apz/tests/Apz.Tests.cs index d398fd51..4d41d8cc 100644 --- a/lib/channels/apz/tests/Apz.Tests.cs +++ b/lib/channels/apz/tests/Apz.Tests.cs @@ -168,7 +168,7 @@ public class ApzTests // Generate 9 corrections with isNew=false (different values) for (int i = 0; i < 9; i++) { - var correctionBar = new TBar(tenthBar.Time, tenthBar.Open + i, tenthBar.High + i * 2, tenthBar.Low - i, tenthBar.Close + i, tenthBar.Volume); + var correctionBar = new TBar(tenthBar.Time, tenthBar.Open + i, tenthBar.High + (i * 2), tenthBar.Low - i, tenthBar.Close + i, tenthBar.Volume); apz.Update(correctionBar, isNew: false); } diff --git a/lib/channels/apz/tests/Apz.Validation.Tests.cs b/lib/channels/apz/tests/Apz.Validation.Tests.cs index 7ea911c3..75740c5c 100644 --- a/lib/channels/apz/tests/Apz.Validation.Tests.cs +++ b/lib/channels/apz/tests/Apz.Validation.Tests.cs @@ -383,7 +383,7 @@ public sealed class ApzValidationTests : IDisposable } else { - ema = alpha * bar.Close + (1 - alpha) * ema; + ema = (alpha * bar.Close) + ((1 - alpha) * ema); } emaResults.Add(ema); diff --git a/lib/channels/atrbands/tests/AtrBands.Validation.Tests.cs b/lib/channels/atrbands/tests/AtrBands.Validation.Tests.cs index b6a63aee..90b63f27 100644 --- a/lib/channels/atrbands/tests/AtrBands.Validation.Tests.cs +++ b/lib/channels/atrbands/tests/AtrBands.Validation.Tests.cs @@ -332,8 +332,8 @@ public sealed class AtrBandsValidationTests : IDisposable double expectedMid = smaResult[i].Sma!.Value; double expectedAtr = atrResult[i].Atr!.Value; - double expectedUp = expectedMid + multiplier * expectedAtr; - double expectedLo = expectedMid - multiplier * expectedAtr; + double expectedUp = expectedMid + (multiplier * expectedAtr); + double expectedLo = expectedMid - (multiplier * expectedAtr); Assert.True( Math.Abs(qMid[i].Value - expectedMid) <= ValidationHelper.SkenderTolerance, diff --git a/lib/channels/bbands/tests/Bbands.Tests.cs b/lib/channels/bbands/tests/Bbands.Tests.cs index 8639fe0a..0942659f 100644 --- a/lib/channels/bbands/tests/Bbands.Tests.cs +++ b/lib/channels/bbands/tests/Bbands.Tests.cs @@ -411,7 +411,7 @@ public class BbandsTests DateTime startTime = DateTime.UtcNow; for (int i = 0; i < data.Length; i++) { - streamBbands.Update(new TValue(startTime + i * TimeSpan.FromSeconds(1), data[i]), isNew: true); + streamBbands.Update(new TValue(startTime + (i * TimeSpan.FromSeconds(1)), data[i]), isNew: true); } Assert.Equal(streamBbands.Middle.Value, primedBbands.Middle.Value, precision: 10); diff --git a/lib/channels/jbands/tests/Jbands.Quantower.Tests.cs b/lib/channels/jbands/tests/Jbands.Quantower.Tests.cs index ca447ba5..9569b626 100644 --- a/lib/channels/jbands/tests/Jbands.Quantower.Tests.cs +++ b/lib/channels/jbands/tests/Jbands.Quantower.Tests.cs @@ -22,7 +22,7 @@ public class JbandsIndicatorTests public void MinHistoryDepths_MatchesWarmupFormula() { var ind = new JbandsIndicator { Period = 14 }; - int expected = (int)Math.Ceiling(20.0 + 80.0 * Math.Pow(14, 0.36)); + int expected = (int)Math.Ceiling(20.0 + (80.0 * Math.Pow(14, 0.36))); Assert.Equal(expected, ind.MinHistoryDepths); } @@ -155,7 +155,7 @@ public class JbandsIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100 + Math.Sin(i * 0.3) * 10; + double price = 100 + (Math.Sin(i * 0.3) * 10); indZero.HistoricalData.AddBar(now.AddMinutes(i), price - 1, price + 2, price - 2, price); indPos.HistoricalData.AddBar(now.AddMinutes(i), price - 1, price + 2, price - 2, price); indZero.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); @@ -185,7 +185,7 @@ public class JbandsIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100 + Math.Sin(i * 0.3) * 10; + double price = 100 + (Math.Sin(i * 0.3) * 10); indPos.HistoricalData.AddBar(now.AddMinutes(i), price - 1, price + 2, price - 2, price); indNeg.HistoricalData.AddBar(now.AddMinutes(i), price - 1, price + 2, price - 2, price); indPos.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); diff --git a/lib/channels/jbands/tests/Jbands.Tests.cs b/lib/channels/jbands/tests/Jbands.Tests.cs index ae9f0ac3..c086ebad 100644 --- a/lib/channels/jbands/tests/Jbands.Tests.cs +++ b/lib/channels/jbands/tests/Jbands.Tests.cs @@ -617,7 +617,7 @@ public class JbandsTests for (int i = 0; i < 100; i++) { - var val = new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.5); + var val = new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.5)); src.Add(val.Time, val.Value); j.Update(val, isNew: true); } diff --git a/lib/channels/maenv/tests/Maenv.Tests.cs b/lib/channels/maenv/tests/Maenv.Tests.cs index 196b85c5..6f8ad54a 100644 --- a/lib/channels/maenv/tests/Maenv.Tests.cs +++ b/lib/channels/maenv/tests/Maenv.Tests.cs @@ -158,7 +158,7 @@ public class MaenvTests // Actual: first bar w=9, second bar: newest w=9, oldest w=6; sum=110*9+100*6=990+600=1590; norm=15 // WMA = 1590/15 = 106 m.Update(new TValue(DateTime.UtcNow, 110)); - double expected2 = (110 * 9 + 100 * 6) / 15.0; + double expected2 = ((110 * 9) + (100 * 6)) / 15.0; Assert.Equal(expected2, m.Last.Value, 1e-10); } diff --git a/lib/channels/maenv/tests/Maenv.Validation.Tests.cs b/lib/channels/maenv/tests/Maenv.Validation.Tests.cs index dd7bbd11..503481d6 100644 --- a/lib/channels/maenv/tests/Maenv.Validation.Tests.cs +++ b/lib/channels/maenv/tests/Maenv.Validation.Tests.cs @@ -120,11 +120,11 @@ public sealed class MaenvValidationTests : IDisposable Assert.Equal(100.0, ind.Last.Value, 1e-10); ind.Update(series[1]); - double expected2 = (110.0 * 9 + 100.0 * 6) / 15.0; + double expected2 = ((110.0 * 9) + (100.0 * 6)) / 15.0; Assert.Equal(expected2, ind.Last.Value, 1e-10); ind.Update(series[2]); - double expected3 = (120.0 * 9 + 110.0 * 6 + 100.0 * 3) / 18.0; + double expected3 = ((120.0 * 9) + (110.0 * 6) + (100.0 * 3)) / 18.0; Assert.Equal(expected3, ind.Last.Value, 1e-10); _output.WriteLine("Maenv WMA manual calculation validated"); diff --git a/lib/channels/regchannel/tests/Regchannel.Quantower.Tests.cs b/lib/channels/regchannel/tests/Regchannel.Quantower.Tests.cs index 8373d984..803abffb 100644 --- a/lib/channels/regchannel/tests/Regchannel.Quantower.Tests.cs +++ b/lib/channels/regchannel/tests/Regchannel.Quantower.Tests.cs @@ -129,7 +129,7 @@ public class RegchannelIndicatorTests // Add some volatility to ensure non-zero stddev for (int i = 0; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.5) * 10; + double price = 100 + (Math.Sin(i * 0.5) * 10); ind.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price, 1000); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } @@ -173,7 +173,7 @@ public class RegchannelIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double price = 100 + i * 0.5; + double price = 100 + (i * 0.5); ind1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price); ind2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price); ind1.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); @@ -266,14 +266,14 @@ public class RegchannelIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100 + i * 2; // Strong uptrend + double price = 100 + (i * 2); // Strong uptrend ind.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } // After warmup, middle should be close to the current regression line value double middle = ind.LinesSeries[0].GetValue(0); - double lastPrice = 100 + 29 * 2; // 158 + double lastPrice = 100 + (29 * 2); // 158 // Middle should be close to last price (within reasonable range for regression) Assert.True(Math.Abs(middle - lastPrice) < 10, $"Middle ({middle}) should be close to last price ({lastPrice})"); diff --git a/lib/channels/regchannel/tests/Regchannel.Tests.cs b/lib/channels/regchannel/tests/Regchannel.Tests.cs index 911c07eb..193adffd 100644 --- a/lib/channels/regchannel/tests/Regchannel.Tests.cs +++ b/lib/channels/regchannel/tests/Regchannel.Tests.cs @@ -90,7 +90,7 @@ public class RegchannelTests // Feed perfect linear data: y = 100 + 2*i (slope = 2) for (int i = 0; i < 20; i++) { - ind.Update(new TValue(now.AddMinutes(i), 100 + 2 * i)); + ind.Update(new TValue(now.AddMinutes(i), 100 + (2 * i))); } // Slope should be 2 @@ -107,13 +107,13 @@ public class RegchannelTests // Low volatility: close to linear for (int i = 0; i < 20; i++) { - ind1.Update(new TValue(now.AddMinutes(i), 100 + i + 0.1 * Math.Sin(i))); + ind1.Update(new TValue(now.AddMinutes(i), 100 + i + (0.1 * Math.Sin(i)))); } // High volatility: large deviations from linear for (int i = 0; i < 20; i++) { - ind2.Update(new TValue(now.AddMinutes(i), 100 + i + 5 * Math.Sin(i))); + ind2.Update(new TValue(now.AddMinutes(i), 100 + i + (5 * Math.Sin(i)))); } double width1 = ind1.Upper.Value - ind1.Lower.Value; @@ -130,7 +130,7 @@ public class RegchannelTests for (int i = 0; i < 20; i++) { - ind.Update(new TValue(now.AddMinutes(i), 100 + i + Math.Sin(i) * 3)); + ind.Update(new TValue(now.AddMinutes(i), 100 + i + (Math.Sin(i) * 3))); } double upperDist = ind.Upper.Value - ind.Last.Value; @@ -148,7 +148,7 @@ public class RegchannelTests for (int i = 0; i < 20; i++) { - double val = 100 + i + Math.Sin(i) * 3; + double val = 100 + i + (Math.Sin(i) * 3); ind1.Update(new TValue(now.AddMinutes(i), val)); ind2.Update(new TValue(now.AddMinutes(i), val)); } @@ -465,7 +465,7 @@ public class RegchannelTests for (int i = 0; i < 10000; i++) { - double val = 100 + Math.Sin(i * 0.01) * 10 + i * 0.001; + double val = 100 + (Math.Sin(i * 0.01) * 10) + (i * 0.001); ind.Update(new TValue(now.AddMinutes(i), val)); } diff --git a/lib/channels/regchannel/tests/Regchannel.Validation.Tests.cs b/lib/channels/regchannel/tests/Regchannel.Validation.Tests.cs index 134ee812..b0b524a3 100644 --- a/lib/channels/regchannel/tests/Regchannel.Validation.Tests.cs +++ b/lib/channels/regchannel/tests/Regchannel.Validation.Tests.cs @@ -81,7 +81,7 @@ public sealed class RegchannelValidationTests : IDisposable // Perfect linear trend: 100, 110, 120, 130, 140 for (int i = 0; i < 5; i++) { - series.Add(new TValue(t0.AddMinutes(i), 100 + i * 10)); + series.Add(new TValue(t0.AddMinutes(i), 100 + (i * 10))); } var ind = new Regchannel(5, 2.0); @@ -424,7 +424,7 @@ public sealed class RegchannelValidationTests : IDisposable var t0 = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - uptrend.Add(new TValue(t0.AddMinutes(i), 100 + i * 2 + (i % 3))); // Noisy uptrend + uptrend.Add(new TValue(t0.AddMinutes(i), 100 + (i * 2) + (i % 3))); // Noisy uptrend } var indUp = new Regchannel(10, 2.0); @@ -438,7 +438,7 @@ public sealed class RegchannelValidationTests : IDisposable var downtrend = new TSeries(); for (int i = 0; i < 20; i++) { - downtrend.Add(new TValue(t0.AddMinutes(i), 200 - i * 2 + (i % 3))); // Noisy downtrend + downtrend.Add(new TValue(t0.AddMinutes(i), 200 - (i * 2) + (i % 3))); // Noisy downtrend } var indDown = new Regchannel(10, 2.0); diff --git a/lib/channels/sdchannel/tests/Sdchannel.Quantower.Tests.cs b/lib/channels/sdchannel/tests/Sdchannel.Quantower.Tests.cs index f09cb1ac..17bf15ab 100644 --- a/lib/channels/sdchannel/tests/Sdchannel.Quantower.Tests.cs +++ b/lib/channels/sdchannel/tests/Sdchannel.Quantower.Tests.cs @@ -129,7 +129,7 @@ public class SdchannelIndicatorTests // Add some volatility to ensure non-zero stddev for (int i = 0; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.5) * 10; + double price = 100 + (Math.Sin(i * 0.5) * 10); ind.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price, 1000); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } @@ -173,7 +173,7 @@ public class SdchannelIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double price = 100 + i * 0.5; + double price = 100 + (i * 0.5); ind1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price); ind2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price); ind1.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); @@ -266,14 +266,14 @@ public class SdchannelIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100 + i * 2; // Strong uptrend + double price = 100 + (i * 2); // Strong uptrend ind.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } // After warmup, middle should be close to the current regression line value double middle = ind.LinesSeries[0].GetValue(0); - double lastPrice = 100 + 29 * 2; // 158 + double lastPrice = 100 + (29 * 2); // 158 // Middle should be close to last price (within reasonable range for regression) Assert.True(Math.Abs(middle - lastPrice) < 10, $"Middle ({middle}) should be close to last price ({lastPrice})"); diff --git a/lib/channels/sdchannel/tests/Sdchannel.Tests.cs b/lib/channels/sdchannel/tests/Sdchannel.Tests.cs index c412ef15..e0901b4d 100644 --- a/lib/channels/sdchannel/tests/Sdchannel.Tests.cs +++ b/lib/channels/sdchannel/tests/Sdchannel.Tests.cs @@ -192,7 +192,7 @@ public class SdchannelTests // Perfect linear trend: 100, 102, 104, 106, 108 for (int i = 0; i < 5; i++) { - s.Update(new TValue(DateTime.UtcNow, 100 + i * 2)); + s.Update(new TValue(DateTime.UtcNow, 100 + (i * 2))); } // All points lie exactly on regression line diff --git a/lib/channels/sdchannel/tests/Sdchannel.Validation.Tests.cs b/lib/channels/sdchannel/tests/Sdchannel.Validation.Tests.cs index 7d7e42e8..e860399b 100644 --- a/lib/channels/sdchannel/tests/Sdchannel.Validation.Tests.cs +++ b/lib/channels/sdchannel/tests/Sdchannel.Validation.Tests.cs @@ -90,7 +90,7 @@ public sealed class SdchannelValidationTests : IDisposable // Perfect linear trend: 100, 110, 120, 130, 140 for (int i = 0; i < 5; i++) { - series.Add(new TValue(t0.AddMinutes(i), 100 + i * 10)); + series.Add(new TValue(t0.AddMinutes(i), 100 + (i * 10))); } var ind = new Sdchannel(5, 2.0); @@ -433,7 +433,7 @@ public sealed class SdchannelValidationTests : IDisposable var t0 = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - uptrend.Add(new TValue(t0.AddMinutes(i), 100 + i * 2 + (i % 3))); // Noisy uptrend + uptrend.Add(new TValue(t0.AddMinutes(i), 100 + (i * 2) + (i % 3))); // Noisy uptrend } var indUp = new Sdchannel(10, 2.0); @@ -447,7 +447,7 @@ public sealed class SdchannelValidationTests : IDisposable var downtrend = new TSeries(); for (int i = 0; i < 20; i++) { - downtrend.Add(new TValue(t0.AddMinutes(i), 200 - i * 2 + (i % 3))); // Noisy downtrend + downtrend.Add(new TValue(t0.AddMinutes(i), 200 - (i * 2) + (i % 3))); // Noisy downtrend } var indDown = new Sdchannel(10, 2.0); diff --git a/lib/channels/starchannel/tests/Starchannel.Validation.Tests.cs b/lib/channels/starchannel/tests/Starchannel.Validation.Tests.cs index c523554e..22a1a8d0 100644 --- a/lib/channels/starchannel/tests/Starchannel.Validation.Tests.cs +++ b/lib/channels/starchannel/tests/Starchannel.Validation.Tests.cs @@ -396,7 +396,7 @@ public sealed class StarchannelValidationTests : IDisposable // Create predictable data: 100, 102, 104, 106, 108 for (int i = 0; i < 5; i++) { - double close = 100 + i * 2; + double close = 100 + (i * 2); series.Add(new TBar(t0.AddMinutes(i), close, close + 5, close - 5, close, 100)); } diff --git a/lib/channels/stbands/tests/Stbands.Tests.cs b/lib/channels/stbands/tests/Stbands.Tests.cs index c1b661e2..9cf59f36 100644 --- a/lib/channels/stbands/tests/Stbands.Tests.cs +++ b/lib/channels/stbands/tests/Stbands.Tests.cs @@ -403,7 +403,7 @@ public class StbandsTests var series = new TSeries(); for (int i = 0; i < 20; i++) { - series.Add(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.5); + series.Add(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.5)); } TSeries result = stbands.Update(series); diff --git a/lib/channels/ttm_lrc/tests/TtmLrc.Quantower.Tests.cs b/lib/channels/ttm_lrc/tests/TtmLrc.Quantower.Tests.cs index 654c2123..51309418 100644 --- a/lib/channels/ttm_lrc/tests/TtmLrc.Quantower.Tests.cs +++ b/lib/channels/ttm_lrc/tests/TtmLrc.Quantower.Tests.cs @@ -132,7 +132,7 @@ public class TtmLrcIndicatorTests // Add some volatility to ensure non-zero stddev for (int i = 0; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.5) * 10; + double price = 100 + (Math.Sin(i * 0.5) * 10); ind.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price, 1000); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } @@ -214,7 +214,7 @@ public class TtmLrcIndicatorTests // Perfect linear data: y = 100 + 2*i for (int i = 0; i < 20; i++) { - double price = 100 + i * 2; + double price = 100 + (i * 2); ind.HistoricalData.AddBar(now.AddMinutes(i), price, price, price, price); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } @@ -264,14 +264,14 @@ public class TtmLrcIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100 + i * 2; // Strong uptrend + double price = 100 + (i * 2); // Strong uptrend ind.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); ind.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } // After warmup, midline should be close to the current regression line value double midline = ind.LinesSeries[0].GetValue(0); - double lastPrice = 100 + 29 * 2; // 158 + double lastPrice = 100 + (29 * 2); // 158 // Midline should be close to last price (within reasonable range for regression) Assert.True(Math.Abs(midline - lastPrice) < 10, $"Midline ({midline}) should be close to last price ({lastPrice})"); diff --git a/lib/channels/ttm_lrc/tests/TtmLrc.Tests.cs b/lib/channels/ttm_lrc/tests/TtmLrc.Tests.cs index ce82bf30..7e023da5 100644 --- a/lib/channels/ttm_lrc/tests/TtmLrc.Tests.cs +++ b/lib/channels/ttm_lrc/tests/TtmLrc.Tests.cs @@ -166,7 +166,7 @@ public class TtmLrcTests // Perfect linear data: y = 100 + 2*x for (int i = 0; i < 15; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 + 2.0 * i), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 + (2.0 * i)), isNew: true); } Assert.True(indicator.IsHot); @@ -189,7 +189,7 @@ public class TtmLrcTests for (int i = 0; i < 15; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 + 5.0 * i), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 + (5.0 * i)), isNew: true); } Assert.True(indicator.Slope > 0, $"Slope should be positive for uptrend, got {indicator.Slope}"); @@ -203,7 +203,7 @@ public class TtmLrcTests for (int i = 0; i < 15; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 - 3.0 * i), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 - (3.0 * i)), isNew: true); } Assert.True(indicator.Slope < 0, $"Slope should be negative for downtrend, got {indicator.Slope}"); @@ -236,7 +236,7 @@ public class TtmLrcTests for (int i = 0; i < 15; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 + 2.0 * i), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 + (2.0 * i)), isNew: true); } Assert.True(Math.Abs(indicator.RSquared - 1.0) < 1e-9, $"R² should be 1.0 for perfect linear fit, got {indicator.RSquared}"); @@ -313,7 +313,7 @@ public class TtmLrcTests for (int i = 0; i < 8; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 + i * 2), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 + (i * 2)), isNew: true); } double baseMid = indicator.Midline.Value; @@ -321,11 +321,11 @@ public class TtmLrcTests // Multiple corrections for (int j = 0; j < 5; j++) { - indicator.Update(new TValue(now.AddMinutes(7), 150 + j * 10), isNew: false); + indicator.Update(new TValue(now.AddMinutes(7), 150 + (j * 10)), isNew: false); } // Revert to original - indicator.Update(new TValue(now.AddMinutes(7), 100 + 7 * 2), isNew: false); + indicator.Update(new TValue(now.AddMinutes(7), 100 + (7 * 2)), isNew: false); Assert.Equal(baseMid, indicator.Midline.Value, 10); } @@ -492,7 +492,7 @@ public class TtmLrcTests for (int i = 0; i < 10; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 + i * 2), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 + (i * 2)), isNew: true); } Assert.True(indicator.IsHot); @@ -546,7 +546,7 @@ public class TtmLrcTests for (int i = 0; i < 15; i++) { times.Add(now.AddMinutes(i).Ticks); - values.Add(100 + i * 2); + values.Add(100 + (i * 2)); } var source = new TSeries(times, values); @@ -565,7 +565,7 @@ public class TtmLrcTests for (int i = 0; i < 8; i++) { - source.Add(new TValue(now.AddMinutes(i), 100 + i * 3), isNew: true); + source.Add(new TValue(now.AddMinutes(i), 100 + (i * 3)), isNew: true); } Assert.True(indicator.IsHot); @@ -720,7 +720,7 @@ public class TtmLrcTests for (int i = 0; i < 8; i++) { - indicator.Update(new TValue(now.AddMinutes(i), 100 + i * 2), isNew: true); + indicator.Update(new TValue(now.AddMinutes(i), 100 + (i * 2)), isNew: true); } Assert.NotNull(lastPubValue); diff --git a/lib/channels/ttm_lrc/tests/TtmLrc.Validation.Tests.cs b/lib/channels/ttm_lrc/tests/TtmLrc.Validation.Tests.cs index 552ffdc6..952d3d06 100644 --- a/lib/channels/ttm_lrc/tests/TtmLrc.Validation.Tests.cs +++ b/lib/channels/ttm_lrc/tests/TtmLrc.Validation.Tests.cs @@ -74,8 +74,8 @@ public sealed class TtmLrcValidationTests : IDisposable Assert.Equal(115.0 - expectedStdDev, ind.Lower1.Value, 1e-10); // Verify ±2σ bands - Assert.Equal(115.0 + 2.0 * expectedStdDev, ind.Upper2.Value, 1e-10); - Assert.Equal(115.0 - 2.0 * expectedStdDev, ind.Lower2.Value, 1e-10); + Assert.Equal(115.0 + (2.0 * expectedStdDev), ind.Upper2.Value, 1e-10); + Assert.Equal(115.0 - (2.0 * expectedStdDev), ind.Lower2.Value, 1e-10); _output.WriteLine("TtmLrc manual calculation validated"); } @@ -89,7 +89,7 @@ public sealed class TtmLrcValidationTests : IDisposable // Perfect linear trend: 100, 110, 120, 130, 140 for (int i = 0; i < 5; i++) { - series.Add(new TValue(t0.AddMinutes(i), 100 + i * 10)); + series.Add(new TValue(t0.AddMinutes(i), 100 + (i * 10))); } var ind = new TtmLrc(5); @@ -362,7 +362,7 @@ public sealed class TtmLrcValidationTests : IDisposable // Feed perfect linear data for (int i = 0; i < 10; i++) { - ind.Update(new TValue(t0.AddMinutes(i), 100 + i * 5)); + ind.Update(new TValue(t0.AddMinutes(i), 100 + (i * 5))); } Assert.Equal(1.0, ind.RSquared, 1e-9); @@ -481,7 +481,7 @@ public sealed class TtmLrcValidationTests : IDisposable var t0 = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - uptrend.Add(new TValue(t0.AddMinutes(i), 100 + i * 2 + (i % 3))); // Noisy uptrend + uptrend.Add(new TValue(t0.AddMinutes(i), 100 + (i * 2) + (i % 3))); // Noisy uptrend } var indUp = new TtmLrc(10); @@ -495,7 +495,7 @@ public sealed class TtmLrcValidationTests : IDisposable var downtrend = new TSeries(); for (int i = 0; i < 20; i++) { - downtrend.Add(new TValue(t0.AddMinutes(i), 200 - i * 2 + (i % 3))); // Noisy downtrend + downtrend.Add(new TValue(t0.AddMinutes(i), 200 - (i * 2) + (i % 3))); // Noisy downtrend } var indDown = new TtmLrc(10); diff --git a/lib/channels/ubands/tests/Ubands.Validation.Tests.cs b/lib/channels/ubands/tests/Ubands.Validation.Tests.cs index 7b2bd7a3..2baf6477 100644 --- a/lib/channels/ubands/tests/Ubands.Validation.Tests.cs +++ b/lib/channels/ubands/tests/Ubands.Validation.Tests.cs @@ -409,7 +409,7 @@ public sealed class UbandsValidationTests : IDisposable _output.WriteLine($"Source variance: {sourceVar:F4}"); _output.WriteLine($"Middle (USF) variance: {middleVar:F4}"); - _output.WriteLine($"Noise reduction: {(1 - middleVar / sourceVar) * 100:F1}%"); + _output.WriteLine($"Noise reduction: {(1 - (middleVar / sourceVar)) * 100:F1}%"); Assert.True(middleVar < sourceVar, "Smoothed signal should have lower variance"); } diff --git a/lib/channels/uchannel/tests/Uchannel.Quantower.Tests.cs b/lib/channels/uchannel/tests/Uchannel.Quantower.Tests.cs index 19ccfd52..95cf802f 100644 --- a/lib/channels/uchannel/tests/Uchannel.Quantower.Tests.cs +++ b/lib/channels/uchannel/tests/Uchannel.Quantower.Tests.cs @@ -358,7 +358,7 @@ public class UchannelQuantowerTests double width2 = indicator2.LinesSeries[4].GetValue(0); // Width2 should be approximately 2x Width1 - Assert.True(Math.Abs(width2 - 2 * width1) < 0.0001, + Assert.True(Math.Abs(width2 - (2 * width1)) < 0.0001, $"Width2 ({width2}) should be ~2x Width1 ({width1})"); } @@ -377,7 +377,7 @@ public class UchannelQuantowerTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double close = 100 + (i % 5) * 2; + double close = 100 + ((i % 5) * 2); indicator1.HistoricalData.AddBar(now.AddMinutes(i), close, close + 3, close - 3, close, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); indicator2.HistoricalData.AddBar(now.AddMinutes(i), close, close + 3, close - 3, close, 1000); diff --git a/lib/channels/vwapbands/tests/Vwapbands.Quantower.Tests.cs b/lib/channels/vwapbands/tests/Vwapbands.Quantower.Tests.cs index badc9fdd..dc1c4f8f 100644 --- a/lib/channels/vwapbands/tests/Vwapbands.Quantower.Tests.cs +++ b/lib/channels/vwapbands/tests/Vwapbands.Quantower.Tests.cs @@ -148,7 +148,7 @@ public class VwapbandsIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 5; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 105 + i, 95 + i, 102 + i, 1000 + i * 100); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 105 + i, 95 + i, 102 + i, 1000 + (i * 100)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/channels/vwapbands/tests/Vwapbands.Tests.cs b/lib/channels/vwapbands/tests/Vwapbands.Tests.cs index 13dde4ad..c061d374 100644 --- a/lib/channels/vwapbands/tests/Vwapbands.Tests.cs +++ b/lib/channels/vwapbands/tests/Vwapbands.Tests.cs @@ -120,7 +120,7 @@ public class VwapbandsTests // Make multiple corrections for (int i = 0; i < 10; i++) { - var correctionBar = new TBar(DateTime.UtcNow, 150 + i, 160 + i, 140 + i, 155 + i, 2000 + i * 100); + var correctionBar = new TBar(DateTime.UtcNow, 150 + i, 160 + i, 140 + i, 155 + i, 2000 + (i * 100)); vwapbands.Update(correctionBar, isNew: false); } @@ -359,7 +359,7 @@ public class VwapbandsTests vwapbands.Update(bar2); // VWAP = (100*1000 + 110*2000) / (1000+2000) = 320000/3000 = 106.666... - double expectedVwap = (100.0 * 1000 + 110.0 * 2000) / (1000 + 2000); + double expectedVwap = ((100.0 * 1000) + (110.0 * 2000)) / (1000 + 2000); Assert.Equal(expectedVwap, vwapbands.Vwap.Value, precision: 10); } @@ -600,7 +600,7 @@ public class VwapbandsTests // VWAP should be closer to 100 due to higher volume // VWAP = (100*10000 + 200*100) / (10000+100) = 1020000/10100 ≈ 100.99 - double expectedVwap = (100.0 * 10000 + 200.0 * 100) / (10000 + 100); + double expectedVwap = ((100.0 * 10000) + (200.0 * 100)) / (10000 + 100); Assert.Equal(expectedVwap, vwapbands.Vwap.Value, precision: 10); Assert.True(vwapbands.Vwap.Value < 110, "VWAP should be heavily weighted toward 100"); } diff --git a/lib/channels/vwapbands/tests/Vwapbands.Validation.Tests.cs b/lib/channels/vwapbands/tests/Vwapbands.Validation.Tests.cs index 69e2cb3e..93c19cf0 100644 --- a/lib/channels/vwapbands/tests/Vwapbands.Validation.Tests.cs +++ b/lib/channels/vwapbands/tests/Vwapbands.Validation.Tests.cs @@ -273,7 +273,7 @@ public sealed class VwapbandsValidationTests : IDisposable // VWAP should be closer to 100 (high volume price) // VWAP = (100 × 10000 + 200 × 100) / (10000 + 100) = 1020000 / 10100 ≈ 100.99 - double expectedVwap = (100.0 * 10000 + 200.0 * 100) / (10000 + 100); + double expectedVwap = ((100.0 * 10000) + (200.0 * 100)) / (10000 + 100); Assert.Equal(expectedVwap, vwapbands.Vwap.Value, precision: 10); Assert.True(vwapbands.Vwap.Value < 110, "VWAP should be heavily weighted toward 100"); @@ -434,7 +434,7 @@ public sealed class VwapbandsValidationTests : IDisposable // Multiple zero-volume bars with different prices for (int i = 0; i < 5; i++) { - var zeroVolBar = new TBar(DateTime.UtcNow.AddMinutes(i + 1), 200 + i * 10, 200 + i * 10, 200 + i * 10, 200 + i * 10, 0); + var zeroVolBar = new TBar(DateTime.UtcNow.AddMinutes(i + 1), 200 + (i * 10), 200 + (i * 10), 200 + (i * 10), 200 + (i * 10), 0); vwapbands.Update(zeroVolBar); } diff --git a/lib/channels/vwapsd/tests/Vwapsd.Quantower.Tests.cs b/lib/channels/vwapsd/tests/Vwapsd.Quantower.Tests.cs index 170ac42e..a0c16edd 100644 --- a/lib/channels/vwapsd/tests/Vwapsd.Quantower.Tests.cs +++ b/lib/channels/vwapsd/tests/Vwapsd.Quantower.Tests.cs @@ -242,7 +242,7 @@ public class VwapsdIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 5; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 105 + i, 95 + i, 102 + i, 1000 + i * 100); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 105 + i, 95 + i, 102 + i, 1000 + (i * 100)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -344,7 +344,7 @@ public class VwapsdIndicatorTests double width2 = indicator2.LinesSeries[3].GetValue(0); // Width2 should be approximately 2x Width1 - Assert.True(Math.Abs(width2 - 2 * width1) < 0.0001, + Assert.True(Math.Abs(width2 - (2 * width1)) < 0.0001, $"Width2 ({width2}) should be ~2x Width1 ({width1})"); } diff --git a/lib/channels/vwapsd/tests/Vwapsd.Tests.cs b/lib/channels/vwapsd/tests/Vwapsd.Tests.cs index d6710686..18b21712 100644 --- a/lib/channels/vwapsd/tests/Vwapsd.Tests.cs +++ b/lib/channels/vwapsd/tests/Vwapsd.Tests.cs @@ -136,7 +136,7 @@ public class VwapsdTests // Make multiple corrections for (int i = 0; i < 10; i++) { - var correctionBar = new TBar(DateTime.UtcNow, 150 + i, 160 + i, 140 + i, 155 + i, 2000 + i * 100); + var correctionBar = new TBar(DateTime.UtcNow, 150 + i, 160 + i, 140 + i, 155 + i, 2000 + (i * 100)); vwapsd.Update(correctionBar, isNew: false); } @@ -371,7 +371,7 @@ public class VwapsdTests vwapsd.Update(bar2); // VWAP = (100*1000 + 110*2000) / (1000+2000) = 320000/3000 = 106.666... - double expectedVwap = (100.0 * 1000 + 110.0 * 2000) / (1000 + 2000); + double expectedVwap = ((100.0 * 1000) + (110.0 * 2000)) / (1000 + 2000); Assert.Equal(expectedVwap, vwapsd.Vwap.Value, precision: 10); } @@ -634,7 +634,7 @@ public class VwapsdTests // VWAP should be closer to 100 due to higher volume // VWAP = (100*10000 + 200*100) / (10000+100) = 1020000/10100 ≈ 100.99 - double expectedVwap = (100.0 * 10000 + 200.0 * 100) / (10000 + 100); + double expectedVwap = ((100.0 * 10000) + (200.0 * 100)) / (10000 + 100); Assert.Equal(expectedVwap, vwapsd.Vwap.Value, precision: 10); Assert.True(vwapsd.Vwap.Value < 110, "VWAP should be heavily weighted toward 100"); } diff --git a/lib/channels/vwapsd/tests/Vwapsd.Validation.Tests.cs b/lib/channels/vwapsd/tests/Vwapsd.Validation.Tests.cs index ca8cc8d3..0b39fd6c 100644 --- a/lib/channels/vwapsd/tests/Vwapsd.Validation.Tests.cs +++ b/lib/channels/vwapsd/tests/Vwapsd.Validation.Tests.cs @@ -305,7 +305,7 @@ public sealed class VwapsdValidationTests : IDisposable // VWAP should be closer to 100 (high volume price) // VWAP = (100 × 10000 + 200 × 100) / (10000 + 100) = 1020000 / 10100 ≈ 100.99 - double expectedVwap = (100.0 * 10000 + 200.0 * 100) / (10000 + 100); + double expectedVwap = ((100.0 * 10000) + (200.0 * 100)) / (10000 + 100); Assert.Equal(expectedVwap, vwapsd.Vwap.Value, precision: 10); Assert.True(vwapsd.Vwap.Value < 110, "VWAP should be heavily weighted toward 100"); @@ -466,7 +466,7 @@ public sealed class VwapsdValidationTests : IDisposable // Multiple zero-volume bars with different prices for (int i = 0; i < 5; i++) { - var zeroVolBar = new TBar(DateTime.UtcNow.AddMinutes(i + 1), 200 + i * 10, 200 + i * 10, 200 + i * 10, 200 + i * 10, 0); + var zeroVolBar = new TBar(DateTime.UtcNow.AddMinutes(i + 1), 200 + (i * 10), 200 + (i * 10), 200 + (i * 10), 200 + (i * 10), 0); vwapsd.Update(zeroVolBar); } diff --git a/lib/core/midpoint/tests/Midpoint.Quantower.Tests.cs b/lib/core/midpoint/tests/Midpoint.Quantower.Tests.cs index c6ba5894..0a9a2120 100644 --- a/lib/core/midpoint/tests/Midpoint.Quantower.Tests.cs +++ b/lib/core/midpoint/tests/Midpoint.Quantower.Tests.cs @@ -100,10 +100,10 @@ public class MidpointIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/core/tbarseries/tests/TBarSeries.Tests.cs b/lib/core/tbarseries/tests/TBarSeries.Tests.cs index 20d29350..7d06b573 100644 --- a/lib/core/tbarseries/tests/TBarSeries.Tests.cs +++ b/lib/core/tbarseries/tests/TBarSeries.Tests.cs @@ -1223,9 +1223,9 @@ public class TBarSeriesTests { times[i] = i; opens[i] = i * 10.0; - highs[i] = i * 10.0 + 5.0; - lows[i] = i * 10.0 - 5.0; - closes[i] = i * 10.0 + 2.0; + highs[i] = (i * 10.0) + 5.0; + lows[i] = (i * 10.0) - 5.0; + closes[i] = (i * 10.0) + 2.0; volumes[i] = i * 100.0; } @@ -1233,7 +1233,7 @@ public class TBarSeriesTests Assert.Equal(N, series.Count); Assert.Equal(0, series[0].Time); - Assert.Equal((N - 1) * 10.0 + 2.0, series[N - 1].Close); + Assert.Equal(((N - 1) * 10.0) + 2.0, series[N - 1].Close); Assert.Equal((N - 1) * 100.0, series[N - 1].Volume); } @@ -1246,7 +1246,7 @@ public class TBarSeriesTests for (int i = 0; i < N; i++) { - bars[i] = new TBar(i, i * 10.0, i * 10.0 + 5.0, i * 10.0 - 5.0, i * 10.0 + 2.0, i * 100.0); + bars[i] = new TBar(i, i * 10.0, (i * 10.0) + 5.0, (i * 10.0) - 5.0, (i * 10.0) + 2.0, i * 100.0); } series.AddRange(bars); @@ -1254,6 +1254,6 @@ public class TBarSeriesTests Assert.Equal(N, series.Count); Assert.Equal(0, series[0].Time); Assert.Equal(2.0, series[0].Close); - Assert.Equal((N - 1) * 10.0 + 2.0, series[N - 1].Close); + Assert.Equal(((N - 1) * 10.0) + 2.0, series[N - 1].Close); } } diff --git a/lib/core/tests/BiInputIndicatorBase.Tests.cs b/lib/core/tests/BiInputIndicatorBase.Tests.cs index 8ec250b0..6033e7cb 100644 --- a/lib/core/tests/BiInputIndicatorBase.Tests.cs +++ b/lib/core/tests/BiInputIndicatorBase.Tests.cs @@ -82,7 +82,7 @@ public class BiInputIndicatorBaseTests var indicator = new Mae(5); for (int i = 0; i < 4; i++) { - indicator.Update(i * 10.0, i * 10.0 + 5.0); + indicator.Update(i * 10.0, (i * 10.0) + 5.0); Assert.False(indicator.IsHot); } } @@ -93,7 +93,7 @@ public class BiInputIndicatorBaseTests var indicator = new Mae(5); for (int i = 0; i < 5; i++) { - indicator.Update(i * 10.0, i * 10.0 + 5.0); + indicator.Update(i * 10.0, (i * 10.0) + 5.0); } Assert.True(indicator.IsHot); } @@ -104,7 +104,7 @@ public class BiInputIndicatorBaseTests var indicator = new Mae(3); for (int i = 0; i < 20; i++) { - indicator.Update(i * 10.0, i * 10.0 + 5.0); + indicator.Update(i * 10.0, (i * 10.0) + 5.0); } Assert.True(indicator.IsHot); } @@ -268,7 +268,7 @@ public class BiInputIndicatorBaseTests for (int i = 0; i < 10; i++) { - indicator.Update(i * 10.0, i * 10.0 + 5.0); + indicator.Update(i * 10.0, (i * 10.0) + 5.0); } double original = indicator.Last.Value; @@ -360,7 +360,7 @@ public class BiInputIndicatorBaseTests var indicator = new Mae(3); for (int i = 0; i < 5; i++) { - indicator.Update(i * 10.0, i * 10.0 + 5.0); + indicator.Update(i * 10.0, (i * 10.0) + 5.0); } Assert.True(indicator.IsHot); @@ -563,7 +563,7 @@ public class BiInputIndicatorBaseTests for (int i = 0; i < 20; i++) { actual.Add(now.AddMinutes(i), i * 10.0); - predicted.Add(now.AddMinutes(i), i * 10.0 + 5.0); + predicted.Add(now.AddMinutes(i), (i * 10.0) + 5.0); } var result = Mae.Batch(actual, predicted, 5); @@ -603,7 +603,7 @@ public class BiInputIndicatorBaseTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10.0); - predicted.Add(now.AddMinutes(i), i * 10.0 + 3.0); + predicted.Add(now.AddMinutes(i), (i * 10.0) + 3.0); } var (results, indicator) = Mae.Calculate(actual, predicted, 5); @@ -647,7 +647,7 @@ public class BiInputIndicatorBaseTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.03 + 1.0; + predicted[i] = (bar.Close * 1.03) + 1.0; } // Streaming diff --git a/lib/core/tseries/tests/TSeries.Tests.cs b/lib/core/tseries/tests/TSeries.Tests.cs index 3fbbd7b0..1b2030d3 100644 --- a/lib/core/tseries/tests/TSeries.Tests.cs +++ b/lib/core/tseries/tests/TSeries.Tests.cs @@ -536,7 +536,6 @@ public class TSeriesTests Assert.Equal(3.0, series[2].Value); } - [Fact] public void GetEnumerator_ExplicitGenericInterface_Works() { diff --git a/lib/core/wclprice/tests/Wclprice.Validation.Tests.cs b/lib/core/wclprice/tests/Wclprice.Validation.Tests.cs index 9dbb4c62..7918e2fc 100644 --- a/lib/core/wclprice/tests/Wclprice.Validation.Tests.cs +++ b/lib/core/wclprice/tests/Wclprice.Validation.Tests.cs @@ -100,7 +100,7 @@ public sealed class WclpriceValidationTests : IDisposable var bar = new TBar(DateTime.UtcNow, open: 10.0, high: 20.0, low: 8.0, close: 16.0, volume: 1000); var ind = new Wclprice(); var result = ind.Update(bar, isNew: true); - double expected = (20.0 + 8.0 + 2.0 * 16.0) / 4.0; // = 15.0 + double expected = (20.0 + 8.0 + (2.0 * 16.0)) / 4.0; // = 15.0 Assert.Equal(expected, result.Value, 1e-12); _output.WriteLine($"WCLPRICE formula: expected={expected}, actual={result.Value}: PASSED"); } diff --git a/lib/cycles/ccor/tests/Ccor.Quantower.Tests.cs b/lib/cycles/ccor/tests/Ccor.Quantower.Tests.cs index eb5310a2..c825e812 100644 --- a/lib/cycles/ccor/tests/Ccor.Quantower.Tests.cs +++ b/lib/cycles/ccor/tests/Ccor.Quantower.Tests.cs @@ -122,7 +122,7 @@ public class CcorIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100 + 5 * Math.Sin(2 * Math.PI * i / 20.0); + double price = 100 + (5 * Math.Sin(2 * Math.PI * i / 20.0)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price + 1); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/cycles/ccor/tests/Ccor.Tests.cs b/lib/cycles/ccor/tests/Ccor.Tests.cs index aa04b616..c8c1f9e5 100644 --- a/lib/cycles/ccor/tests/Ccor.Tests.cs +++ b/lib/cycles/ccor/tests/Ccor.Tests.cs @@ -488,7 +488,7 @@ public class CcorTests // Feed a perfect sine wave of the same period for (int i = 0; i < 100; i++) { - double val = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / period); + double val = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / period)); _ = ind.Update(new TValue(DateTime.UtcNow.AddMinutes(i), val)); } diff --git a/lib/cycles/ccyc/tests/Ccyc.Quantower.Tests.cs b/lib/cycles/ccyc/tests/Ccyc.Quantower.Tests.cs index cbf12c82..477ca4e3 100644 --- a/lib/cycles/ccyc/tests/Ccyc.Quantower.Tests.cs +++ b/lib/cycles/ccyc/tests/Ccyc.Quantower.Tests.cs @@ -116,7 +116,7 @@ public class CcycIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double price = 100 + 5 * Math.Sin(2 * Math.PI * i / 20.0); + double price = 100 + (5 * Math.Sin(2 * Math.PI * i / 20.0)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price + 1); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/cycles/ccyc/tests/Ccyc.Tests.cs b/lib/cycles/ccyc/tests/Ccyc.Tests.cs index e4faf26d..a9bbb4da 100644 --- a/lib/cycles/ccyc/tests/Ccyc.Tests.cs +++ b/lib/cycles/ccyc/tests/Ccyc.Tests.cs @@ -425,7 +425,7 @@ public class CcycTests for (int i = 0; i < 200; i++) { - double value = 100 + 10 * Math.Sin(2 * Math.PI * i / period); + double value = 100 + (10 * Math.Sin(2 * Math.PI * i / period)); ccyc.Update(new TValue(DateTime.UtcNow.AddDays(i), value), true); } @@ -459,7 +459,7 @@ public class CcycTests double[] primeData = new double[50]; for (int i = 0; i < 50; i++) { - primeData[i] = 100 + 5 * Math.Sin(2 * Math.PI * i / 20.0); + primeData[i] = 100 + (5 * Math.Sin(2 * Math.PI * i / 20.0)); } ccyc.Prime(primeData.AsSpan()); diff --git a/lib/cycles/ccyc/tests/Ccyc.Validation.Tests.cs b/lib/cycles/ccyc/tests/Ccyc.Validation.Tests.cs index 481ea41b..32327e8f 100644 --- a/lib/cycles/ccyc/tests/Ccyc.Validation.Tests.cs +++ b/lib/cycles/ccyc/tests/Ccyc.Validation.Tests.cs @@ -41,7 +41,7 @@ public class CcycValidationTests for (int i = 0; i < 500; i++) { - ccyc.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + 0.5 * i), true); + ccyc.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (0.5 * i)), true); } // After warmup, should be near zero since linear trend has no cycle component @@ -58,7 +58,7 @@ public class CcycValidationTests for (int i = 0; i < 200; i++) { - double value = 100 + 10 * Math.Sin(2 * Math.PI * i / period); + double value = 100 + (10 * Math.Sin(2 * Math.PI * i / period)); ccyc.Update(new TValue(DateTime.UtcNow.AddMinutes(i), value), true); } @@ -80,7 +80,7 @@ public class CcycValidationTests for (int i = 0; i < 300; i++) { - double value = 100 + 10 * Math.Sin(2 * Math.PI * i / period); + double value = 100 + (10 * Math.Sin(2 * Math.PI * i / period)); var r = ccyc.Update(new TValue(DateTime.UtcNow.AddMinutes(i), value), true); if (i > 20 && prev * r.Value < 0 && prev != 0) @@ -169,7 +169,7 @@ public class CcycValidationTests double noiseVal = rng.Next().Close; ccycNoise.Update(new TValue(DateTime.UtcNow.AddMinutes(i), noiseVal), true); - double sineVal = 100 + 10 * Math.Sin(2 * Math.PI * i / 20.0); + double sineVal = 100 + (10 * Math.Sin(2 * Math.PI * i / 20.0)); var sineResult = ccycSine.Update(new TValue(DateTime.UtcNow.AddMinutes(i), sineVal), true); if (i > 30) @@ -216,7 +216,7 @@ public class CcycValidationTests for (int i = 0; i < 300; i++) { - double value = 100 + 10 * Math.Sin(2 * Math.PI * i / 20.0); + double value = 100 + (10 * Math.Sin(2 * Math.PI * i / 20.0)); ccyc.Update(new TValue(DateTime.UtcNow.AddMinutes(i), value), true); if (i > 20) @@ -340,7 +340,7 @@ public class CcycValidationTests for (int i = 0; i < 20; i++) { - double value = 100 + 5 * Math.Sin(2 * Math.PI * i / 20.0); + double value = 100 + (5 * Math.Sin(2 * Math.PI * i / 20.0)); var r = ccyc.Update(new TValue(DateTime.UtcNow.AddMinutes(i), value), true); results.Add(r.Value); } diff --git a/lib/cycles/cg/tests/Cg.Quantower.Tests.cs b/lib/cycles/cg/tests/Cg.Quantower.Tests.cs index b99b0a49..ed2d136e 100644 --- a/lib/cycles/cg/tests/Cg.Quantower.Tests.cs +++ b/lib/cycles/cg/tests/Cg.Quantower.Tests.cs @@ -262,7 +262,7 @@ public class CgIndicatorTests var now = DateTime.UtcNow; double[] closes = { 100, 102, 98, 105, 97, 110, 95, 108, 92, 115, 90, 120 }; - double maxExpectedBound = (10 - 1) / 2.0 + 1.0; // Period-based bound with margin + double maxExpectedBound = ((10 - 1) / 2.0) + 1.0; // Period-based bound with margin foreach (var close in closes) { diff --git a/lib/cycles/cg/tests/Cg.Tests.cs b/lib/cycles/cg/tests/Cg.Tests.cs index 5b5d036e..8af85d82 100644 --- a/lib/cycles/cg/tests/Cg.Tests.cs +++ b/lib/cycles/cg/tests/Cg.Tests.cs @@ -79,7 +79,7 @@ public class CgTests var cg = new Cg(5); for (int i = 0; i < 10; i++) { - cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + i * 10)); + cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + (i * 10))); } Assert.True(cg.Last.Value > 0, $"Expected positive CG, got {cg.Last.Value}"); } @@ -91,7 +91,7 @@ public class CgTests var cg = new Cg(5); for (int i = 0; i < 10; i++) { - cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 200 - i * 10)); + cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 200 - (i * 10))); } Assert.True(cg.Last.Value < 0, $"Expected negative CG, got {cg.Last.Value}"); } @@ -328,7 +328,7 @@ public class CgTests // Generate and store values for (int i = 0; i < 20; i++) { - inputs.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + i * 0.5)); + inputs.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + (i * 0.5))); } // First pass diff --git a/lib/cycles/cg/tests/Cg.Validation.Tests.cs b/lib/cycles/cg/tests/Cg.Validation.Tests.cs index 0eb4b70e..48fe79be 100644 --- a/lib/cycles/cg/tests/Cg.Validation.Tests.cs +++ b/lib/cycles/cg/tests/Cg.Validation.Tests.cs @@ -28,7 +28,7 @@ public class CgValidationTests var gbm = new GBM(seed: 42); var bars = gbm.Fetch(500, DateTime.UtcNow.Ticks, TimeSpan.FromMinutes(1)); - double maxAbsValue = (period - 1) / 2.0 + 0.5; // Allow small margin + double maxAbsValue = ((period - 1) / 2.0) + 0.5; // Allow small margin foreach (var bar in bars) { @@ -65,7 +65,7 @@ public class CgValidationTests for (int i = 0; i < 50; i++) { - double price = 100.0 + i * 1.0; // Linear uptrend + double price = 100.0 + (i * 1.0); // Linear uptrend cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -82,7 +82,7 @@ public class CgValidationTests for (int i = 0; i < 50; i++) { - double price = 200.0 - i * 1.0; // Linear downtrend + double price = 200.0 - (i * 1.0); // Linear downtrend cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -100,7 +100,7 @@ public class CgValidationTests for (int i = 0; i < 50; i++) { double expPrice = 100.0 * Math.Exp(i * 0.02); - double linPrice = 100.0 + i * 2.0; + double linPrice = 100.0 + (i * 2.0); cgExp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), expPrice)); cgLin.Update(new TValue(DateTime.UtcNow.AddSeconds(i), linPrice)); } @@ -120,7 +120,7 @@ public class CgValidationTests // Generate sine wave to simulate price oscillation for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.2); + double price = 100.0 + (10.0 * Math.Sin(i * 0.2)); cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); if (cg.IsHot) { @@ -162,9 +162,9 @@ public class CgValidationTests // num = 1*10 + 2*12 + 3*11 + 4*13 + 5*15 = 10 + 24 + 33 + 52 + 75 = 194 // den = 10 + 12 + 11 + 13 + 15 = 61 // result = 194/61 - (5+1)/2 = 3.1803... - 3 = 0.1803... - double expectedNum = 1 * 10 + 2 * 12 + 3 * 11 + 4 * 13 + 5 * 15; + double expectedNum = (1 * 10) + (2 * 12) + (3 * 11) + (4 * 13) + (5 * 15); double expectedDen = 10 + 12 + 11 + 13 + 15; - double expectedCg = (expectedNum / expectedDen) - (period + 1) / 2.0; + double expectedCg = (expectedNum / expectedDen) - ((period + 1) / 2.0); var cg = new Cg(period); for (int i = 0; i < prices.Length; i++) @@ -287,7 +287,7 @@ public class CgValidationTests Assert.True(double.IsFinite(cg.Last.Value)); // CG bounds check - double maxAbsValue = (period - 1) / 2.0 + 1.0; + double maxAbsValue = ((period - 1) / 2.0) + 1.0; Assert.True(Math.Abs(cg.Last.Value) <= maxAbsValue, $"CG with period {period} should be within ±{maxAbsValue}, got {cg.Last.Value}"); } @@ -337,7 +337,7 @@ public class CgValidationTests // Uptrend for (int i = 0; i < 30; i++) { - double price = 100.0 + i * 0.5; + double price = 100.0 + (i * 0.5); cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); prices.Add(price); if (cg.IsHot) @@ -349,7 +349,7 @@ public class CgValidationTests // Plateau/slight decline for (int i = 30; i < 50; i++) { - double price = 115.0 - (i - 30) * 0.2; + double price = 115.0 - ((i - 30) * 0.2); cg.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); prices.Add(price); cgValues.Add(cg.Last.Value); diff --git a/lib/cycles/dsp/tests/Dsp.Quantower.Tests.cs b/lib/cycles/dsp/tests/Dsp.Quantower.Tests.cs index 24b2f3d4..f684cdc2 100644 --- a/lib/cycles/dsp/tests/Dsp.Quantower.Tests.cs +++ b/lib/cycles/dsp/tests/Dsp.Quantower.Tests.cs @@ -326,7 +326,7 @@ public class DspIndicatorTests // Generate sine wave price pattern for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.1); + double price = 100.0 + (10.0 * Math.Sin(i * 0.1)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); values.Add(indicator.LinesSeries[0].GetValue(0)); diff --git a/lib/cycles/dsp/tests/Dsp.Tests.cs b/lib/cycles/dsp/tests/Dsp.Tests.cs index e1b36fed..3c8193c9 100644 --- a/lib/cycles/dsp/tests/Dsp.Tests.cs +++ b/lib/cycles/dsp/tests/Dsp.Tests.cs @@ -103,7 +103,7 @@ public class DspTests for (int i = 0; i < 100; i++) { - double price = 100.0 + i * 1.0; + double price = 100.0 + (i * 1.0); dsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -118,7 +118,7 @@ public class DspTests for (int i = 0; i < 100; i++) { - double price = 200.0 - i * 1.0; + double price = 200.0 - (i * 1.0); dsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -414,7 +414,7 @@ public class DspTests for (int i = 0; i < 100; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } // Both should have values diff --git a/lib/cycles/dsp/tests/Dsp.Validation.Tests.cs b/lib/cycles/dsp/tests/Dsp.Validation.Tests.cs index 1ab16364..c760269e 100644 --- a/lib/cycles/dsp/tests/Dsp.Validation.Tests.cs +++ b/lib/cycles/dsp/tests/Dsp.Validation.Tests.cs @@ -69,7 +69,7 @@ public class DspValidationTests // Generate sine wave to simulate price oscillation for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.1); + double price = 100.0 + (10.0 * Math.Sin(i * 0.1)); dsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); if (dsp.IsHot) { @@ -310,7 +310,7 @@ public class DspValidationTests for (int i = 0; i < 100; i++) { - double price = 0.0001 + i * 0.00001; + double price = 0.0001 + (i * 0.00001); dsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -325,7 +325,7 @@ public class DspValidationTests for (int i = 0; i < 100; i++) { - double price = 1e10 + i * 1e8; + double price = 1e10 + (i * 1e8); dsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -363,7 +363,7 @@ public class DspValidationTests // Strong uptrend with some noise for (int i = 0; i < 300; i++) { - double trend = 100.0 + i * 0.5; + double trend = 100.0 + (i * 0.5); double noise = Math.Sin(i * 0.3) * 2.0; double price = trend + noise; dsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); diff --git a/lib/cycles/eacp/tests/Eacp.Quantower.Tests.cs b/lib/cycles/eacp/tests/Eacp.Quantower.Tests.cs index a20ce4d0..b881da44 100644 --- a/lib/cycles/eacp/tests/Eacp.Quantower.Tests.cs +++ b/lib/cycles/eacp/tests/Eacp.Quantower.Tests.cs @@ -305,7 +305,7 @@ public class EacpIndicatorTests // Generate sine wave pattern for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod); + double price = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -324,7 +324,7 @@ public class EacpIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20.0); + double price = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20.0)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -348,7 +348,7 @@ public class EacpIndicatorTests // Add same data to both for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20.0); + double price = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20.0)); indicatorEnhanced.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicatorNormal.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicatorEnhanced.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/cycles/eacp/tests/Eacp.Tests.cs b/lib/cycles/eacp/tests/Eacp.Tests.cs index 5b6beb04..735f2e7d 100644 --- a/lib/cycles/eacp/tests/Eacp.Tests.cs +++ b/lib/cycles/eacp/tests/Eacp.Tests.cs @@ -169,7 +169,7 @@ public class EacpTests // Build some history for (int i = 0; i < 100; i++) { - eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10), isNew: true); + eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)), isNew: true); } eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(100), 110.0), isNew: true); @@ -237,7 +237,7 @@ public class EacpTests // First run for (int i = 0; i < 200; i++) { - eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } var firstResult = eacp.Last.Value; @@ -246,7 +246,7 @@ public class EacpTests // Second run with same data for (int i = 0; i < 200; i++) { - eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + eacp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } var secondResult = eacp.Last.Value; @@ -431,7 +431,7 @@ public class EacpTests for (int i = 0; i < 200; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } Assert.True(eacp.IsHot); @@ -447,7 +447,7 @@ public class EacpTests for (int i = 0; i < 300; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } // Both should have values diff --git a/lib/cycles/ebsw/tests/Ebsw.Quantower.Tests.cs b/lib/cycles/ebsw/tests/Ebsw.Quantower.Tests.cs index 60816ed7..36829801 100644 --- a/lib/cycles/ebsw/tests/Ebsw.Quantower.Tests.cs +++ b/lib/cycles/ebsw/tests/Ebsw.Quantower.Tests.cs @@ -316,7 +316,7 @@ public class EbswIndicatorTests // Add varying price bars for (int i = 0; i < 100; i++) { - double price = 100 + 20 * Math.Sin(i * 0.2); + double price = 100 + (20 * Math.Sin(i * 0.2)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -338,7 +338,7 @@ public class EbswIndicatorTests // Generate sine wave price pattern for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.1); + double price = 100.0 + (10.0 * Math.Sin(i * 0.1)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); values.Add(indicator.LinesSeries[0].GetValue(0)); @@ -364,7 +364,7 @@ public class EbswIndicatorTests // Generate sine wave price pattern for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.15); + double price = 100.0 + (10.0 * Math.Sin(i * 0.15)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); values.Add(indicator.LinesSeries[0].GetValue(0)); diff --git a/lib/cycles/ebsw/tests/Ebsw.Tests.cs b/lib/cycles/ebsw/tests/Ebsw.Tests.cs index cca57bf2..e676600b 100644 --- a/lib/cycles/ebsw/tests/Ebsw.Tests.cs +++ b/lib/cycles/ebsw/tests/Ebsw.Tests.cs @@ -137,7 +137,7 @@ public class EbswTests for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * frequency); + double price = 100.0 + (10.0 * Math.Sin(i * frequency)); ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -235,7 +235,7 @@ public class EbswTests // First run for (int i = 0; i < 100; i++) { - ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } var firstResult = ebsw.Last.Value; @@ -244,7 +244,7 @@ public class EbswTests // Second run with same data for (int i = 0; i < 100; i++) { - ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } var secondResult = ebsw.Last.Value; @@ -451,7 +451,7 @@ public class EbswTests for (int i = 0; i < 100; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } Assert.True(ebsw.IsHot); @@ -467,7 +467,7 @@ public class EbswTests for (int i = 0; i < 200; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } // Both should have values diff --git a/lib/cycles/ebsw/tests/Ebsw.Validation.Tests.cs b/lib/cycles/ebsw/tests/Ebsw.Validation.Tests.cs index 656608f9..a2771730 100644 --- a/lib/cycles/ebsw/tests/Ebsw.Validation.Tests.cs +++ b/lib/cycles/ebsw/tests/Ebsw.Validation.Tests.cs @@ -89,7 +89,7 @@ public class EbswValidationTests // Generate sine wave to simulate price oscillation for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.1); + double price = 100.0 + (10.0 * Math.Sin(i * 0.1)); ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); if (ebsw.IsHot) { @@ -186,7 +186,7 @@ public class EbswValidationTests // Larger amplitude oscillation to ensure EBSW detects cycles for (int i = 0; i < 300; i++) { - double trend = 100.0 + i * 0.5; + double trend = 100.0 + (i * 0.5); double oscillation = Math.Sin(i * 0.15) * 10.0; // Larger amplitude, longer period double price = trend + oscillation; ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); @@ -252,7 +252,7 @@ public class EbswValidationTests double frequency = 2.0 * Math.PI / 40.0; for (int i = 0; i < 500; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * frequency); + double price = 100.0 + (10.0 * Math.Sin(i * frequency)); ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); if (ebsw.IsHot) { @@ -405,7 +405,7 @@ public class EbswValidationTests for (int i = 0; i < 100; i++) { - double price = 0.0001 + i * 0.00001; + double price = 0.0001 + (i * 0.00001); ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -421,7 +421,7 @@ public class EbswValidationTests for (int i = 0; i < 100; i++) { - double price = 1e10 + i * 1e8; + double price = 1e10 + (i * 1e8); ebsw.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } diff --git a/lib/cycles/homod/tests/Homod.Quantower.Tests.cs b/lib/cycles/homod/tests/Homod.Quantower.Tests.cs index fd601d33..9a13fdeb 100644 --- a/lib/cycles/homod/tests/Homod.Quantower.Tests.cs +++ b/lib/cycles/homod/tests/Homod.Quantower.Tests.cs @@ -269,7 +269,7 @@ public class HomodIndicatorTests // Generate sine wave pattern for (int i = 0; i < 200; i++) { - double price = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod); + double price = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -309,7 +309,7 @@ public class HomodIndicatorTests for (int i = 0; i < 100; i++) { - double price = 100.0 + i * 0.5; // Trending up + double price = 100.0 + (i * 0.5); // Trending up indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/cycles/homod/tests/Homod.Tests.cs b/lib/cycles/homod/tests/Homod.Tests.cs index 77bc7a9d..eb293bad 100644 --- a/lib/cycles/homod/tests/Homod.Tests.cs +++ b/lib/cycles/homod/tests/Homod.Tests.cs @@ -146,7 +146,7 @@ public class HomodTests // Build some history for (int i = 0; i < 100; i++) { - homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10), isNew: true); + homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10)), isNew: true); } homod.Update(new TValue(DateTime.UtcNow.AddSeconds(100), 110.0), isNew: true); @@ -213,7 +213,7 @@ public class HomodTests // First run for (int i = 0; i < 200; i++) { - homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } var firstResult = homod.Last.Value; @@ -222,7 +222,7 @@ public class HomodTests // Second run with same data for (int i = 0; i < 200; i++) { - homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } var secondResult = homod.Last.Value; @@ -407,7 +407,7 @@ public class HomodTests for (int i = 0; i < 200; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } Assert.True(homod.IsHot); @@ -423,7 +423,7 @@ public class HomodTests for (int i = 0; i < 300; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } // Both should have values diff --git a/lib/cycles/homod/tests/Homod.Validation.Tests.cs b/lib/cycles/homod/tests/Homod.Validation.Tests.cs index 43655c3f..d6a623d2 100644 --- a/lib/cycles/homod/tests/Homod.Validation.Tests.cs +++ b/lib/cycles/homod/tests/Homod.Validation.Tests.cs @@ -110,7 +110,7 @@ public class HomodValidationTests // Generate 500 bars of sine wave for (int i = 0; i < 500; i++) { - double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod); + double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / knownPeriod)); homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value)); } @@ -131,7 +131,7 @@ public class HomodValidationTests // Generate sine wave with specified period for (int i = 0; i < 600; i++) { - double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / period); + double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / period)); homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value)); } @@ -282,7 +282,7 @@ public class HomodValidationTests // Strong uptrend with no cyclical component for (int i = 0; i < 500; i++) { - double value = 100.0 + i * 0.5; + double value = 100.0 + (i * 0.5); var result = homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value)); Assert.True(double.IsFinite(result.Value)); } @@ -339,7 +339,7 @@ public class HomodValidationTests // Generate synthetic cycle for (int i = 0; i < 200; i++) { - double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20); + double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20)); homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value)); } @@ -347,7 +347,7 @@ public class HomodValidationTests var postWarmupValues = new List(); for (int i = 200; i < 400; i++) { - double value = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20); + double value = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20)); var result = homod.Update(new TValue(DateTime.UtcNow.AddSeconds(i), value)); postWarmupValues.Add(result.Value); } diff --git a/lib/cycles/ht_dcperiod/tests/HtDcperiod.Quantower.Tests.cs b/lib/cycles/ht_dcperiod/tests/HtDcperiod.Quantower.Tests.cs index b265085f..3ede699f 100644 --- a/lib/cycles/ht_dcperiod/tests/HtDcperiod.Quantower.Tests.cs +++ b/lib/cycles/ht_dcperiod/tests/HtDcperiod.Quantower.Tests.cs @@ -178,7 +178,7 @@ public class HtDcperiodIndicatorTests // HT_DCPERIOD needs significant warmup - feed sinusoidal data for (int i = 0; i < 100; i++) { - double price = 100 + 10 * Math.Sin(i * 0.3); + double price = 100 + (10 * Math.Sin(i * 0.3)); indicator.HistoricalData.AddBar( time: now.AddMinutes(i), open: price - 1, @@ -339,7 +339,7 @@ public class HtDcperiodIndicatorTests // Feed sinusoidal data with known period (~21 bars) for (int i = 0; i < 100; i++) { - double price = 100 + 10 * Math.Sin(2 * Math.PI * i / 21.0); + double price = 100 + (10 * Math.Sin(2 * Math.PI * i / 21.0)); indicator.HistoricalData.AddBar( time: now.AddMinutes(i), open: price - 0.5, diff --git a/lib/cycles/ht_dcperiod/tests/HtDcperiod.Tests.cs b/lib/cycles/ht_dcperiod/tests/HtDcperiod.Tests.cs index bf8824f4..21e8d93d 100644 --- a/lib/cycles/ht_dcperiod/tests/HtDcperiod.Tests.cs +++ b/lib/cycles/ht_dcperiod/tests/HtDcperiod.Tests.cs @@ -27,7 +27,7 @@ public class HtDcperiodTests // Feed data through publisher for (int i = 0; i < 40; i++) { - source.Add(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + Math.Sin(i * 0.3) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (Math.Sin(i * 0.3) * 10))); } Assert.True(ht.IsHot); @@ -144,7 +144,7 @@ public class HtDcperiodTests // Prime with data for (int i = 0; i < 50; i++) { - ht.Update(new TValue(now.AddMinutes(i), 100 + Math.Sin(i * 0.1) * 10)); + ht.Update(new TValue(now.AddMinutes(i), 100 + (Math.Sin(i * 0.1) * 10))); } Assert.True(ht.IsHot); @@ -203,7 +203,7 @@ public class HtDcperiodTests // Feed valid data to warm up for (int i = 0; i < 50; i++) { - ht.Update(new TValue(now.AddMinutes(i), 100 + Math.Sin(i * 0.2) * 5)); + ht.Update(new TValue(now.AddMinutes(i), 100 + (Math.Sin(i * 0.2) * 5))); } Assert.True(ht.IsHot); @@ -221,7 +221,7 @@ public class HtDcperiodTests for (int i = 0; i < 50; i++) { - ht.Update(new TValue(now.AddMinutes(i), 100 + i * 0.5)); + ht.Update(new TValue(now.AddMinutes(i), 100 + (i * 0.5))); } var result = ht.Update(new TValue(now.AddMinutes(50), double.PositiveInfinity)); @@ -255,7 +255,7 @@ public class HtDcperiodTests // First use for (int i = 0; i < 50; i++) { - ht.Update(new TValue(now.AddMinutes(i), 100 + Math.Sin(i * 0.2) * 5)); + ht.Update(new TValue(now.AddMinutes(i), 100 + (Math.Sin(i * 0.2) * 5))); } Assert.True(ht.IsHot); var firstResult = ht.Last.Value; @@ -266,7 +266,7 @@ public class HtDcperiodTests for (int i = 0; i < 50; i++) { - ht.Update(new TValue(now.AddMinutes(i), 100 + Math.Sin(i * 0.2) * 5)); + ht.Update(new TValue(now.AddMinutes(i), 100 + (Math.Sin(i * 0.2) * 5))); } Assert.True(ht.IsHot); Assert.Equal(firstResult, ht.Last.Value); @@ -387,7 +387,7 @@ public class HtDcperiodTests var values = new double[50]; for (int i = 0; i < 50; i++) { - values[i] = 100 + Math.Sin(i * 0.2) * 5; + values[i] = 100 + (Math.Sin(i * 0.2) * 5); } ht.Prime(values, TimeSpan.FromMinutes(5)); @@ -443,7 +443,7 @@ public class HtDcperiodTests for (int i = 0; i < 300; i++) { - ht.Update(new TValue(now.AddMinutes(i), 100 + 10 * Math.Sin(omega * i))); + ht.Update(new TValue(now.AddMinutes(i), 100 + (10 * Math.Sin(omega * i)))); } // After sufficient data, the detected period should be diff --git a/lib/cycles/ht_phasor/tests/HtPhasor.Tests.cs b/lib/cycles/ht_phasor/tests/HtPhasor.Tests.cs index b4ae7adf..d975eed2 100644 --- a/lib/cycles/ht_phasor/tests/HtPhasor.Tests.cs +++ b/lib/cycles/ht_phasor/tests/HtPhasor.Tests.cs @@ -54,7 +54,7 @@ public class HtPhasorTests for (int i = 0; i < 100; i++) { - phasor.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 5)); + phasor.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 5))); } Assert.True(double.IsFinite(phasor.Quadrature)); @@ -126,7 +126,7 @@ public class HtPhasorTests for (int i = 0; i < 50; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.2) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.2) * 10))); } Assert.True(phasor.IsHot); @@ -238,7 +238,7 @@ public class HtPhasorTests double[] data = new double[50]; for (int i = 0; i < 50; i++) { - data[i] = 100.0 + Math.Sin(i * 0.3) * 10; + data[i] = 100.0 + (Math.Sin(i * 0.3) * 10); } phasor1.Prime(data); diff --git a/lib/cycles/ht_sine/tests/HtSine.Quantower.Tests.cs b/lib/cycles/ht_sine/tests/HtSine.Quantower.Tests.cs index a628ceb8..060d0b7f 100644 --- a/lib/cycles/ht_sine/tests/HtSine.Quantower.Tests.cs +++ b/lib/cycles/ht_sine/tests/HtSine.Quantower.Tests.cs @@ -207,7 +207,7 @@ public class HtSineIndicatorTests // Add enough bars to pass warmup (63 bars) for (int i = 0; i < 70; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.15); + double price = 100.0 + (10.0 * Math.Sin(i * 0.15)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -231,7 +231,7 @@ public class HtSineIndicatorTests // Generate enough data for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.15); + double price = 100.0 + (10.0 * Math.Sin(i * 0.15)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -260,7 +260,7 @@ public class HtSineIndicatorTests // Generate cyclic price pattern for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.15); + double price = 100.0 + (10.0 * Math.Sin(i * 0.15)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); sineValues.Add(indicator.LinesSeries[0].GetValue(0)); diff --git a/lib/cycles/ht_sine/tests/HtSine.Tests.cs b/lib/cycles/ht_sine/tests/HtSine.Tests.cs index 07f92ed1..f998721a 100644 --- a/lib/cycles/ht_sine/tests/HtSine.Tests.cs +++ b/lib/cycles/ht_sine/tests/HtSine.Tests.cs @@ -91,7 +91,7 @@ public class HtSineTests for (int i = 0; i < 100; i++) { - htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } Assert.True(double.IsFinite(htSine.LeadSine)); @@ -106,7 +106,7 @@ public class HtSineTests const int period = 20; for (int i = 0; i < 500; i++) { - double price = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / period); + double price = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / period)); htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -128,7 +128,7 @@ public class HtSineTests // Build some history first for (int i = 0; i < 100; i++) { - htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1), isNew: true); + htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1)), isNew: true); } var first = htSine.Last.Value; @@ -147,7 +147,7 @@ public class HtSineTests // Build some history first for (int i = 0; i < 100; i++) { - htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1), isNew: true); + htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1)), isNew: true); } htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(100), 150.0), isNew: true); @@ -168,7 +168,7 @@ public class HtSineTests // Build some history for (int i = 0; i < 100; i++) { - htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1), isNew: true); + htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1)), isNew: true); } // Add a new bar @@ -215,7 +215,7 @@ public class HtSineTests // First run for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.1); + double price = 100.0 + (10.0 * Math.Sin(i * 0.1)); htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } var firstResult = htSine.Last.Value; @@ -225,7 +225,7 @@ public class HtSineTests // Second run with same data for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.1); + double price = 100.0 + (10.0 * Math.Sin(i * 0.1)); htSine.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } var secondResult = htSine.Last.Value; @@ -412,7 +412,7 @@ public class HtSineTests for (int i = 0; i < 100; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } Assert.True(htSine.IsHot); diff --git a/lib/cycles/ssfdsp/tests/Ssfdsp.Quantower.Tests.cs b/lib/cycles/ssfdsp/tests/Ssfdsp.Quantower.Tests.cs index ca90a77b..41ac577f 100644 --- a/lib/cycles/ssfdsp/tests/Ssfdsp.Quantower.Tests.cs +++ b/lib/cycles/ssfdsp/tests/Ssfdsp.Quantower.Tests.cs @@ -247,7 +247,7 @@ public class SsfdspIndicatorTests // Generate trending then ranging price pattern for (int i = 0; i < 100; i++) { - double price = 100.0 + 10.0 * Math.Sin(i * 0.15); + double price = 100.0 + (10.0 * Math.Sin(i * 0.15)); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); values.Add(indicator.LinesSeries[0].GetValue(0)); diff --git a/lib/cycles/ssfdsp/tests/Ssfdsp.Tests.cs b/lib/cycles/ssfdsp/tests/Ssfdsp.Tests.cs index 2503585f..d9ed83a2 100644 --- a/lib/cycles/ssfdsp/tests/Ssfdsp.Tests.cs +++ b/lib/cycles/ssfdsp/tests/Ssfdsp.Tests.cs @@ -103,7 +103,7 @@ public class SsfdspTests for (int i = 0; i < 100; i++) { - double price = 100.0 + i * 1.0; + double price = 100.0 + (i * 1.0); ssfdsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -118,7 +118,7 @@ public class SsfdspTests for (int i = 0; i < 100; i++) { - double price = 200.0 - i * 1.0; + double price = 200.0 - (i * 1.0); ssfdsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); } @@ -423,7 +423,7 @@ public class SsfdspTests for (int i = 0; i < 100; i++) { - source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } // Both should have values diff --git a/lib/cycles/ssfdsp/tests/Ssfdsp.Validation.Tests.cs b/lib/cycles/ssfdsp/tests/Ssfdsp.Validation.Tests.cs index c42f0781..6d4d48c5 100644 --- a/lib/cycles/ssfdsp/tests/Ssfdsp.Validation.Tests.cs +++ b/lib/cycles/ssfdsp/tests/Ssfdsp.Validation.Tests.cs @@ -159,7 +159,7 @@ public class SsfdspValidationTests for (int i = 0; i < 200; i++) { - double price = 100 + 10 * Math.Sin(frequency * i); + double price = 100 + (10 * Math.Sin(frequency * i)); ssfdsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); if (i >= 80) // After warmup { @@ -337,7 +337,7 @@ public class SsfdspValidationTests for (int i = 0; i < 1000; i++) { - double price = 100 + 10 * Math.Sin(2 * Math.PI * i / 40); + double price = 100 + (10 * Math.Sin(2 * Math.PI * i / 40)); ssfdsp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price)); if (i >= 100) // After warmup diff --git a/lib/dynamics/alligator/tests/Alligator.Validation.Tests.cs b/lib/dynamics/alligator/tests/Alligator.Validation.Tests.cs index 5515827d..970b69c0 100644 --- a/lib/dynamics/alligator/tests/Alligator.Validation.Tests.cs +++ b/lib/dynamics/alligator/tests/Alligator.Validation.Tests.cs @@ -78,7 +78,7 @@ public sealed class AlligatorValidationTests : IDisposable // Create strong uptrend for (int i = 0; i < 100; i++) { - double price = 100.0 + i * 2.0; + double price = 100.0 + (i * 2.0); var bar = new TBar(DateTime.UtcNow.AddMinutes(i), price, price + 1, price - 1, price, 1000); alligator.Update(bar); } diff --git a/lib/dynamics/amat/tests/Amat.Tests.cs b/lib/dynamics/amat/tests/Amat.Tests.cs index 661198b8..8c21255e 100644 --- a/lib/dynamics/amat/tests/Amat.Tests.cs +++ b/lib/dynamics/amat/tests/Amat.Tests.cs @@ -83,7 +83,7 @@ public class AmatTests // Feed rising prices to create bullish trend for (int i = 0; i < 20; i++) { - amat.Update(new TValue(DateTime.UtcNow, 100 + i * 2)); + amat.Update(new TValue(DateTime.UtcNow, 100 + (i * 2))); } // Trend should be +1, -1, or 0 @@ -99,7 +99,7 @@ public class AmatTests // Feed steadily rising prices for (int i = 0; i < 50; i++) { - amat.Update(new TValue(DateTime.UtcNow, 100 + i * 3)); + amat.Update(new TValue(DateTime.UtcNow, 100 + (i * 3))); } // Should be bullish when fast EMA > slow EMA and both rising @@ -121,7 +121,7 @@ public class AmatTests // Feed steadily falling prices for (int i = 0; i < 50; i++) { - amat.Update(new TValue(DateTime.UtcNow, 200 - i * 3)); + amat.Update(new TValue(DateTime.UtcNow, 200 - (i * 3))); } // Should be bearish when fast EMA < slow EMA and both falling @@ -471,7 +471,7 @@ public class AmatTests // Feed rising prices to create divergence for (int i = 0; i < 30; i++) { - amat.Update(new TValue(DateTime.UtcNow, 100 + i * 5)); + amat.Update(new TValue(DateTime.UtcNow, 100 + (i * 5))); } // Strength should be positive when there's divergence diff --git a/lib/dynamics/amat/tests/Amat.Validation.Tests.cs b/lib/dynamics/amat/tests/Amat.Validation.Tests.cs index 9ffc68ea..47b6538a 100644 --- a/lib/dynamics/amat/tests/Amat.Validation.Tests.cs +++ b/lib/dynamics/amat/tests/Amat.Validation.Tests.cs @@ -273,7 +273,7 @@ public sealed class AmatValidationTests : IDisposable // Phase 2: Falling prices (reversal) for (int i = 50; i < 150; i++) { - double price = 150 - (i - 50) * 2; // Fall faster than rise + double price = 150 - ((i - 50) * 2); // Fall faster than rise amat.Update(new TValue(time.AddMinutes(i), price)); } double bearishTrend = amat.Last.Value; diff --git a/lib/dynamics/chop/tests/Chop.Tests.cs b/lib/dynamics/chop/tests/Chop.Tests.cs index 782ff270..9fc8ec60 100644 --- a/lib/dynamics/chop/tests/Chop.Tests.cs +++ b/lib/dynamics/chop/tests/Chop.Tests.cs @@ -34,7 +34,7 @@ public class ChopTests // Generate trending bars: each bar higher than the last for (int i = 0; i < 50; i++) { - double basePrice = 100 + i * 2; // Strong uptrend + double basePrice = 100 + (i * 2); // Strong uptrend bars.Add(new TBar( time: DateTime.UtcNow.AddMinutes(i), open: basePrice - 0.5, diff --git a/lib/dynamics/chop/tests/Chop.Validation.Tests.cs b/lib/dynamics/chop/tests/Chop.Validation.Tests.cs index afc8b283..df2a6eb0 100644 --- a/lib/dynamics/chop/tests/Chop.Validation.Tests.cs +++ b/lib/dynamics/chop/tests/Chop.Validation.Tests.cs @@ -74,7 +74,7 @@ public sealed class ChopValidationTests : IDisposable for (int i = 0; i < 100; i++) { - double price = 100.0 + i * 3.0; // Strong linear uptrend + double price = 100.0 + (i * 3.0); // Strong linear uptrend var bar = new TBar(DateTime.UtcNow.AddMinutes(i), price, price + 0.5, price - 0.5, price, 1000); chop.Update(bar); } @@ -95,7 +95,7 @@ public sealed class ChopValidationTests : IDisposable for (int i = 0; i < 100; i++) { // Oscillating price with wide range but no trend - double price = 100.0 + 5.0 * Math.Sin(2.0 * Math.PI * i / 3.0); + double price = 100.0 + (5.0 * Math.Sin(2.0 * Math.PI * i / 3.0)); double high = price + 3.0; double low = price - 3.0; var bar = new TBar(DateTime.UtcNow.AddMinutes(i), price, high, low, price, 1000); diff --git a/lib/dynamics/ht_trendmode/tests/HtTrendmode.Tests.cs b/lib/dynamics/ht_trendmode/tests/HtTrendmode.Tests.cs index 569c8d43..03fa6dc6 100644 --- a/lib/dynamics/ht_trendmode/tests/HtTrendmode.Tests.cs +++ b/lib/dynamics/ht_trendmode/tests/HtTrendmode.Tests.cs @@ -60,7 +60,7 @@ public class HtTrendmodeTests // Feed data for (int i = 0; i < 50; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 0.5)); + indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 0.5))); } // TrendMode property should match output @@ -76,7 +76,7 @@ public class HtTrendmodeTests // Feed data for (int i = 0; i < 50; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + Math.Sin(i * 0.2) * 10)); + indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (Math.Sin(i * 0.2) * 10))); } // SmoothPeriod should be in valid range @@ -93,7 +93,7 @@ public class HtTrendmodeTests // Feed data for (int i = 0; i < 50; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + Math.Sin(i * 0.3) * 8)); + indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (Math.Sin(i * 0.3) * 8))); } // InstPeriod should be positive @@ -109,7 +109,7 @@ public class HtTrendmodeTests // Strong trend: monotonically increasing for (int i = 0; i < 100; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 2.0)); + indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 2.0))); } // With strong trend, inst_period should be larger → trend mode likely @@ -126,7 +126,7 @@ public class HtTrendmodeTests // Pure sinusoidal data (strong cycle) for (int i = 0; i < 100; i++) { - double value = 100.0 + Math.Sin(i * 0.4) * 10.0; + double value = 100.0 + (Math.Sin(i * 0.4) * 10.0); indicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), value)); } @@ -195,7 +195,7 @@ public class HtTrendmodeTests for (int i = 0; i < 100; i++) { - series.Add(DateTime.UtcNow.AddMinutes(i), 100.0 + Math.Sin(i * 0.2) * 10); + series.Add(DateTime.UtcNow.AddMinutes(i), 100.0 + (Math.Sin(i * 0.2) * 10)); } var result = indicator.Update(series); @@ -218,7 +218,7 @@ public class HtTrendmodeTests for (int i = 0; i < input.Length; i++) { - input[i] = 100.0 + Math.Sin(i * 0.15) * 8; + input[i] = 100.0 + (Math.Sin(i * 0.15) * 8); } HtTrendmode.Batch(input.AsSpan(), output.AsSpan()); @@ -238,7 +238,7 @@ public class HtTrendmodeTests for (int i = 0; i < 100; i++) { - series.Add(DateTime.UtcNow.AddMinutes(i), 100.0 + Math.Sin(i * 0.25) * 12); + series.Add(DateTime.UtcNow.AddMinutes(i), 100.0 + (Math.Sin(i * 0.25) * 12)); } var result = HtTrendmode.Batch(series); @@ -278,7 +278,7 @@ public class HtTrendmodeTests for (int i = 0; i < 100; i++) { - double value = 100.0 + Math.Sin(i * 0.2) * 10 + Math.Cos(i * 0.3) * 5; + double value = 100.0 + (Math.Sin(i * 0.2) * 10) + (Math.Cos(i * 0.3) * 5); series.Add(DateTime.UtcNow.AddMinutes(i), value); var result = streamingIndicator.Update(new TValue(DateTime.UtcNow.AddMinutes(i), value)); @@ -303,7 +303,7 @@ public class HtTrendmodeTests double[] primeData = new double[70]; for (int i = 0; i < primeData.Length; i++) { - primeData[i] = 100.0 + i * 0.5; + primeData[i] = 100.0 + (i * 0.5); } indicator.Prime(primeData); diff --git a/lib/dynamics/ichimoku/tests/Ichimoku.Quantower.Tests.cs b/lib/dynamics/ichimoku/tests/Ichimoku.Quantower.Tests.cs index d1a66395..d257c233 100644 --- a/lib/dynamics/ichimoku/tests/Ichimoku.Quantower.Tests.cs +++ b/lib/dynamics/ichimoku/tests/Ichimoku.Quantower.Tests.cs @@ -174,7 +174,7 @@ public class IchimokuIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice); var args = new UpdateArgs(UpdateReason.HistoricalBar); indicator.ProcessUpdate(args); diff --git a/lib/dynamics/ichimoku/tests/Ichimoku.Tests.cs b/lib/dynamics/ichimoku/tests/Ichimoku.Tests.cs index 19f51bf0..f960c1ce 100644 --- a/lib/dynamics/ichimoku/tests/Ichimoku.Tests.cs +++ b/lib/dynamics/ichimoku/tests/Ichimoku.Tests.cs @@ -83,7 +83,7 @@ public class IchimokuTests for (int i = 0; i < 52; i++) { - var bar = new TBar(baseTime + i * 60000, 100 + i, 105 + i, 95 + i, 102 + i, 1000); + var bar = new TBar(baseTime + (i * 60000), 100 + i, 105 + i, 95 + i, 102 + i, 1000); ichimoku.Update(bar); } @@ -241,18 +241,18 @@ public class IchimokuTests // Add some initial bars for (int i = 0; i < 3; i++) { - ichimoku.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 100, 1000)); + ichimoku.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 100, 1000)); } // Capture state before update (use underscore to indicate intentionally unused) _ = ichimoku.Tenkan.Value; // Update with new bar - ichimoku.Update(new TBar(baseTime + 3 * 60000, 110, 120, 100, 115, 1000), isNew: true); + ichimoku.Update(new TBar(baseTime + (3 * 60000), 110, 120, 100, 115, 1000), isNew: true); double tenkanAfterNew = ichimoku.Tenkan.Value; // Correct the bar (isNew=false) with different values - ichimoku.Update(new TBar(baseTime + 3 * 60000, 90, 95, 85, 90, 1000), isNew: false); + ichimoku.Update(new TBar(baseTime + (3 * 60000), 90, 95, 85, 90, 1000), isNew: false); double tenkanAfterCorrection = ichimoku.Tenkan.Value; // Values should differ based on the correction @@ -268,17 +268,17 @@ public class IchimokuTests // Fill buffer for (int i = 0; i < 5; i++) { - ichimoku.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 100, 1000)); + ichimoku.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 100, 1000)); } // First update - ichimoku.Update(new TBar(baseTime + 5 * 60000, 105, 110, 100, 105, 1000), isNew: true); + ichimoku.Update(new TBar(baseTime + (5 * 60000), 105, 110, 100, 105, 1000), isNew: true); double firstTenkan = ichimoku.Tenkan.Value; // Multiple corrections should converge for (int i = 0; i < 3; i++) { - ichimoku.Update(new TBar(baseTime + 5 * 60000, 105, 110, 100, 105, 1000), isNew: false); + ichimoku.Update(new TBar(baseTime + (5 * 60000), 105, 110, 100, 105, 1000), isNew: false); } Assert.Equal(firstTenkan, ichimoku.Tenkan.Value, Precision); @@ -344,7 +344,7 @@ public class IchimokuTests // Process some bars for (int i = 0; i < 60; i++) { - ichimoku.Update(new TBar(baseTime + i * 60000, 100 + i, 105 + i, 95 + i, 100 + i, 1000)); + ichimoku.Update(new TBar(baseTime + (i * 60000), 100 + i, 105 + i, 95 + i, 100 + i, 1000)); } Assert.True(ichimoku.IsHot); @@ -368,7 +368,7 @@ public class IchimokuTests // First use for (int i = 0; i < 10; i++) { - ichimoku.Update(new TBar(baseTime + i * 60000, 100, 110, 90, 100, 1000)); + ichimoku.Update(new TBar(baseTime + (i * 60000), 100, 110, 90, 100, 1000)); } double firstTenkan = ichimoku.Tenkan.Value; @@ -378,7 +378,7 @@ public class IchimokuTests for (int i = 0; i < 10; i++) { - ichimoku.Update(new TBar(baseTime + i * 60000, 100, 110, 90, 100, 1000)); + ichimoku.Update(new TBar(baseTime + (i * 60000), 100, 110, 90, 100, 1000)); } Assert.Equal(firstTenkan, ichimoku.Tenkan.Value, Precision); @@ -396,7 +396,7 @@ public class IchimokuTests for (int i = 0; i < 60; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 110, 90, 100, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 110, 90, 100, 1000)); } var (tenkan, kijun, senkouA, senkouB, chikou) = Ichimoku.Batch(source); @@ -430,7 +430,7 @@ public class IchimokuTests for (int i = 0; i < 20; i++) { - source.Add(new TBar(baseTime + i * 60000, 100 + i, 110 + i, 90 + i, 100 + i, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100 + i, 110 + i, 90 + i, 100 + i, 1000)); } var (tenkan, _, _, _, _) = Ichimoku.Batch(source, 3, 5, 10, 5); @@ -446,7 +446,7 @@ public class IchimokuTests for (int i = 0; i < 60; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 110, 90, 100, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 110, 90, 100, 1000)); } var (results, indicator) = Ichimoku.Calculate(source); @@ -469,7 +469,7 @@ public class IchimokuTests // Constant high=low=close=100 for (int i = 0; i < 10; i++) { - ichimoku.Update(new TBar(baseTime + i * 60000, 100, 100, 100, 100, 1000)); + ichimoku.Update(new TBar(baseTime + (i * 60000), 100, 100, 100, 100, 1000)); } Assert.Equal(100.0, ichimoku.Tenkan.Value, Precision); @@ -506,8 +506,8 @@ public class IchimokuTests // Uptrend: increasing highs and lows for (int i = 0; i < 15; i++) { - double basePrice = 100 + i * 2; - ichimoku.Update(new TBar(baseTime + i * 60000, basePrice, basePrice + 5, basePrice - 5, basePrice, 1000)); + double basePrice = 100 + (i * 2); + ichimoku.Update(new TBar(baseTime + (i * 60000), basePrice, basePrice + 5, basePrice - 5, basePrice, 1000)); } // In uptrend, Tenkan should be above Kijun (faster vs slower) diff --git a/lib/dynamics/qstick/tests/Qstick.Tests.cs b/lib/dynamics/qstick/tests/Qstick.Tests.cs index 8072e4ab..0c7906db 100644 --- a/lib/dynamics/qstick/tests/Qstick.Tests.cs +++ b/lib/dynamics/qstick/tests/Qstick.Tests.cs @@ -507,8 +507,8 @@ public class QstickTests for (int i = 0; i < 20; i++) { - double open = 100.0 + i * 0.5; - double close = open + (i % 3 - 1); // varies between -1, 0, 1 + double open = 100.0 + (i * 0.5); + double close = open + ((i % 3) - 1); // varies between -1, 0, 1 bars.Add(new TBar(time.AddMinutes(i).Ticks, open, open + 2, open - 1, close, 1000)); } diff --git a/lib/dynamics/qstick/tests/Qstick.Validation.Tests.cs b/lib/dynamics/qstick/tests/Qstick.Validation.Tests.cs index d6a103ef..53aef171 100644 --- a/lib/dynamics/qstick/tests/Qstick.Validation.Tests.cs +++ b/lib/dynamics/qstick/tests/Qstick.Validation.Tests.cs @@ -123,7 +123,7 @@ public sealed class QstickValidationTests : IDisposable // Bar 2: diff = 3, EMA = alpha * 3 + (1-alpha) * 6- qstick.Update(new TBar(time.AddMinutes(1).Ticks, 100.0, 108.0, 96.0, 103.0, 1000)); - expectedEma = alpha * 3 + (1 - alpha) * expectedEma; + expectedEma = (alpha * 3) + ((1 - alpha) * expectedEma); Assert.Equal(expectedEma, qstick.Last.Value, 10); } diff --git a/lib/dynamics/ttm_squeeze/tests/TtmSqueeze.Tests.cs b/lib/dynamics/ttm_squeeze/tests/TtmSqueeze.Tests.cs index 667e2d77..5b8d3b2f 100644 --- a/lib/dynamics/ttm_squeeze/tests/TtmSqueeze.Tests.cs +++ b/lib/dynamics/ttm_squeeze/tests/TtmSqueeze.Tests.cs @@ -87,7 +87,7 @@ public class TtmSqueezeTests for (int i = 0; i < 4; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } Assert.False(squeeze.IsHot); @@ -101,7 +101,7 @@ public class TtmSqueezeTests for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } Assert.True(squeeze.IsHot); @@ -120,7 +120,7 @@ public class TtmSqueezeTests // Low volatility: tight range bars for (int i = 0; i < 10; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 100.5, 99.5, 100, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 100.5, 99.5, 100, 1000)); } // With tight range (0.5 from mid), low stddev means BB should be tighter @@ -139,7 +139,7 @@ public class TtmSqueezeTests for (int i = 0; i < 10; i++) { double offset = (i % 2 == 0) ? 10 : -10; - squeeze.Update(new TBar(baseTime + i * 60000, 100, 110 + offset, 90 + offset, 100 + offset, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 110 + offset, 90 + offset, 100 + offset, 1000)); } Assert.True(double.IsFinite(squeeze.Momentum.Value)); @@ -154,11 +154,11 @@ public class TtmSqueezeTests // Start with tight range (likely squeeze on) for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 100.1, 99.9, 100, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 100.1, 99.9, 100, 1000)); } // Sudden volatility expansion (removed unused initialSqueezeOn variable) - squeeze.Update(new TBar(baseTime + 5 * 60000, 100, 120, 80, 115, 1000)); + squeeze.Update(new TBar(baseTime + (5 * 60000), 100, 120, 80, 115, 1000)); // The squeeze state should have changed // (The exact behavior depends on the calculation) @@ -210,12 +210,12 @@ public class TtmSqueezeTests // Flat then accelerating up for (int i = 0; i < 3; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 101, 99, 100, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 101, 99, 100, 1000)); } // Strong up move - squeeze.Update(new TBar(baseTime + 3 * 60000, 100, 115, 99, 112, 1000)); - squeeze.Update(new TBar(baseTime + 4 * 60000, 112, 125, 110, 122, 1000)); + squeeze.Update(new TBar(baseTime + (3 * 60000), 100, 115, 99, 112, 1000)); + squeeze.Update(new TBar(baseTime + (4 * 60000), 112, 125, 110, 122, 1000)); Assert.True(squeeze.MomentumRising); } @@ -233,7 +233,7 @@ public class TtmSqueezeTests // Strong uptrend with rising momentum for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100 + i * 2, 105 + i * 2, 98 + i * 2, 103 + i * 2, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100 + (i * 2), 105 + (i * 2), 98 + (i * 2), 103 + (i * 2), 1000)); } // Should be MomentumPositive and MomentumRising = ColorCode 0 (Cyan) @@ -252,7 +252,7 @@ public class TtmSqueezeTests // Strong downtrend with falling momentum for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100 - i * 2, 102 - i * 2, 95 - i * 2, 97 - i * 2, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100 - (i * 2), 102 - (i * 2), 95 - (i * 2), 97 - (i * 2), 1000)); } // Should be !MomentumPositive and !MomentumRising = ColorCode 2 (Red) @@ -274,15 +274,15 @@ public class TtmSqueezeTests for (int i = 0; i < 3; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } // Add new bar - squeeze.Update(new TBar(baseTime + 3 * 60000, 100, 110, 98, 108, 1000), isNew: true); + squeeze.Update(new TBar(baseTime + (3 * 60000), 100, 110, 98, 108, 1000), isNew: true); double valueAfterNew = squeeze.Momentum.Value; // Correct the bar with different data - squeeze.Update(new TBar(baseTime + 3 * 60000, 108, 112, 105, 92, 1000), isNew: false); + squeeze.Update(new TBar(baseTime + (3 * 60000), 108, 112, 105, 92, 1000), isNew: false); double valueAfterCorrection = squeeze.Momentum.Value; Assert.NotEqual(valueAfterNew, valueAfterCorrection); @@ -296,18 +296,18 @@ public class TtmSqueezeTests for (int i = 0; i < 3; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } // New bar - squeeze.Update(new TBar(baseTime + 3 * 60000, 100, 110, 98, 108, 1000), isNew: true); + squeeze.Update(new TBar(baseTime + (3 * 60000), 100, 110, 98, 108, 1000), isNew: true); double firstValue = squeeze.Momentum.Value; // Correction 1 - squeeze.Update(new TBar(baseTime + 3 * 60000, 108, 115, 105, 90, 1000), isNew: false); + squeeze.Update(new TBar(baseTime + (3 * 60000), 108, 115, 105, 90, 1000), isNew: false); // Correction 2 - same as first new bar - squeeze.Update(new TBar(baseTime + 3 * 60000, 100, 110, 98, 108, 1000), isNew: false); + squeeze.Update(new TBar(baseTime + (3 * 60000), 100, 110, 98, 108, 1000), isNew: false); double secondValue = squeeze.Momentum.Value; Assert.Equal(firstValue, secondValue, Precision); @@ -355,7 +355,7 @@ public class TtmSqueezeTests for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } Assert.True(squeeze.IsHot); @@ -375,7 +375,7 @@ public class TtmSqueezeTests // Uptrend for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100 + i * 2, 105 + i * 2, 95 + i * 2, 103 + i * 2, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100 + (i * 2), 105 + (i * 2), 95 + (i * 2), 103 + (i * 2), 1000)); } double upTrendMomentum = squeeze.Momentum.Value; @@ -385,7 +385,7 @@ public class TtmSqueezeTests // Downtrend for (int i = 0; i < 5; i++) { - squeeze.Update(new TBar(baseTime + i * 60000, 100 - i * 2, 102 - i * 2, 95 - i * 2, 97 - i * 2, 1000)); + squeeze.Update(new TBar(baseTime + (i * 60000), 100 - (i * 2), 102 - (i * 2), 95 - (i * 2), 97 - (i * 2), 1000)); } Assert.NotEqual(upTrendMomentum, squeeze.Momentum.Value); @@ -404,7 +404,7 @@ public class TtmSqueezeTests for (int i = 0; i < 10; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } squeeze.Prime(source); @@ -424,7 +424,7 @@ public class TtmSqueezeTests for (int i = 0; i < 20; i++) { - source.Add(new TBar(baseTime + i * 60000, 100 + i, 105 + i, 95 + i, 102 + i, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100 + i, 105 + i, 95 + i, 102 + i, 1000)); } var result = TtmSqueeze.Batch(source); @@ -449,7 +449,7 @@ public class TtmSqueezeTests for (int i = 0; i < 20; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } var (results, indicator) = TtmSqueeze.Calculate(source, bbPeriod: 10, bbMult: 2.0, kcPeriod: 10, kcMult: 1.5, momPeriod: 10); diff --git a/lib/dynamics/ttm_trend/tests/TtmTrend.Quantower.Tests.cs b/lib/dynamics/ttm_trend/tests/TtmTrend.Quantower.Tests.cs index 88a5be97..06358fea 100644 --- a/lib/dynamics/ttm_trend/tests/TtmTrend.Quantower.Tests.cs +++ b/lib/dynamics/ttm_trend/tests/TtmTrend.Quantower.Tests.cs @@ -303,14 +303,14 @@ public class TtmTrendIndicatorTests // Feed historical bars for (int i = 0; i < 5; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 2, 110 + i * 2, 90 + i * 2, 105 + i * 2); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 2), 110 + (i * 2), 90 + (i * 2), 105 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } // Feed new bars for (int i = 5; i < 8; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 2, 110 + i * 2, 90 + i * 2, 105 + i * 2); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 2), 110 + (i * 2), 90 + (i * 2), 105 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.NewBar)); } diff --git a/lib/dynamics/ttm_trend/tests/TtmTrend.Tests.cs b/lib/dynamics/ttm_trend/tests/TtmTrend.Tests.cs index f48490e0..9503aeb1 100644 --- a/lib/dynamics/ttm_trend/tests/TtmTrend.Tests.cs +++ b/lib/dynamics/ttm_trend/tests/TtmTrend.Tests.cs @@ -81,7 +81,7 @@ public class TtmTrendBasicTests // EMA = alpha * value + (1 - alpha) * prevEMA // EMA = 0.2857 * 107 + 0.7143 * 100 = 30.57 + 71.43 = 102.0 double alpha = 2.0 / 7.0; - double expected = alpha * 107.0 + (1 - alpha) * 100.0; + double expected = (alpha * 107.0) + ((1 - alpha) * 100.0); Assert.Equal(expected, result.Value, 10); } @@ -360,7 +360,7 @@ public class TtmTrendBarCorrectionTests // Should use 105 instead of 110 double alpha = 2.0 / 7.0; - double expected = alpha * 105.0 + (1 - alpha) * 100.0; + double expected = (alpha * 105.0) + ((1 - alpha) * 100.0); Assert.Equal(expected, corrected.Value, 10); } } diff --git a/lib/dynamics/ttm_trend/tests/TtmTrend.Validation.Tests.cs b/lib/dynamics/ttm_trend/tests/TtmTrend.Validation.Tests.cs index 60e82ab4..b26a7f8b 100644 --- a/lib/dynamics/ttm_trend/tests/TtmTrend.Validation.Tests.cs +++ b/lib/dynamics/ttm_trend/tests/TtmTrend.Validation.Tests.cs @@ -64,7 +64,7 @@ public class TtmTrendValidationTests // Feed enough bars to warm up, then inject consistently rising prices for (int i = 0; i < 20; i++) { - double price = basePrice + i * 2.0; + double price = basePrice + (i * 2.0); var bar = new TBar( DateTime.UtcNow.AddMinutes(i), price - 0.5, price + 0.5, price - 0.5, price, 1000); @@ -84,7 +84,7 @@ public class TtmTrendValidationTests // Feed enough bars to warm up, then inject consistently falling prices for (int i = 0; i < 20; i++) { - double price = basePrice - i * 2.0; + double price = basePrice - (i * 2.0); var bar = new TBar( DateTime.UtcNow.AddMinutes(i), price + 0.5, price + 0.5, price - 0.5, price, 1000); diff --git a/lib/dynamics/vortex/tests/Vortex.Tests.cs b/lib/dynamics/vortex/tests/Vortex.Tests.cs index 3518d31b..e5575730 100644 --- a/lib/dynamics/vortex/tests/Vortex.Tests.cs +++ b/lib/dynamics/vortex/tests/Vortex.Tests.cs @@ -172,8 +172,8 @@ public class VortexTests // VI- = 17 / 27 ≈ 0.630 Assert.True(vortex.IsHot); - Assert.True(Math.Abs(vortex.ViPlus.Value - 32.0 / 27.0) < 0.001); - Assert.True(Math.Abs(vortex.ViMinus.Value - 17.0 / 27.0) < 0.001); + Assert.True(Math.Abs(vortex.ViPlus.Value - (32.0 / 27.0)) < 0.001); + Assert.True(Math.Abs(vortex.ViMinus.Value - (17.0 / 27.0)) < 0.001); } [Fact] @@ -205,8 +205,8 @@ public class VortexTests for (int i = 0; i < 50; i++) { - double price = basePrice + i * 2; // Strong uptrend - var bar = new TBar(baseTime + i * 60000, price, price + 1, price - 0.5, price + 0.5, 1000); + double price = basePrice + (i * 2); // Strong uptrend + var bar = new TBar(baseTime + (i * 60000), price, price + 1, price - 0.5, price + 0.5, 1000); vortex.Update(bar); } @@ -225,8 +225,8 @@ public class VortexTests for (int i = 0; i < 50; i++) { - double price = basePrice - i * 2; // Strong downtrend - var bar = new TBar(baseTime + i * 60000, price, price + 0.5, price - 1, price - 0.5, 1000); + double price = basePrice - (i * 2); // Strong downtrend + var bar = new TBar(baseTime + (i * 60000), price, price + 0.5, price - 1, price - 0.5, 1000); vortex.Update(bar); } diff --git a/lib/errors/huber/tests/Huber.Tests.cs b/lib/errors/huber/tests/Huber.Tests.cs index aacf2712..e90f16d0 100644 --- a/lib/errors/huber/tests/Huber.Tests.cs +++ b/lib/errors/huber/tests/Huber.Tests.cs @@ -39,10 +39,10 @@ public class HuberTests for (int i = 0; i < period - 1; i++) { Assert.False(huber.IsHot, $"IsHot should be false at index {i}"); - huber.Update(i * 10, i * 10 + 5); + huber.Update(i * 10, (i * 10) + 5); } - huber.Update((period - 1) * 10, (period - 1) * 10 + 5); + huber.Update((period - 1) * 10, ((period - 1) * 10) + 5); Assert.True(huber.IsHot, "IsHot should be true after period updates"); } @@ -70,7 +70,7 @@ public class HuberTests // Error = 10 (large), Huber = delta * |error| - 0.5 * delta^2 = 1 * 10 - 0.5 = 9.5 var res1 = huber.Update(110, 100); - Assert.Equal(delta * 10 - halfDeltaSquared, res1.Value, 10); + Assert.Equal((delta * 10) - halfDeltaSquared, res1.Value, 10); } [Fact] @@ -89,7 +89,7 @@ public class HuberTests var aboveDelta = huber2.Update(105.1, 100); // Should be very close to quadratic at transition // delta * 5.1 - 0.5 * delta^2 = 5 * 5.1 - 12.5 = 25.5 - 12.5 = 13 - double expected = delta * 5.1 - 0.5 * delta * delta; + double expected = (delta * 5.1) - (0.5 * delta * delta); Assert.Equal(expected, aboveDelta.Value, 5); } @@ -163,7 +163,7 @@ public class HuberTests for (int i = 0; i < 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; huber.Update(tenthActual, tenthPredicted); } @@ -188,7 +188,7 @@ public class HuberTests for (int i = 0; i < 10; i++) { - huber.Update(i * 10, i * 10 + 5); + huber.Update(i * 10, (i * 10) + 5); } Assert.True(huber.IsHot); @@ -267,7 +267,7 @@ public class HuberTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; // Offset prediction + predicted[i] = (bar.Close * 1.05) + 2; // Offset prediction } // Streaming diff --git a/lib/errors/logcosh/tests/LogCosh.Tests.cs b/lib/errors/logcosh/tests/LogCosh.Tests.cs index ec4c0a9c..eb28f947 100644 --- a/lib/errors/logcosh/tests/LogCosh.Tests.cs +++ b/lib/errors/logcosh/tests/LogCosh.Tests.cs @@ -398,7 +398,7 @@ public class LogCoshTests for (int i = 0; i < 100; i++) { var bar = gbm.Next(isNew: true); - logCosh.Update(bar.Close, bar.Close * (1 + (i % 3 - 1) * 0.1)); + logCosh.Update(bar.Close, bar.Close * (1 + (((i % 3) - 1) * 0.1))); Assert.True(logCosh.Last.Value >= 0, $"LogCosh should be non-negative, got {logCosh.Last.Value}"); } } diff --git a/lib/errors/mae/tests/Mae.Tests.cs b/lib/errors/mae/tests/Mae.Tests.cs index 9f3fb99c..13ffa661 100644 --- a/lib/errors/mae/tests/Mae.Tests.cs +++ b/lib/errors/mae/tests/Mae.Tests.cs @@ -34,10 +34,10 @@ public class MaeTests for (int i = 0; i < period - 1; i++) { Assert.False(mae.IsHot, $"IsHot should be false at index {i}"); - mae.Update(i * 10, i * 10 + 5); + mae.Update(i * 10, (i * 10) + 5); } - mae.Update((period - 1) * 10, (period - 1) * 10 + 5); + mae.Update((period - 1) * 10, ((period - 1) * 10) + 5); Assert.True(mae.IsHot, "IsHot should be true after period updates"); } @@ -146,7 +146,7 @@ public class MaeTests for (int i = 0; i < 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; mae.Update(tenthActual, tenthPredicted); } @@ -171,7 +171,7 @@ public class MaeTests for (int i = 0; i < 10; i++) { - mae.Update(i * 10, i * 10 + 5); + mae.Update(i * 10, (i * 10) + 5); } Assert.True(mae.IsHot); @@ -249,7 +249,7 @@ public class MaeTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; // Offset prediction + predicted[i] = (bar.Close * 1.05) + 2; // Offset prediction } // Streaming @@ -305,7 +305,7 @@ public class MaeTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10); - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); } var results = Mae.Batch(actual, predicted, 3); diff --git a/lib/errors/mapd/tests/Mapd.Tests.cs b/lib/errors/mapd/tests/Mapd.Tests.cs index df964981..8095d26e 100644 --- a/lib/errors/mapd/tests/Mapd.Tests.cs +++ b/lib/errors/mapd/tests/Mapd.Tests.cs @@ -56,7 +56,7 @@ public class MapdTests // |50 - 60| / 60 * 100 = 16.666...% var res3 = mapd.Update(50, 60); - double expected = (100.0 * 10 / 110 + 100.0 * 20 / 220 + 100.0 * 10 / 60) / 3; + double expected = ((100.0 * 10 / 110) + (100.0 * 20 / 220) + (100.0 * 10 / 60)) / 3; Assert.Equal(expected, res3.Value, 10); } @@ -130,7 +130,7 @@ public class MapdTests for (int i = 1; i <= 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; mapd.Update(tenthActual, tenthPredicted); } @@ -155,7 +155,7 @@ public class MapdTests for (int i = 1; i <= 10; i++) { - mapd.Update(i * 10, i * 10 + 5); + mapd.Update(i * 10, (i * 10) + 5); } Assert.True(mapd.IsHot); @@ -233,7 +233,7 @@ public class MapdTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; // Offset prediction + predicted[i] = (bar.Close * 1.05) + 2; // Offset prediction } // Streaming diff --git a/lib/errors/mape/tests/Mape.Tests.cs b/lib/errors/mape/tests/Mape.Tests.cs index d42d72b0..7030f6f2 100644 --- a/lib/errors/mape/tests/Mape.Tests.cs +++ b/lib/errors/mape/tests/Mape.Tests.cs @@ -146,7 +146,7 @@ public class MapeTests for (int i = 1; i <= 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; mape.Update(tenthActual, tenthPredicted); } @@ -171,7 +171,7 @@ public class MapeTests for (int i = 1; i <= 10; i++) { - mape.Update(i * 10, i * 10 + 5); + mape.Update(i * 10, (i * 10) + 5); } Assert.True(mape.IsHot); @@ -249,7 +249,7 @@ public class MapeTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; // Offset prediction + predicted[i] = (bar.Close * 1.05) + 2; // Offset prediction } // Streaming diff --git a/lib/errors/mase/tests/Mase.Tests.cs b/lib/errors/mase/tests/Mase.Tests.cs index f5eef5e3..f068cfbd 100644 --- a/lib/errors/mase/tests/Mase.Tests.cs +++ b/lib/errors/mase/tests/Mase.Tests.cs @@ -198,7 +198,7 @@ public class MaseTests // Generate data where prediction is always perfect for (int i = 0; i < 20; i++) { - double actual = 100 + i * 2; + double actual = 100 + (i * 2); double perfect = actual; // Perfect prediction mase.Update(new TValue(time.AddSeconds(i), actual), new TValue(time.AddSeconds(i), perfect)); } diff --git a/lib/errors/me/tests/Me.Tests.cs b/lib/errors/me/tests/Me.Tests.cs index e8c622e9..2c437db0 100644 --- a/lib/errors/me/tests/Me.Tests.cs +++ b/lib/errors/me/tests/Me.Tests.cs @@ -34,10 +34,10 @@ public class MeTests for (int i = 0; i < period - 1; i++) { Assert.False(me.IsHot, $"IsHot should be false at index {i}"); - me.Update(i * 10, i * 10 + 5); + me.Update(i * 10, (i * 10) + 5); } - me.Update((period - 1) * 10, (period - 1) * 10 + 5); + me.Update((period - 1) * 10, ((period - 1) * 10) + 5); Assert.True(me.IsHot, "IsHot should be true after period updates"); } @@ -172,7 +172,7 @@ public class MeTests for (int i = 0; i < 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; me.Update(tenthActual, tenthPredicted); } @@ -197,7 +197,7 @@ public class MeTests for (int i = 0; i < 10; i++) { - me.Update(i * 10, i * 10 + 5); + me.Update(i * 10, (i * 10) + 5); } Assert.True(me.IsHot); @@ -275,7 +275,7 @@ public class MeTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; // Offset prediction + predicted[i] = (bar.Close * 1.05) + 2; // Offset prediction } // Streaming @@ -331,7 +331,7 @@ public class MeTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10); - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); } var results = Me.Batch(actual, predicted, 3); diff --git a/lib/errors/mrae/tests/Mrae.Tests.cs b/lib/errors/mrae/tests/Mrae.Tests.cs index 3632c428..72d85ba6 100644 --- a/lib/errors/mrae/tests/Mrae.Tests.cs +++ b/lib/errors/mrae/tests/Mrae.Tests.cs @@ -34,10 +34,10 @@ public class MraeTests for (int i = 1; i <= period - 1; i++) { Assert.False(mrae.IsHot, $"IsHot should be false at index {i}"); - mrae.Update(i * 10, i * 10 + 5); + mrae.Update(i * 10, (i * 10) + 5); } - mrae.Update(period * 10, period * 10 + 5); + mrae.Update(period * 10, (period * 10) + 5); Assert.True(mrae.IsHot, "IsHot should be true after period updates"); } @@ -127,7 +127,7 @@ public class MraeTests for (int i = 1; i <= 10; i++) { tenthActual = i * 100; - tenthPredicted = i * 100 + 10; + tenthPredicted = (i * 100) + 10; mrae.Update(tenthActual, tenthPredicted); } @@ -152,7 +152,7 @@ public class MraeTests for (int i = 1; i <= 10; i++) { - mrae.Update(i * 10, i * 10 + 5); + mrae.Update(i * 10, (i * 10) + 5); } Assert.True(mrae.IsHot); @@ -230,7 +230,7 @@ public class MraeTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; + predicted[i] = (bar.Close * 1.05) + 2; } // Streaming diff --git a/lib/errors/mse/tests/Mse.Tests.cs b/lib/errors/mse/tests/Mse.Tests.cs index 16c395fc..e573c5ed 100644 --- a/lib/errors/mse/tests/Mse.Tests.cs +++ b/lib/errors/mse/tests/Mse.Tests.cs @@ -34,10 +34,10 @@ public class MseTests for (int i = 0; i < period - 1; i++) { Assert.False(mse.IsHot, $"IsHot should be false at index {i}"); - mse.Update(i * 10, i * 10 + 5); + mse.Update(i * 10, (i * 10) + 5); } - mse.Update((period - 1) * 10, (period - 1) * 10 + 5); + mse.Update((period - 1) * 10, ((period - 1) * 10) + 5); Assert.True(mse.IsHot, "IsHot should be true after period updates"); } @@ -152,7 +152,7 @@ public class MseTests for (int i = 0; i < 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; mse.Update(tenthActual, tenthPredicted); } @@ -177,7 +177,7 @@ public class MseTests for (int i = 0; i < 10; i++) { - mse.Update(i * 10, i * 10 + 5); + mse.Update(i * 10, (i * 10) + 5); } Assert.True(mse.IsHot); @@ -237,7 +237,7 @@ public class MseTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; + predicted[i] = (bar.Close * 1.05) + 2; } // Streaming @@ -284,7 +284,7 @@ public class MseTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10); - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); } var results = Mse.Batch(actual, predicted, 3); diff --git a/lib/errors/pseudohuber/tests/PseudoHuber.Tests.cs b/lib/errors/pseudohuber/tests/PseudoHuber.Tests.cs index 748c12b0..e4d30e9f 100644 --- a/lib/errors/pseudohuber/tests/PseudoHuber.Tests.cs +++ b/lib/errors/pseudohuber/tests/PseudoHuber.Tests.cs @@ -204,7 +204,7 @@ public class PseudoHuberTests for (int i = 0; i < 100; i++) { var bar = gbm.Next(); - pseudoHuber.Update(bar.Close, bar.Close + (i % 2 == 0 ? 1 : -1) * (i + 1)); + pseudoHuber.Update(bar.Close, bar.Close + ((i % 2 == 0 ? 1 : -1) * (i + 1))); Assert.True(pseudoHuber.Last.Value >= 0, "Pseudo-Huber loss should always be non-negative"); } } diff --git a/lib/errors/quantileloss/tests/QuantileLoss.Tests.cs b/lib/errors/quantileloss/tests/QuantileLoss.Tests.cs index 6187feca..5ed9765b 100644 --- a/lib/errors/quantileloss/tests/QuantileLoss.Tests.cs +++ b/lib/errors/quantileloss/tests/QuantileLoss.Tests.cs @@ -381,7 +381,7 @@ public class QuantileLossTests for (int i = 0; i < 100; i++) { var bar = gbm.Next(isNew: true); - quantileLoss.Update(bar.Close, bar.Close * (1 + (i % 3 - 1) * 0.1)); + quantileLoss.Update(bar.Close, bar.Close * (1 + (((i % 3) - 1) * 0.1))); Assert.True(quantileLoss.Last.Value >= 0, $"QuantileLoss should be non-negative, got {quantileLoss.Last.Value}"); } } diff --git a/lib/errors/rae/tests/Rae.Tests.cs b/lib/errors/rae/tests/Rae.Tests.cs index 801f4396..5116ed01 100644 --- a/lib/errors/rae/tests/Rae.Tests.cs +++ b/lib/errors/rae/tests/Rae.Tests.cs @@ -148,7 +148,7 @@ public class RaeTests // Different actual values but perfect predictions for (int i = 0; i < 20; i++) { - double val = 100 + i * 2; + double val = 100 + (i * 2); rae.Update(new TValue(time.AddSeconds(i), val), new TValue(time.AddSeconds(i), val)); } diff --git a/lib/errors/rmse/tests/Rmse.Tests.cs b/lib/errors/rmse/tests/Rmse.Tests.cs index f78d23fd..ce3ce0fd 100644 --- a/lib/errors/rmse/tests/Rmse.Tests.cs +++ b/lib/errors/rmse/tests/Rmse.Tests.cs @@ -34,10 +34,10 @@ public class RmseTests for (int i = 0; i < period - 1; i++) { Assert.False(rmse.IsHot); - rmse.Update(i * 10, i * 10 + 5); + rmse.Update(i * 10, (i * 10) + 5); } - rmse.Update((period - 1) * 10, (period - 1) * 10 + 5); + rmse.Update((period - 1) * 10, ((period - 1) * 10) + 5); Assert.True(rmse.IsHot); } @@ -67,8 +67,8 @@ public class RmseTests for (int i = 0; i < 20; i++) { - rmse.Update(i * 10, i * 10 + 7); - mse.Update(i * 10, i * 10 + 7); + rmse.Update(i * 10, (i * 10) + 7); + mse.Update(i * 10, (i * 10) + 7); } Assert.Equal(Math.Sqrt(mse.Last.Value), rmse.Last.Value, 10); @@ -127,7 +127,7 @@ public class RmseTests for (int i = 0; i < 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; rmse.Update(tenthActual, tenthPredicted); } @@ -150,7 +150,7 @@ public class RmseTests for (int i = 0; i < 10; i++) { - rmse.Update(i * 10, i * 10 + 5); + rmse.Update(i * 10, (i * 10) + 5); } Assert.True(rmse.IsHot); @@ -196,7 +196,7 @@ public class RmseTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; + predicted[i] = (bar.Close * 1.05) + 2; } var rmse = new Rmse(period); @@ -238,7 +238,7 @@ public class RmseTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10); - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); } var results = Rmse.Batch(actual, predicted, 3); diff --git a/lib/errors/rmsle/tests/Rmsle.Tests.cs b/lib/errors/rmsle/tests/Rmsle.Tests.cs index 3330715c..fe263232 100644 --- a/lib/errors/rmsle/tests/Rmsle.Tests.cs +++ b/lib/errors/rmsle/tests/Rmsle.Tests.cs @@ -362,7 +362,7 @@ public class RmsleTests for (int i = 0; i < 100; i++) { var bar = gbm.Next(isNew: true); - var result = rmsle.Update(bar.Close, bar.Close * (0.8 + 0.4 * (i % 2))); + var result = rmsle.Update(bar.Close, bar.Close * (0.8 + (0.4 * (i % 2)))); Assert.True(result.Value >= 0, $"RMSLE should always be non-negative, got {result.Value}"); } } diff --git a/lib/errors/rse/tests/Rse.Tests.cs b/lib/errors/rse/tests/Rse.Tests.cs index ec784ad3..c34dfb93 100644 --- a/lib/errors/rse/tests/Rse.Tests.cs +++ b/lib/errors/rse/tests/Rse.Tests.cs @@ -148,7 +148,7 @@ public class RseTests // Different actual values but perfect predictions for (int i = 0; i < 20; i++) { - double val = 100 + i * 2; + double val = 100 + (i * 2); rse.Update(new TValue(time.AddSeconds(i), val), new TValue(time.AddSeconds(i), val)); } @@ -165,8 +165,8 @@ public class RseTests // Generate data with some error for (int i = 0; i < 20; i++) { - double actual = 100 + i * 2; - double predicted = actual + (i % 3 - 1) * 2; // Small systematic error + double actual = 100 + (i * 2); + double predicted = actual + (((i % 3) - 1) * 2); // Small systematic error rse.Update(new TValue(time.AddSeconds(i), actual), new TValue(time.AddSeconds(i), predicted)); } diff --git a/lib/errors/rsquared/tests/Rsquared.Tests.cs b/lib/errors/rsquared/tests/Rsquared.Tests.cs index cbab3b15..b7cc3098 100644 --- a/lib/errors/rsquared/tests/Rsquared.Tests.cs +++ b/lib/errors/rsquared/tests/Rsquared.Tests.cs @@ -147,7 +147,7 @@ public class RsquaredTests // Different actual values but perfect predictions for (int i = 0; i < 20; i++) { - double val = 100 + i * 2; + double val = 100 + (i * 2); r2.Update(new TValue(time.AddSeconds(i), val), new TValue(time.AddSeconds(i), val)); } @@ -165,8 +165,8 @@ public class RsquaredTests // Generate data with some error for (int i = 0; i < 20; i++) { - double actual = 100 + i * 2; - double predicted = actual + (i % 3 - 1) * 2; + double actual = 100 + (i * 2); + double predicted = actual + (((i % 3) - 1) * 2); r2.Update(new TValue(time.AddSeconds(i), actual), new TValue(time.AddSeconds(i), predicted)); rse.Update(new TValue(time.AddSeconds(i), actual), new TValue(time.AddSeconds(i), predicted)); } @@ -210,7 +210,7 @@ public class RsquaredTests // Linear trend with small random noise in predictions for (int i = 0; i < 20; i++) { - double actual = 100 + i * 2; + double actual = 100 + (i * 2); double predicted = actual + (i % 2 == 0 ? 0.5 : -0.5); // Small systematic error r2.Update(new TValue(time.AddSeconds(i), actual), new TValue(time.AddSeconds(i), predicted)); } @@ -261,8 +261,8 @@ public class RsquaredTests for (int i = 0; i < 100; i++) { - double actual = 100 + Math.Sin(i * 0.1) * 20; - double predicted = actual + (i % 5 - 2); // Small systematic error + double actual = 100 + (Math.Sin(i * 0.1) * 20); + double predicted = actual + ((i % 5) - 2); // Small systematic error r2.Update(new TValue(time.AddSeconds(i), actual), new TValue(time.AddSeconds(i), predicted)); // R² should never exceed 1 diff --git a/lib/errors/tukeybiweight/tests/TukeyBiweight.Tests.cs b/lib/errors/tukeybiweight/tests/TukeyBiweight.Tests.cs index d0863d0c..376f226b 100644 --- a/lib/errors/tukeybiweight/tests/TukeyBiweight.Tests.cs +++ b/lib/errors/tukeybiweight/tests/TukeyBiweight.Tests.cs @@ -361,7 +361,7 @@ public class TukeyBiweightTests for (int i = 0; i < 100; i++) { var bar = gbm.Next(isNew: true); - tukey.Update(bar.Close, bar.Close * (1 + (i % 3 - 1) * 0.2)); + tukey.Update(bar.Close, bar.Close * (1 + (((i % 3) - 1) * 0.2))); Assert.True(tukey.Last.Value >= 0, $"Loss should be non-negative, got {tukey.Last.Value}"); Assert.True(tukey.Last.Value <= maxLoss, $"Loss should be <= {maxLoss}, got {tukey.Last.Value}"); } diff --git a/lib/errors/wrmse/tests/Wrmse.Tests.cs b/lib/errors/wrmse/tests/Wrmse.Tests.cs index b84ce29e..76b02a7a 100644 --- a/lib/errors/wrmse/tests/Wrmse.Tests.cs +++ b/lib/errors/wrmse/tests/Wrmse.Tests.cs @@ -34,10 +34,10 @@ public class WrmseTests for (int i = 0; i < period - 1; i++) { Assert.False(wrmse.IsHot); - wrmse.Update(i * 10, i * 10 + 5); + wrmse.Update(i * 10, (i * 10) + 5); } - wrmse.Update((period - 1) * 10, (period - 1) * 10 + 5); + wrmse.Update((period - 1) * 10, ((period - 1) * 10) + 5); Assert.True(wrmse.IsHot); } @@ -49,8 +49,8 @@ public class WrmseTests for (int i = 0; i < 20; i++) { - wrmse.Update(i * 10, i * 10 + 7); - rmse.Update(i * 10, i * 10 + 7); + wrmse.Update(i * 10, (i * 10) + 7); + rmse.Update(i * 10, (i * 10) + 7); } // With default weight of 1.0, WRMSE should equal RMSE @@ -154,7 +154,7 @@ public class WrmseTests for (int i = 0; i < 10; i++) { tenthActual = i * 10; - tenthPredicted = i * 10 + 5; + tenthPredicted = (i * 10) + 5; tenthWeight = i + 1.0; wrmse.Update(tenthActual, tenthPredicted, tenthWeight); } @@ -178,7 +178,7 @@ public class WrmseTests for (int i = 0; i < 10; i++) { - wrmse.Update(i * 10, i * 10 + 5, i + 1.0); + wrmse.Update(i * 10, (i * 10) + 5, i + 1.0); } Assert.True(wrmse.IsHot); @@ -238,7 +238,7 @@ public class WrmseTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; + predicted[i] = (bar.Close * 1.05) + 2; } var wrmse = new Wrmse(period); @@ -271,7 +271,7 @@ public class WrmseTests { var bar = gbm.Next(); actual[i] = bar.Close; - predicted[i] = bar.Close * 1.05 + 2; + predicted[i] = (bar.Close * 1.05) + 2; weights[i] = (i % 5) + 1.0; // Varying weights 1-5 } @@ -317,7 +317,7 @@ public class WrmseTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10); - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); } var results = Wrmse.Batch(actual, predicted, 3); @@ -362,7 +362,7 @@ public class WrmseTests actual.Add(now.AddMinutes(i), i * 10); if (i < 5) { - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); } } @@ -380,7 +380,7 @@ public class WrmseTests for (int i = 0; i < 10; i++) { actual.Add(now.AddMinutes(i), i * 10); - predicted.Add(now.AddMinutes(i), i * 10 + 5); + predicted.Add(now.AddMinutes(i), (i * 10) + 5); if (i < 5) { weights.Add(now.AddMinutes(i), 1.0); diff --git a/lib/filters/agc/tests/Agc.Tests.cs b/lib/filters/agc/tests/Agc.Tests.cs index e4156fdf..deb0fa6c 100644 --- a/lib/filters/agc/tests/Agc.Tests.cs +++ b/lib/filters/agc/tests/Agc.Tests.cs @@ -2,7 +2,6 @@ namespace QuanTAlib; public class AgcTests { - // Helper: generate a sine wave that oscillates around zero private static TSeries MakeSineWave(int count, double amplitude = 1.0, double period = 20.0) { diff --git a/lib/filters/agc/tests/Agc.Validation.Tests.cs b/lib/filters/agc/tests/Agc.Validation.Tests.cs index ac2e56ca..96514f08 100644 --- a/lib/filters/agc/tests/Agc.Validation.Tests.cs +++ b/lib/filters/agc/tests/Agc.Validation.Tests.cs @@ -43,7 +43,7 @@ public class AgcValidationTests double[] input = new double[T]; for (int i = 0; i < T; i++) { - double amplitude = 1.0 + i * 0.01; // grows from 1 to 11 + double amplitude = 1.0 + (i * 0.01); // grows from 1 to 11 input[i] = amplitude * Math.Sin(2.0 * Math.PI * i / 20.0); } @@ -92,7 +92,7 @@ public class AgcValidationTests double[] input = new double[500]; for (int i = 0; i < input.Length; i++) { - input[i] = Math.Sin(2.0 * Math.PI * i / 25.0) * (1.0 + 0.3 * Math.Sin(2.0 * Math.PI * i / 100.0)); + input[i] = Math.Sin(2.0 * Math.PI * i / 25.0) * (1.0 + (0.3 * Math.Sin(2.0 * Math.PI * i / 100.0))); } double[] out1 = new double[input.Length]; diff --git a/lib/filters/alaguerre/tests/ALaguerre.Tests.cs b/lib/filters/alaguerre/tests/ALaguerre.Tests.cs index 40997820..9a7581eb 100644 --- a/lib/filters/alaguerre/tests/ALaguerre.Tests.cs +++ b/lib/filters/alaguerre/tests/ALaguerre.Tests.cs @@ -561,7 +561,7 @@ public class ALaguerreTests // Trending input: 100, 110, 120, ... for (int i = 0; i < 30; i++) { - alTrend.Update(new TValue(DateTime.UtcNow, 100 + i * 10.0)); + alTrend.Update(new TValue(DateTime.UtcNow, 100 + (i * 10.0))); } // Flat input: constant 100 diff --git a/lib/filters/alaguerre/tests/ALaguerre.Validation.Tests.cs b/lib/filters/alaguerre/tests/ALaguerre.Validation.Tests.cs index b74befb0..9e0f80de 100644 --- a/lib/filters/alaguerre/tests/ALaguerre.Validation.Tests.cs +++ b/lib/filters/alaguerre/tests/ALaguerre.Validation.Tests.cs @@ -173,7 +173,7 @@ public sealed class ALaguerreValidationTests : IDisposable Assert.True(filteredVariance < sourceVariance, $"Filtered variance ({filteredVariance:F6}) should be less than source variance ({sourceVariance:F6})"); - _output.WriteLine($"Variance: source={sourceVariance:F6}, filtered={filteredVariance:F6}, reduction={1 - filteredVariance / sourceVariance:P2}"); + _output.WriteLine($"Variance: source={sourceVariance:F6}, filtered={filteredVariance:F6}, reduction={1 - (filteredVariance / sourceVariance):P2}"); } [Fact] @@ -202,7 +202,7 @@ public sealed class ALaguerreValidationTests : IDisposable var trendSeries = new TSeries(); for (int i = 0; i < 50; i++) { - trendSeries.Add(DateTime.UtcNow.Ticks + i, 100.0 + i * 5.0); + trendSeries.Add(DateTime.UtcNow.Ticks + i, 100.0 + (i * 5.0)); } foreach (var item in trendSeries) diff --git a/lib/filters/baxterking/tests/BaxterKing.Tests.cs b/lib/filters/baxterking/tests/BaxterKing.Tests.cs index 2fe22c04..9a22f6a6 100644 --- a/lib/filters/baxterking/tests/BaxterKing.Tests.cs +++ b/lib/filters/baxterking/tests/BaxterKing.Tests.cs @@ -246,7 +246,7 @@ public class BaxterKingTests var ind = new BaxterKing(6, 32, 5); // filterLen = 11 for (int i = 0; i < 10; i++) { - double v = ind.Update(new TValue(DateTime.UtcNow, 100 + i * 0.5)).Value; + double v = ind.Update(new TValue(DateTime.UtcNow, 100 + (i * 0.5))).Value; Assert.Equal(0.0, v, 15); } } diff --git a/lib/filters/butter2/tests/Butter2.Validation.Tests.cs b/lib/filters/butter2/tests/Butter2.Validation.Tests.cs index d9c54483..6cb0353a 100644 --- a/lib/filters/butter2/tests/Butter2.Validation.Tests.cs +++ b/lib/filters/butter2/tests/Butter2.Validation.Tests.cs @@ -117,7 +117,7 @@ public class Butter2ValidationTests else { double ssrc = src; - filt = (b0 * ssrc + b1 * src1 + b2 * src2 - a1 * filt1 - a2 * filt2) / a0; + filt = ((b0 * ssrc) + (b1 * src1) + (b2 * src2) - (a1 * filt1) - (a2 * filt2)) / a0; } result.Add(filt); diff --git a/lib/filters/butter3/tests/Butter3.Validation.Tests.cs b/lib/filters/butter3/tests/Butter3.Validation.Tests.cs index db94abd7..69002d3f 100644 --- a/lib/filters/butter3/tests/Butter3.Validation.Tests.cs +++ b/lib/filters/butter3/tests/Butter3.Validation.Tests.cs @@ -68,7 +68,7 @@ public class Butter3ValidationTests double c1 = a1 * a1; double coef2 = b1 + c1; - double coef3 = -(c1 + b1 * c1); + double coef3 = -(c1 + (b1 * c1)); double coef4 = c1 * c1; double coef1 = (1.0 - b1 + c1) * (1.0 - c1) / 8.0; @@ -85,8 +85,8 @@ public class Butter3ValidationTests } else { - filt = coef1 * (src + 3.0 * src1 + 3.0 * src2 + src3) - + coef2 * filt1 + coef3 * filt2 + coef4 * filt3; + filt = (coef1 * (src + (3.0 * src1) + (3.0 * src2) + src3)) + + (coef2 * filt1) + (coef3 * filt2) + (coef4 * filt3); } result.Add(filt); diff --git a/lib/filters/cfitz/tests/Cfitz.Validation.Tests.cs b/lib/filters/cfitz/tests/Cfitz.Validation.Tests.cs index 79d48118..a6f4ce68 100644 --- a/lib/filters/cfitz/tests/Cfitz.Validation.Tests.cs +++ b/lib/filters/cfitz/tests/Cfitz.Validation.Tests.cs @@ -57,7 +57,7 @@ public class CfitzValidationTests double[] input = new double[200]; for (int i = 0; i < 200; i++) { - input[i] = 100.0 + 0.5 * i; // linear trend + input[i] = 100.0 + (0.5 * i); // linear trend } double[] output = new double[200]; Cfitz.Batch(input, output, 6, 32); diff --git a/lib/filters/elliptic/tests/Elliptic.Validation.Tests.cs b/lib/filters/elliptic/tests/Elliptic.Validation.Tests.cs index 113b8515..fd98d5cc 100644 --- a/lib/filters/elliptic/tests/Elliptic.Validation.Tests.cs +++ b/lib/filters/elliptic/tests/Elliptic.Validation.Tests.cs @@ -30,7 +30,7 @@ public sealed class EllipticValidationTests : IDisposable var noisySignal = new List(N); for (int i = 0; i < N; i++) { - noisySignal.Add(100.0 + (closes[i + 1] / closes[i] - 1.0) * 1000.0); // amplified jitter around 100 + noisySignal.Add(100.0 + (((closes[i + 1] / closes[i]) - 1.0) * 1000.0)); // amplified jitter around 100 } var output = new List(); diff --git a/lib/filters/gauss/tests/Gauss.Tests.cs b/lib/filters/gauss/tests/Gauss.Tests.cs index f5676b24..a7179cdd 100644 --- a/lib/filters/gauss/tests/Gauss.Tests.cs +++ b/lib/filters/gauss/tests/Gauss.Tests.cs @@ -45,7 +45,7 @@ public class GaussTests var source = new TSeries(); for (int i = 0; i < 50; i++) { - source.Add(new TValue(DateTime.MinValue.AddSeconds(i), 100 + Math.Sin(i * 0.1) * 10)); + source.Add(new TValue(DateTime.MinValue.AddSeconds(i), 100 + (Math.Sin(i * 0.1) * 10))); } var gauss = new Gauss(1.0); diff --git a/lib/filters/gauss/tests/Gauss.Validation.Tests.cs b/lib/filters/gauss/tests/Gauss.Validation.Tests.cs index 8135c528..efcc3c05 100644 --- a/lib/filters/gauss/tests/Gauss.Validation.Tests.cs +++ b/lib/filters/gauss/tests/Gauss.Validation.Tests.cs @@ -44,7 +44,7 @@ public class GaussValidationTests : IDisposable /// private static double[] CalculateExpectedGauss(double[] source, double sigma) { - int kernelSize = (int)(2 * Math.Ceiling(3.0 * sigma) + 1); + int kernelSize = (int)((2 * Math.Ceiling(3.0 * sigma)) + 1); double[] weights = new double[kernelSize]; double sum = 0; int center = kernelSize / 2; diff --git a/lib/filters/hp/tests/Hp.Validation.Tests.cs b/lib/filters/hp/tests/Hp.Validation.Tests.cs index 5a83d167..e9fa14ea 100644 --- a/lib/filters/hp/tests/Hp.Validation.Tests.cs +++ b/lib/filters/hp/tests/Hp.Validation.Tests.cs @@ -54,7 +54,7 @@ public class HpValidationTests : IDisposable var result = new List(); double s = Math.Sqrt(lambda); - double alpha = (s * 0.5 - 1.0) / (s * 0.5 + 1.0); + double alpha = ((s * 0.5) - 1.0) / ((s * 0.5) + 1.0); alpha = Math.Max(alpha, 0.0001); alpha = Math.Min(alpha, 0.9999); @@ -75,9 +75,9 @@ public class HpValidationTests : IDisposable } else { - hp_trend = (1.0 - alpha) * price + - alpha * prev_trend + - 0.5 * alpha * (prev_trend - prev_prev_trend); + hp_trend = ((1.0 - alpha) * price) + + (alpha * prev_trend) + + (0.5 * alpha * (prev_trend - prev_prev_trend)); prev_prev_trend = prev_trend; prev_trend = hp_trend; diff --git a/lib/filters/hpf/tests/Hpf.Tests.cs b/lib/filters/hpf/tests/Hpf.Tests.cs index a4da9add..ab1500b3 100644 --- a/lib/filters/hpf/tests/Hpf.Tests.cs +++ b/lib/filters/hpf/tests/Hpf.Tests.cs @@ -20,7 +20,6 @@ public class HpfTests Assert.StartsWith("HPF", hpf.Name, StringComparison.Ordinal); } - [Fact] public void Calc_ReturnsValue() { diff --git a/lib/filters/hpf/tests/Hpf.Validation.Tests.cs b/lib/filters/hpf/tests/Hpf.Validation.Tests.cs index 77c28580..915cbc09 100644 --- a/lib/filters/hpf/tests/Hpf.Validation.Tests.cs +++ b/lib/filters/hpf/tests/Hpf.Validation.Tests.cs @@ -122,7 +122,7 @@ public class HpfValidationTests : IDisposable { double ssrc = src[i]; - double term1 = coeff1 * (ssrc - 2.0 * src1 + src2); + double term1 = coeff1 * (ssrc - (2.0 * src1) + src2); double term2 = coeff2 * hp1; double term3 = coeff3 * hp2; diff --git a/lib/filters/kalman/tests/Kalman.Validation.Tests.cs b/lib/filters/kalman/tests/Kalman.Validation.Tests.cs index 77bae293..dc0027d3 100644 --- a/lib/filters/kalman/tests/Kalman.Validation.Tests.cs +++ b/lib/filters/kalman/tests/Kalman.Validation.Tests.cs @@ -67,7 +67,7 @@ public class KalmanValidationTests : IDisposable double k = p_pred / denom; // Update - x = x + k * (input[i] - x); + x = x + (k * (input[i] - x)); // p = (1 - k) * pPred // But implementation uses: p = (pPred * r) / denom diff --git a/lib/filters/laguerre/tests/Laguerre.Validation.Tests.cs b/lib/filters/laguerre/tests/Laguerre.Validation.Tests.cs index e9dcb14c..6699ba28 100644 --- a/lib/filters/laguerre/tests/Laguerre.Validation.Tests.cs +++ b/lib/filters/laguerre/tests/Laguerre.Validation.Tests.cs @@ -129,7 +129,7 @@ public sealed class LaguerreValidationTests : IDisposable else if (i >= 4) { // After warmup: FIR = (input + 2*prev1 + 2*prev2 + prev3) / 6 - double expectedFir = (input + 2.0 * prev0 + 2.0 * prev1 + prev2) / 6.0; + double expectedFir = (input + (2.0 * prev0) + (2.0 * prev1) + prev2) / 6.0; Assert.Equal(expectedFir, lagResult, 1e-10); } @@ -326,6 +326,6 @@ public sealed class LaguerreValidationTests : IDisposable } double mean = sum / n; - return Math.Max(0, sumSq / n - mean * mean); + return Math.Max(0, (sumSq / n) - (mean * mean)); } } diff --git a/lib/filters/lms/tests/Lms.Validation.Tests.cs b/lib/filters/lms/tests/Lms.Validation.Tests.cs index 3c0bea2f..82d3fff6 100644 --- a/lib/filters/lms/tests/Lms.Validation.Tests.cs +++ b/lib/filters/lms/tests/Lms.Validation.Tests.cs @@ -16,7 +16,7 @@ public class LmsValidationTests double[] sine = new double[T]; for (int i = 0; i < T; i++) { - sine[i] = 100.0 + 10.0 * Math.Sin(2 * Math.PI * i / 40.0); + sine[i] = 100.0 + (10.0 * Math.Sin(2 * Math.PI * i / 40.0)); } double[] output = new double[T]; diff --git a/lib/filters/modf/tests/Modf.Tests.cs b/lib/filters/modf/tests/Modf.Tests.cs index 6751317e..011854bc 100644 --- a/lib/filters/modf/tests/Modf.Tests.cs +++ b/lib/filters/modf/tests/Modf.Tests.cs @@ -118,14 +118,14 @@ public class ModfTests var modf = new Modf(14); for (int i = 0; i < 30; i++) { - modf.Update(new TValue(DateTime.UtcNow, 100.0 + i * 0.5), isNew: true); + modf.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 0.5)), isNew: true); } double before = modf.Last.Value; // Correct last bar multiple times for (int i = 0; i < 5; i++) { - modf.Update(new TValue(DateTime.UtcNow, 100.0 + 29 * 0.5), isNew: false); + modf.Update(new TValue(DateTime.UtcNow, 100.0 + (29 * 0.5)), isNew: false); } Assert.Equal(before, modf.Last.Value, 10); @@ -312,11 +312,11 @@ public class ModfTests // Feed uptrend for (int i = 0; i < 30; i++) { - modf.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2.0)); + modf.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2.0))); } double upResult = modf.Last.Value; // Output should be at or below price in uptrend (lower band tracks behind) - Assert.True(upResult <= 100.0 + 29 * 2.0); + Assert.True(upResult <= 100.0 + (29 * 2.0)); } [Fact] diff --git a/lib/filters/nw/tests/Nw.Tests.cs b/lib/filters/nw/tests/Nw.Tests.cs index b2887a74..549e726f 100644 --- a/lib/filters/nw/tests/Nw.Tests.cs +++ b/lib/filters/nw/tests/Nw.Tests.cs @@ -328,7 +328,7 @@ public class NwTests double[] dst = new double[len]; for (int i = 0; i < len; i++) { - src[i] = 100.0 + i * 0.01; + src[i] = 100.0 + (i * 0.01); } Nw.Batch(src, dst, 500, 50.0); // period > StackallocThreshold Assert.False(double.IsNaN(dst[len - 1])); @@ -402,7 +402,7 @@ public class NwTests } nw.Update(new TValue(DateTime.UtcNow, 200.0), isNew: true); // With h=100 and period=20, all weights nearly equal → nearly SMA - double expected = (100.0 * 19 + 200.0) / 20.0; // ~105 + double expected = ((100.0 * 19) + 200.0) / 20.0; // ~105 Assert.True(Math.Abs(nw.Last.Value - expected) < 5.0); } @@ -429,7 +429,7 @@ public class NwTests var n2 = new Nw(10, 3.0); for (int i = 0; i < 30; i++) { - double v = 100.0 + Math.Sin(i * 0.3) * 10.0; + double v = 100.0 + (Math.Sin(i * 0.3) * 10.0); n1.Update(new TValue(DateTime.UtcNow, v)); n2.Update(new TValue(DateTime.UtcNow, v)); } diff --git a/lib/filters/nw/tests/Nw.Validation.Tests.cs b/lib/filters/nw/tests/Nw.Validation.Tests.cs index 729fbb43..3cf56c3c 100644 --- a/lib/filters/nw/tests/Nw.Validation.Tests.cs +++ b/lib/filters/nw/tests/Nw.Validation.Tests.cs @@ -167,12 +167,12 @@ public sealed class NwValidationTests : IDisposable // Bar 1: src[1] with w0=1.0, src[0] with w1=exp(-1/(2*1))=exp(-0.5) double w0 = 1.0; double w1 = Math.Exp(-0.5); - double expected1 = (w0 * 20.0 + w1 * 10.0) / (w0 + w1); + double expected1 = ((w0 * 20.0) + (w1 * 10.0)) / (w0 + w1); Assert.Equal(expected1, dst[1], 10); // Bar 2: src[2] w0=1, src[1] w1=exp(-0.5), src[0] w2=exp(-4/2)=exp(-2) double w2 = Math.Exp(-2.0); - double expected2 = (w0 * 30.0 + w1 * 20.0 + w2 * 10.0) / (w0 + w1 + w2); + double expected2 = ((w0 * 30.0) + (w1 * 20.0) + (w2 * 10.0)) / (w0 + w1 + w2); Assert.Equal(expected2, dst[2], 10); _output.WriteLine($"Manual calc: bar0={dst[0]:F6}, bar1={dst[1]:F6} (expect {expected1:F6}), bar2={dst[2]:F6} (expect {expected2:F6})"); diff --git a/lib/filters/oneeuro/tests/OneEuro.Validation.Tests.cs b/lib/filters/oneeuro/tests/OneEuro.Validation.Tests.cs index dedfa450..21e5aced 100644 --- a/lib/filters/oneeuro/tests/OneEuro.Validation.Tests.cs +++ b/lib/filters/oneeuro/tests/OneEuro.Validation.Tests.cs @@ -56,7 +56,7 @@ public class OneEuroValidationTests double[] output = new double[N]; for (int i = 0; i < N; i++) { - src[i] = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20.0); + src[i] = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 20.0)); } // With beta=0, cutoff is always minCutoff regardless of speed @@ -83,7 +83,7 @@ public class OneEuroValidationTests double[] src = new double[N]; for (int i = 0; i < N; i++) { - src[i] = 100.0 + 5.0 * Math.Sin(2.0 * Math.PI * i / 10.0); + src[i] = 100.0 + (5.0 * Math.Sin(2.0 * Math.PI * i / 10.0)); } double[] smoothOut = new double[N]; @@ -137,7 +137,7 @@ public class OneEuroValidationTests double[] src = new double[N]; for (int i = 0; i < N; i++) { - src[i] = 100.0 + (closes[i + 1] / closes[i] - 1.0) * 100.0; // ±pct jitter around 100 + src[i] = 100.0 + (((closes[i + 1] / closes[i]) - 1.0) * 100.0); // ±pct jitter around 100 } double[] output = new double[N]; @@ -161,7 +161,7 @@ public class OneEuroValidationTests double[] src = new double[N]; for (int i = 0; i < N; i++) { - src[i] = 100.0 + 20.0 * Math.Sin(2.0 * Math.PI * i / 30.0); + src[i] = 100.0 + (20.0 * Math.Sin(2.0 * Math.PI * i / 30.0)); } double[] output = new double[N]; @@ -187,7 +187,7 @@ public class OneEuroValidationTests double[] src = new double[N]; for (int i = 0; i < N; i++) { - src[i] = 100.0 + 5.0 * Math.Sin(2.0 * Math.PI * i / 20.0) + (i % 3 == 0 ? 1.0 : -1.0); + src[i] = 100.0 + (5.0 * Math.Sin(2.0 * Math.PI * i / 20.0)) + (i % 3 == 0 ? 1.0 : -1.0); } // Batch @@ -252,6 +252,6 @@ public class OneEuroValidationTests sumSq += v * v; } double mean = sum / data.Length; - return sumSq / data.Length - mean * mean; + return (sumSq / data.Length) - (mean * mean); } } diff --git a/lib/filters/rls/tests/Rls.Validation.Tests.cs b/lib/filters/rls/tests/Rls.Validation.Tests.cs index 48535c63..081d71c0 100644 --- a/lib/filters/rls/tests/Rls.Validation.Tests.cs +++ b/lib/filters/rls/tests/Rls.Validation.Tests.cs @@ -17,7 +17,7 @@ public class RlsValidationTests double[] sine = new double[T]; for (int i = 0; i < T; i++) { - sine[i] = 100.0 + 10.0 * Math.Sin(2 * Math.PI * i / 40.0); + sine[i] = 100.0 + (10.0 * Math.Sin(2 * Math.PI * i / 40.0)); } double[] output = new double[T]; diff --git a/lib/filters/sak/tests/Sak.Tests.cs b/lib/filters/sak/tests/Sak.Tests.cs index 055808df..bebe491b 100644 --- a/lib/filters/sak/tests/Sak.Tests.cs +++ b/lib/filters/sak/tests/Sak.Tests.cs @@ -386,7 +386,7 @@ public sealed class SakTests var output = new double[size]; for (int i = 0; i < size; i++) { - src[i] = 100.0 + i * 0.01; + src[i] = 100.0 + (i * 0.01); } // Should not throw StackOverflowException diff --git a/lib/filters/sak/tests/Sak.Validation.Tests.cs b/lib/filters/sak/tests/Sak.Validation.Tests.cs index f7325b82..cb1be3e5 100644 --- a/lib/filters/sak/tests/Sak.Validation.Tests.cs +++ b/lib/filters/sak/tests/Sak.Validation.Tests.cs @@ -83,7 +83,7 @@ public sealed class SakValidationTests double c0 = alpha * alpha / 4.0; double x0 = 10.0, x1 = 20.0, x2 = 30.0; - double expectedY = c0 * (x0 + 2.0 * x1 + x2); // pure FIR formula + double expectedY = c0 * (x0 + (2.0 * x1) + x2); // pure FIR formula var sak = new Sak("Smooth", period: period); var now = DateTime.UtcNow; diff --git a/lib/filters/sgf/tests/Sgf.Validation.Tests.cs b/lib/filters/sgf/tests/Sgf.Validation.Tests.cs index 4fcf01e2..eff580a1 100644 --- a/lib/filters/sgf/tests/Sgf.Validation.Tests.cs +++ b/lib/filters/sgf/tests/Sgf.Validation.Tests.cs @@ -56,16 +56,16 @@ public class SgfValidationTests : IDisposable double weight = 0; if (polyOrder == 2) { - weight = 3.0 * (3.0 * adjPeriod * adjPeriod - 7.0 - 20.0 * k * k); + weight = 3.0 * ((3.0 * adjPeriod * adjPeriod) - 7.0 - (20.0 * k * k)); } else if (polyOrder == 4) { double k2 = k * k; - weight = 15.0 + k2 * (-20.0 + k2 * 6.0); + weight = 15.0 + (k2 * (-20.0 + (k2 * 6.0))); } else { - weight = 1.0 - Math.Abs((double)k) / (double)halfWindow; + weight = 1.0 - (Math.Abs((double)k) / (double)halfWindow); } weights[i] = weight; diff --git a/lib/filters/ssf3/tests/Ssf3.Validation.Tests.cs b/lib/filters/ssf3/tests/Ssf3.Validation.Tests.cs index 48e06e1e..2ae9079a 100644 --- a/lib/filters/ssf3/tests/Ssf3.Validation.Tests.cs +++ b/lib/filters/ssf3/tests/Ssf3.Validation.Tests.cs @@ -67,7 +67,7 @@ public class Ssf3ValidationTests double c1 = a1 * a1; double coef2 = b1 + c1; - double coef3 = -(c1 + b1 * c1); + double coef3 = -(c1 + (b1 * c1)); double coef4 = c1 * c1; double coef1 = 1.0 - coef2 - coef3 - coef4; @@ -84,7 +84,7 @@ public class Ssf3ValidationTests else { // y = coef1*x + coef2*y[1] + coef3*y[2] + coef4*y[3] - filt = coef1 * src + coef2 * filt1 + coef3 * filt2 + coef4 * filt3; + filt = (coef1 * src) + (coef2 * filt1) + (coef3 * filt2) + (coef4 * filt3); } result.Add(filt); diff --git a/lib/filters/usf/tests/Usf.Validation.Tests.cs b/lib/filters/usf/tests/Usf.Validation.Tests.cs index 4faaf684..6675905a 100644 --- a/lib/filters/usf/tests/Usf.Validation.Tests.cs +++ b/lib/filters/usf/tests/Usf.Validation.Tests.cs @@ -113,7 +113,7 @@ public sealed class UsfValidationTests : IDisposable usfLinear.Update(new TValue(DateTime.UtcNow, 100.0 + i)); } // After warmup on a linear trend, USF should be close to the current value - double expectedLinear = 100.0 + (period * 5 - 1); + double expectedLinear = 100.0 + ((period * 5) - 1); Assert.True(Math.Abs(usfLinear.Last.Value - expectedLinear) < period, $"USF should track linear trend closely. Expected ~{expectedLinear}, got {usfLinear.Last.Value}"); diff --git a/lib/filters/voss/tests/Voss.Tests.cs b/lib/filters/voss/tests/Voss.Tests.cs index 3094b97d..cb88d085 100644 --- a/lib/filters/voss/tests/Voss.Tests.cs +++ b/lib/filters/voss/tests/Voss.Tests.cs @@ -125,7 +125,7 @@ public class VossTests // Feed enough bars past warmup (Count > 5) so Filt is not clamped to 0 for (int i = 0; i < 10; i++) { - ind.Update(new TValue(DateTime.UtcNow, 100 + i * 2), isNew: true); + ind.Update(new TValue(DateTime.UtcNow, 100 + (i * 2)), isNew: true); } double val1 = ind.Last.Value; @@ -141,7 +141,7 @@ public class VossTests // Feed enough bars past warmup (Count > 5) so Filt is not clamped to 0 for (int i = 0; i < 10; i++) { - ind.Update(new TValue(DateTime.UtcNow, 100 + i * 3), isNew: true); + ind.Update(new TValue(DateTime.UtcNow, 100 + (i * 3)), isNew: true); } double val1 = ind.Last.Value; diff --git a/lib/filters/wavelet/tests/Wavelet.Tests.cs b/lib/filters/wavelet/tests/Wavelet.Tests.cs index 04a4cdcc..3fb5618d 100644 --- a/lib/filters/wavelet/tests/Wavelet.Tests.cs +++ b/lib/filters/wavelet/tests/Wavelet.Tests.cs @@ -516,8 +516,8 @@ public class WaveletTests for (int i = 0; i < len; i++) { - double signal = 100 + 10 * Math.Sin(2 * Math.PI * i / 40.0); - double noise = 2.0 * Math.Sin(17.3 * i) + 1.5 * Math.Cos(31.7 * i); + double signal = 100 + (10 * Math.Sin(2 * Math.PI * i / 40.0)); + double noise = (2.0 * Math.Sin(17.3 * i)) + (1.5 * Math.Cos(31.7 * i)); input[i] = signal + noise; } @@ -563,7 +563,7 @@ public class WaveletTests double[] input = new double[len]; for (int i = 0; i < len; i++) { - input[i] = 100 + 10 * Math.Sin(2 * Math.PI * i / 40.0) + 5 * Math.Sin(73.1 * i); + input[i] = 100 + (10 * Math.Sin(2 * Math.PI * i / 40.0)) + (5 * Math.Sin(73.1 * i)); } double[] lowThresh = new double[len]; @@ -596,6 +596,6 @@ public class WaveletTests sum2 += data[i] * data[i]; } double mean = sum / data.Length; - return sum2 / data.Length - mean * mean; + return (sum2 / data.Length) - (mean * mean); } } diff --git a/lib/filters/wavelet/tests/Wavelet.Validation.Tests.cs b/lib/filters/wavelet/tests/Wavelet.Validation.Tests.cs index e494882d..075d52b5 100644 --- a/lib/filters/wavelet/tests/Wavelet.Validation.Tests.cs +++ b/lib/filters/wavelet/tests/Wavelet.Validation.Tests.cs @@ -18,9 +18,9 @@ public class WaveletValidationTests double[] noisy = new double[T]; for (int i = 0; i < T; i++) { - clean[i] = 100.0 + 10.0 * Math.Sin(2 * Math.PI * i / 80.0); + clean[i] = 100.0 + (10.0 * Math.Sin(2 * Math.PI * i / 80.0)); // Alternating noise with amplitude 25 — much larger than signal variation - noisy[i] = clean[i] + 25.0 * ((i % 2 == 0) ? 1.0 : -1.0); + noisy[i] = clean[i] + (25.0 * ((i % 2 == 0) ? 1.0 : -1.0)); } double[] denoised = new double[T]; @@ -132,7 +132,7 @@ public class WaveletValidationTests double[] output = new double[len]; for (int i = 0; i < len; i++) { - input[i] = 100.0 + 0.5 * i; + input[i] = 100.0 + (0.5 * i); } Wavelet.Batch(input, output, 3, 1.0); @@ -156,7 +156,7 @@ public class WaveletValidationTests double[] output = new double[len]; for (int i = 0; i < len; i++) { - input[i] = 100 + 10 * Math.Sin(2 * Math.PI * i / 50.0) + 0.5 * Math.Sin(101.1 * i); + input[i] = 100 + (10 * Math.Sin(2 * Math.PI * i / 50.0)) + (0.5 * Math.Sin(101.1 * i)); } Wavelet.Batch(input, output, 4, 1.0); @@ -216,6 +216,6 @@ public class WaveletValidationTests } int n = data.Length - 1; double mean = sum / n; - return sum2 / n - mean * mean; + return (sum2 / n) - (mean * mean); } } diff --git a/lib/filters/wiener/tests/Wiener.Validation.Tests.cs b/lib/filters/wiener/tests/Wiener.Validation.Tests.cs index 033f7e3e..636ccdcf 100644 --- a/lib/filters/wiener/tests/Wiener.Validation.Tests.cs +++ b/lib/filters/wiener/tests/Wiener.Validation.Tests.cs @@ -104,7 +104,7 @@ public class WienerValidationTests : IDisposable kp = signalVar / (signalVar + noiseVar); } - result[i] = mean + kp * (source[i] - mean); + result[i] = mean + (kp * (source[i] - mean)); } return result; diff --git a/lib/momentum/bias/tests/Bias.Validation.Tests.cs b/lib/momentum/bias/tests/Bias.Validation.Tests.cs index 357e96aa..109461e9 100644 --- a/lib/momentum/bias/tests/Bias.Validation.Tests.cs +++ b/lib/momentum/bias/tests/Bias.Validation.Tests.cs @@ -271,7 +271,7 @@ public sealed class BiasValidationTests : IDisposable for (int i = 0; i < 100; i++) { - double value = baseValue * (1 + i * 0.01); + double value = baseValue * (1 + (i * 0.01)); bias.Update(new TValue(DateTime.UtcNow, value)); Assert.True(double.IsFinite(bias.Last.Value), $"Bias should be finite at index {i}"); @@ -415,7 +415,7 @@ public sealed class BiasValidationTests : IDisposable var biasValues = new List(); for (int i = 0; i < 100; i++) { - double value = mean + amplitude * Math.Sin(i * 0.5); + double value = mean + (amplitude * Math.Sin(i * 0.5)); bias.Update(new TValue(DateTime.UtcNow, value)); if (i >= 9) // After warmup { diff --git a/lib/momentum/cmo/tests/Cmo.Tests.cs b/lib/momentum/cmo/tests/Cmo.Tests.cs index eb8a9416..507b12f2 100644 --- a/lib/momentum/cmo/tests/Cmo.Tests.cs +++ b/lib/momentum/cmo/tests/Cmo.Tests.cs @@ -284,7 +284,7 @@ public class CmoTests var prices = new TSeries(); for (int i = 0; i < 20; i++) { - prices.Add(new TValue(DateTime.Now.Ticks + i, 100 + Math.Sin(i) * 10)); + prices.Add(new TValue(DateTime.Now.Ticks + i, 100 + (Math.Sin(i) * 10))); } var results = Cmo.Batch(prices, 5); @@ -298,7 +298,7 @@ public class CmoTests var prices = new TSeries(); for (int i = 0; i < 50; i++) { - prices.Add(new TValue(DateTime.Now.Ticks + i, 100 + Math.Sin(i * 0.5) * 20)); + prices.Add(new TValue(DateTime.Now.Ticks + i, 100 + (Math.Sin(i * 0.5) * 20))); } var batchResults = Cmo.Batch(prices, 14); @@ -362,7 +362,7 @@ public class CmoTests double smallChange = 1e-10; for (int i = 0; i < 6; i++) { - cmo.Update(new TValue(DateTime.Now.Ticks + i, baseVal + i * smallChange)); + cmo.Update(new TValue(DateTime.Now.Ticks + i, baseVal + (i * smallChange))); } // All tiny up moves, should still be 100 diff --git a/lib/momentum/macd/tests/Macd.Tests.cs b/lib/momentum/macd/tests/Macd.Tests.cs index 54772967..1c89b918 100644 --- a/lib/momentum/macd/tests/Macd.Tests.cs +++ b/lib/momentum/macd/tests/Macd.Tests.cs @@ -169,7 +169,7 @@ public class MacdTests var series = new TSeries(); for (int i = 0; i < 100; i++) { - series.Add(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + Math.Sin(i * 0.1) * 10)); + series.Add(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (Math.Sin(i * 0.1) * 10))); } var batchResult = macd.Update(series); @@ -195,7 +195,7 @@ public class MacdTests var series = new TSeries(); for (int i = 0; i < 100; i++) { - series.Add(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + Math.Sin(i * 0.1) * 10)); + series.Add(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (Math.Sin(i * 0.1) * 10))); } var batchResult = macd.Update(series); diff --git a/lib/momentum/mom/tests/Mom.Quantower.Tests.cs b/lib/momentum/mom/tests/Mom.Quantower.Tests.cs index 83967979..7e558152 100644 --- a/lib/momentum/mom/tests/Mom.Quantower.Tests.cs +++ b/lib/momentum/mom/tests/Mom.Quantower.Tests.cs @@ -101,10 +101,10 @@ public class MomIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -166,7 +166,7 @@ public class MomIndicatorTests for (int i = 0; i < 10; i++) { - double price = 100 + i * 5; + double price = 100 + (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -185,7 +185,7 @@ public class MomIndicatorTests for (int i = 0; i < 10; i++) { - double price = 200 - i * 5; + double price = 200 - (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/mom/tests/Mom.Tests.cs b/lib/momentum/mom/tests/Mom.Tests.cs index 54291f8b..b2623854 100644 --- a/lib/momentum/mom/tests/Mom.Tests.cs +++ b/lib/momentum/mom/tests/Mom.Tests.cs @@ -363,7 +363,7 @@ public class MomTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Mom.Batch(source, output, TestPeriod); diff --git a/lib/momentum/pmo/tests/Pmo.Quantower.Tests.cs b/lib/momentum/pmo/tests/Pmo.Quantower.Tests.cs index 89206a90..e1d05cc8 100644 --- a/lib/momentum/pmo/tests/Pmo.Quantower.Tests.cs +++ b/lib/momentum/pmo/tests/Pmo.Quantower.Tests.cs @@ -101,10 +101,10 @@ public class PmoIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/pmo/tests/Pmo.Tests.cs b/lib/momentum/pmo/tests/Pmo.Tests.cs index b841e99d..553328da 100644 --- a/lib/momentum/pmo/tests/Pmo.Tests.cs +++ b/lib/momentum/pmo/tests/Pmo.Tests.cs @@ -102,7 +102,7 @@ public class PmoTests var pmo = new Pmo(5, 3, 3); for (int i = 0; i < 30; i++) { - pmo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 2.0), true); + pmo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 2.0)), true); } Assert.True(pmo.Last.Value > 0, $"PMO should be positive with rising prices, got {pmo.Last.Value}"); @@ -114,7 +114,7 @@ public class PmoTests var pmo = new Pmo(5, 3, 3); for (int i = 0; i < 30; i++) { - pmo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 200.0 - i * 2.0), true); + pmo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 200.0 - (i * 2.0)), true); } Assert.True(pmo.Last.Value < 0, $"PMO should be negative with falling prices, got {pmo.Last.Value}"); @@ -178,7 +178,7 @@ public class PmoTests // Build up state for (int i = 0; i < 20; i++) { - pmo.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.5), true); + pmo.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.5)), true); } var baseline = pmo.Update(new TValue(time.AddSeconds(20), 120.0), true); @@ -195,7 +195,7 @@ public class PmoTests for (int i = 0; i < 20; i++) { - pmo.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.5), true); + pmo.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.5)), true); } var baseline = pmo.Update(new TValue(time.AddSeconds(20), 120.0), true); @@ -366,7 +366,7 @@ public class PmoTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Pmo.Batch(source, output, TestTimePeriods, TestSmoothPeriods, TestSignalPeriods); diff --git a/lib/momentum/pmo/tests/Pmo.Validation.Tests.cs b/lib/momentum/pmo/tests/Pmo.Validation.Tests.cs index 983f8789..61c7f376 100644 --- a/lib/momentum/pmo/tests/Pmo.Validation.Tests.cs +++ b/lib/momentum/pmo/tests/Pmo.Validation.Tests.cs @@ -232,7 +232,7 @@ public sealed class PmoValidationTests(ITestOutputHelper output) : IDisposable for (int i = 0; i < 50; i++) { - double price = 100 + i * 5; // Strong uptrend + double price = 100 + (i * 5); // Strong uptrend pmo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price), true); } @@ -247,7 +247,7 @@ public sealed class PmoValidationTests(ITestOutputHelper output) : IDisposable for (int i = 0; i < 50; i++) { - double price = 200 - i * 3; // Strong downtrend + double price = 200 - (i * 3); // Strong downtrend pmo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), price), true); } diff --git a/lib/momentum/ppo/tests/Ppo.Quantower.Tests.cs b/lib/momentum/ppo/tests/Ppo.Quantower.Tests.cs index 639231ae..13b8fc1a 100644 --- a/lib/momentum/ppo/tests/Ppo.Quantower.Tests.cs +++ b/lib/momentum/ppo/tests/Ppo.Quantower.Tests.cs @@ -107,10 +107,10 @@ public class PpoIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -180,10 +180,10 @@ public class PpoIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/ppo/tests/Ppo.Tests.cs b/lib/momentum/ppo/tests/Ppo.Tests.cs index 0d36094b..2c353e2f 100644 --- a/lib/momentum/ppo/tests/Ppo.Tests.cs +++ b/lib/momentum/ppo/tests/Ppo.Tests.cs @@ -131,7 +131,7 @@ public class PpoTests var ppo = new Ppo(TestFastPeriod, TestSlowPeriod, TestSignalPeriod); for (int i = 0; i < 30; i++) { - ppo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.5), true); + ppo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.5)), true); } Assert.Equal(ppo.Last.Value - ppo.Signal.Value, ppo.Histogram.Value, 10); } @@ -142,7 +142,7 @@ public class PpoTests var ppo = new Ppo(TestFastPeriod, TestSlowPeriod, TestSignalPeriod); for (int i = 0; i < 40; i++) { - ppo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 2.0), true); + ppo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 2.0)), true); } Assert.True(ppo.Last.Value > 0, $"PPO should be positive with rising prices, got {ppo.Last.Value}"); @@ -154,7 +154,7 @@ public class PpoTests var ppo = new Ppo(TestFastPeriod, TestSlowPeriod, TestSignalPeriod); for (int i = 0; i < 40; i++) { - ppo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 300.0 - i * 2.0), true); + ppo.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 300.0 - (i * 2.0)), true); } Assert.True(ppo.Last.Value < 0, $"PPO should be negative with falling prices, got {ppo.Last.Value}"); @@ -216,7 +216,7 @@ public class PpoTests for (int i = 0; i < 25; i++) { - ppo.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.5), true); + ppo.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.5)), true); } var baseline = ppo.Update(new TValue(time.AddSeconds(25), 120.0), true); @@ -233,7 +233,7 @@ public class PpoTests for (int i = 0; i < 25; i++) { - ppo.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.5), true); + ppo.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.5)), true); } var baseline = ppo.Update(new TValue(time.AddSeconds(25), 120.0), true); @@ -385,7 +385,7 @@ public class PpoTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Ppo.Batch(source, output, TestFastPeriod, TestSlowPeriod); diff --git a/lib/momentum/prs/tests/Prs.Tests.cs b/lib/momentum/prs/tests/Prs.Tests.cs index a48c6379..c901d71c 100644 --- a/lib/momentum/prs/tests/Prs.Tests.cs +++ b/lib/momentum/prs/tests/Prs.Tests.cs @@ -88,7 +88,7 @@ public class PrsTests for (int i = 0; i < 20; i++) { double basePrice = 200.0 + i; - double compPrice = 100.0 + i * 0.5; + double compPrice = 100.0 + (i * 0.5); prs.Update(basePrice, compPrice); results.Add(prs.Last.Value); } @@ -382,8 +382,8 @@ public class PrsTests // Base grows faster than comparison for (int i = 0; i < 20; i++) { - double basePrice = 100.0 + i * 2; // +2 per bar - double compPrice = 100.0 + i * 1; // +1 per bar + double basePrice = 100.0 + (i * 2); // +2 per bar + double compPrice = 100.0 + (i * 1); // +1 per bar prs.Update(basePrice, compPrice); } @@ -399,8 +399,8 @@ public class PrsTests // Base grows slower than comparison for (int i = 0; i < 20; i++) { - double basePrice = 100.0 + i * 1; // +1 per bar - double compPrice = 100.0 + i * 2; // +2 per bar + double basePrice = 100.0 + (i * 1); // +1 per bar + double compPrice = 100.0 + (i * 2); // +2 per bar prs.Update(basePrice, compPrice); } @@ -416,8 +416,8 @@ public class PrsTests // Both grow at same rate for (int i = 0; i < 20; i++) { - double basePrice = 100.0 + i * 2; - double compPrice = 50.0 + i * 1; + double basePrice = 100.0 + (i * 2); + double compPrice = 50.0 + (i * 1); prs.Update(basePrice, compPrice); } diff --git a/lib/momentum/roc/tests/Roc.Quantower.Tests.cs b/lib/momentum/roc/tests/Roc.Quantower.Tests.cs index f1bd4c30..49773b64 100644 --- a/lib/momentum/roc/tests/Roc.Quantower.Tests.cs +++ b/lib/momentum/roc/tests/Roc.Quantower.Tests.cs @@ -102,10 +102,10 @@ public class RocIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -167,7 +167,7 @@ public class RocIndicatorTests for (int i = 0; i < 10; i++) { - double price = 100 + i * 5; + double price = 100 + (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -186,7 +186,7 @@ public class RocIndicatorTests for (int i = 0; i < 10; i++) { - double price = 200 - i * 5; + double price = 200 - (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/roc/tests/Roc.Tests.cs b/lib/momentum/roc/tests/Roc.Tests.cs index e983fe5f..038865f5 100644 --- a/lib/momentum/roc/tests/Roc.Tests.cs +++ b/lib/momentum/roc/tests/Roc.Tests.cs @@ -374,7 +374,7 @@ public class RocTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } // Should not throw diff --git a/lib/momentum/rocp/tests/Rocp.Quantower.Tests.cs b/lib/momentum/rocp/tests/Rocp.Quantower.Tests.cs index a5407add..f6fae5f5 100644 --- a/lib/momentum/rocp/tests/Rocp.Quantower.Tests.cs +++ b/lib/momentum/rocp/tests/Rocp.Quantower.Tests.cs @@ -130,10 +130,10 @@ public class RocpIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -195,7 +195,7 @@ public class RocpIndicatorTests for (int i = 0; i < 10; i++) { - double price = 100 + i * 5; + double price = 100 + (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -214,7 +214,7 @@ public class RocpIndicatorTests for (int i = 0; i < 10; i++) { - double price = 200 - i * 5; + double price = 200 - (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/rocp/tests/Rocp.Tests.cs b/lib/momentum/rocp/tests/Rocp.Tests.cs index 378f5084..1673b2ca 100644 --- a/lib/momentum/rocp/tests/Rocp.Tests.cs +++ b/lib/momentum/rocp/tests/Rocp.Tests.cs @@ -368,7 +368,7 @@ public class RocpTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Rocp.Batch(source, output, TestPeriod); diff --git a/lib/momentum/rocr/tests/Rocr.Quantower.Tests.cs b/lib/momentum/rocr/tests/Rocr.Quantower.Tests.cs index 5bb5bb90..ac3ac994 100644 --- a/lib/momentum/rocr/tests/Rocr.Quantower.Tests.cs +++ b/lib/momentum/rocr/tests/Rocr.Quantower.Tests.cs @@ -130,10 +130,10 @@ public class RocrIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -195,7 +195,7 @@ public class RocrIndicatorTests for (int i = 0; i < 10; i++) { - double price = 100 + i * 5; + double price = 100 + (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -214,7 +214,7 @@ public class RocrIndicatorTests for (int i = 0; i < 10; i++) { - double price = 200 - i * 5; + double price = 200 - (i * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/rocr/tests/Rocr.Tests.cs b/lib/momentum/rocr/tests/Rocr.Tests.cs index ee6de7ba..9df8573f 100644 --- a/lib/momentum/rocr/tests/Rocr.Tests.cs +++ b/lib/momentum/rocr/tests/Rocr.Tests.cs @@ -387,7 +387,7 @@ public class RocrTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } // Should not throw diff --git a/lib/momentum/sam/tests/Sam.Quantower.Tests.cs b/lib/momentum/sam/tests/Sam.Quantower.Tests.cs index 47b8d8be..b3adb356 100644 --- a/lib/momentum/sam/tests/Sam.Quantower.Tests.cs +++ b/lib/momentum/sam/tests/Sam.Quantower.Tests.cs @@ -102,10 +102,10 @@ public class SamIndicatorTests { indicator.HistoricalData.AddBar( now.AddMinutes(i), - 100 + i * 2, - 105 + i * 2, - 95 + i * 2, - 102 + i * 2); + 100 + (i * 2), + 105 + (i * 2), + 95 + (i * 2), + 102 + (i * 2)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/momentum/sam/tests/Sam.Tests.cs b/lib/momentum/sam/tests/Sam.Tests.cs index 564de7af..c0727c12 100644 --- a/lib/momentum/sam/tests/Sam.Tests.cs +++ b/lib/momentum/sam/tests/Sam.Tests.cs @@ -122,7 +122,7 @@ public class SamTests var sam = new Sam(); for (int i = 0; i < 200; i++) { - sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1)); + sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1))); } Assert.True(sam.DominantCycle > 0); } @@ -166,7 +166,7 @@ public class SamTests // Feed enough data to get past trivial warmup for (int i = 0; i < 120; i++) { - sam.Update(new TValue(time.AddSeconds(i), 100.0 + Math.Sin(i * 0.3) * 10), true); + sam.Update(new TValue(time.AddSeconds(i), 100.0 + (Math.Sin(i * 0.3) * 10)), true); } var first = sam.Update(new TValue(time.AddSeconds(120), 115.0), true); @@ -184,7 +184,7 @@ public class SamTests for (int i = 0; i < 120; i++) { - sam.Update(new TValue(time.AddSeconds(i), 100.0 + Math.Sin(i * 0.3) * 10), true); + sam.Update(new TValue(time.AddSeconds(i), 100.0 + (Math.Sin(i * 0.3) * 10)), true); } var baseline = sam.Update(new TValue(time.AddSeconds(120), 105.0), true); @@ -259,7 +259,7 @@ public class SamTests for (int i = 0; i < 120; i++) { - sam.Update(new TValue(time.AddSeconds(i), 100.0 + Math.Sin(i * 0.2) * 5), true); + sam.Update(new TValue(time.AddSeconds(i), 100.0 + (Math.Sin(i * 0.2) * 5)), true); } var afterNaN = sam.Update(new TValue(time.AddSeconds(120), double.NaN), true); @@ -274,7 +274,7 @@ public class SamTests for (int i = 0; i < 120; i++) { - sam.Update(new TValue(time.AddSeconds(i), 100.0 + i * 0.1), true); + sam.Update(new TValue(time.AddSeconds(i), 100.0 + (i * 0.1)), true); } var afterInf = sam.Update(new TValue(time.AddSeconds(120), double.PositiveInfinity), true); @@ -289,7 +289,7 @@ public class SamTests for (int i = 0; i < 200; i++) { - var value = i % 5 == 0 ? double.NaN : 100.0 + i * 0.1; + var value = i % 5 == 0 ? double.NaN : 100.0 + (i * 0.1); var tv = sam.Update(new TValue(time.AddSeconds(i), value), true); Assert.True(double.IsFinite(tv.Value)); } @@ -418,7 +418,7 @@ public class SamTests for (int i = 0; i < largeSize; i++) { - source[i] = 100.0 + Math.Sin(i * 0.1) * 20; + source[i] = 100.0 + (Math.Sin(i * 0.1) * 20); } Sam.Batch(source, output); @@ -493,7 +493,7 @@ public class SamTests double[] primeData = new double[150]; for (int i = 0; i < 150; i++) { - primeData[i] = 100.0 + Math.Sin(i * 0.2) * 10; + primeData[i] = 100.0 + (Math.Sin(i * 0.2) * 10); } sam.Prime(primeData); @@ -510,7 +510,7 @@ public class SamTests double[] data = new double[150]; for (int i = 0; i < 150; i++) { - data[i] = 100.0 + Math.Sin(i * 0.2) * 10; + data[i] = 100.0 + (Math.Sin(i * 0.2) * 10); } sam1.Prime(data); @@ -535,7 +535,7 @@ public class SamTests for (int i = 0; i < 200; i++) { - result = sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 2), true); + result = sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 2)), true); } // Strong trend should produce non-zero smoothed momentum @@ -552,7 +552,7 @@ public class SamTests for (int i = 0; i < 500; i++) { var result = sam.Update( - new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + Math.Sin(i * 0.2) * 20), true); + new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (Math.Sin(i * 0.2) * 20)), true); if (sam.IsHot) { @@ -581,7 +581,7 @@ public class SamTests for (int i = 0; i < 300; i++) { sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), - 100.0 + Math.Sin(i * 2.0 * Math.PI / 20.0) * 10), true); + 100.0 + (Math.Sin(i * 2.0 * Math.PI / 20.0) * 10)), true); } // After warmup, dominant cycle should have stabilized to a finite positive value diff --git a/lib/momentum/sam/tests/Sam.Validation.Tests.cs b/lib/momentum/sam/tests/Sam.Validation.Tests.cs index 31252e5d..8af4224e 100644 --- a/lib/momentum/sam/tests/Sam.Validation.Tests.cs +++ b/lib/momentum/sam/tests/Sam.Validation.Tests.cs @@ -333,7 +333,7 @@ public class SamValidationTests for (int i = 0; i < 300; i++) { - var result = sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 3.0), true); + var result = sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 3.0)), true); if (sam.IsHot) { hotCount++; @@ -359,7 +359,7 @@ public class SamValidationTests for (int i = 0; i < 300; i++) { - var result = sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 500.0 - i * 3.0), true); + var result = sam.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 500.0 - (i * 3.0)), true); if (sam.IsHot) { hotCount++; diff --git a/lib/momentum/tsi/tests/Tsi.Quantower.Tests.cs b/lib/momentum/tsi/tests/Tsi.Quantower.Tests.cs index af2a0efa..52d42ee2 100644 --- a/lib/momentum/tsi/tests/Tsi.Quantower.Tests.cs +++ b/lib/momentum/tsi/tests/Tsi.Quantower.Tests.cs @@ -81,7 +81,7 @@ public class TsiIndicatorTests for (int i = 0; i < 20; i++) { - core.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 0.5)); + core.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 0.5))); } // Signal property should return signal line value diff --git a/lib/momentum/tsi/tests/Tsi.Tests.cs b/lib/momentum/tsi/tests/Tsi.Tests.cs index 065bea7a..9a27d069 100644 --- a/lib/momentum/tsi/tests/Tsi.Tests.cs +++ b/lib/momentum/tsi/tests/Tsi.Tests.cs @@ -124,7 +124,7 @@ public class TsiTests for (int i = 0; i < 20; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 0.5)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 0.5))); } // Signal should be a smoothed version of TSI @@ -148,7 +148,7 @@ public class TsiTests // Feed enough data to warm up all EMAs for (int i = 0; i < 50; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 0.5)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 0.5))); } Assert.True(tsi.IsHot); @@ -163,7 +163,7 @@ public class TsiTests // Initial values - building up momentum history for (int i = 0; i < 20; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 0.5)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 0.5))); } // Update with new bar (large spike) @@ -206,7 +206,7 @@ public class TsiTests var source = new TSeries(); for (int i = 0; i < 50; i++) { - source.Add(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 0.5)); + source.Add(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 0.5))); } var result = Tsi.Batch(source); @@ -276,7 +276,7 @@ public class TsiTests // Negative prices (like temperature or P&L) for (int i = 0; i < 20; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(i), -10.0 + i * 0.5)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(i), -10.0 + (i * 0.5))); } Assert.True(!double.IsNaN(tsi.Last.Value)); @@ -291,7 +291,7 @@ public class TsiTests // Very small price changes for (int i = 0; i < 20; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 1e-8)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 1e-8))); } Assert.True(!double.IsNaN(tsi.Last.Value)); @@ -412,7 +412,7 @@ public class TsiTests for (int i = 0; i < 20; i++) { - source.Add(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 0.5)); + source.Add(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 0.5))); } Assert.Equal(20, receivedValues.Count); @@ -427,14 +427,14 @@ public class TsiTests // Rising prices for (int i = 0; i < 15; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + i * 2)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(i), 100.0 + (i * 2))); } Assert.True(tsi.Last.Value > 0); // Falling prices for (int i = 0; i < 20; i++) { - tsi.Update(new TValue(DateTime.Now.AddMinutes(15 + i), 128.0 - i * 2)); + tsi.Update(new TValue(DateTime.Now.AddMinutes(15 + i), 128.0 - (i * 2))); } Assert.True(tsi.Last.Value < 0); } @@ -450,8 +450,8 @@ public class TsiTests for (int i = 0; i < 40; i++) { double price = i < 20 - ? 100.0 + i * 2 // Rising - : 140.0 - (i - 20) * 2; // Falling + ? 100.0 + (i * 2) // Rising + : 140.0 - ((i - 20) * 2); // Falling tsi.Update(new TValue(DateTime.Now.AddMinutes(i), price)); tsiValues.Add(tsi.Last.Value); signalValues.Add(tsi.Signal); diff --git a/lib/momentum/tsi/tests/Tsi.Validation.Tests.cs b/lib/momentum/tsi/tests/Tsi.Validation.Tests.cs index aaaef7a1..f2e1c39c 100644 --- a/lib/momentum/tsi/tests/Tsi.Validation.Tests.cs +++ b/lib/momentum/tsi/tests/Tsi.Validation.Tests.cs @@ -143,7 +143,7 @@ public sealed class TsiValidationTests(ITestOutputHelper output) : IDisposable for (int i = 0; i < 50; i++) { - tsi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 2)); + tsi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 2))); } Assert.True(tsi.Last.Value > 95.0, $"Expected TSI > 95, got {tsi.Last.Value}"); @@ -156,7 +156,7 @@ public sealed class TsiValidationTests(ITestOutputHelper output) : IDisposable for (int i = 0; i < 50; i++) { - tsi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 200.0 - i * 2)); + tsi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 200.0 - (i * 2))); } Assert.True(tsi.Last.Value < -95.0, $"Expected TSI < -95, got {tsi.Last.Value}"); @@ -184,7 +184,7 @@ public sealed class TsiValidationTests(ITestOutputHelper output) : IDisposable for (int i = 0; i < 20; i++) { - double price = i < 10 ? 100.0 + i * 2 : 120.0 - (i - 10) * 2; + double price = i < 10 ? 100.0 + (i * 2) : 120.0 - ((i - 10) * 2); tsi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)); tsiValues.Add(tsi.Last.Value); signalValues.Add(tsi.Signal); diff --git a/lib/numerics/betadist/tests/Betadist.Tests.cs b/lib/numerics/betadist/tests/Betadist.Tests.cs index c3bf2164..6fc6b835 100644 --- a/lib/numerics/betadist/tests/Betadist.Tests.cs +++ b/lib/numerics/betadist/tests/Betadist.Tests.cs @@ -524,7 +524,7 @@ public class BetadistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/betadist/tests/Betadist.Validation.Tests.cs b/lib/numerics/betadist/tests/Betadist.Validation.Tests.cs index 407e03d1..4b06608c 100644 --- a/lib/numerics/betadist/tests/Betadist.Validation.Tests.cs +++ b/lib/numerics/betadist/tests/Betadist.Validation.Tests.cs @@ -115,7 +115,7 @@ public class BetadistValidationTests for (int i = 0; i <= 10; i++) { - double x = i / 10.0 + 1e-10; // avoid exact 0 + double x = (i / 10.0) + 1e-10; // avoid exact 0 x = Math.Min(x, 1.0 - 1e-10); double cdf = Betadist.IncompleteBeta(x, alpha, beta); diff --git a/lib/numerics/binomdist/tests/Binomdist.Tests.cs b/lib/numerics/binomdist/tests/Binomdist.Tests.cs index a38da235..0a516ae6 100644 --- a/lib/numerics/binomdist/tests/Binomdist.Tests.cs +++ b/lib/numerics/binomdist/tests/Binomdist.Tests.cs @@ -489,7 +489,7 @@ public class BinomdistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/change/tests/Change.Validation.Tests.cs b/lib/numerics/change/tests/Change.Validation.Tests.cs index 8c8c23aa..cad52d80 100644 --- a/lib/numerics/change/tests/Change.Validation.Tests.cs +++ b/lib/numerics/change/tests/Change.Validation.Tests.cs @@ -249,8 +249,8 @@ public class ChangeValidationTests 0.0, 0.1, // (110-100)/100 -0.1, // (99-110)/110 - 120.0 / 99.0 - 1.0, // (120-99)/99 - 100.0 / 120.0 - 1.0 // (100-120)/120 + (120.0 / 99.0) - 1.0, // (120-99)/99 + (100.0 / 120.0) - 1.0 // (100-120)/120 ]; var indicator = new Change(period); diff --git a/lib/numerics/cwt/tests/Cwt.Tests.cs b/lib/numerics/cwt/tests/Cwt.Tests.cs index f57e3ebd..19712a13 100644 --- a/lib/numerics/cwt/tests/Cwt.Tests.cs +++ b/lib/numerics/cwt/tests/Cwt.Tests.cs @@ -496,7 +496,7 @@ public class CwtTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/dwt/tests/Dwt.Tests.cs b/lib/numerics/dwt/tests/Dwt.Tests.cs index c78cd76f..c666caf9 100644 --- a/lib/numerics/dwt/tests/Dwt.Tests.cs +++ b/lib/numerics/dwt/tests/Dwt.Tests.cs @@ -518,7 +518,7 @@ public class DwtTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/expdist/tests/Expdist.Tests.cs b/lib/numerics/expdist/tests/Expdist.Tests.cs index b1f57093..112fe350 100644 --- a/lib/numerics/expdist/tests/Expdist.Tests.cs +++ b/lib/numerics/expdist/tests/Expdist.Tests.cs @@ -516,7 +516,7 @@ public class ExpdistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/fdist/tests/Fdist.Tests.cs b/lib/numerics/fdist/tests/Fdist.Tests.cs index 9010fb63..5f3b972d 100644 --- a/lib/numerics/fdist/tests/Fdist.Tests.cs +++ b/lib/numerics/fdist/tests/Fdist.Tests.cs @@ -535,7 +535,7 @@ public class FdistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/fdist/tests/Fdist.Validation.Tests.cs b/lib/numerics/fdist/tests/Fdist.Validation.Tests.cs index 411fd592..df3041db 100644 --- a/lib/numerics/fdist/tests/Fdist.Validation.Tests.cs +++ b/lib/numerics/fdist/tests/Fdist.Validation.Tests.cs @@ -213,7 +213,7 @@ public class FdistValidationTests public void FdistCdf_ParameterCombos_OutputBounded(int d1, int d2, int period) { int count = period + 50; - var gbm = new GBM(startPrice: 100, mu: 0.05, sigma: 0.2, seed: 66004 + d1 * 100 + d2); + var gbm = new GBM(startPrice: 100, mu: 0.05, sigma: 0.2, seed: 66004 + (d1 * 100) + d2); var bars = gbm.Fetch(count, DateTime.UtcNow.Ticks, TimeSpan.FromMinutes(1)); var indicator = new Fdist(d1, d2, period); diff --git a/lib/numerics/fft/tests/Fft.Tests.cs b/lib/numerics/fft/tests/Fft.Tests.cs index 58b4f0e7..9a627d10 100644 --- a/lib/numerics/fft/tests/Fft.Tests.cs +++ b/lib/numerics/fft/tests/Fft.Tests.cs @@ -524,7 +524,7 @@ public class FftTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.2) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.2) * 10.0); } double[] dst = new double[count]; @@ -589,7 +589,7 @@ public class FftTests var time = DateTime.UtcNow; for (int i = 0; i < windowSize; i++) { - source.Add(new TValue(time.AddMinutes(i), 100.0 + Math.Sin(i * 0.5) * 5.0), true); + source.Add(new TValue(time.AddMinutes(i), 100.0 + (Math.Sin(i * 0.5) * 5.0)), true); } Assert.True(indicator.IsHot); @@ -648,7 +648,7 @@ public class FftTests // Feed 3x the window size to ensure convergence for (int i = 0; i < windowSize * 3; i++) { - double signal = 50.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / period); + double signal = 50.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / period)); indicator.Update(new TValue(time.AddMinutes(i), signal), true); } diff --git a/lib/numerics/gammadist/tests/Gammadist.Tests.cs b/lib/numerics/gammadist/tests/Gammadist.Tests.cs index 44c9dba9..c5d3d890 100644 --- a/lib/numerics/gammadist/tests/Gammadist.Tests.cs +++ b/lib/numerics/gammadist/tests/Gammadist.Tests.cs @@ -550,7 +550,7 @@ public class GammadistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/ifft/tests/Ifft.Tests.cs b/lib/numerics/ifft/tests/Ifft.Tests.cs index 5a2e6654..ad463854 100644 --- a/lib/numerics/ifft/tests/Ifft.Tests.cs +++ b/lib/numerics/ifft/tests/Ifft.Tests.cs @@ -499,7 +499,7 @@ public class IfftTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.2) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.2) * 10.0); } double[] dst = new double[count]; @@ -564,7 +564,7 @@ public class IfftTests var time = DateTime.UtcNow; for (int i = 0; i < windowSize; i++) { - source.Add(new TValue(time.AddMinutes(i), 100.0 + Math.Sin(i * 0.5) * 5.0), true); + source.Add(new TValue(time.AddMinutes(i), 100.0 + (Math.Sin(i * 0.5) * 5.0)), true); } Assert.True(indicator.IsHot); @@ -657,10 +657,10 @@ public class IfftTests for (int i = 0; i < count; i++) { double v = 100.0 - + 10.0 * Math.Sin(twoPiOverN * 1 * i) - + 10.0 * Math.Sin(twoPiOverN * 2 * i) - + 10.0 * Math.Sin(twoPiOverN * 4 * i) - + 10.0 * Math.Sin(twoPiOverN * 8 * i); + + (10.0 * Math.Sin(twoPiOverN * 1 * i)) + + (10.0 * Math.Sin(twoPiOverN * 2 * i)) + + (10.0 * Math.Sin(twoPiOverN * 4 * i)) + + (10.0 * Math.Sin(twoPiOverN * 8 * i)); values.Add(new TValue(time.AddMinutes(i), v)); } diff --git a/lib/numerics/ifft/tests/Ifft.Validation.Tests.cs b/lib/numerics/ifft/tests/Ifft.Validation.Tests.cs index 34874869..edc0d86a 100644 --- a/lib/numerics/ifft/tests/Ifft.Validation.Tests.cs +++ b/lib/numerics/ifft/tests/Ifft.Validation.Tests.cs @@ -91,7 +91,7 @@ public class IfftValidationTests var values = new List(count); for (int i = 0; i < count; i++) { - values.Add(new TValue(time.AddMinutes(i), 100.0 + 30.0 * Math.Sin(twoPiOverN * 1 * i))); + values.Add(new TValue(time.AddMinutes(i), 100.0 + (30.0 * Math.Sin(twoPiOverN * 1 * i)))); } var indH1 = new Ifft(windowSize, numHarmonics: 1); @@ -294,7 +294,7 @@ public class IfftValidationTests for (int i = 0; i < count; i++) { - double v = 100.0 + 25.0 * Math.Sin(twoPiOverN * 1 * i); + double v = 100.0 + (25.0 * Math.Sin(twoPiOverN * 1 * i)); indH1.Update(new TValue(time.AddMinutes(i), v)); if (indH1.IsHot) { diff --git a/lib/numerics/jerk/tests/Jerk.Tests.cs b/lib/numerics/jerk/tests/Jerk.Tests.cs index 35464051..7ae83fd1 100644 --- a/lib/numerics/jerk/tests/Jerk.Tests.cs +++ b/lib/numerics/jerk/tests/Jerk.Tests.cs @@ -328,7 +328,7 @@ public class JerkTests for (int i = 0; i < 30; i++) { - source.Add(now.AddSeconds(i), 100 + i * 0.5); + source.Add(now.AddSeconds(i), 100 + (i * 0.5)); } var (results, indicator) = Jerk.Calculate(source); diff --git a/lib/numerics/lineartrans/tests/Lineartrans.Validation.Tests.cs b/lib/numerics/lineartrans/tests/Lineartrans.Validation.Tests.cs index d36597d1..081034d6 100644 --- a/lib/numerics/lineartrans/tests/Lineartrans.Validation.Tests.cs +++ b/lib/numerics/lineartrans/tests/Lineartrans.Validation.Tests.cs @@ -23,7 +23,7 @@ public class LineartransValidationTests for (int i = 0; i < series.Count; i++) { - double expected = slope * series[i].Value + intercept; + double expected = (slope * series[i].Value) + intercept; Assert.Equal(expected, result[i].Value, Tolerance); } } @@ -41,7 +41,7 @@ public class LineartransValidationTests for (int i = 0; i < series.Count; i++) { var result = linear.Update(series[i], true); - double expected = slope * series[i].Value + intercept; + double expected = (slope * series[i].Value) + intercept; Assert.Equal(expected, result.Value, Tolerance); } } @@ -59,7 +59,7 @@ public class LineartransValidationTests for (int i = 0; i < source.Length; i++) { - double expected = slope * source[i] + intercept; + double expected = (slope * source[i]) + intercept; Assert.Equal(expected, output[i], Tolerance); } } @@ -111,7 +111,7 @@ public class LineartransValidationTests // Direct composed transform: y = c*(a*x + b) + d = (a*c)*x + (b*c + d) double composedSlope = a * c; - double composedIntercept = b * c + d; + double composedIntercept = (b * c) + d; var direct = Lineartrans.Batch(series, composedSlope, composedIntercept); for (int i = 0; i < series.Count; i++) diff --git a/lib/numerics/lognormdist/tests/Lognormdist.Tests.cs b/lib/numerics/lognormdist/tests/Lognormdist.Tests.cs index c05c04d5..cdeef9f3 100644 --- a/lib/numerics/lognormdist/tests/Lognormdist.Tests.cs +++ b/lib/numerics/lognormdist/tests/Lognormdist.Tests.cs @@ -498,7 +498,7 @@ public class LognormdistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/normalize/tests/Normalize.Validation.Tests.cs b/lib/numerics/normalize/tests/Normalize.Validation.Tests.cs index 89304f1e..2b53d0e9 100644 --- a/lib/numerics/normalize/tests/Normalize.Validation.Tests.cs +++ b/lib/numerics/normalize/tests/Normalize.Validation.Tests.cs @@ -163,9 +163,9 @@ public class NormalizeValidationTests norm.Update(new TValue(DateTime.UtcNow, baseVal)); norm.Update(new TValue(DateTime.UtcNow, baseVal + epsilon)); - norm.Update(new TValue(DateTime.UtcNow, baseVal + epsilon / 2)); - norm.Update(new TValue(DateTime.UtcNow, baseVal + epsilon / 4)); - var result = norm.Update(new TValue(DateTime.UtcNow, baseVal + epsilon * 0.75)); + norm.Update(new TValue(DateTime.UtcNow, baseVal + (epsilon / 2))); + norm.Update(new TValue(DateTime.UtcNow, baseVal + (epsilon / 4))); + var result = norm.Update(new TValue(DateTime.UtcNow, baseVal + (epsilon * 0.75))); // Should be in valid range Assert.True(result.Value >= 0.0 && result.Value <= 1.0); diff --git a/lib/numerics/normdist/tests/Normdist.Tests.cs b/lib/numerics/normdist/tests/Normdist.Tests.cs index 46050165..ead116c5 100644 --- a/lib/numerics/normdist/tests/Normdist.Tests.cs +++ b/lib/numerics/normdist/tests/Normdist.Tests.cs @@ -512,7 +512,7 @@ public class NormdistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/poissondist/tests/Poissondist.Tests.cs b/lib/numerics/poissondist/tests/Poissondist.Tests.cs index 9ad623e8..6bed0521 100644 --- a/lib/numerics/poissondist/tests/Poissondist.Tests.cs +++ b/lib/numerics/poissondist/tests/Poissondist.Tests.cs @@ -487,7 +487,7 @@ public class PoissondistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/slope/tests/Slope.Validation.Tests.cs b/lib/numerics/slope/tests/Slope.Validation.Tests.cs index e84266d8..8a893c0e 100644 --- a/lib/numerics/slope/tests/Slope.Validation.Tests.cs +++ b/lib/numerics/slope/tests/Slope.Validation.Tests.cs @@ -155,7 +155,7 @@ public class SlopeValidationTests double[] data = new double[count]; for (int i = 0; i < count; i++) { - data[i] = 100.0 + i * 0.5; + data[i] = 100.0 + (i * 0.5); } var slope = new Slope(); diff --git a/lib/numerics/tdist/tests/Tdist.Tests.cs b/lib/numerics/tdist/tests/Tdist.Tests.cs index 583a1dc9..67cf779d 100644 --- a/lib/numerics/tdist/tests/Tdist.Tests.cs +++ b/lib/numerics/tdist/tests/Tdist.Tests.cs @@ -510,7 +510,7 @@ public class TdistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/numerics/tdist/tests/Tdist.Validation.Tests.cs b/lib/numerics/tdist/tests/Tdist.Validation.Tests.cs index d569a16a..cc8bddfc 100644 --- a/lib/numerics/tdist/tests/Tdist.Validation.Tests.cs +++ b/lib/numerics/tdist/tests/Tdist.Validation.Tests.cs @@ -249,7 +249,7 @@ public class TdistValidationTests // Cauchy (ν=1): CDF(100; 1) = 0.5 + arctan(100)/π ≈ 0.99681... // Heavy tails — does NOT approach 1 quickly double cdf = Tdist.StaticCdf(100.0, 1); - double expected = 0.5 + Math.Atan(100.0) / Math.PI; + double expected = 0.5 + (Math.Atan(100.0) / Math.PI); Assert.Equal(expected, cdf, 1e-9); Assert.True(cdf > 0.99 && cdf < 1.0, $"Cauchy CDF(100) = {cdf} should be in (0.99, 1.0)"); } @@ -269,7 +269,7 @@ public class TdistValidationTests { // Cauchy (ν=1): CDF(-100; 1) = 0.5 - arctan(100)/π ≈ 0.00319... double cdf = Tdist.StaticCdf(-100.0, 1); - double expected = 0.5 - Math.Atan(100.0) / Math.PI; + double expected = 0.5 - (Math.Atan(100.0) / Math.PI); Assert.Equal(expected, cdf, 1e-9); Assert.True(cdf > 0.0 && cdf < 0.01, $"Cauchy CDF(-100) = {cdf} should be in (0, 0.01)"); } diff --git a/lib/numerics/weibulldist/tests/Weibulldist.Tests.cs b/lib/numerics/weibulldist/tests/Weibulldist.Tests.cs index 4075c07a..a02db4c6 100644 --- a/lib/numerics/weibulldist/tests/Weibulldist.Tests.cs +++ b/lib/numerics/weibulldist/tests/Weibulldist.Tests.cs @@ -556,7 +556,7 @@ public class WeibulldistTests double[] src = new double[count]; for (int i = 0; i < count; i++) { - src[i] = 100.0 + Math.Sin(i * 0.1) * 10.0; + src[i] = 100.0 + (Math.Sin(i * 0.1) * 10.0); } double[] dst = new double[count]; diff --git a/lib/oscillators/ac/tests/Ac.Tests.cs b/lib/oscillators/ac/tests/Ac.Tests.cs index 9da231b4..077f5d67 100644 --- a/lib/oscillators/ac/tests/Ac.Tests.cs +++ b/lib/oscillators/ac/tests/Ac.Tests.cs @@ -329,7 +329,7 @@ public sealed class AcTests var ac = new Ac(); for (int i = 0; i < 50; i++) { - var val = new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 0.1); + var val = new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 0.1)); _ = ac.Update(val, isNew: true); } diff --git a/lib/oscillators/bbi/tests/Bbi.Quantower.Tests.cs b/lib/oscillators/bbi/tests/Bbi.Quantower.Tests.cs index 7bac3bf0..66c519b3 100644 --- a/lib/oscillators/bbi/tests/Bbi.Quantower.Tests.cs +++ b/lib/oscillators/bbi/tests/Bbi.Quantower.Tests.cs @@ -115,7 +115,7 @@ public sealed class BbiIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.5, 110 + i * 0.5, 90 + i * 0.5, 105 + i * 0.5); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.5), 110 + (i * 0.5), 90 + (i * 0.5), 105 + (i * 0.5)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/oscillators/bbi/tests/Bbi.Tests.cs b/lib/oscillators/bbi/tests/Bbi.Tests.cs index 5e959588..2c6d6861 100644 --- a/lib/oscillators/bbi/tests/Bbi.Tests.cs +++ b/lib/oscillators/bbi/tests/Bbi.Tests.cs @@ -381,7 +381,7 @@ public sealed class BbiTests int n = 10_000; var source = new double[n]; var output = new double[n]; - for (int i = 0; i < n; i++) { source[i] = 100.0 + i * 0.01; } + for (int i = 0; i < n; i++) { source[i] = 100.0 + (i * 0.01); } var ex = Record.Exception(() => Bbi.Batch(source.AsSpan(), output.AsSpan())); Assert.Null(ex); } diff --git a/lib/oscillators/bbs/tests/Bbs.Tests.cs b/lib/oscillators/bbs/tests/Bbs.Tests.cs index 495627d0..074cf199 100644 --- a/lib/oscillators/bbs/tests/Bbs.Tests.cs +++ b/lib/oscillators/bbs/tests/Bbs.Tests.cs @@ -68,7 +68,7 @@ public sealed class BbsTests // Constant price => stddev = 0 => BB width = 0 => bandwidth = 0 for (int i = 0; i < 5; i++) { - bbs.Update(new TBar(baseTime + i * 60000, 100, 100, 100, 100, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), 100, 100, 100, 100, 1000)); } Assert.Equal(0.0, bbs.Last.Value, 10); @@ -86,7 +86,7 @@ public sealed class BbsTests // Close is always 100, but high/low create ATR for (int i = 0; i < 10; i++) { - bbs.Update(new TBar(baseTime + i * 60000, 100, 102, 98, 100, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), 100, 102, 98, 100, 1000)); } // With constant close and non-zero ATR, BB bands (based on close stddev) should be @@ -110,7 +110,7 @@ public sealed class BbsTests double c = closes[i]; // H/L track actual price so TR ≈ close-to-close gap (ATR stays proportional) // but BB mult * stddev >> KC mult * ATR when kcMult is small - bbs.Update(new TBar(baseTime + i * 60000, c, c + 0.5, c - 0.5, c, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), c, c + 0.5, c - 0.5, c, 1000)); } // BB bands (3 * stddev) should exceed KC bands (0.5 * ATR) @@ -127,7 +127,7 @@ public sealed class BbsTests // Feed initial bars for (int i = 0; i < 5; i++) { - bbs.Update(new TBar(baseTime + i * 60000, 100 + i, 102 + i, 98 + i, 100 + i, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), 100 + i, 102 + i, 98 + i, 100 + i, 1000)); } // Save state after bar 5 for reference @@ -135,11 +135,11 @@ public sealed class BbsTests _ = bbs.SqueezeOn; // Update with new bar - bbs.Update(new TBar(baseTime + 5 * 60000, 110, 112, 108, 110, 1000), isNew: true); + bbs.Update(new TBar(baseTime + (5 * 60000), 110, 112, 108, 110, 1000), isNew: true); double afterBar6 = bbs.Last.Value; // Roll back with isNew=false - bbs.Update(new TBar(baseTime + 5 * 60000, 105, 107, 103, 105, 1000), isNew: false); + bbs.Update(new TBar(baseTime + (5 * 60000), 105, 107, 103, 105, 1000), isNew: false); double corrected = bbs.Last.Value; // Corrected value should differ from bar 6 (different price) but be valid @@ -156,7 +156,7 @@ public sealed class BbsTests // Phase 1: Tight range (squeeze on) for (int i = 0; i < 5; i++) { - bbs.Update(new TBar(baseTime + i * 60000, 100, 102, 98, 100, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), 100, 102, 98, 100, 1000)); } _ = bbs.SqueezeOn; // capture pre-breakout state @@ -164,8 +164,8 @@ public sealed class BbsTests // Phase 2: Breakout with huge price movement (squeeze off) for (int i = 0; i < 5; i++) { - double price = 100 + (i + 1) * 20; // 120, 140, 160, 180, 200 - bbs.Update(new TBar(baseTime + (5 + i) * 60000, price, price + 1, price - 1, price, 1000)); + double price = 100 + ((i + 1) * 20); // 120, 140, 160, 180, 200 + bbs.Update(new TBar(baseTime + ((5 + i) * 60000), price, price + 1, price - 1, price, 1000)); } // If squeeze was on and now off, SqueezeFired should have been true at transition @@ -181,8 +181,8 @@ public sealed class BbsTests for (int i = 0; i < 10; i++) { - double price = 100 + Math.Sin(i) * 5; - bbs.Update(new TBar(baseTime + i * 60000, price, price + 2, price - 2, price, 1000)); + double price = 100 + (Math.Sin(i) * 5); + bbs.Update(new TBar(baseTime + (i * 60000), price, price + 2, price - 2, price, 1000)); } // With varying prices, bandwidth should be positive @@ -214,7 +214,7 @@ public sealed class BbsTests for (int i = 0; i < 5; i++) { - bbs.Update(new TBar(baseTime + i * 60000, 100 + i, 102 + i, 98 + i, 100 + i, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), 100 + i, 102 + i, 98 + i, 100 + i, 1000)); } Assert.True(bbs.IsHot); @@ -236,7 +236,7 @@ public sealed class BbsTests for (int i = 0; i < 20; i++) { - series.Add(new TBar(baseTime + i * 60000, 100 + i, 110 + i, 90 + i, 105 + i, 1000)); + series.Add(new TBar(baseTime + (i * 60000), 100 + i, 110 + i, 90 + i, 105 + i, 1000)); } var result = Bbs.Batch(series); @@ -259,7 +259,7 @@ public sealed class BbsTests for (int i = 0; i < 20; i++) { - series.Add(new TBar(baseTime + i * 60000, 100 + i, 110 + i, 90 + i, 105 + i, 1000)); + series.Add(new TBar(baseTime + (i * 60000), 100 + i, 110 + i, 90 + i, 105 + i, 1000)); } var result = Bbs.Batch(series, bbPeriod: 10, bbMult: 1.5, kcPeriod: 10, kcMult: 2.0); @@ -275,8 +275,8 @@ public sealed class BbsTests for (int i = 0; i < 50; i++) { - double price = 100 + Math.Sin(i * 0.5) * 10; - series.Add(new TBar(baseTime + i * 60000, price, price + 3, price - 3, price, 1000)); + double price = 100 + (Math.Sin(i * 0.5) * 10); + series.Add(new TBar(baseTime + (i * 60000), price, price + 3, price - 3, price, 1000)); } // Streaming @@ -383,7 +383,7 @@ public sealed class BbsTests for (int i = 0; i < 30; i++) { - series.Add(new TBar(baseTime + i * 60000, 100 + i, 110 + i, 90 + i, 105 + i, 1000)); + series.Add(new TBar(baseTime + (i * 60000), 100 + i, 110 + i, 90 + i, 105 + i, 1000)); } var (results, indicator) = Bbs.Calculate(series, bbPeriod: 5, bbMult: 2.0, kcPeriod: 5, kcMult: 1.5); @@ -403,7 +403,7 @@ public sealed class BbsTests for (int i = 0; i < 5; i++) { - bbs.Update(new TBar(baseTime + i * 60000, 100 + i, 102 + i, 98 + i, 100 + i, 1000)); + bbs.Update(new TBar(baseTime + (i * 60000), 100 + i, 102 + i, 98 + i, 100 + i, 1000)); } Assert.Equal(5, eventCount); diff --git a/lib/oscillators/brar/tests/Brar.Quantower.Tests.cs b/lib/oscillators/brar/tests/Brar.Quantower.Tests.cs index c6dda6af..171c0a75 100644 --- a/lib/oscillators/brar/tests/Brar.Quantower.Tests.cs +++ b/lib/oscillators/brar/tests/Brar.Quantower.Tests.cs @@ -116,7 +116,7 @@ public sealed class BrarIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100.0 + i * 0.5; + double basePrice = 100.0 + (i * 0.5); indicator.HistoricalData.AddBar( now.AddMinutes(i), open: basePrice, diff --git a/lib/oscillators/coppock/tests/Coppock.Quantower.Tests.cs b/lib/oscillators/coppock/tests/Coppock.Quantower.Tests.cs index 38f4242d..7a15ad70 100644 --- a/lib/oscillators/coppock/tests/Coppock.Quantower.Tests.cs +++ b/lib/oscillators/coppock/tests/Coppock.Quantower.Tests.cs @@ -114,7 +114,7 @@ public sealed class CoppockIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 25; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.5, 110 + i * 0.5, 90 + i * 0.5, 105 + i * 0.5); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.5), 110 + (i * 0.5), 90 + (i * 0.5), 105 + (i * 0.5)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/oscillators/coppock/tests/Coppock.Tests.cs b/lib/oscillators/coppock/tests/Coppock.Tests.cs index ad5b0b39..04a8d7bf 100644 --- a/lib/oscillators/coppock/tests/Coppock.Tests.cs +++ b/lib/oscillators/coppock/tests/Coppock.Tests.cs @@ -149,7 +149,7 @@ public sealed class CoppockBarCorrectionTests var c = new Coppock(longRoc: 3, shortRoc: 2, wmaPeriod: 3); for (int i = 0; i < 5; i++) { - c.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2), isNew: true); + c.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2)), isNew: true); } double val1 = c.Last.Value; c.Update(new TValue(DateTime.UtcNow, 115.0), isNew: true); diff --git a/lib/oscillators/coppock/tests/Coppock.Validation.Tests.cs b/lib/oscillators/coppock/tests/Coppock.Validation.Tests.cs index abe70669..7941841f 100644 --- a/lib/oscillators/coppock/tests/Coppock.Validation.Tests.cs +++ b/lib/oscillators/coppock/tests/Coppock.Validation.Tests.cs @@ -93,7 +93,7 @@ public sealed class CoppockValidationTests(ITestOutputHelper output) double startPrice = 100.0; int n = 60; double[] prices = new double[n]; - for (int i = 0; i < n; i++) { prices[i] = startPrice + i * 0.5; } + for (int i = 0; i < n; i++) { prices[i] = startPrice + (i * 0.5); } var spanOut = new double[n]; Coppock.Batch(prices, spanOut, longRoc: 5, shortRoc: 4, wmaPeriod: 4); @@ -114,7 +114,7 @@ public sealed class CoppockValidationTests(ITestOutputHelper output) double startPrice = 200.0; int n = 60; double[] prices = new double[n]; - for (int i = 0; i < n; i++) { prices[i] = startPrice - i * 0.5; } + for (int i = 0; i < n; i++) { prices[i] = startPrice - (i * 0.5); } var spanOut = new double[n]; Coppock.Batch(prices, spanOut, longRoc: 5, shortRoc: 4, wmaPeriod: 4); diff --git a/lib/oscillators/crsi/tests/Crsi.Tests.cs b/lib/oscillators/crsi/tests/Crsi.Tests.cs index eb62d589..0ae3901b 100644 --- a/lib/oscillators/crsi/tests/Crsi.Tests.cs +++ b/lib/oscillators/crsi/tests/Crsi.Tests.cs @@ -382,7 +382,7 @@ public sealed class CrsiTests var out1 = new double[n]; for (int i = 0; i < n; i++) { - src[i] = 100.0 + i * 0.01; + src[i] = 100.0 + (i * 0.01); } // rankPeriod > 256 to exercise ArrayPool path diff --git a/lib/oscillators/cti/tests/Cti.Tests.cs b/lib/oscillators/cti/tests/Cti.Tests.cs index 041e7db7..2898ef3a 100644 --- a/lib/oscillators/cti/tests/Cti.Tests.cs +++ b/lib/oscillators/cti/tests/Cti.Tests.cs @@ -372,7 +372,7 @@ public sealed class CtiTests double[] output = new double[10000]; for (int i = 0; i < src.Length; i++) { - src[i] = 100.0 + i * 0.01; + src[i] = 100.0 + (i * 0.01); } var ex = Record.Exception(() => Cti.Batch(src.AsSpan(), output.AsSpan(), DefaultPeriod)); Assert.Null(ex); diff --git a/lib/oscillators/deco/tests/Deco.Tests.cs b/lib/oscillators/deco/tests/Deco.Tests.cs index 94768906..df6ecb1c 100644 --- a/lib/oscillators/deco/tests/Deco.Tests.cs +++ b/lib/oscillators/deco/tests/Deco.Tests.cs @@ -364,7 +364,7 @@ public class DecoTests TValue last = default; for (int i = 0; i < 30; i++) { - last = deco.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * i * 0.1)); + last = deco.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * i * 0.1))); } Assert.NotEqual(0.0, last.Value); } diff --git a/lib/oscillators/deco/tests/Deco.Validation.Tests.cs b/lib/oscillators/deco/tests/Deco.Validation.Tests.cs index a15283f8..b937b4fa 100644 --- a/lib/oscillators/deco/tests/Deco.Validation.Tests.cs +++ b/lib/oscillators/deco/tests/Deco.Validation.Tests.cs @@ -116,8 +116,8 @@ public class DecoValidationTests for (int i = 0; i < 60; i++) { double phase = 2.0 * Math.PI * i / 20.0; // period=20 bars - var rUp = decoUp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + 10.0 * Math.Sin(phase))); - var rDown = decoDown.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 - 10.0 * Math.Sin(phase))); + var rUp = decoUp.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (10.0 * Math.Sin(phase)))); + var rDown = decoDown.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 - (10.0 * Math.Sin(phase)))); lastUp = rUp.Value; lastDown = rDown.Value; } diff --git a/lib/oscillators/dem/tests/Dem.Quantower.Tests.cs b/lib/oscillators/dem/tests/Dem.Quantower.Tests.cs index cfb7a8e5..303a0472 100644 --- a/lib/oscillators/dem/tests/Dem.Quantower.Tests.cs +++ b/lib/oscillators/dem/tests/Dem.Quantower.Tests.cs @@ -111,7 +111,7 @@ public sealed class DemIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100.0 + i * 0.5; + double basePrice = 100.0 + (i * 0.5); indicator.HistoricalData.AddBar( now.AddMinutes(i), open: basePrice, diff --git a/lib/oscillators/dosc/tests/Dosc.Tests.cs b/lib/oscillators/dosc/tests/Dosc.Tests.cs index 4f9e6373..52a5d638 100644 --- a/lib/oscillators/dosc/tests/Dosc.Tests.cs +++ b/lib/oscillators/dosc/tests/Dosc.Tests.cs @@ -88,7 +88,7 @@ public class DoscTests for (int i = 0; i < 500; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1)); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1))); } Assert.True(indicator.IsHot); @@ -112,7 +112,7 @@ public class DoscTests // Warm up well past the period threshold for (int i = 0; i < DefaultRsi + DefaultSig + 10; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.5), isNew: true); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.5)), isNew: true); } TValue r1 = indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(50), 120.0), isNew: true); @@ -197,7 +197,7 @@ public class DoscTests for (int i = 0; i < 200; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1)); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1))); if (indicator.IsHot && hotAt < 0) { hotAt = i; @@ -246,7 +246,7 @@ public class DoscTests for (int i = 0; i < 100; i++) { - source[i] = 100.0 + i * 0.5; + source[i] = 100.0 + (i * 0.5); } source[50] = double.NaN; @@ -348,7 +348,7 @@ public class DoscTests for (int i = 0; i < size; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Dosc.Batch(source, output, 14, 5, 3, 9); diff --git a/lib/oscillators/dpo/tests/Dpo.Tests.cs b/lib/oscillators/dpo/tests/Dpo.Tests.cs index c686e207..45902a47 100644 --- a/lib/oscillators/dpo/tests/Dpo.Tests.cs +++ b/lib/oscillators/dpo/tests/Dpo.Tests.cs @@ -107,7 +107,7 @@ public sealed class DpoTests double[] data = new double[warmup + 3]; for (int i = 0; i < data.Length; i++) { - data[i] = 100 + i * 2; + data[i] = 100 + (i * 2); } for (int i = 0; i < data.Length; i++) diff --git a/lib/oscillators/dymoi/tests/Dymoi.Quantower.Tests.cs b/lib/oscillators/dymoi/tests/Dymoi.Quantower.Tests.cs index deef6dc4..c57007b7 100644 --- a/lib/oscillators/dymoi/tests/Dymoi.Quantower.Tests.cs +++ b/lib/oscillators/dymoi/tests/Dymoi.Quantower.Tests.cs @@ -94,7 +94,7 @@ public sealed class DymoiIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 60; i++) { - double price = 100.0 + Math.Sin(i * 0.3) * 10.0 + i * 0.1; + double price = 100.0 + (Math.Sin(i * 0.3) * 10.0) + (i * 0.1); indicator.HistoricalData.AddBar(now.AddMinutes(i), price + 5, price + 10, price - 5, price); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -122,7 +122,7 @@ public sealed class DymoiIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - double price = 100.0 + i * 0.5; + double price = 100.0 + (i * 0.5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price + 3, price + 6, price - 3, price); var reason = i < 49 ? UpdateReason.HistoricalBar : UpdateReason.NewBar; diff --git a/lib/oscillators/dymoi/tests/Dymoi.Tests.cs b/lib/oscillators/dymoi/tests/Dymoi.Tests.cs index 6dc4c4c4..f7600826 100644 --- a/lib/oscillators/dymoi/tests/Dymoi.Tests.cs +++ b/lib/oscillators/dymoi/tests/Dymoi.Tests.cs @@ -467,7 +467,7 @@ public sealed class DymoiTests var t = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - source.Add(new TValue(t.AddMinutes(i), 100.0 + i * 0.5)); + source.Add(new TValue(t.AddMinutes(i), 100.0 + (i * 0.5))); } Assert.Equal(30, output.Count); diff --git a/lib/oscillators/er/tests/Er.Tests.cs b/lib/oscillators/er/tests/Er.Tests.cs index c349b66e..c6736eec 100644 --- a/lib/oscillators/er/tests/Er.Tests.cs +++ b/lib/oscillators/er/tests/Er.Tests.cs @@ -62,7 +62,7 @@ public sealed class ErTests var er = new Er(period: 10); for (int i = 0; i < 20; i++) { - er.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2)); + er.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2))); } Assert.True(er.Last.Value > 0.8, "Strongly trending prices should produce high ER"); } @@ -117,7 +117,7 @@ public sealed class ErTests double[] data = new double[15]; for (int i = 0; i < data.Length; i++) { - data[i] = 100 + i * 2; + data[i] = 100 + (i * 2); } for (int i = 0; i < data.Length; i++) diff --git a/lib/oscillators/er/tests/Er.Validation.Tests.cs b/lib/oscillators/er/tests/Er.Validation.Tests.cs index 9701d529..1ea59d52 100644 --- a/lib/oscillators/er/tests/Er.Validation.Tests.cs +++ b/lib/oscillators/er/tests/Er.Validation.Tests.cs @@ -99,7 +99,7 @@ public sealed class ErValidationTests(ITestOutputHelper output) const int N = 100; const int period = 10; double[] prices = new double[N]; - for (int i = 0; i < N; i++) { prices[i] = 100.0 + i * 1.0; } + for (int i = 0; i < N; i++) { prices[i] = 100.0 + (i * 1.0); } var output2 = new double[N]; Er.Batch(prices.AsSpan(), output2.AsSpan(), period); diff --git a/lib/oscillators/fi/tests/Fi.Validation.Tests.cs b/lib/oscillators/fi/tests/Fi.Validation.Tests.cs index 5ab4aef6..8416bcd5 100644 --- a/lib/oscillators/fi/tests/Fi.Validation.Tests.cs +++ b/lib/oscillators/fi/tests/Fi.Validation.Tests.cs @@ -142,7 +142,7 @@ public sealed class FiValidationTests : IDisposable // Monotonically increasing force values double[] force = new double[N]; - for (int i = 0; i < N; i++) { force[i] = 100.0 + i * 10.0; } + for (int i = 0; i < N; i++) { force[i] = 100.0 + (i * 10.0); } var output = new double[N]; Fi.Calculate(force.AsSpan(), output.AsSpan(), period); diff --git a/lib/oscillators/fisher/tests/Fisher.Tests.cs b/lib/oscillators/fisher/tests/Fisher.Tests.cs index 8ec67eeb..b81d696f 100644 --- a/lib/oscillators/fisher/tests/Fisher.Tests.cs +++ b/lib/oscillators/fisher/tests/Fisher.Tests.cs @@ -88,7 +88,7 @@ public sealed class FisherTests var fisher = new Fisher(period: 5); for (int i = 0; i < 20; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2)); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2))); } Assert.True(fisher.FisherValue > 0, "Rising prices should produce positive Fisher"); } @@ -99,7 +99,7 @@ public sealed class FisherTests var fisher = new Fisher(period: 5); for (int i = 0; i < 20; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 200.0 - i * 2)); + fisher.Update(new TValue(DateTime.UtcNow, 200.0 - (i * 2))); } Assert.True(fisher.FisherValue < 0, "Falling prices should produce negative Fisher"); } @@ -131,7 +131,7 @@ public sealed class FisherTests double[] data = new double[15]; for (int i = 0; i < data.Length; i++) { - data[i] = 100 + i * 2; + data[i] = 100 + (i * 2); } for (int i = 0; i < data.Length; i++) @@ -388,7 +388,7 @@ public sealed class FisherTests // Create a very strong uptrend for (int i = 0; i < 30; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + i * 10)); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 10))); } // Fisher should be significantly positive @@ -404,7 +404,7 @@ public sealed class FisherTests for (int i = 0; i < 30; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + i * 5)); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 5))); } // Both should be positive in uptrend diff --git a/lib/oscillators/fisher/tests/Fisher.Validation.Tests.cs b/lib/oscillators/fisher/tests/Fisher.Validation.Tests.cs index c685fee7..0473d05b 100644 --- a/lib/oscillators/fisher/tests/Fisher.Validation.Tests.cs +++ b/lib/oscillators/fisher/tests/Fisher.Validation.Tests.cs @@ -128,7 +128,7 @@ public sealed class FisherValidationTests(ITestOutputHelper output) : IDisposabl } // Ehlers 2002: Fish = arctanh(Value1) + 0.5 * Fish[1] (IIR feedback) - fisherValue = 0.5 * Math.Log((1.0 + emaValue) / (1.0 - emaValue)) + 0.5 * fisherValue; + fisherValue = (0.5 * Math.Log((1.0 + emaValue) / (1.0 - emaValue))) + (0.5 * fisherValue); manualOutput[i] = fisherValue; } diff --git a/lib/oscillators/fisher04/tests/Fisher04.Tests.cs b/lib/oscillators/fisher04/tests/Fisher04.Tests.cs index 3116d042..22a2da97 100644 --- a/lib/oscillators/fisher04/tests/Fisher04.Tests.cs +++ b/lib/oscillators/fisher04/tests/Fisher04.Tests.cs @@ -74,7 +74,7 @@ public sealed class Fisher04Tests var fisher = new Fisher04(period: 5); for (int i = 0; i < 20; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2)); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2))); } Assert.True(fisher.FisherValue > 0, "Rising prices should produce positive Fisher04"); } @@ -85,7 +85,7 @@ public sealed class Fisher04Tests var fisher = new Fisher04(period: 5); for (int i = 0; i < 20; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 200.0 - i * 2)); + fisher.Update(new TValue(DateTime.UtcNow, 200.0 - (i * 2))); } Assert.True(fisher.FisherValue < 0, "Falling prices should produce negative Fisher04"); } @@ -117,7 +117,7 @@ public sealed class Fisher04Tests double[] data = new double[15]; for (int i = 0; i < data.Length; i++) { - data[i] = 100 + i * 2; + data[i] = 100 + (i * 2); } for (int i = 0; i < data.Length; i++) @@ -421,7 +421,7 @@ public sealed class Fisher04Tests // Create a very strong uptrend for (int i = 0; i < 30; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + i * 10)); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 10))); } // Fisher04 should be positive for uptrend @@ -437,7 +437,7 @@ public sealed class Fisher04Tests for (int i = 0; i < 30; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + i * 5)); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 5))); } // Both should be positive in uptrend diff --git a/lib/oscillators/fisher04/tests/Fisher04.Validation.Tests.cs b/lib/oscillators/fisher04/tests/Fisher04.Validation.Tests.cs index b0b60f8e..e1c7cef3 100644 --- a/lib/oscillators/fisher04/tests/Fisher04.Validation.Tests.cs +++ b/lib/oscillators/fisher04/tests/Fisher04.Validation.Tests.cs @@ -293,7 +293,7 @@ public sealed class Fisher04ValidationTests(ITestOutputHelper output) : IDisposa // Keep feeding extreme values to push value1 toward clamp for (int i = 0; i < 50; i++) { - fisher.Update(new TValue(DateTime.UtcNow, 100.0 + (i + 4) * 100.0), isNew: true); + fisher.Update(new TValue(DateTime.UtcNow, 100.0 + ((i + 4) * 100.0)), isNew: true); } // Fisher should remain finite (clamping prevents log(∞)) diff --git a/lib/oscillators/imi/tests/Imi.Tests.cs b/lib/oscillators/imi/tests/Imi.Tests.cs index 12915663..73f3d8e5 100644 --- a/lib/oscillators/imi/tests/Imi.Tests.cs +++ b/lib/oscillators/imi/tests/Imi.Tests.cs @@ -68,7 +68,7 @@ public class ImiTests for (int i = 0; i < 4; i++) { - imi.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } Assert.False(imi.IsHot); @@ -82,7 +82,7 @@ public class ImiTests for (int i = 0; i < 5; i++) { - imi.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } Assert.True(imi.IsHot); @@ -236,18 +236,18 @@ public class ImiTests // Fill buffer for (int i = 0; i < 3; i++) { - imi.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 102, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 102, 1000)); } // New bar - imi.Update(new TBar(baseTime + 3 * 60000, 100, 110, 99, 108, 1000), isNew: true); + imi.Update(new TBar(baseTime + (3 * 60000), 100, 110, 99, 108, 1000), isNew: true); double firstValue = imi.Last.Value; // Correction 1 - imi.Update(new TBar(baseTime + 3 * 60000, 100, 115, 99, 92, 1000), isNew: false); + imi.Update(new TBar(baseTime + (3 * 60000), 100, 115, 99, 92, 1000), isNew: false); // Correction 2 - same as first new bar - imi.Update(new TBar(baseTime + 3 * 60000, 100, 110, 99, 108, 1000), isNew: false); + imi.Update(new TBar(baseTime + (3 * 60000), 100, 110, 99, 108, 1000), isNew: false); double secondValue = imi.Last.Value; Assert.Equal(firstValue, secondValue, Precision); @@ -311,7 +311,7 @@ public class ImiTests for (int i = 0; i < 5; i++) { - imi.Update(new TBar(baseTime + i * 60000, 100, 110, 99, 108, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 100, 110, 99, 108, 1000)); } Assert.True(imi.IsHot); @@ -331,7 +331,7 @@ public class ImiTests // All up bars for (int i = 0; i < 3; i++) { - imi.Update(new TBar(baseTime + i * 60000, 100, 110, 99, 108, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 100, 110, 99, 108, 1000)); } Assert.Equal(100.0, imi.Last.Value, Precision); @@ -340,7 +340,7 @@ public class ImiTests // All down bars for (int i = 0; i < 3; i++) { - imi.Update(new TBar(baseTime + i * 60000, 108, 110, 99, 100, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 108, 110, 99, 100, 1000)); } Assert.Equal(0.0, imi.Last.Value, Precision); } @@ -358,7 +358,7 @@ public class ImiTests for (int i = 0; i < 10; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 110, 99, 108, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 110, 99, 108, 1000)); } imi.Prime(source); @@ -379,7 +379,7 @@ public class ImiTests for (int i = 0; i < 20; i++) { - source.Add(new TBar(baseTime + i * 60000, 100 + i, 110 + i, 90 + i, 105 + i, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100 + i, 110 + i, 90 + i, 105 + i, 1000)); } var result = Imi.Batch(source); @@ -404,7 +404,7 @@ public class ImiTests for (int i = 0; i < 20; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 110, 99, 108, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 110, 99, 108, 1000)); } var result = Imi.Batch(source, 5); @@ -421,7 +421,7 @@ public class ImiTests for (int i = 0; i < 20; i++) { - source.Add(new TBar(baseTime + i * 60000, 100, 110, 99, 108, 1000)); + source.Add(new TBar(baseTime + (i * 60000), 100, 110, 99, 108, 1000)); } var (results, indicator) = Imi.Calculate(source, 10); diff --git a/lib/oscillators/imi/tests/Imi.Validation.Tests.cs b/lib/oscillators/imi/tests/Imi.Validation.Tests.cs index 8102fee2..0b2ac95c 100644 --- a/lib/oscillators/imi/tests/Imi.Validation.Tests.cs +++ b/lib/oscillators/imi/tests/Imi.Validation.Tests.cs @@ -162,7 +162,7 @@ public sealed class ImiValidationTests : IDisposable for (int i = 0; i < 5; i++) { // Doji: Open == Close - imi.Update(new TBar(baseTime + i * 60000, 100, 105, 95, 100, 1000)); + imi.Update(new TBar(baseTime + (i * 60000), 100, 105, 95, 100, 1000)); } Assert.Equal(50.0, imi.Last.Value, 1e-10); diff --git a/lib/oscillators/inertia/tests/Inertia.Tests.cs b/lib/oscillators/inertia/tests/Inertia.Tests.cs index abc208b3..f1ef8b4e 100644 --- a/lib/oscillators/inertia/tests/Inertia.Tests.cs +++ b/lib/oscillators/inertia/tests/Inertia.Tests.cs @@ -381,7 +381,7 @@ public sealed class InertiaTests var inertia = new Inertia(period: 5); for (int i = 0; i < 10; i++) { - inertia.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2.0)); + inertia.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2.0))); } // Perfect linear trend → regression fits perfectly → residual = 0 Assert.Equal(0.0, inertia.Last.Value, precision: 10); diff --git a/lib/oscillators/inertia/tests/Inertia.Validation.Tests.cs b/lib/oscillators/inertia/tests/Inertia.Validation.Tests.cs index 71b4499e..e7816820 100644 --- a/lib/oscillators/inertia/tests/Inertia.Validation.Tests.cs +++ b/lib/oscillators/inertia/tests/Inertia.Validation.Tests.cs @@ -174,10 +174,10 @@ public sealed class InertiaValidationTests : IDisposable sumX2 += x * x; } - double denom = n * sumX2 - sumX * sumX; - double slope = (n * sumXY - sumX * sumY) / denom; - double intercept = (sumY - slope * sumX) / n; - double tsf = slope * (n - 1) + intercept; + double denom = (n * sumX2) - (sumX * sumX); + double slope = ((n * sumXY) - (sumX * sumY)) / denom; + double intercept = (sumY - (slope * sumX)) / n; + double tsf = (slope * (n - 1)) + intercept; double expected = raw[^1] - tsf; _output.WriteLine($"Manual Inertia: {expected:F12}"); diff --git a/lib/oscillators/kdj/tests/Kdj.Tests.cs b/lib/oscillators/kdj/tests/Kdj.Tests.cs index 2cd21670..9a58437a 100644 --- a/lib/oscillators/kdj/tests/Kdj.Tests.cs +++ b/lib/oscillators/kdj/tests/Kdj.Tests.cs @@ -517,9 +517,9 @@ public sealed class KdjTests for (int i = 0; i < barCount; i++) { - high[i] = 100.0 + i * 0.1; - low[i] = 99.0 + i * 0.1; - close[i] = 99.5 + i * 0.1; + high[i] = 100.0 + (i * 0.1); + low[i] = 99.0 + (i * 0.1); + close[i] = 99.5 + (i * 0.1); } // Should not throw StackOverflowException (uses ArrayPool for > 256) @@ -582,12 +582,12 @@ public sealed class KdjTests // Now sharp move up for (int i = 3; i < 8; i++) { - kdj.Update(new TBar(time.AddSeconds(i), 100 + (i - 2) * 5, 110 + (i - 2) * 5, 95 + (i - 2) * 5, 110 + (i - 2) * 5, 1000)); + kdj.Update(new TBar(time.AddSeconds(i), 100 + ((i - 2) * 5), 110 + ((i - 2) * 5), 95 + ((i - 2) * 5), 110 + ((i - 2) * 5), 1000)); } // J should be able to exceed 100 (it's unbounded) // This is a property test - we just verify J is computed as 3K-2D - double expectedJ = 3.0 * kdj.K.Value - 2.0 * kdj.D.Value; + double expectedJ = (3.0 * kdj.K.Value) - (2.0 * kdj.D.Value); Assert.Equal(expectedJ, kdj.Last.Value, 1e-10); } @@ -606,10 +606,10 @@ public sealed class KdjTests // Sharp move down for (int i = 3; i < 8; i++) { - kdj.Update(new TBar(time.AddSeconds(i), 200 - (i - 2) * 5, 210 - (i - 2) * 5, 190 - (i - 2) * 5, 190 - (i - 2) * 5, 1000)); + kdj.Update(new TBar(time.AddSeconds(i), 200 - ((i - 2) * 5), 210 - ((i - 2) * 5), 190 - ((i - 2) * 5), 190 - ((i - 2) * 5), 1000)); } - double expectedJ = 3.0 * kdj.K.Value - 2.0 * kdj.D.Value; + double expectedJ = (3.0 * kdj.K.Value) - (2.0 * kdj.D.Value); Assert.Equal(expectedJ, kdj.Last.Value, 1e-10); } diff --git a/lib/oscillators/kdj/tests/Kdj.Validation.Tests.cs b/lib/oscillators/kdj/tests/Kdj.Validation.Tests.cs index a488de7b..00d21a4c 100644 --- a/lib/oscillators/kdj/tests/Kdj.Validation.Tests.cs +++ b/lib/oscillators/kdj/tests/Kdj.Validation.Tests.cs @@ -129,7 +129,7 @@ public sealed class KdjValidationTests(ITestOutputHelper output) : IDisposable for (int i = 0; i < barCount; i++) { - double expectedJ = 3.0 * bK.Values[i] - 2.0 * bD.Values[i]; + double expectedJ = (3.0 * bK.Values[i]) - (2.0 * bD.Values[i]); Assert.Equal(expectedJ, bJ.Values[i], 1e-10); } diff --git a/lib/oscillators/kri/tests/Kri.Tests.cs b/lib/oscillators/kri/tests/Kri.Tests.cs index 6ac01809..9f685e27 100644 --- a/lib/oscillators/kri/tests/Kri.Tests.cs +++ b/lib/oscillators/kri/tests/Kri.Tests.cs @@ -21,7 +21,7 @@ public sealed class KriTests var k = new Kri(5); for (int i = 0; i < 20; i++) { - k.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2)); + k.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2))); } Assert.True(k.Last.Value > 0, "Price above SMA should produce positive KRI"); } @@ -31,7 +31,7 @@ public sealed class KriTests var k = new Kri(5); for (int i = 0; i < 20; i++) { - k.Update(new TValue(DateTime.UtcNow, 200.0 - i * 2)); + k.Update(new TValue(DateTime.UtcNow, 200.0 - (i * 2))); } Assert.True(k.Last.Value < 0, "Price below SMA should produce negative KRI"); } @@ -57,7 +57,7 @@ public sealed class KriTests double[] data = new double[15]; for (int i = 0; i < data.Length; i++) { - data[i] = 100 + i * 2; + data[i] = 100 + (i * 2); } for (int i = 0; i < data.Length; i++) { diff --git a/lib/oscillators/kri/tests/Kri.Validation.Tests.cs b/lib/oscillators/kri/tests/Kri.Validation.Tests.cs index 5b8fa563..f0554583 100644 --- a/lib/oscillators/kri/tests/Kri.Validation.Tests.cs +++ b/lib/oscillators/kri/tests/Kri.Validation.Tests.cs @@ -101,7 +101,7 @@ public sealed class KriValidationTests(ITestOutputHelper output) const int N = 100; const int period = 5; double[] prices = new double[N]; - for (int i = 0; i < N; i++) { prices[i] = 100.0 + i * 2.0; } + for (int i = 0; i < N; i++) { prices[i] = 100.0 + (i * 2.0); } var batchOut = new double[N]; Kri.Batch(prices.AsSpan(), batchOut.AsSpan(), period); @@ -123,7 +123,7 @@ public sealed class KriValidationTests(ITestOutputHelper output) const int N = 100; const int period = 5; double[] prices = new double[N]; - for (int i = 0; i < N; i++) { prices[i] = 200.0 - i * 2.0; } + for (int i = 0; i < N; i++) { prices[i] = 200.0 - (i * 2.0); } var batchOut = new double[N]; Kri.Batch(prices.AsSpan(), batchOut.AsSpan(), period); diff --git a/lib/oscillators/kst/tests/Kst.Quantower.Tests.cs b/lib/oscillators/kst/tests/Kst.Quantower.Tests.cs index 75f4dd6e..2f023267 100644 --- a/lib/oscillators/kst/tests/Kst.Quantower.Tests.cs +++ b/lib/oscillators/kst/tests/Kst.Quantower.Tests.cs @@ -127,7 +127,7 @@ public sealed class KstIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.5, 110 + i * 0.5, 90 + i * 0.5, 105 + i * 0.5); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.5), 110 + (i * 0.5), 90 + (i * 0.5), 105 + (i * 0.5)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/oscillators/kst/tests/Kst.Tests.cs b/lib/oscillators/kst/tests/Kst.Tests.cs index c98bb332..bbe8af5c 100644 --- a/lib/oscillators/kst/tests/Kst.Tests.cs +++ b/lib/oscillators/kst/tests/Kst.Tests.cs @@ -148,7 +148,7 @@ public sealed class KstBarCorrectionTests var kst = new Kst(r1: 3, r2: 4, r3: 5, r4: 6, s1: 2, s2: 2, s3: 2, s4: 2, sigPeriod: 2); for (int i = 0; i < 5; i++) { - kst.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2), isNew: true); + kst.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2)), isNew: true); } double val1 = kst.Last.Value; kst.Update(new TValue(DateTime.UtcNow, 110.0), isNew: true); diff --git a/lib/oscillators/kst/tests/Kst.Validation.Tests.cs b/lib/oscillators/kst/tests/Kst.Validation.Tests.cs index 6d1ce058..edc87e80 100644 --- a/lib/oscillators/kst/tests/Kst.Validation.Tests.cs +++ b/lib/oscillators/kst/tests/Kst.Validation.Tests.cs @@ -101,7 +101,7 @@ public sealed class KstValidationTests(ITestOutputHelper output) double startPrice = 100.0; int n = 60; double[] prices = new double[n]; - for (int i = 0; i < n; i++) { prices[i] = startPrice + i * 0.5; } // constant rise + for (int i = 0; i < n; i++) { prices[i] = startPrice + (i * 0.5); } // constant rise var spanK = new double[n]; var spanS = new double[n]; @@ -124,7 +124,7 @@ public sealed class KstValidationTests(ITestOutputHelper output) double startPrice = 200.0; int n = 60; double[] prices = new double[n]; - for (int i = 0; i < n; i++) { prices[i] = startPrice - i * 0.5; } // constant fall + for (int i = 0; i < n; i++) { prices[i] = startPrice - (i * 0.5); } // constant fall var spanK = new double[n]; var spanS = new double[n]; diff --git a/lib/oscillators/lrsi/tests/Lrsi.Quantower.Tests.cs b/lib/oscillators/lrsi/tests/Lrsi.Quantower.Tests.cs index 90c59070..0895d174 100644 --- a/lib/oscillators/lrsi/tests/Lrsi.Quantower.Tests.cs +++ b/lib/oscillators/lrsi/tests/Lrsi.Quantower.Tests.cs @@ -66,7 +66,7 @@ public sealed class LrsiIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double price = 100.0 + Math.Sin(i * 0.3) * 10.0 + i * 0.1; + double price = 100.0 + (Math.Sin(i * 0.3) * 10.0) + (i * 0.1); indicator.HistoricalData.AddBar(now.AddMinutes(i), price + 5, price + 10, price - 5, price); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -87,7 +87,7 @@ public sealed class LrsiIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double price = 100.0 + i * 0.5; + double price = 100.0 + (i * 0.5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price + 3, price + 6, price - 3, price); var reason = i < 19 ? UpdateReason.HistoricalBar : UpdateReason.NewBar; @@ -138,7 +138,7 @@ public sealed class LrsiIndicatorTests // Feed a volatile sine wave to exercise full range for (int i = 0; i < 100; i++) { - double price = 100.0 + Math.Sin(i * 0.2) * 20.0; + double price = 100.0 + (Math.Sin(i * 0.2) * 20.0); indicator.HistoricalData.AddBar(now.AddMinutes(i), price + 5, price + 10, price - 5, price); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/oscillators/lrsi/tests/Lrsi.Tests.cs b/lib/oscillators/lrsi/tests/Lrsi.Tests.cs index 598644b6..889d7e95 100644 --- a/lib/oscillators/lrsi/tests/Lrsi.Tests.cs +++ b/lib/oscillators/lrsi/tests/Lrsi.Tests.cs @@ -475,7 +475,7 @@ public sealed class LrsiTests var t = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - source.Add(new TValue(t.AddMinutes(i), 100.0 + i * 0.5)); + source.Add(new TValue(t.AddMinutes(i), 100.0 + (i * 0.5))); } Assert.Equal(30, output.Count); diff --git a/lib/oscillators/mstoch/tests/Mstoch.Quantower.Tests.cs b/lib/oscillators/mstoch/tests/Mstoch.Quantower.Tests.cs index 5ece0e13..656faba3 100644 --- a/lib/oscillators/mstoch/tests/Mstoch.Quantower.Tests.cs +++ b/lib/oscillators/mstoch/tests/Mstoch.Quantower.Tests.cs @@ -68,7 +68,7 @@ public sealed class MstochIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.5, 110 + i * 0.5, 90 + i * 0.5, 105 + i * 0.5); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.5), 110 + (i * 0.5), 90 + (i * 0.5), 105 + (i * 0.5)); var args = new UpdateArgs(UpdateReason.HistoricalBar); indicator.ProcessUpdate(args); } @@ -118,7 +118,7 @@ public sealed class MstochIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.5, 110 + i * 0.5, 90 + i * 0.5, 105 + i * 0.5); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.5), 110 + (i * 0.5), 90 + (i * 0.5), 105 + (i * 0.5)); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/oscillators/mstoch/tests/Mstoch.Validation.Tests.cs b/lib/oscillators/mstoch/tests/Mstoch.Validation.Tests.cs index 204c9b38..6b339416 100644 --- a/lib/oscillators/mstoch/tests/Mstoch.Validation.Tests.cs +++ b/lib/oscillators/mstoch/tests/Mstoch.Validation.Tests.cs @@ -178,7 +178,7 @@ public sealed class MstochValidationTests // Feed 50 strongly rising bars for (int i = 0; i < 50; i++) { - mstoch.Update(new TValue(t0.AddSeconds(100 + i), 100.0 + i * 2.0)); + mstoch.Update(new TValue(t0.AddSeconds(100 + i), 100.0 + (i * 2.0))); } double risingVal = mstoch.Last.Value; @@ -190,7 +190,7 @@ public sealed class MstochValidationTests } for (int i = 0; i < 50; i++) { - mstoch.Update(new TValue(t0.AddSeconds(100 + i), 100.0 - i * 2.0)); + mstoch.Update(new TValue(t0.AddSeconds(100 + i), 100.0 - (i * 2.0))); } double fallingVal = mstoch.Last.Value; diff --git a/lib/oscillators/pgo/tests/Pgo.Validation.Tests.cs b/lib/oscillators/pgo/tests/Pgo.Validation.Tests.cs index d3a967c1..a771dfbb 100644 --- a/lib/oscillators/pgo/tests/Pgo.Validation.Tests.cs +++ b/lib/oscillators/pgo/tests/Pgo.Validation.Tests.cs @@ -74,7 +74,7 @@ public sealed class PgoValidationTests // Feed gradually rising prices for (int i = 0; i < 10; i++) { - double c = 100.0 + i * 2; + double c = 100.0 + (i * 2); pgo.Update(new TBar(DateTime.UtcNow, c - 1, c + 3, c - 3, c, 100)); } @@ -92,13 +92,13 @@ public sealed class PgoValidationTests // Feed rising prices first, then drop for (int i = 0; i < 7; i++) { - double c = 100.0 + i * 5; + double c = 100.0 + (i * 5); pgo.Update(new TBar(DateTime.UtcNow, c - 1, c + 3, c - 3, c, 100)); } // Now drop sharply for (int i = 0; i < 5; i++) { - double c = 80.0 - i * 5; + double c = 80.0 - (i * 5); pgo.Update(new TBar(DateTime.UtcNow, c - 1, c + 3, c - 3, c, 100)); } diff --git a/lib/oscillators/psl/tests/Psl.Tests.cs b/lib/oscillators/psl/tests/Psl.Tests.cs index 3ce7e4d4..76f05b13 100644 --- a/lib/oscillators/psl/tests/Psl.Tests.cs +++ b/lib/oscillators/psl/tests/Psl.Tests.cs @@ -21,7 +21,7 @@ public sealed class PslTests var p = new Psl(5); for (int i = 0; i < 20; i++) { - p.Update(new TValue(DateTime.UtcNow, 100.0 + i * 2)); + p.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 2))); } Assert.True(p.Last.Value > 50, "Rising prices should produce PSL > 50"); } @@ -31,7 +31,7 @@ public sealed class PslTests var p = new Psl(5); for (int i = 0; i < 20; i++) { - p.Update(new TValue(DateTime.UtcNow, 200.0 - i * 2)); + p.Update(new TValue(DateTime.UtcNow, 200.0 - (i * 2))); } Assert.True(p.Last.Value < 50, "Falling prices should produce PSL < 50"); } @@ -67,7 +67,7 @@ public sealed class PslTests double[] data = new double[15]; for (int i = 0; i < data.Length; i++) { - data[i] = 100 + i * 2; + data[i] = 100 + (i * 2); } for (int i = 0; i < data.Length; i++) { diff --git a/lib/oscillators/reflex/tests/Reflex.Tests.cs b/lib/oscillators/reflex/tests/Reflex.Tests.cs index a823c502..53397650 100644 --- a/lib/oscillators/reflex/tests/Reflex.Tests.cs +++ b/lib/oscillators/reflex/tests/Reflex.Tests.cs @@ -72,7 +72,7 @@ public class ReflexTests for (int i = 0; i < 500; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1)); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1))); } Assert.True(indicator.IsHot); @@ -98,7 +98,7 @@ public class ReflexTests // Warm up past the period threshold first for (int i = 0; i < DefaultPeriod + 5; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.5), isNew: true); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.5)), isNew: true); } TValue r1 = indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(30), 120.0), isNew: true); @@ -235,7 +235,7 @@ public class ReflexTests for (int i = 0; i < 100; i++) { - source[i] = 100.0 + i * 0.5; + source[i] = 100.0 + (i * 0.5); } source[50] = double.NaN; @@ -328,7 +328,7 @@ public class ReflexTests for (int i = 0; i < size; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Reflex.Batch(source, output, 20); diff --git a/lib/oscillators/reverseema/tests/ReverseEma.Tests.cs b/lib/oscillators/reverseema/tests/ReverseEma.Tests.cs index 8ebca84a..2688fd4e 100644 --- a/lib/oscillators/reverseema/tests/ReverseEma.Tests.cs +++ b/lib/oscillators/reverseema/tests/ReverseEma.Tests.cs @@ -65,7 +65,7 @@ public class ReverseEmaTests for (int i = 0; i < 500; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1)); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1))); } Assert.True(indicator.IsHot); @@ -223,7 +223,7 @@ public class ReverseEmaTests for (int i = 0; i < 100; i++) { - source[i] = 100.0 + i * 0.5; + source[i] = 100.0 + (i * 0.5); } source[50] = double.NaN; @@ -316,7 +316,7 @@ public class ReverseEmaTests for (int i = 0; i < size; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } ReverseEma.Batch(source, output, 20); diff --git a/lib/oscillators/rvgi/tests/Rvgi.Quantower.Tests.cs b/lib/oscillators/rvgi/tests/Rvgi.Quantower.Tests.cs index 0cbc797e..323850aa 100644 --- a/lib/oscillators/rvgi/tests/Rvgi.Quantower.Tests.cs +++ b/lib/oscillators/rvgi/tests/Rvgi.Quantower.Tests.cs @@ -116,7 +116,7 @@ public sealed class RvgiIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100.0 + i * 0.5; + double basePrice = 100.0 + (i * 0.5); indicator.HistoricalData.AddBar( now.AddMinutes(i), open: basePrice, diff --git a/lib/oscillators/rvgi/tests/Rvgi.Validation.Tests.cs b/lib/oscillators/rvgi/tests/Rvgi.Validation.Tests.cs index 798c1379..7aa74945 100644 --- a/lib/oscillators/rvgi/tests/Rvgi.Validation.Tests.cs +++ b/lib/oscillators/rvgi/tests/Rvgi.Validation.Tests.cs @@ -239,7 +239,7 @@ public sealed class RvgiValidationTests(ITestOutputHelper output) for (int i = 0; i < 50; i++) { - double basePrice = 100.0 + i * 0.5; + double basePrice = 100.0 + (i * 0.5); rvgi.Update(new TBar( DateTime.UtcNow.AddMinutes(i), open: basePrice, @@ -261,7 +261,7 @@ public sealed class RvgiValidationTests(ITestOutputHelper output) for (int i = 0; i < 50; i++) { - double basePrice = 200.0 - i * 0.5; + double basePrice = 200.0 - (i * 0.5); rvgi.Update(new TBar( DateTime.UtcNow.AddMinutes(i), open: basePrice + 2.0, diff --git a/lib/oscillators/squeeze/tests/Squeeze.Quantower.Tests.cs b/lib/oscillators/squeeze/tests/Squeeze.Quantower.Tests.cs index d458ab24..516a51bf 100644 --- a/lib/oscillators/squeeze/tests/Squeeze.Quantower.Tests.cs +++ b/lib/oscillators/squeeze/tests/Squeeze.Quantower.Tests.cs @@ -111,7 +111,7 @@ public sealed class SqueezeIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 15; i++) { - double price = 50.0 + i * 0.5; + double price = 50.0 + (i * 0.5); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 0.5, price - 0.5, price + 0.1); var args = new UpdateArgs(UpdateReason.HistoricalBar); indicator.ProcessUpdate(args); diff --git a/lib/oscillators/stc/tests/Stc.Quantower.Tests.cs b/lib/oscillators/stc/tests/Stc.Quantower.Tests.cs index 8db96d7c..4d4ef8d1 100644 --- a/lib/oscillators/stc/tests/Stc.Quantower.Tests.cs +++ b/lib/oscillators/stc/tests/Stc.Quantower.Tests.cs @@ -144,7 +144,7 @@ public class StcIndicatorTests double[] closes = new double[100]; for (int i = 0; i < 100; i++) { - closes[i] = 100 + Math.Sin(i * 0.1) * 10; + closes[i] = 100 + (Math.Sin(i * 0.1) * 10); } foreach (var close in closes) diff --git a/lib/oscillators/trendflex/tests/Trendflex.Tests.cs b/lib/oscillators/trendflex/tests/Trendflex.Tests.cs index 160bfde2..88ea7cea 100644 --- a/lib/oscillators/trendflex/tests/Trendflex.Tests.cs +++ b/lib/oscillators/trendflex/tests/Trendflex.Tests.cs @@ -65,7 +65,7 @@ public class TrendflexTests for (int i = 0; i < 500; i++) { - indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.1)); + indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.1))); } Assert.True(indicator.IsHot); @@ -223,7 +223,7 @@ public class TrendflexTests for (int i = 0; i < 100; i++) { - source[i] = 100.0 + i * 0.5; + source[i] = 100.0 + (i * 0.5); } source[50] = double.NaN; @@ -316,7 +316,7 @@ public class TrendflexTests for (int i = 0; i < size; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Trendflex.Batch(source, output, 20); @@ -412,7 +412,7 @@ public class TrendflexTests // Strong uptrend for (int i = 0; i < 100; i++) { - TValue r = indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 2.0)); + TValue r = indicator.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 2.0))); lastResult = r.Value; } diff --git a/lib/oscillators/trix/tests/Trix.Validation.Tests.cs b/lib/oscillators/trix/tests/Trix.Validation.Tests.cs index d9246bfd..e7af8358 100644 --- a/lib/oscillators/trix/tests/Trix.Validation.Tests.cs +++ b/lib/oscillators/trix/tests/Trix.Validation.Tests.cs @@ -338,7 +338,7 @@ public sealed class TrixValidationTests(ITestOutputHelper output) : IDisposable // Feed a long sustained uptrend to ensure TRIX stabilizes positive for (int i = 0; i < 50; i++) { - trix.Update(new TValue(DateTime.UtcNow, 100 + i * 2)); + trix.Update(new TValue(DateTime.UtcNow, 100 + (i * 2))); } double uptrendTrix = trix.Last.Value; Assert.True(uptrendTrix > 0, $"Sustained uptrend should produce positive TRIX, got {uptrendTrix}"); @@ -346,7 +346,7 @@ public sealed class TrixValidationTests(ITestOutputHelper output) : IDisposable // Feed a long sustained downtrend for (int i = 0; i < 50; i++) { - trix.Update(new TValue(DateTime.UtcNow, 200 - i * 2)); + trix.Update(new TValue(DateTime.UtcNow, 200 - (i * 2))); } double downtrendTrix = trix.Last.Value; Assert.True(downtrendTrix < 0, $"Sustained downtrend should produce negative TRIX, got {downtrendTrix}"); diff --git a/lib/oscillators/ttm_wave/tests/TtmWave.Quantower.Tests.cs b/lib/oscillators/ttm_wave/tests/TtmWave.Quantower.Tests.cs index 73b89504..fc09dc8c 100644 --- a/lib/oscillators/ttm_wave/tests/TtmWave.Quantower.Tests.cs +++ b/lib/oscillators/ttm_wave/tests/TtmWave.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class TtmWaveIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 800; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.1, 110 + i * 0.1, 90 + i * 0.1, 105 + i * 0.1); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.1), 110 + (i * 0.1), 90 + (i * 0.1), 105 + (i * 0.1)); var args = new UpdateArgs(UpdateReason.HistoricalBar); indicator.ProcessUpdate(args); @@ -85,7 +85,7 @@ public sealed class TtmWaveIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 800; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.1, 110 + i * 0.1, 90 + i * 0.1, 105 + i * 0.1); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.1), 110 + (i * 0.1), 90 + (i * 0.1), 105 + (i * 0.1)); var args = new UpdateArgs(UpdateReason.HistoricalBar); indicator.ProcessUpdate(args); } @@ -138,7 +138,7 @@ public sealed class TtmWaveIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 800; i++) { - indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 0.1, 110 + i * 0.1, 90 + i * 0.1, 105 + i * 0.1); + indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 0.1), 110 + (i * 0.1), 90 + (i * 0.1), 105 + (i * 0.1)); var args = new UpdateArgs(UpdateReason.HistoricalBar); indicator.ProcessUpdate(args); } diff --git a/lib/reversals/chandelier/tests/Chandelier.Tests.cs b/lib/reversals/chandelier/tests/Chandelier.Tests.cs index 475e6591..5b64e813 100644 --- a/lib/reversals/chandelier/tests/Chandelier.Tests.cs +++ b/lib/reversals/chandelier/tests/Chandelier.Tests.cs @@ -114,12 +114,12 @@ public sealed class ChandelierBasicTests // Steady uptrend for (int i = 0; i < 20; i++) { - double price = basePrice + i * 2; + double price = basePrice + (i * 2); _ = ch.Update(new TBar(DateTime.UtcNow.AddMinutes(i), price + 1, price - 1, price + 0.5, price, 1000)); } - Assert.True(ch.ExitLong < 100.0 + 19 * 2, "ExitLong should be below the current price in an uptrend"); + Assert.True(ch.ExitLong < 100.0 + (19 * 2), "ExitLong should be below the current price in an uptrend"); } } diff --git a/lib/reversals/ckstop/tests/Ckstop.Tests.cs b/lib/reversals/ckstop/tests/Ckstop.Tests.cs index c94945cc..15cf8879 100644 --- a/lib/reversals/ckstop/tests/Ckstop.Tests.cs +++ b/lib/reversals/ckstop/tests/Ckstop.Tests.cs @@ -131,12 +131,12 @@ public sealed class CkstopBasicTests // Steady uptrend for (int i = 0; i < 20; i++) { - double price = basePrice + i * 2; + double price = basePrice + (i * 2); _ = ck.Update(new TBar(DateTime.UtcNow.AddMinutes(i), price + 1, price - 1, price + 0.5, price, 1000)); } - Assert.True(ck.StopLong < 100.0 + 19 * 2, "StopLong should be below the current price in an uptrend"); + Assert.True(ck.StopLong < 100.0 + (19 * 2), "StopLong should be below the current price in an uptrend"); } } diff --git a/lib/reversals/fractals/tests/Fractals.Tests.cs b/lib/reversals/fractals/tests/Fractals.Tests.cs index 4b1d9649..132c4076 100644 --- a/lib/reversals/fractals/tests/Fractals.Tests.cs +++ b/lib/reversals/fractals/tests/Fractals.Tests.cs @@ -97,7 +97,7 @@ public sealed class FractalsBasicTests // Monotone ascending - no fractal for (int i = 0; i < 5; i++) { - double price = 100.0 + i * 5; + double price = 100.0 + (i * 5); _ = f.Update(new TBar(dt.AddMinutes(i), price, price + 2, price - 2, price + 1, 1000), isNew: true); } diff --git a/lib/reversals/pivot/tests/Pivot.Quantower.Tests.cs b/lib/reversals/pivot/tests/Pivot.Quantower.Tests.cs index 9dc0d15b..dcb1da4c 100644 --- a/lib/reversals/pivot/tests/Pivot.Quantower.Tests.cs +++ b/lib/reversals/pivot/tests/Pivot.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class PivotIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 10; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/reversals/pivot/tests/Pivot.Tests.cs b/lib/reversals/pivot/tests/Pivot.Tests.cs index f664d9f9..e36b89d1 100644 --- a/lib/reversals/pivot/tests/Pivot.Tests.cs +++ b/lib/reversals/pivot/tests/Pivot.Tests.cs @@ -101,12 +101,12 @@ public sealed class PivotBasicTests double expectedPP = (120.0 + 100.0 + 115.0) / 3.0; Assert.Equal(expectedPP, p.PP, precision: 10); - Assert.Equal(2.0 * expectedPP - 100.0, p.R1, precision: 10); - Assert.Equal(2.0 * expectedPP - 120.0, p.S1, precision: 10); + Assert.Equal((2.0 * expectedPP) - 100.0, p.R1, precision: 10); + Assert.Equal((2.0 * expectedPP) - 120.0, p.S1, precision: 10); Assert.Equal(expectedPP + 20.0, p.R2, precision: 10); Assert.Equal(expectedPP - 20.0, p.S2, precision: 10); - Assert.Equal(120.0 + 2.0 * (expectedPP - 100.0), p.R3, precision: 10); - Assert.Equal(100.0 - 2.0 * (120.0 - expectedPP), p.S3, precision: 10); + Assert.Equal(120.0 + (2.0 * (expectedPP - 100.0)), p.R3, precision: 10); + Assert.Equal(100.0 - (2.0 * (120.0 - expectedPP)), p.S3, precision: 10); } [Fact] diff --git a/lib/reversals/pivot/tests/Pivot.Validation.Tests.cs b/lib/reversals/pivot/tests/Pivot.Validation.Tests.cs index 9f4d60ce..8d724f8b 100644 --- a/lib/reversals/pivot/tests/Pivot.Validation.Tests.cs +++ b/lib/reversals/pivot/tests/Pivot.Validation.Tests.cs @@ -61,12 +61,12 @@ public sealed class PivotValidationTests double range = pH - pL; Assert.Equal(pp, p.PP, precision: 10); - Assert.Equal(2.0 * pp - pL, p.R1, precision: 10); - Assert.Equal(2.0 * pp - pH, p.S1, precision: 10); + Assert.Equal((2.0 * pp) - pL, p.R1, precision: 10); + Assert.Equal((2.0 * pp) - pH, p.S1, precision: 10); Assert.Equal(pp + range, p.R2, precision: 10); Assert.Equal(pp - range, p.S2, precision: 10); - Assert.Equal(pH + 2.0 * (pp - pL), p.R3, precision: 10); - Assert.Equal(pL - 2.0 * (pH - pp), p.S3, precision: 10); + Assert.Equal(pH + (2.0 * (pp - pL)), p.R3, precision: 10); + Assert.Equal(pL - (2.0 * (pH - pp)), p.S3, precision: 10); } } } @@ -258,5 +258,4 @@ public sealed class PivotValidationTests } } } - } diff --git a/lib/reversals/pivotcam/tests/Pivotcam.Quantower.Tests.cs b/lib/reversals/pivotcam/tests/Pivotcam.Quantower.Tests.cs index 6eded56b..bfbfbc45 100644 --- a/lib/reversals/pivotcam/tests/Pivotcam.Quantower.Tests.cs +++ b/lib/reversals/pivotcam/tests/Pivotcam.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class PivotcamIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 10; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/reversals/pivotcam/tests/Pivotcam.Tests.cs b/lib/reversals/pivotcam/tests/Pivotcam.Tests.cs index 4608230d..f35d4201 100644 --- a/lib/reversals/pivotcam/tests/Pivotcam.Tests.cs +++ b/lib/reversals/pivotcam/tests/Pivotcam.Tests.cs @@ -83,14 +83,14 @@ public sealed class PivotcamBasicTests double range = 20.0; double pC = 100.0; Assert.Equal(100.0, p.PP, precision: 10); - Assert.Equal(pC + range * 1.0833 / 12.0, p.R1, precision: 4); - Assert.Equal(pC - range * 1.0833 / 12.0, p.S1, precision: 4); - Assert.Equal(pC + range * 1.1666 / 12.0, p.R2, precision: 4); - Assert.Equal(pC - range * 1.1666 / 12.0, p.S2, precision: 4); - Assert.Equal(pC + range * 1.25 / 12.0, p.R3, precision: 4); - Assert.Equal(pC - range * 1.25 / 12.0, p.S3, precision: 4); - Assert.Equal(pC + range * 1.5 / 12.0, p.R4, precision: 4); - Assert.Equal(pC - range * 1.5 / 12.0, p.S4, precision: 4); + Assert.Equal(pC + (range * 1.0833 / 12.0), p.R1, precision: 4); + Assert.Equal(pC - (range * 1.0833 / 12.0), p.S1, precision: 4); + Assert.Equal(pC + (range * 1.1666 / 12.0), p.R2, precision: 4); + Assert.Equal(pC - (range * 1.1666 / 12.0), p.S2, precision: 4); + Assert.Equal(pC + (range * 1.25 / 12.0), p.R3, precision: 4); + Assert.Equal(pC - (range * 1.25 / 12.0), p.S3, precision: 4); + Assert.Equal(pC + (range * 1.5 / 12.0), p.R4, precision: 4); + Assert.Equal(pC - (range * 1.5 / 12.0), p.S4, precision: 4); } [Fact] @@ -108,14 +108,14 @@ public sealed class PivotcamBasicTests double pC = 115.0; Assert.Equal(expectedPP, p.PP, precision: 10); - Assert.Equal(pC + range * 1.0833 / 12.0, p.R1, precision: 4); - Assert.Equal(pC - range * 1.0833 / 12.0, p.S1, precision: 4); - Assert.Equal(pC + range * 1.1666 / 12.0, p.R2, precision: 4); - Assert.Equal(pC - range * 1.1666 / 12.0, p.S2, precision: 4); - Assert.Equal(pC + range * 1.25 / 12.0, p.R3, precision: 4); - Assert.Equal(pC - range * 1.25 / 12.0, p.S3, precision: 4); - Assert.Equal(pC + range * 1.5 / 12.0, p.R4, precision: 4); - Assert.Equal(pC - range * 1.5 / 12.0, p.S4, precision: 4); + Assert.Equal(pC + (range * 1.0833 / 12.0), p.R1, precision: 4); + Assert.Equal(pC - (range * 1.0833 / 12.0), p.S1, precision: 4); + Assert.Equal(pC + (range * 1.1666 / 12.0), p.R2, precision: 4); + Assert.Equal(pC - (range * 1.1666 / 12.0), p.S2, precision: 4); + Assert.Equal(pC + (range * 1.25 / 12.0), p.R3, precision: 4); + Assert.Equal(pC - (range * 1.25 / 12.0), p.S3, precision: 4); + Assert.Equal(pC + (range * 1.5 / 12.0), p.R4, precision: 4); + Assert.Equal(pC - (range * 1.5 / 12.0), p.S4, precision: 4); } [Fact] diff --git a/lib/reversals/pivotcam/tests/Pivotcam.Validation.Tests.cs b/lib/reversals/pivotcam/tests/Pivotcam.Validation.Tests.cs index 9c9872cc..cfccdb9d 100644 --- a/lib/reversals/pivotcam/tests/Pivotcam.Validation.Tests.cs +++ b/lib/reversals/pivotcam/tests/Pivotcam.Validation.Tests.cs @@ -59,14 +59,14 @@ public sealed class PivotcamValidationTests double range = pH - pL; Assert.Equal(pp, p.PP, precision: 10); - Assert.Equal(pC + range * 1.0833 / 12.0, p.R1, precision: 4); - Assert.Equal(pC - range * 1.0833 / 12.0, p.S1, precision: 4); - Assert.Equal(pC + range * 1.1666 / 12.0, p.R2, precision: 4); - Assert.Equal(pC - range * 1.1666 / 12.0, p.S2, precision: 4); - Assert.Equal(pC + range * 1.25 / 12.0, p.R3, precision: 4); - Assert.Equal(pC - range * 1.25 / 12.0, p.S3, precision: 4); - Assert.Equal(pC + range * 1.5 / 12.0, p.R4, precision: 4); - Assert.Equal(pC - range * 1.5 / 12.0, p.S4, precision: 4); + Assert.Equal(pC + (range * 1.0833 / 12.0), p.R1, precision: 4); + Assert.Equal(pC - (range * 1.0833 / 12.0), p.S1, precision: 4); + Assert.Equal(pC + (range * 1.1666 / 12.0), p.R2, precision: 4); + Assert.Equal(pC - (range * 1.1666 / 12.0), p.S2, precision: 4); + Assert.Equal(pC + (range * 1.25 / 12.0), p.R3, precision: 4); + Assert.Equal(pC - (range * 1.25 / 12.0), p.S3, precision: 4); + Assert.Equal(pC + (range * 1.5 / 12.0), p.R4, precision: 4); + Assert.Equal(pC - (range * 1.5 / 12.0), p.S4, precision: 4); } } } @@ -272,5 +272,4 @@ public sealed class PivotcamValidationTests } } } - } diff --git a/lib/reversals/pivotdem/tests/Pivotdem.Quantower.Tests.cs b/lib/reversals/pivotdem/tests/Pivotdem.Quantower.Tests.cs index b9d73265..d4eded5b 100644 --- a/lib/reversals/pivotdem/tests/Pivotdem.Quantower.Tests.cs +++ b/lib/reversals/pivotdem/tests/Pivotdem.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class PivotdemIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 10; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/reversals/pivotdem/tests/Pivotdem.Validation.Tests.cs b/lib/reversals/pivotdem/tests/Pivotdem.Validation.Tests.cs index 932f562e..ed23a391 100644 --- a/lib/reversals/pivotdem/tests/Pivotdem.Validation.Tests.cs +++ b/lib/reversals/pivotdem/tests/Pivotdem.Validation.Tests.cs @@ -36,9 +36,9 @@ public sealed class PivotdemValidationTests double pC = bars[i - 1].Close; double x; - if (pC < pO) { x = pH + 2.0 * pL + pC; } - else if (pC > pO) { x = 2.0 * pH + pL + pC; } - else { x = pH + pL + 2.0 * pC; } + if (pC < pO) { x = pH + (2.0 * pL) + pC; } + else if (pC > pO) { x = (2.0 * pH) + pL + pC; } + else { x = pH + pL + (2.0 * pC); } double expectedPP = x * 0.25; Assert.Equal(expectedPP, p.PP, precision: 10); @@ -64,9 +64,9 @@ public sealed class PivotdemValidationTests double pC = bars[i - 1].Close; double x; - if (pC < pO) { x = pH + 2.0 * pL + pC; } - else if (pC > pO) { x = 2.0 * pH + pL + pC; } - else { x = pH + pL + 2.0 * pC; } + if (pC < pO) { x = pH + (2.0 * pL) + pC; } + else if (pC > pO) { x = (2.0 * pH) + pL + pC; } + else { x = pH + pL + (2.0 * pC); } double halfX = x * 0.5; Assert.Equal(x * 0.25, p.PP, precision: 10); @@ -239,5 +239,4 @@ public sealed class PivotdemValidationTests } } } - } diff --git a/lib/reversals/pivotext/tests/Pivotext.Quantower.Tests.cs b/lib/reversals/pivotext/tests/Pivotext.Quantower.Tests.cs index c49e5494..b744f1dd 100644 --- a/lib/reversals/pivotext/tests/Pivotext.Quantower.Tests.cs +++ b/lib/reversals/pivotext/tests/Pivotext.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class PivotextIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 10; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/reversals/pivotext/tests/Pivotext.Tests.cs b/lib/reversals/pivotext/tests/Pivotext.Tests.cs index 1c64a0f8..036eeb77 100644 --- a/lib/reversals/pivotext/tests/Pivotext.Tests.cs +++ b/lib/reversals/pivotext/tests/Pivotext.Tests.cs @@ -125,16 +125,16 @@ public sealed class PivotextBasicTests double hMinusPP = 120.0 - expectedPP; Assert.Equal(expectedPP, p.PP, precision: 10); - Assert.Equal(2.0 * expectedPP - 100.0, p.R1, precision: 10); - Assert.Equal(2.0 * expectedPP - 120.0, p.S1, precision: 10); + Assert.Equal((2.0 * expectedPP) - 100.0, p.R1, precision: 10); + Assert.Equal((2.0 * expectedPP) - 120.0, p.S1, precision: 10); Assert.Equal(expectedPP + 20.0, p.R2, precision: 10); Assert.Equal(expectedPP - 20.0, p.S2, precision: 10); - Assert.Equal(120.0 + 2.0 * ppMinusL, p.R3, precision: 10); - Assert.Equal(100.0 - 2.0 * hMinusPP, p.S3, precision: 10); - Assert.Equal(120.0 + 3.0 * ppMinusL, p.R4, precision: 10); - Assert.Equal(100.0 - 3.0 * hMinusPP, p.S4, precision: 10); - Assert.Equal(120.0 + 4.0 * ppMinusL, p.R5, precision: 10); - Assert.Equal(100.0 - 4.0 * hMinusPP, p.S5, precision: 10); + Assert.Equal(120.0 + (2.0 * ppMinusL), p.R3, precision: 10); + Assert.Equal(100.0 - (2.0 * hMinusPP), p.S3, precision: 10); + Assert.Equal(120.0 + (3.0 * ppMinusL), p.R4, precision: 10); + Assert.Equal(100.0 - (3.0 * hMinusPP), p.S4, precision: 10); + Assert.Equal(120.0 + (4.0 * ppMinusL), p.R5, precision: 10); + Assert.Equal(100.0 - (4.0 * hMinusPP), p.S5, precision: 10); } [Fact] diff --git a/lib/reversals/pivotext/tests/Pivotext.Validation.Tests.cs b/lib/reversals/pivotext/tests/Pivotext.Validation.Tests.cs index 85be4110..c12316fc 100644 --- a/lib/reversals/pivotext/tests/Pivotext.Validation.Tests.cs +++ b/lib/reversals/pivotext/tests/Pivotext.Validation.Tests.cs @@ -60,16 +60,16 @@ public sealed class PivotextValidationTests double hMinusPP = pH - pp; Assert.Equal(pp, p.PP, precision: 10); - Assert.Equal(2.0 * pp - pL, p.R1, precision: 10); - Assert.Equal(2.0 * pp - pH, p.S1, precision: 10); + Assert.Equal((2.0 * pp) - pL, p.R1, precision: 10); + Assert.Equal((2.0 * pp) - pH, p.S1, precision: 10); Assert.Equal(pp + range, p.R2, precision: 10); Assert.Equal(pp - range, p.S2, precision: 10); - Assert.Equal(pH + 2.0 * ppMinusL, p.R3, precision: 10); - Assert.Equal(pL - 2.0 * hMinusPP, p.S3, precision: 10); - Assert.Equal(pH + 3.0 * ppMinusL, p.R4, precision: 10); - Assert.Equal(pL - 3.0 * hMinusPP, p.S4, precision: 10); - Assert.Equal(pH + 4.0 * ppMinusL, p.R5, precision: 10); - Assert.Equal(pL - 4.0 * hMinusPP, p.S5, precision: 10); + Assert.Equal(pH + (2.0 * ppMinusL), p.R3, precision: 10); + Assert.Equal(pL - (2.0 * hMinusPP), p.S3, precision: 10); + Assert.Equal(pH + (3.0 * ppMinusL), p.R4, precision: 10); + Assert.Equal(pL - (3.0 * hMinusPP), p.S4, precision: 10); + Assert.Equal(pH + (4.0 * ppMinusL), p.R5, precision: 10); + Assert.Equal(pL - (4.0 * hMinusPP), p.S5, precision: 10); } } } diff --git a/lib/reversals/pivotfib/tests/Pivotfib.Quantower.Tests.cs b/lib/reversals/pivotfib/tests/Pivotfib.Quantower.Tests.cs index 88707e86..cf24645e 100644 --- a/lib/reversals/pivotfib/tests/Pivotfib.Quantower.Tests.cs +++ b/lib/reversals/pivotfib/tests/Pivotfib.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class PivotfibIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 10; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/reversals/pivotfib/tests/Pivotfib.Validation.Tests.cs b/lib/reversals/pivotfib/tests/Pivotfib.Validation.Tests.cs index 2d78b1e0..22262d64 100644 --- a/lib/reversals/pivotfib/tests/Pivotfib.Validation.Tests.cs +++ b/lib/reversals/pivotfib/tests/Pivotfib.Validation.Tests.cs @@ -36,10 +36,10 @@ public sealed class PivotfibValidationTests double range = pH - pL; Assert.Equal(expectedPP, ind.PP, 10); - Assert.Equal(expectedPP + 0.382 * range, ind.R1, 10); - Assert.Equal(expectedPP - 0.382 * range, ind.S1, 10); - Assert.Equal(expectedPP + 0.618 * range, ind.R2, 10); - Assert.Equal(expectedPP - 0.618 * range, ind.S2, 10); + Assert.Equal(expectedPP + (0.382 * range), ind.R1, 10); + Assert.Equal(expectedPP - (0.382 * range), ind.S1, 10); + Assert.Equal(expectedPP + (0.618 * range), ind.R2, 10); + Assert.Equal(expectedPP - (0.618 * range), ind.S2, 10); Assert.Equal(expectedPP + range, ind.R3, 10); Assert.Equal(expectedPP - range, ind.S3, 10); } @@ -245,5 +245,4 @@ public sealed class PivotfibValidationTests Assert.Equal(ind.R3 - ind.PP, ind.PP - ind.S3, 10); } } - } diff --git a/lib/reversals/pivotwood/tests/Pivotwood.Quantower.Tests.cs b/lib/reversals/pivotwood/tests/Pivotwood.Quantower.Tests.cs index 4289c36c..34e4e9d3 100644 --- a/lib/reversals/pivotwood/tests/Pivotwood.Quantower.Tests.cs +++ b/lib/reversals/pivotwood/tests/Pivotwood.Quantower.Tests.cs @@ -64,7 +64,7 @@ public sealed class PivotwoodIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 10; i++) { - double basePrice = 100 + i * 2; + double basePrice = 100 + (i * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/reversals/pivotwood/tests/Pivotwood.Validation.Tests.cs b/lib/reversals/pivotwood/tests/Pivotwood.Validation.Tests.cs index c1a27495..f9c1c239 100644 --- a/lib/reversals/pivotwood/tests/Pivotwood.Validation.Tests.cs +++ b/lib/reversals/pivotwood/tests/Pivotwood.Validation.Tests.cs @@ -32,16 +32,16 @@ public sealed class PivotwoodValidationTests double pL = bars[i - 1].Low; double pC = bars[i - 1].Close; - double expectedPP = (pH + pL + 2.0 * pC) / 4.0; + double expectedPP = (pH + pL + (2.0 * pC)) / 4.0; double range = pH - pL; Assert.Equal(expectedPP, ind.PP, 10); - Assert.Equal(2.0 * expectedPP - pL, ind.R1, 10); - Assert.Equal(2.0 * expectedPP - pH, ind.S1, 10); + Assert.Equal((2.0 * expectedPP) - pL, ind.R1, 10); + Assert.Equal((2.0 * expectedPP) - pH, ind.S1, 10); Assert.Equal(expectedPP + range, ind.R2, 10); Assert.Equal(expectedPP - range, ind.S2, 10); - Assert.Equal(pH + 2.0 * (expectedPP - pL), ind.R3, 10); - Assert.Equal(pL - 2.0 * (pH - expectedPP), ind.S3, 10); + Assert.Equal(pH + (2.0 * (expectedPP - pL)), ind.R3, 10); + Assert.Equal(pL - (2.0 * (pH - expectedPP)), ind.S3, 10); } } @@ -253,5 +253,4 @@ public sealed class PivotwoodValidationTests } } } - } diff --git a/lib/reversals/psar/tests/Psar.Tests.cs b/lib/reversals/psar/tests/Psar.Tests.cs index c31be50c..c922874a 100644 --- a/lib/reversals/psar/tests/Psar.Tests.cs +++ b/lib/reversals/psar/tests/Psar.Tests.cs @@ -150,12 +150,12 @@ public sealed class PsarBasicTests // Steady uptrend - SAR should trail below for (int i = 0; i < 20; i++) { - double price = 100.0 + i * 2; + double price = 100.0 + (i * 2); _ = psar.Update(new TBar(DateTime.UtcNow.AddMinutes(i), price + 1, price - 1, price + 0.5, price, 1000)); } - double lastClose = 100.0 + 19 * 2; + double lastClose = 100.0 + (19 * 2); Assert.True(psar.Sar < lastClose, "SAR should be below price in uptrend"); Assert.True(psar.IsLong, "Should be in long mode during uptrend"); } @@ -168,12 +168,12 @@ public sealed class PsarBasicTests // Steady downtrend - SAR should trail above for (int i = 0; i < 20; i++) { - double price = 200.0 - i * 2; + double price = 200.0 - (i * 2); _ = psar.Update(new TBar(DateTime.UtcNow.AddMinutes(i), price + 1, price - 1, price + 0.5, price, 1000)); } - double lastClose = 200.0 - 19 * 2; + double lastClose = 200.0 - (19 * 2); Assert.True(psar.Sar > lastClose, "SAR should be above price in downtrend"); Assert.False(psar.IsLong, "Should be in short mode during downtrend"); } @@ -423,7 +423,7 @@ public sealed class PsarConsistencyTests // Continue uptrend for (int i = 1; i <= 5; i++) { - double price = 105 + i * 2; + double price = 105 + (i * 2); _ = psar.Update(new TBar(dt.AddMinutes(i), price + 1, price - 1, price + 0.5, price, 1000), isNew: true); } diff --git a/lib/reversals/swings/tests/Swings.Tests.cs b/lib/reversals/swings/tests/Swings.Tests.cs index 5a095d53..518c5f8e 100644 --- a/lib/reversals/swings/tests/Swings.Tests.cs +++ b/lib/reversals/swings/tests/Swings.Tests.cs @@ -114,7 +114,7 @@ public sealed class SwingsBasicTests // Monotone ascending - no swing high or low for (int i = 0; i < 5; i++) { - double price = 100.0 + i * 5; + double price = 100.0 + (i * 5); _ = sw.Update(new TBar(dt.AddMinutes(i), price, price + 2, price - 2, price + 1, 1000), isNew: true); } diff --git a/lib/reversals/swings/tests/Swings.Validation.Tests.cs b/lib/reversals/swings/tests/Swings.Validation.Tests.cs index 767f8f4c..1709d7d5 100644 --- a/lib/reversals/swings/tests/Swings.Validation.Tests.cs +++ b/lib/reversals/swings/tests/Swings.Validation.Tests.cs @@ -102,7 +102,7 @@ public sealed class SwingsValidationTests int lookback = 3; Swings.Batch(bars.HighValues, bars.LowValues, spanHigh, spanLow, lookback); - int windowSize = 2 * lookback + 1; + int windowSize = (2 * lookback) + 1; for (int i = windowSize - 1; i < bars.Count; i++) { if (double.IsNaN(spanHigh[i])) @@ -139,7 +139,7 @@ public sealed class SwingsValidationTests int lookback = 3; Swings.Batch(bars.HighValues, bars.LowValues, spanHigh, spanLow, lookback); - int windowSize = 2 * lookback + 1; + int windowSize = (2 * lookback) + 1; for (int i = windowSize - 1; i < bars.Count; i++) { if (double.IsNaN(spanLow[i])) diff --git a/lib/reversals/ttm_scalper/tests/TtmScalper.Tests.cs b/lib/reversals/ttm_scalper/tests/TtmScalper.Tests.cs index cdd38564..ce5d819d 100644 --- a/lib/reversals/ttm_scalper/tests/TtmScalper.Tests.cs +++ b/lib/reversals/ttm_scalper/tests/TtmScalper.Tests.cs @@ -101,7 +101,7 @@ public sealed class TtmScalperBasicTests // Monotone ascending — no pivot for (int i = 0; i < 3; i++) { - double price = 100.0 + i * 5; + double price = 100.0 + (i * 5); _ = ts.Update(new TBar(dt.AddMinutes(i), price, price + 2, price - 2, price + 1, 1000), isNew: true); } diff --git a/lib/statistics/acf/tests/Acf.Tests.cs b/lib/statistics/acf/tests/Acf.Tests.cs index b81832b6..ec50d023 100644 --- a/lib/statistics/acf/tests/Acf.Tests.cs +++ b/lib/statistics/acf/tests/Acf.Tests.cs @@ -318,7 +318,7 @@ public class AcfTests // Generate and store values for (int i = 0; i < 20; i++) { - inputs.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + i * 0.5)); + inputs.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + (i * 0.5))); } // First pass diff --git a/lib/statistics/acf/tests/Acf.Validation.Tests.cs b/lib/statistics/acf/tests/Acf.Validation.Tests.cs index 3a2f8a4c..dba77ef4 100644 --- a/lib/statistics/acf/tests/Acf.Validation.Tests.cs +++ b/lib/statistics/acf/tests/Acf.Validation.Tests.cs @@ -226,7 +226,7 @@ public class AcfValidationTests for (int i = 1; i < n; i++) { double epsilon = Math.Log(bars[i].Close / bars[i - 1].Close) * 0.5; // incremental log-return scaled as noise - ar1Data[i] = phi * ar1Data[i - 1] + epsilon; + ar1Data[i] = (phi * ar1Data[i - 1]) + epsilon; } // Compute ACF at different lags diff --git a/lib/statistics/beta/tests/Beta.Tests.cs b/lib/statistics/beta/tests/Beta.Tests.cs index fccb78f7..5a214584 100644 --- a/lib/statistics/beta/tests/Beta.Tests.cs +++ b/lib/statistics/beta/tests/Beta.Tests.cs @@ -153,7 +153,7 @@ public class BetaTests var beta = new Beta(5); for (int i = 0; i < 10; i++) { - beta.Update(100 + i * 2, 100 + i); // Different ratios + beta.Update(100 + (i * 2), 100 + i); // Different ratios } Assert.True(beta.IsHot); diff --git a/lib/statistics/beta/tests/Beta.Validation.Tests.cs b/lib/statistics/beta/tests/Beta.Validation.Tests.cs index f3eef404..8abcd7a9 100644 --- a/lib/statistics/beta/tests/Beta.Validation.Tests.cs +++ b/lib/statistics/beta/tests/Beta.Validation.Tests.cs @@ -42,7 +42,7 @@ public sealed class BetaValidationTests : IDisposable var noiseBar = noiseGbm.Next(); double noise = (noiseBar.Close - noiseBar.Open) / noiseBar.Open; - double assetReturn = targetBeta * marketReturn + noise; + double assetReturn = (targetBeta * marketReturn) + noise; assetPrice *= (1 + assetReturn); assetQuotes.Add(new TBar(marketQuotes[i].Time, assetPrice, assetPrice, assetPrice, assetPrice, 1000)); @@ -117,7 +117,7 @@ public sealed class BetaValidationTests : IDisposable double mktReturn = (marketQuotes[i].Value - marketQuotes[i - 1].Value) / marketQuotes[i - 1].Value; var noiseBar = noiseGbm.Next(); double noise = (noiseBar.Close - noiseBar.Open) / noiseBar.Open; - double astReturn = targetBeta * mktReturn + noise * 0.1; + double astReturn = (targetBeta * mktReturn) + (noise * 0.1); assetPrice *= (1 + astReturn); assetPrices[i] = assetPrice; marketPrices[i] = marketQuotes[i].Value; diff --git a/lib/statistics/cointegration/tests/Cointegration.Tests.cs b/lib/statistics/cointegration/tests/Cointegration.Tests.cs index 6145a71e..4056cdb9 100644 --- a/lib/statistics/cointegration/tests/Cointegration.Tests.cs +++ b/lib/statistics/cointegration/tests/Cointegration.Tests.cs @@ -342,7 +342,7 @@ public class CointegrationTests for (int i = 0; i < 10; i++) { - indicator.Update(100.0 + i, 100.0 + i * 0.5); + indicator.Update(100.0 + i, 100.0 + (i * 0.5)); } _ = indicator.Last.Value; // beforeNaN - verify state before NaN @@ -362,7 +362,7 @@ public class CointegrationTests for (int i = 0; i < 10; i++) { - indicator.Update(100.0 + i, 100.0 + i * 0.5); + indicator.Update(100.0 + i, 100.0 + (i * 0.5)); } // Update with infinity @@ -380,7 +380,7 @@ public class CointegrationTests for (int i = 0; i < 20; i++) { double a = i % 5 == 0 ? double.NaN : 100.0 + i; - double b = i % 7 == 0 ? double.NaN : 100.0 + i * 0.5; + double b = i % 7 == 0 ? double.NaN : 100.0 + (i * 0.5); indicator.Update(a, b); } @@ -592,8 +592,8 @@ public class CointegrationTests for (int i = 0; i < 100; i++) { - double a = 100.0 + i * 0.1; - double b = a + Math.Log(random.Next().Close / 100.0) * 0.1; // Highly correlated + double a = 100.0 + (i * 0.1); + double b = a + (Math.Log(random.Next().Close / 100.0) * 0.1); // Highly correlated indicator.Update(a, b); } @@ -616,9 +616,9 @@ public class CointegrationTests for (int i = 0; i < 100; i++) { // Cointegrated pair - double a1 = 100.0 + i * 0.1; + double a1 = 100.0 + (i * 0.1); double noise1 = Math.Log(random.Next().Close / 100.0); - double b1 = a1 + noise1 * 0.1; + double b1 = a1 + (noise1 * 0.1); indicatorCointegrated.Update(a1, b1); // Random walks diff --git a/lib/statistics/cointegration/tests/Cointegration.Validation.Tests.cs b/lib/statistics/cointegration/tests/Cointegration.Validation.Tests.cs index e07f11ea..3fc895fb 100644 --- a/lib/statistics/cointegration/tests/Cointegration.Validation.Tests.cs +++ b/lib/statistics/cointegration/tests/Cointegration.Validation.Tests.cs @@ -29,8 +29,8 @@ public class CointegrationValidationTests { // Incremental log-return: truly i.i.d. noise, variance ~(0.2²·dt) double noise = Math.Log(bars[i].Close / bars[i - 1].Close); - double a = 100.0 + i * 0.5 + noise * 0.1; - double b = 2.0 * a + 10.0 + noise * 0.1; + double a = 100.0 + (i * 0.5) + (noise * 0.1); + double b = (2.0 * a) + 10.0 + (noise * 0.1); indicator.Update(a, b); } @@ -49,7 +49,7 @@ public class CointegrationValidationTests for (int i = 0; i < 100; i++) { - double value = 100.0 + Math.Sin(i * 0.1) * 10.0; + double value = 100.0 + (Math.Sin(i * 0.1) * 10.0); indicator.Update(value, value); } @@ -68,9 +68,9 @@ public class CointegrationValidationTests for (int i = 0; i < 100; i++) { - double a = 50.0 + i * 0.3 + Math.Sin(i * 0.2) * 5.0; + double a = 50.0 + (i * 0.3) + (Math.Sin(i * 0.2) * 5.0); double noise = GbmNoise(random) * 0.5; - double b = 1.5 * a + noise; + double b = (1.5 * a) + noise; indicator.Update(a, b); } @@ -87,9 +87,9 @@ public class CointegrationValidationTests for (int i = 0; i < 100; i++) { - double a = 100.0 + i * 0.2; + double a = 100.0 + (i * 0.2); double noise = GbmNoise(random) * 0.5; // Small noise - double b = 25.0 + 0.8 * a + noise; + double b = 25.0 + (0.8 * a) + noise; indicator.Update(a, b); } @@ -105,8 +105,8 @@ public class CointegrationValidationTests for (int i = 0; i < 100; i++) { - double a = 100.0 + i * 0.3; - double b = 50.0 + 0.5 * a + Math.Sin(i * 0.1); + double a = 100.0 + (i * 0.3); + double b = 50.0 + (0.5 * a) + Math.Sin(i * 0.1); indicator10.Update(a, b); indicator30.Update(a, b); } @@ -128,8 +128,8 @@ public class CointegrationValidationTests for (int i = 0; i < 50; i++) { - double a = 100.0 + i * 0.2 + Math.Sin(i * 0.1) * 3.0; - double b = 30.0 + 0.7 * a + Math.Cos(i * 0.15) * 2.0; + double a = 100.0 + (i * 0.2) + (Math.Sin(i * 0.1) * 3.0); + double b = 30.0 + (0.7 * a) + (Math.Cos(i * 0.15) * 2.0); seriesA.Add(baseTime.AddMinutes(i), a); seriesB.Add(baseTime.AddMinutes(i), b); } @@ -165,8 +165,8 @@ public class CointegrationValidationTests for (int i = 0; i < length; i++) { - seriesA[i] = 100.0 + i * 0.2 + Math.Sin(i * 0.1) * 3.0; - seriesB[i] = 30.0 + 0.7 * seriesA[i] + Math.Cos(i * 0.15) * 2.0; + seriesA[i] = 100.0 + (i * 0.2) + (Math.Sin(i * 0.1) * 3.0); + seriesB[i] = 30.0 + (0.7 * seriesA[i]) + (Math.Cos(i * 0.15) * 2.0); } // Span calculation @@ -198,8 +198,8 @@ public class CointegrationValidationTests // First run for (int i = 0; i < 50; i++) { - double a = 100.0 + i * 0.3; - double b = 50.0 + 0.5 * a; + double a = 100.0 + (i * 0.3); + double b = 50.0 + (0.5 * a); indicator.Update(a, b); } var firstResult = indicator.Last.Value; @@ -209,8 +209,8 @@ public class CointegrationValidationTests // Second run with same data for (int i = 0; i < 50; i++) { - double a = 100.0 + i * 0.3; - double b = 50.0 + 0.5 * a; + double a = 100.0 + (i * 0.3); + double b = 50.0 + (0.5 * a); indicator.Update(a, b); } var secondResult = indicator.Last.Value; @@ -259,8 +259,8 @@ public class CointegrationValidationTests for (int i = 0; i < 20; i++) { - double a = 100.0 + i + GbmNoise(random) * 0.1; - double b = 50.0 + 0.5 * a + GbmNoise(random) * 0.1; + double a = 100.0 + i + (GbmNoise(random) * 0.1); + double b = 50.0 + (0.5 * a) + (GbmNoise(random) * 0.1); indicator.Update(a, b); } @@ -277,8 +277,8 @@ public class CointegrationValidationTests for (int i = 0; i < 150; i++) { - double a = 100.0 + i * 0.1 + GbmNoise(random) * 0.1; - double b = 30.0 + 0.8 * a + GbmNoise(random) * 0.1; + double a = 100.0 + (i * 0.1) + (GbmNoise(random) * 0.1); + double b = 30.0 + (0.8 * a) + (GbmNoise(random) * 0.1); indicator.Update(a, b); } @@ -298,8 +298,8 @@ public class CointegrationValidationTests for (int i = 0; i < 50; i++) { - double a = 1e8 + i * 1e5; - double b = 2e8 + 2.0 * a; + double a = 1e8 + (i * 1e5); + double b = 2e8 + (2.0 * a); indicator.Update(a, b); } @@ -313,8 +313,8 @@ public class CointegrationValidationTests for (int i = 0; i < 50; i++) { - double a = 1e-6 + i * 1e-8; - double b = 2e-6 + 1.5 * a; + double a = 1e-6 + (i * 1e-8); + double b = 2e-6 + (1.5 * a); indicator.Update(a, b); } @@ -329,7 +329,7 @@ public class CointegrationValidationTests for (int i = 0; i < 50; i++) { double a = 1000.0 + i; - double b = 0.001 + 0.000001 * a; // Much smaller scale + double b = 0.001 + (0.000001 * a); // Much smaller scale indicator.Update(a, b); } diff --git a/lib/statistics/correlation/tests/Correlation.Validation.Tests.cs b/lib/statistics/correlation/tests/Correlation.Validation.Tests.cs index 324d7cb9..7a4d26a0 100644 --- a/lib/statistics/correlation/tests/Correlation.Validation.Tests.cs +++ b/lib/statistics/correlation/tests/Correlation.Validation.Tests.cs @@ -211,8 +211,8 @@ public sealed class CorrelationValidationTests : IDisposable for (int i = 0; i < 50; i++) { - double x = 10.0 + i * 2.5; - double y = 5.0 + 3.0 * x; // y = 5 + 3x + double x = 10.0 + (i * 2.5); + double y = 5.0 + (3.0 * x); // y = 5 + 3x indicator.Update(x, y); } @@ -227,8 +227,8 @@ public sealed class CorrelationValidationTests : IDisposable for (int i = 0; i < 50; i++) { - double x = 10.0 + i * 2.5; - double y = 100.0 - 2.0 * x; // y = 100 - 2x + double x = 10.0 + (i * 2.5); + double y = 100.0 - (2.0 * x); // y = 100 - 2x indicator.Update(x, y); } @@ -272,7 +272,7 @@ public sealed class CorrelationValidationTests : IDisposable double x = gbmX.Next().Close; double y = gbmY.Next().Close; indicator1.Update(x, y); - indicator2.Update(a * x + b, c * y + d); + indicator2.Update((a * x) + b, (c * y) + d); } // Relax tolerance due to floating point precision with large transformations @@ -526,8 +526,8 @@ public sealed class CorrelationValidationTests : IDisposable for (int i = 0; i < 50; i++) { - double x = 1e8 + i * 1e5; - double y = 2e8 + 2.0 * (i * 1e5); // Linear relationship + double x = 1e8 + (i * 1e5); + double y = 2e8 + (2.0 * (i * 1e5)); // Linear relationship indicator.Update(x, y); } @@ -543,8 +543,8 @@ public sealed class CorrelationValidationTests : IDisposable // Use values that are small but not so small they cause numerical issues for (int i = 0; i < 50; i++) { - double x = 0.001 + i * 0.0001; - double y = 0.002 + 1.5 * (i * 0.0001); // Linear relationship + double x = 0.001 + (i * 0.0001); + double y = 0.002 + (1.5 * (i * 0.0001)); // Linear relationship indicator.Update(x, y); } @@ -581,8 +581,8 @@ public sealed class CorrelationValidationTests : IDisposable // Use deterministic data that creates high correlation for (int i = 0; i < 100; i++) { - double x = 100.0 + i + (i % 3) * 0.1; // Small variation - double y = 0.9 * x + (i % 5) * 0.2; // High correlation with small noise + double x = 100.0 + i + ((i % 3) * 0.1); // Small variation + double y = (0.9 * x) + ((i % 5) * 0.2); // High correlation with small noise indicator.Update(x, y); } @@ -598,8 +598,8 @@ public sealed class CorrelationValidationTests : IDisposable for (int i = 0; i < 100; i++) { - double x = 100.0 + i + Math.Log(random.Next().Close / 100.0) * 2; - double y = 200.0 - 0.8 * i + Math.Log(random.Next().Close / 100.0) * 2; // Negative relationship + double x = 100.0 + i + (Math.Log(random.Next().Close / 100.0) * 2); + double y = 200.0 - (0.8 * i) + (Math.Log(random.Next().Close / 100.0) * 2); // Negative relationship indicator.Update(x, y); } diff --git a/lib/statistics/covariance/tests/Covariance.Tests.cs b/lib/statistics/covariance/tests/Covariance.Tests.cs index c4fd9924..cdf79074 100644 --- a/lib/statistics/covariance/tests/Covariance.Tests.cs +++ b/lib/statistics/covariance/tests/Covariance.Tests.cs @@ -294,7 +294,7 @@ public class CovarianceTests { var bar = gbm.Next(); x[i] = bar.Close; - y[i] = bar.Close * 1.5 + 10; // Correlated series + y[i] = (bar.Close * 1.5) + 10; // Correlated series } // Streaming diff --git a/lib/statistics/entropy/tests/Entropy.Validation.Tests.cs b/lib/statistics/entropy/tests/Entropy.Validation.Tests.cs index 66783e71..0a7017ab 100644 --- a/lib/statistics/entropy/tests/Entropy.Validation.Tests.cs +++ b/lib/statistics/entropy/tests/Entropy.Validation.Tests.cs @@ -154,7 +154,7 @@ public sealed class EntropyValidationTests for (int i = 0; i < 20; i++) { // All values within 1e-12 of each other - e.Update(new TValue(DateTime.UtcNow, 100.0 + i * 1e-12)); + e.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 1e-12))); } // Range ≈ 19e-12, which is > epsilon but all values collapse into same bin diff --git a/lib/statistics/geomean/tests/Geomean.Validation.Tests.cs b/lib/statistics/geomean/tests/Geomean.Validation.Tests.cs index 6caa6f7b..dccc9fb5 100644 --- a/lib/statistics/geomean/tests/Geomean.Validation.Tests.cs +++ b/lib/statistics/geomean/tests/Geomean.Validation.Tests.cs @@ -106,7 +106,7 @@ public sealed class GeomeanValidationTests var g = new Geomean(10); for (int i = 0; i < 20; i++) { - g.Update(new TValue(DateTime.UtcNow, 100.0 + i * 0.001)); + g.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 0.001))); } Assert.True(Math.Abs(g.Last.Value - 100.01) < 0.1, $"Expected near 100.01, got {g.Last.Value}"); diff --git a/lib/statistics/granger/tests/Granger.Tests.cs b/lib/statistics/granger/tests/Granger.Tests.cs index be4f2963..6a1784f6 100644 --- a/lib/statistics/granger/tests/Granger.Tests.cs +++ b/lib/statistics/granger/tests/Granger.Tests.cs @@ -209,7 +209,7 @@ public class GrangerStateCorrectionTests // Multiple corrections converge for (int i = 0; i < 5; i++) { - indicator.Update(y1 + i * 0.01, x1 + i * 0.01, isNew: false); + indicator.Update(y1 + (i * 0.01), x1 + (i * 0.01), isNew: false); } var final1 = indicator.Update(y1, x1, isNew: false); diff --git a/lib/statistics/granger/tests/Granger.Validation.Tests.cs b/lib/statistics/granger/tests/Granger.Validation.Tests.cs index 3f670204..b43a3349 100644 --- a/lib/statistics/granger/tests/Granger.Validation.Tests.cs +++ b/lib/statistics/granger/tests/Granger.Validation.Tests.cs @@ -26,8 +26,8 @@ public class GrangerValidationTests for (int i = 0; i < 200; i++) { - x = 100.0 + Math.Sin(i * 0.1) * 10.0 + GbmNoise(rng) * 2.0; - y = 50.0 + 0.5 * prevY + 0.3 * prevX + GbmNoise(rng) * 0.5; + x = 100.0 + (Math.Sin(i * 0.1) * 10.0) + (GbmNoise(rng) * 2.0); + y = 50.0 + (0.5 * prevY) + (0.3 * prevX) + (GbmNoise(rng) * 0.5); indicator.Update(y, x, isNew: true); @@ -80,12 +80,12 @@ public class GrangerValidationTests for (int i = 0; i < 200; i++) { - x = 100.0 + Math.Sin(i * 0.1) * 10.0 + GbmNoise(rng) * 2.0; + x = 100.0 + (Math.Sin(i * 0.1) * 10.0) + (GbmNoise(rng) * 2.0); // Strong: Y depends heavily on X_lag - yStrong = 50.0 + 0.3 * prevYStrong + 0.6 * prevX + GbmNoise(rng) * 0.5; + yStrong = 50.0 + (0.3 * prevYStrong) + (0.6 * prevX) + (GbmNoise(rng) * 0.5); // Weak: Y barely depends on X_lag - yWeak = 50.0 + 0.8 * prevYWeak + 0.05 * prevX + GbmNoise(rng) * 5.0; + yWeak = 50.0 + (0.8 * prevYWeak) + (0.05 * prevX) + (GbmNoise(rng) * 5.0); strongIndicator.Update(yStrong, x, isNew: true); weakIndicator.Update(yWeak, x, isNew: true); @@ -211,9 +211,9 @@ public class GrangerValidationTests for (int i = 0; i < 200; i++) { // X is exogenous (just random walk with drift) - x = prevX + GbmNoise(rng) * 2.0; + x = prevX + (GbmNoise(rng) * 2.0); // Y depends on X_lag (X Granger-causes Y, but Y does NOT Granger-cause X) - y = 50.0 + 0.3 * prevY + 0.4 * prevX + GbmNoise(rng) * 0.5; + y = 50.0 + (0.3 * prevY) + (0.4 * prevX) + (GbmNoise(rng) * 0.5); indicatorYX.Update(y, x, isNew: true); // Testing: does X cause Y? indicatorXY.Update(x, y, isNew: true); // Testing: does Y cause X? diff --git a/lib/statistics/harmean/tests/Harmean.Validation.Tests.cs b/lib/statistics/harmean/tests/Harmean.Validation.Tests.cs index d2c87c89..2882cea8 100644 --- a/lib/statistics/harmean/tests/Harmean.Validation.Tests.cs +++ b/lib/statistics/harmean/tests/Harmean.Validation.Tests.cs @@ -127,7 +127,7 @@ public sealed class HarmeanValidationTests var h = new Harmean(10); for (int i = 0; i < 20; i++) { - h.Update(new TValue(DateTime.UtcNow, 100.0 + i * 0.001)); + h.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 0.001))); } Assert.True(Math.Abs(h.Last.Value - 100.01) < 0.1, $"Expected near 100.01, got {h.Last.Value}"); diff --git a/lib/statistics/hurst/tests/Hurst.Validation.Tests.cs b/lib/statistics/hurst/tests/Hurst.Validation.Tests.cs index c7e7d6ac..f6ec153b 100644 --- a/lib/statistics/hurst/tests/Hurst.Validation.Tests.cs +++ b/lib/statistics/hurst/tests/Hurst.Validation.Tests.cs @@ -219,5 +219,4 @@ public sealed class HurstValidationTests $"Skender Hurst value {r.HurstExponent.Value} is not finite"); } } - } diff --git a/lib/statistics/jb/tests/Jb.Tests.cs b/lib/statistics/jb/tests/Jb.Tests.cs index 0d17016b..1a52418f 100644 --- a/lib/statistics/jb/tests/Jb.Tests.cs +++ b/lib/statistics/jb/tests/Jb.Tests.cs @@ -120,7 +120,7 @@ public class JbBasicTests for (int i = 0; i < 100; i++) { // Triangular wave approximating normal shape - double val = 50.0 + Math.Sin(i * 0.1) * 10.0; + double val = 50.0 + (Math.Sin(i * 0.1) * 10.0); jb.Update(new TValue(DateTime.UtcNow, val)); } Assert.True(double.IsFinite(jb.Last.Value)); diff --git a/lib/statistics/pacf/tests/Pacf.Tests.cs b/lib/statistics/pacf/tests/Pacf.Tests.cs index f89edc3a..aea142bc 100644 --- a/lib/statistics/pacf/tests/Pacf.Tests.cs +++ b/lib/statistics/pacf/tests/Pacf.Tests.cs @@ -316,7 +316,7 @@ public class PacfTests // Generate and store values for (int i = 0; i < 20; i++) { - inputs.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + i * 0.5)); + inputs.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100 + (i * 0.5))); } // First pass diff --git a/lib/statistics/pacf/tests/Pacf.Validation.Tests.cs b/lib/statistics/pacf/tests/Pacf.Validation.Tests.cs index 3553268f..4cfb5b53 100644 --- a/lib/statistics/pacf/tests/Pacf.Validation.Tests.cs +++ b/lib/statistics/pacf/tests/Pacf.Validation.Tests.cs @@ -115,7 +115,7 @@ public class PacfValidationTests for (int i = 1; i < 500; i++) { double noise = Math.Log(bars[i].Close / bars[i - 1].Close); // i.i.d. incremental return - double newValue = phi * arProcess[^1] + noise; + double newValue = (phi * arProcess[^1]) + noise; arProcess.Add(newValue); } @@ -152,7 +152,7 @@ public class PacfValidationTests for (int i = 0; i < 100; i++) { - pacf.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.5)); + pacf.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + (i * 0.5))); } // Trending series should have high positive PACF at lag 1 diff --git a/lib/statistics/polyfit/tests/Polyfit.Validation.Tests.cs b/lib/statistics/polyfit/tests/Polyfit.Validation.Tests.cs index 02d72cf4..2f8bf0b9 100644 --- a/lib/statistics/polyfit/tests/Polyfit.Validation.Tests.cs +++ b/lib/statistics/polyfit/tests/Polyfit.Validation.Tests.cs @@ -238,7 +238,7 @@ public class PolyfitValidationTests [InlineData(14, 2)] public void GBMData_AllFinite(int period, int degree) { - var gbm = new GBM(100, 0.05, 0.2, seed: period * 10 + degree); + var gbm = new GBM(100, 0.05, 0.2, seed: (period * 10) + degree); var p = new Polyfit(period, degree); for (int i = 0; i < 100; i++) { diff --git a/lib/statistics/spearman/tests/Spearman.Validation.Tests.cs b/lib/statistics/spearman/tests/Spearman.Validation.Tests.cs index 1b98ca58..19b7e798 100644 --- a/lib/statistics/spearman/tests/Spearman.Validation.Tests.cs +++ b/lib/statistics/spearman/tests/Spearman.Validation.Tests.cs @@ -13,7 +13,7 @@ public sealed class SpearmanValidationTests var s = new Spearman(10); for (int i = 1; i <= 10; i++) { - s.Update((double)i, 2.0 * i + 5.0, isNew: true); + s.Update((double)i, (2.0 * i) + 5.0, isNew: true); } Assert.Equal(1.0, s.Last.Value, 1e-10); } diff --git a/lib/statistics/stderr/tests/Stderr.Tests.cs b/lib/statistics/stderr/tests/Stderr.Tests.cs index 2ec8f2f8..9a83933d 100644 --- a/lib/statistics/stderr/tests/Stderr.Tests.cs +++ b/lib/statistics/stderr/tests/Stderr.Tests.cs @@ -78,7 +78,7 @@ public class StderrBasicTests var se = new Stderr(10); for (int i = 0; i < 10; i++) { - se.Update(new TValue(DateTime.UtcNow, i * 2.0 + 5.0)); + se.Update(new TValue(DateTime.UtcNow, (i * 2.0) + 5.0)); } Assert.Equal(0.0, se.Last.Value, precision: 8); } @@ -138,7 +138,7 @@ public class StderrStateTests var se = new Stderr(5); for (int i = 0; i < 5; i++) { - se.Update(new TValue(DateTime.UtcNow, i * 10.0 + 10.0)); + se.Update(new TValue(DateTime.UtcNow, (i * 10.0) + 10.0)); } double after5 = se.Last.Value; @@ -152,7 +152,7 @@ public class StderrStateTests var se = new Stderr(5); for (int i = 0; i < 5; i++) { - se.Update(new TValue(DateTime.UtcNow, i * 10.0 + 10.0)); + se.Update(new TValue(DateTime.UtcNow, (i * 10.0) + 10.0)); } se.Update(new TValue(DateTime.UtcNow, 50.0), isNew: true); diff --git a/lib/statistics/stderr/tests/Stderr.Validation.Tests.cs b/lib/statistics/stderr/tests/Stderr.Validation.Tests.cs index a43e6f3b..19bff9cb 100644 --- a/lib/statistics/stderr/tests/Stderr.Validation.Tests.cs +++ b/lib/statistics/stderr/tests/Stderr.Validation.Tests.cs @@ -31,19 +31,19 @@ public class StderrValidationTests sumX2 += (double)i * i; } - double denom = n * sumX2 - sumX * sumX; + double denom = (n * sumX2) - (sumX * sumX); if (denom == 0) { return 0; } - double slope = (n * sumXY - sumX * sumY) / denom; - double intercept = (sumY - slope * sumX) / n; + double slope = ((n * sumXY) - (sumX * sumY)) / denom; + double intercept = (sumY - (slope * sumX)) / n; double ssr = 0; for (int i = 0; i < n; i++) { - double predicted = slope * i + intercept; + double predicted = (slope * i) + intercept; double res = window[i] - predicted; ssr += res * res; } @@ -58,7 +58,7 @@ public class StderrValidationTests var se = new Stderr(5); for (int i = 0; i < 5; i++) { - se.Update(new TValue(DateTime.UtcNow, i * 3.0 + 2.0)); + se.Update(new TValue(DateTime.UtcNow, (i * 3.0) + 2.0)); } Assert.Equal(0.0, se.Last.Value, precision: 8); } diff --git a/lib/statistics/sum/tests/Sum.Validation.Tests.cs b/lib/statistics/sum/tests/Sum.Validation.Tests.cs index 3c8690b1..b80baa04 100644 --- a/lib/statistics/sum/tests/Sum.Validation.Tests.cs +++ b/lib/statistics/sum/tests/Sum.Validation.Tests.cs @@ -215,7 +215,7 @@ public sealed class SumValidationTests : IDisposable // Expected: sum of 1e10, 1e10+1, ..., 1e10+999 // = 1000 * 1e10 + sum of 0,1,2,...,999 // = 1e13 + 999*1000/2 = 1e13 + 499500 - double expectedSum = 1000 * baseValue + 499500.0; + double expectedSum = (1000 * baseValue) + 499500.0; Assert.Equal(expectedSum, sum.Last.Value, 1e-4); _output.WriteLine($"Sum Kahan-Babuška stability test passed: {sum.Last.Value:G17}"); @@ -364,7 +364,7 @@ public sealed class SumValidationTests : IDisposable } // Expected: 1e16 - 1000 * 1e13 = 1e16 - 1e16 = 0 - double expected = 1e16 - 1000 * 1e13; + double expected = 1e16 - (1000 * 1e13); // With Kahan-Babuška, this should be accurate // Naive sum would have significant error diff --git a/lib/statistics/variance/tests/Variance.Tests.cs b/lib/statistics/variance/tests/Variance.Tests.cs index a91694b6..1f385abf 100644 --- a/lib/statistics/variance/tests/Variance.Tests.cs +++ b/lib/statistics/variance/tests/Variance.Tests.cs @@ -174,8 +174,6 @@ public class VarianceTests } } - - [Fact] public void Batch_SimdPath_Triggered() { @@ -577,8 +575,6 @@ public class VarianceTests Assert.Equal(100, outputSamp[2], precision: 6); // 200/2 } - - [Fact] public void Resync_PreventsDrift_Extended() { diff --git a/lib/statistics/zscore/tests/Zscore.Validation.Tests.cs b/lib/statistics/zscore/tests/Zscore.Validation.Tests.cs index 2796bb99..d49dca92 100644 --- a/lib/statistics/zscore/tests/Zscore.Validation.Tests.cs +++ b/lib/statistics/zscore/tests/Zscore.Validation.Tests.cs @@ -65,7 +65,7 @@ public sealed class ZscoreValidationTests { double val = rng.Next().Close; z1.Update(new TValue(DateTime.UtcNow, val)); - z2.Update(new TValue(DateTime.UtcNow, val * 3.0 + 100.0)); // linear transform + z2.Update(new TValue(DateTime.UtcNow, (val * 3.0) + 100.0)); // linear transform if (z1.IsHot && z2.IsHot) { diff --git a/lib/trends_FIR/blma/tests/Blma.Tests.cs b/lib/trends_FIR/blma/tests/Blma.Tests.cs index 13f057fe..687089ca 100644 --- a/lib/trends_FIR/blma/tests/Blma.Tests.cs +++ b/lib/trends_FIR/blma/tests/Blma.Tests.cs @@ -136,7 +136,6 @@ public class BlmaTests blma.Pub += (object? sender, in TValueEventArgs args) => timestamps.Add(args.Value.AsDateTime); - blma.Prime(input); Assert.Equal(input.Length, timestamps.Count); @@ -162,7 +161,6 @@ public class BlmaTests blma.Pub += (object? sender, in TValueEventArgs args) => timestamps.Add(args.Value.AsDateTime); - blma.Prime(input); Assert.Equal(input.Length, timestamps.Count); diff --git a/lib/trends_FIR/crma/tests/Crma.Validation.Tests.cs b/lib/trends_FIR/crma/tests/Crma.Validation.Tests.cs index d06f4341..ff035b8d 100644 --- a/lib/trends_FIR/crma/tests/Crma.Validation.Tests.cs +++ b/lib/trends_FIR/crma/tests/Crma.Validation.Tests.cs @@ -101,7 +101,7 @@ public class CrmaValidationTests for (int i = 0; i < count; i++) { - values[i] = 2.0 * i + 5.0; + values[i] = (2.0 * i) + 5.0; } global::QuanTAlib.Crma.Batch(values, output, period); @@ -126,7 +126,7 @@ public class CrmaValidationTests for (int i = 0; i < count; i++) { - values[i] = 0.5 * i * i + i + 3.0; + values[i] = (0.5 * i * i) + i + 3.0; } global::QuanTAlib.Crma.Batch(values, output, period); @@ -152,7 +152,7 @@ public class CrmaValidationTests for (int i = 0; i < count; i++) { - values[i] = 0.001 * i * i * i + 0.01 * i * i + i + 5.0; + values[i] = (0.001 * i * i * i) + (0.01 * i * i) + i + 5.0; } global::QuanTAlib.Crma.Batch(values, output, period); diff --git a/lib/trends_FIR/fwma/tests/Fwma.Tests.cs b/lib/trends_FIR/fwma/tests/Fwma.Tests.cs index 5f16d4db..d09fa146 100644 --- a/lib/trends_FIR/fwma/tests/Fwma.Tests.cs +++ b/lib/trends_FIR/fwma/tests/Fwma.Tests.cs @@ -386,7 +386,7 @@ public class FwmaTests double[] output = new double[count]; for (int i = 0; i < count; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Fwma.Batch(source.AsSpan(), output.AsSpan(), 20); diff --git a/lib/trends_FIR/hamma/tests/Hamma.Tests.cs b/lib/trends_FIR/hamma/tests/Hamma.Tests.cs index fe02e46d..669a9a1a 100644 --- a/lib/trends_FIR/hamma/tests/Hamma.Tests.cs +++ b/lib/trends_FIR/hamma/tests/Hamma.Tests.cs @@ -383,7 +383,7 @@ public class HammaTests double weightSum = 0; for (int i = 0; i < period; i++) { - weights[i] = 0.54 - 0.46 * Math.Cos(twoPiOverPm1 * i); + weights[i] = 0.54 - (0.46 * Math.Cos(twoPiOverPm1 * i)); weightSum += weights[i]; } diff --git a/lib/trends_FIR/hamma/tests/Hamma.Validation.Tests.cs b/lib/trends_FIR/hamma/tests/Hamma.Validation.Tests.cs index 616527f9..fbd08fb0 100644 --- a/lib/trends_FIR/hamma/tests/Hamma.Validation.Tests.cs +++ b/lib/trends_FIR/hamma/tests/Hamma.Validation.Tests.cs @@ -163,7 +163,7 @@ public sealed class HammaValidationTests : IDisposable double weightSum = 0; for (int i = 0; i < period; i++) { - weights[i] = 0.54 - 0.46 * Math.Cos(twoPiOverPm1 * i); + weights[i] = 0.54 - (0.46 * Math.Cos(twoPiOverPm1 * i)); weightSum += weights[i]; } @@ -187,11 +187,11 @@ public sealed class HammaValidationTests : IDisposable int period = 5; double twoPiOverPm1 = 2.0 * Math.PI / (period - 1); - double w0 = 0.54 - 0.46 * Math.Cos(0); // 0.08 - double w1 = 0.54 - 0.46 * Math.Cos(twoPiOverPm1 * 1); // ≈0.54 - double w2 = 0.54 - 0.46 * Math.Cos(twoPiOverPm1 * 2); // 1.0 - double w3 = 0.54 - 0.46 * Math.Cos(twoPiOverPm1 * 3); // ≈0.54 - double w4 = 0.54 - 0.46 * Math.Cos(twoPiOverPm1 * 4); // 0.08 + double w0 = 0.54 - (0.46 * Math.Cos(0)); // 0.08 + double w1 = 0.54 - (0.46 * Math.Cos(twoPiOverPm1 * 1)); // ≈0.54 + double w2 = 0.54 - (0.46 * Math.Cos(twoPiOverPm1 * 2)); // 1.0 + double w3 = 0.54 - (0.46 * Math.Cos(twoPiOverPm1 * 3)); // ≈0.54 + double w4 = 0.54 - (0.46 * Math.Cos(twoPiOverPm1 * 4)); // 0.08 Assert.Equal(0.08, w0, 1e-10); Assert.Equal(0.08, w4, 1e-10); diff --git a/lib/trends_FIR/hend/tests/Hend.Tests.cs b/lib/trends_FIR/hend/tests/Hend.Tests.cs index 7ac9f21b..0be9ee37 100644 --- a/lib/trends_FIR/hend/tests/Hend.Tests.cs +++ b/lib/trends_FIR/hend/tests/Hend.Tests.cs @@ -79,13 +79,13 @@ public class HendTests double lastResult = double.NaN; for (int i = 0; i < total; i++) { - double val = 10.0 + 3.0 * i; + double val = 10.0 + (3.0 * i); var result = hend.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); lastResult = result.Value; } // Centered filter: output at bar N = polynomial value at bar N - half int centerIdx = total - 1 - half; - double expected = 10.0 + 3.0 * centerIdx; + double expected = 10.0 + (3.0 * centerIdx); Assert.Equal(expected, lastResult, 1e-6); } @@ -99,12 +99,12 @@ public class HendTests double lastResult = double.NaN; for (int i = 0; i < total; i++) { - double val = 5.0 + 2.0 * i + 0.5 * i * i; + double val = 5.0 + (2.0 * i) + (0.5 * i * i); var result = hend.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); lastResult = result.Value; } int centerIdx = total - 1 - half; - double expected = 5.0 + 2.0 * centerIdx + 0.5 * centerIdx * centerIdx; + double expected = 5.0 + (2.0 * centerIdx) + (0.5 * centerIdx * centerIdx); Assert.Equal(expected, lastResult, 1e-4); } @@ -118,12 +118,12 @@ public class HendTests double lastResult = double.NaN; for (int i = 0; i < total; i++) { - double val = 1.0 + 0.5 * i + 0.1 * i * i + 0.01 * i * i * i; + double val = 1.0 + (0.5 * i) + (0.1 * i * i) + (0.01 * i * i * i); var result = hend.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); lastResult = result.Value; } int centerIdx = total - 1 - half; - double expected = 1.0 + 0.5 * centerIdx + 0.1 * centerIdx * centerIdx + 0.01 * centerIdx * centerIdx * centerIdx; + double expected = 1.0 + (0.5 * centerIdx) + (0.1 * centerIdx * centerIdx) + (0.01 * centerIdx * centerIdx * centerIdx); Assert.Equal(expected, lastResult, 1e-2); } diff --git a/lib/trends_FIR/hend/tests/Hend.Validation.Tests.cs b/lib/trends_FIR/hend/tests/Hend.Validation.Tests.cs index a1a2f1d5..e3af4c2c 100644 --- a/lib/trends_FIR/hend/tests/Hend.Validation.Tests.cs +++ b/lib/trends_FIR/hend/tests/Hend.Validation.Tests.cs @@ -88,12 +88,12 @@ public class HendValidationTests(ITestOutputHelper output) for (int i = 0; i < total; i++) { - double val = a + b * i; + double val = a + (b * i); hend.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } int centerIdx = total - 1 - half; - double expected = a + b * centerIdx; + double expected = a + (b * centerIdx); _output.WriteLine($"Linear: expected={expected}, actual={hend.Last.Value}"); Assert.Equal(expected, hend.Last.Value, 1e-6); } @@ -108,12 +108,12 @@ public class HendValidationTests(ITestOutputHelper output) for (int i = 0; i < total; i++) { - double val = a + b * i + c * i * i; + double val = a + (b * i) + (c * i * i); hend.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } int centerIdx = total - 1 - half; - double expected = a + b * centerIdx + c * centerIdx * centerIdx; + double expected = a + (b * centerIdx) + (c * centerIdx * centerIdx); _output.WriteLine($"Quadratic: expected={expected}, actual={hend.Last.Value}"); Assert.Equal(expected, hend.Last.Value, 0.1); } @@ -128,12 +128,12 @@ public class HendValidationTests(ITestOutputHelper output) for (int i = 0; i < total; i++) { - double val = a + b * i + c * i * i + d * i * i * i; + double val = a + (b * i) + (c * i * i) + (d * i * i * i); hend.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } int centerIdx = total - 1 - half; - double expected = a + b * centerIdx + c * centerIdx * centerIdx + d * centerIdx * centerIdx * centerIdx; + double expected = a + (b * centerIdx) + (c * centerIdx * centerIdx) + (d * centerIdx * centerIdx * centerIdx); _output.WriteLine($"Cubic: expected={expected}, actual={hend.Last.Value}"); Assert.Equal(expected, hend.Last.Value, 1.0); } diff --git a/lib/trends_FIR/ilrs/tests/Ilrs.Tests.cs b/lib/trends_FIR/ilrs/tests/Ilrs.Tests.cs index 899c23a8..2d0370b4 100644 --- a/lib/trends_FIR/ilrs/tests/Ilrs.Tests.cs +++ b/lib/trends_FIR/ilrs/tests/Ilrs.Tests.cs @@ -359,7 +359,7 @@ public class IlrsTests // Feed increasing prices for (int i = 0; i < 10; i++) { - ilrs.Update(new TValue(DateTime.UtcNow, 100.0 + i * 10)); + ilrs.Update(new TValue(DateTime.UtcNow, 100.0 + (i * 10))); } // Integral should be well above starting value @@ -373,7 +373,7 @@ public class IlrsTests // Feed decreasing prices for (int i = 0; i < 10; i++) { - ilrs.Update(new TValue(DateTime.UtcNow, 200.0 - i * 10)); + ilrs.Update(new TValue(DateTime.UtcNow, 200.0 - (i * 10))); } // Integral should be below starting value diff --git a/lib/trends_FIR/lsma/tests/Lsma.Tests.cs b/lib/trends_FIR/lsma/tests/Lsma.Tests.cs index d32b1bb6..3407f845 100644 --- a/lib/trends_FIR/lsma/tests/Lsma.Tests.cs +++ b/lib/trends_FIR/lsma/tests/Lsma.Tests.cs @@ -70,12 +70,12 @@ public class LsmaTests for (int i = 0; i < 20; i++) { - double y = 2 * i + 1; + double y = (2 * i) + 1; var result = lsma.Update(new TValue(DateTime.UtcNow, y)); if (i >= period) { - double expected = 2 * (i + offset) + 1; + double expected = (2 * (i + offset)) + 1; Assert.Equal(expected, result.Value, 1e-9); } } diff --git a/lib/trends_FIR/nlma/tests/Nlma.Tests.cs b/lib/trends_FIR/nlma/tests/Nlma.Tests.cs index 74f17986..89751fdf 100644 --- a/lib/trends_FIR/nlma/tests/Nlma.Tests.cs +++ b/lib/trends_FIR/nlma/tests/Nlma.Tests.cs @@ -82,7 +82,7 @@ public class NlmaTests { // DC gain = 1: constant input → output must equal that constant after warmup var nlma = new Nlma(10); - int flen = 5 * 10 - 1; // 49 + int flen = (5 * 10) - 1; // 49 TValue result = default; for (int i = 0; i < flen + 10; i++) { @@ -96,7 +96,7 @@ public class NlmaTests { // period=2, flen=9. After warmup, constant input → output = input var nlma = new Nlma(2); - int flen = 5 * 2 - 1; // 9 + int flen = (5 * 2) - 1; // 9 TValue result = default; for (int i = 0; i < flen + 5; i++) { @@ -111,7 +111,7 @@ public class NlmaTests // Igorad kernel with any period: constant input must produce constant output // This validates that signed-sum normalization preserves DC gain = 1 var nlma = new Nlma(4); - int flen = 5 * 4 - 1; // 19 + int flen = (5 * 4) - 1; // 19 TValue result = default; for (int i = 0; i < flen + 5; i++) { @@ -126,7 +126,7 @@ public class NlmaTests // Igorad kernel with period 14 should have negative weights for lag cancellation // Test: feed a step function and verify responsiveness var nlma = new Nlma(14); - int flen = 5 * 14 - 1; // 69 + int flen = (5 * 14) - 1; // 69 // Feed flen bars of 100, then flen bars of 200 for (int i = 0; i < flen; i++) @@ -165,7 +165,7 @@ public class NlmaTests { // period=3, flen = 5*3-1 = 14 var nlma = new Nlma(3); - int flen = 5 * 3 - 1; // 14 + int flen = (5 * 3) - 1; // 14 Assert.False(nlma.IsHot); for (int i = 0; i < flen - 1; i++) @@ -281,12 +281,12 @@ public class NlmaTests public void AllModes_ProduceSameResults() { int period = 10; - int flen = 5 * period - 1; // 49 + int flen = (5 * period) - 1; // 49 int len = flen + 30; // ensure enough bars for full kernel var src = new TSeries([], []); for (int i = 0; i < len; i++) { - src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + Math.Sin(i) * 10)); + src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + (Math.Sin(i) * 10))); } // Mode 1: streaming @@ -343,12 +343,12 @@ public class NlmaTests public void Batch_Span_MatchesTSeries() { int period = 7; - int flen = 5 * period - 1; // 34 + int flen = (5 * period) - 1; // 34 int len = flen + 20; var src = new TSeries([], []); for (int i = 0; i < len; i++) { - src.Add(new TValue(DateTime.MinValue.AddDays(i), 50 + i * 0.5)); + src.Add(new TValue(DateTime.MinValue.AddDays(i), 50 + (i * 0.5))); } var tsBatch = Nlma.Batch(src, period); @@ -388,12 +388,12 @@ public class NlmaTests double[] output = new double[count]; for (int i = 0; i < count; i++) { - source[i] = 100.0 + i * 0.1; + source[i] = 100.0 + (i * 0.1); } Nlma.Batch(source, output, 300); // flen = 5*300 - 1 = 1499 - int flen = 5 * 300 - 1; + int flen = (5 * 300) - 1; for (int i = flen; i < count; i++) { Assert.True(double.IsFinite(output[i]), $"Output at index {i} should be finite"); @@ -406,7 +406,7 @@ public class NlmaTests public void Calculate_ReturnsIndicatorAndResults() { int period = 5; - int flen = 5 * period - 1; // 24 + int flen = (5 * period) - 1; // 24 int len = flen + 20; var src = new TSeries([], []); for (int i = 0; i < len; i++) @@ -426,7 +426,7 @@ public class NlmaTests public void Reset_ClearsState() { int period = 5; - int flen = 5 * period - 1; // 24 + int flen = (5 * period) - 1; // 24 var nlma = new Nlma(period); for (int i = 0; i < flen + 10; i++) { @@ -458,11 +458,11 @@ public class NlmaTests public void LargePeriod_Handles() { int period = 500; - int flen = 5 * period - 1; // 2499 + int flen = (5 * period) - 1; // 2499 var nlma = new Nlma(period); for (int i = 0; i < flen + 100; i++) { - nlma.Update(new TValue(DateTime.MinValue.AddDays(i), 100 + i * 0.01)); + nlma.Update(new TValue(DateTime.MinValue.AddDays(i), 100 + (i * 0.01))); } Assert.True(double.IsFinite(nlma.Last.Value)); Assert.True(nlma.IsHot); diff --git a/lib/trends_FIR/nlma/tests/Nlma.Validation.Tests.cs b/lib/trends_FIR/nlma/tests/Nlma.Validation.Tests.cs index 781b102f..ce997603 100644 --- a/lib/trends_FIR/nlma/tests/Nlma.Validation.Tests.cs +++ b/lib/trends_FIR/nlma/tests/Nlma.Validation.Tests.cs @@ -13,12 +13,12 @@ public class NlmaValidationTests public void Batch_Matches_Streaming() { int period = 10; - int flen = 5 * period - 1; // 49 + int flen = (5 * period) - 1; // 49 int len = flen + 30; var src = new TSeries([], []); for (int i = 0; i < len; i++) { - src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + Math.Sin(i) * 20)); + src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + (Math.Sin(i) * 20))); } var batchResult = Nlma.Batch(src, period); @@ -35,12 +35,12 @@ public class NlmaValidationTests public void Span_Matches_Streaming() { int period = 8; - int flen = 5 * period - 1; // 39 + int flen = (5 * period) - 1; // 39 int len = flen + 20; double[] values = new double[len]; for (int i = 0; i < len; i++) { - values[i] = 50 + i * 0.7; + values[i] = 50 + (i * 0.7); } double[] spanOutput = new double[len]; @@ -58,12 +58,12 @@ public class NlmaValidationTests public void Calculate_Matches_Batch() { int period = 12; - int flen = 5 * period - 1; // 59 + int flen = (5 * period) - 1; // 59 int len = flen + 20; var src = new TSeries([], []); for (int i = 0; i < len; i++) { - src.Add(new TValue(DateTime.MinValue.AddDays(i), 200 + i * 0.3)); + src.Add(new TValue(DateTime.MinValue.AddDays(i), 200 + (i * 0.3))); } var batchResult = Nlma.Batch(src, period); @@ -79,7 +79,7 @@ public class NlmaValidationTests public void ConstantInput_ProducesConstant() { int period = 15; - int flen = 5 * period - 1; // 74 + int flen = (5 * period) - 1; // 74 int len = flen + 20; var src = new TSeries([], []); for (int i = 0; i < len; i++) @@ -108,12 +108,12 @@ public class NlmaValidationTests public void LargePeriod_Handles() { int period = 200; - int flen = 5 * period - 1; // 999 + int flen = (5 * period) - 1; // 999 int len = flen + 100; var src = new TSeries([], []); for (int i = 0; i < len; i++) { - src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + Math.Sin(i * 0.1) * 10)); + src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + (Math.Sin(i * 0.1) * 10))); } var result = Nlma.Batch(src, period); @@ -128,7 +128,7 @@ public class NlmaValidationTests [Fact] public void DifferentPeriods_ProduceDifferentResults() { - int maxFlen = 5 * 20 - 1; // 99 for period=20 + int maxFlen = (5 * 20) - 1; // 99 for period=20 int len = maxFlen + 30; var src = new TSeries([], []); for (int i = 0; i < len; i++) @@ -177,7 +177,7 @@ public class NlmaValidationTests // Multiple corrections should not drift for (int c = 0; c < 10; c++) { - nlma.Update(new TValue(DateTime.MinValue.AddDays(29), 129.0 + c * 0.001), isNew: false); + nlma.Update(new TValue(DateTime.MinValue.AddDays(29), 129.0 + (c * 0.001)), isNew: false); } // Final correction with original value @@ -192,13 +192,13 @@ public class NlmaValidationTests // cancellation effect. Verify this by checking that NLMA on sinusoidal data // differs from SMA and shows phase lead (less phase lag than SMA). int period = 10; - int flen = 5 * period - 1; // 49 + int flen = (5 * period) - 1; // 49 int len = 3 * flen; var src = new TSeries([], []); // Sinusoidal signal with period matching the filter period for (int i = 0; i < len; i++) { - src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + 10 * Math.Sin(2 * Math.PI * i / 20))); + src.Add(new TValue(DateTime.MinValue.AddDays(i), 100 + (10 * Math.Sin(2 * Math.PI * i / 20)))); } var nlmaResult = Nlma.Batch(src, period); @@ -235,7 +235,7 @@ public class NlmaValidationTests { // NLMA's negative weights can cause output to exceed input range int period = 14; - int flen = 5 * period - 1; // 69 + int flen = (5 * period) - 1; // 69 var nlma = new Nlma(period); // Step function: all 0s then all 100s — enough data for full kernel diff --git a/lib/trends_FIR/qrma/tests/Qrma.Validation.Tests.cs b/lib/trends_FIR/qrma/tests/Qrma.Validation.Tests.cs index 9c5579f3..58cc0745 100644 --- a/lib/trends_FIR/qrma/tests/Qrma.Validation.Tests.cs +++ b/lib/trends_FIR/qrma/tests/Qrma.Validation.Tests.cs @@ -101,7 +101,7 @@ public class QrmaValidationTests for (int i = 0; i < count; i++) { - values[i] = 2.0 * i + 5.0; + values[i] = (2.0 * i) + 5.0; } global::QuanTAlib.Qrma.Batch(values, output, period); @@ -125,7 +125,7 @@ public class QrmaValidationTests for (int i = 0; i < count; i++) { - values[i] = 0.5 * i * i + i + 3.0; + values[i] = (0.5 * i * i) + i + 3.0; } global::QuanTAlib.Qrma.Batch(values, output, period); diff --git a/lib/trends_FIR/rain/tests/Rain.Validation.Tests.cs b/lib/trends_FIR/rain/tests/Rain.Validation.Tests.cs index 29b56100..6a6673c7 100644 --- a/lib/trends_FIR/rain/tests/Rain.Validation.Tests.cs +++ b/lib/trends_FIR/rain/tests/Rain.Validation.Tests.cs @@ -66,7 +66,7 @@ public sealed class RainValidationTests : IDisposable double[] expected = new double[BarCount]; for (int i = 0; i < BarCount; i++) { - expected[i] = (5.0 * layer0[i] + 4.0 * layer1[i] + 3.0 * layer2[i] + 2.0 * layer3[i] + expected[i] = ((5.0 * layer0[i]) + (4.0 * layer1[i]) + (3.0 * layer2[i]) + (2.0 * layer3[i]) + layer4[i] + layer5[i] + layer6[i] + layer7[i] + layer8[i] + layer9[i]) / 20.0; } diff --git a/lib/trends_FIR/rwma/tests/Rwma.Tests.cs b/lib/trends_FIR/rwma/tests/Rwma.Tests.cs index 401909a1..335c275f 100644 --- a/lib/trends_FIR/rwma/tests/Rwma.Tests.cs +++ b/lib/trends_FIR/rwma/tests/Rwma.Tests.cs @@ -123,7 +123,7 @@ public class RwmaTests var result = rwma.Update(bar2); // RWMA = (10*20 + 20*2) / (20+2) = (200+40)/22 = 10.909... - double expected = (10.0 * 20.0 + 20.0 * 2.0) / (20.0 + 2.0); + double expected = ((10.0 * 20.0) + (20.0 * 2.0)) / (20.0 + 2.0); Assert.Equal(expected, result.Value, 10); // Should be closer to 10 (the high-range bar) than 20 @@ -684,7 +684,7 @@ public class RwmaTests var result = rwma.Update(quietBar); // RWMA = (50*40 + 100*2) / (40+2) = (2000+200)/42 = 52.38... - double expected = (50.0 * 40.0 + 100.0 * 2.0) / 42.0; + double expected = ((50.0 * 40.0) + (100.0 * 2.0)) / 42.0; Assert.Equal(expected, result.Value, 10); // Should be much closer to 50 than 100 diff --git a/lib/trends_FIR/rwma/tests/Rwma.Validation.Tests.cs b/lib/trends_FIR/rwma/tests/Rwma.Validation.Tests.cs index f970bb4e..93c8c89c 100644 --- a/lib/trends_FIR/rwma/tests/Rwma.Validation.Tests.cs +++ b/lib/trends_FIR/rwma/tests/Rwma.Validation.Tests.cs @@ -128,11 +128,11 @@ public class RwmaValidationTests Assert.Equal(10.0, results[0], 6); // Bar 1: RWMA = (10*10 + 20*6) / (10+6) = (100+120)/16 = 13.75 - double expectedBar1 = (10.0 * 10.0 + 20.0 * 6.0) / 16.0; + double expectedBar1 = ((10.0 * 10.0) + (20.0 * 6.0)) / 16.0; Assert.Equal(expectedBar1, results[1], 6); // Bar 2: RWMA = (10*10 + 20*6 + 30*10) / (10+6+10) = (100+120+300)/26 = 20.0 - double expectedBar2 = (10.0 * 10.0 + 20.0 * 6.0 + 30.0 * 10.0) / 26.0; + double expectedBar2 = ((10.0 * 10.0) + (20.0 * 6.0) + (30.0 * 10.0)) / 26.0; Assert.Equal(expectedBar2, results[2], 6); } @@ -168,7 +168,7 @@ public class RwmaValidationTests var result = rwma.Update(new TBar(DateTime.UtcNow.AddMinutes(1), 100, 101, 99, 100, 100)); // range=2 // RWMA = (10*50 + 100*2) / (50+2) = (500+200)/52 = 13.46... - double expected = (10.0 * 50.0 + 100.0 * 2.0) / 52.0; + double expected = ((10.0 * 50.0) + (100.0 * 2.0)) / 52.0; Assert.Equal(expected, result.Value, 6); // RWMA should be much closer to 10 than to 100 diff --git a/lib/trends_FIR/sgma/tests/Sgma.Tests.cs b/lib/trends_FIR/sgma/tests/Sgma.Tests.cs index 1d5842e6..94eb7cbe 100644 --- a/lib/trends_FIR/sgma/tests/Sgma.Tests.cs +++ b/lib/trends_FIR/sgma/tests/Sgma.Tests.cs @@ -394,12 +394,12 @@ public class SgmaTests double[] prices = new double[20]; for (int i = 0; i < 10; i++) { - prices[i] = 100 + i * 5; + prices[i] = 100 + (i * 5); } for (int i = 10; i < 20; i++) { - prices[i] = 145 - (i - 10) * 5; + prices[i] = 145 - ((i - 10) * 5); } var sgma2 = new Sgma(5, 2); diff --git a/lib/trends_FIR/sgma/tests/Sgma.Validation.Tests.cs b/lib/trends_FIR/sgma/tests/Sgma.Validation.Tests.cs index 03eae961..c81ea3b0 100644 --- a/lib/trends_FIR/sgma/tests/Sgma.Validation.Tests.cs +++ b/lib/trends_FIR/sgma/tests/Sgma.Validation.Tests.cs @@ -101,7 +101,7 @@ public class SgmaValidationTests double[] prices = new double[20]; for (int i = 0; i < 20; i++) { - prices[i] = 100.0 + i * 10.0; // Linear: 100, 110, 120, ..., 290 + prices[i] = 100.0 + (i * 10.0); // Linear: 100, 110, 120, ..., 290 } var sgma0 = new Sgma(period, 0); diff --git a/lib/trends_FIR/sinema/tests/Sinema.Validation.Tests.cs b/lib/trends_FIR/sinema/tests/Sinema.Validation.Tests.cs index e09d90b3..1b0b8625 100644 --- a/lib/trends_FIR/sinema/tests/Sinema.Validation.Tests.cs +++ b/lib/trends_FIR/sinema/tests/Sinema.Validation.Tests.cs @@ -230,7 +230,7 @@ public sealed class SinemaValidationTests : IDisposable double w3 = Math.Sin(Math.PI * 4 / 5); double w4 = Math.Sin(Math.PI * 5 / 5); - double expectedSum = 100 * w0 + 102 * w1 + 104 * w2 + 103 * w3 + 105 * w4; + double expectedSum = (100 * w0) + (102 * w1) + (104 * w2) + (103 * w3) + (105 * w4); double weightSum = w0 + w1 + w2 + w3 + w4; double expected = expectedSum / weightSum; @@ -273,7 +273,7 @@ public sealed class SinemaValidationTests : IDisposable // w0 = sin(π*1/2) = 1, w1 = sin(π*2/2) = 0 // Result = (100*1 + 110*0) / 1 = 100 double r2 = sinema.Update(new TValue(DateTime.UtcNow, 110)).Value; - double expected2 = (100 * Math.Sin(Math.PI * 1 / 2) + 110 * Math.Sin(Math.PI * 2 / 2)) + double expected2 = ((100 * Math.Sin(Math.PI * 1 / 2)) + (110 * Math.Sin(Math.PI * 2 / 2))) / (Math.Sin(Math.PI * 1 / 2) + Math.Sin(Math.PI * 2 / 2)); Assert.Equal(expected2, r2, 1e-10); diff --git a/lib/trends_FIR/sp15/tests/Sp15.Tests.cs b/lib/trends_FIR/sp15/tests/Sp15.Tests.cs index 8046600f..cac72723 100644 --- a/lib/trends_FIR/sp15/tests/Sp15.Tests.cs +++ b/lib/trends_FIR/sp15/tests/Sp15.Tests.cs @@ -85,12 +85,12 @@ public class Sp15Tests const int n = 30; for (int i = 0; i < n; i++) { - double val = intercept + slope * i; + double val = intercept + (slope * i); sp15.Update(new TValue(DateTime.UtcNow.AddMinutes(i).Ticks, val)); } // Centered at lag 7: output at bar n-1 matches polynomial at bar (n-1)-7 int centerIdx = n - 1 - 7; - double expected = intercept + slope * centerIdx; + double expected = intercept + (slope * centerIdx); Assert.Equal(expected, sp15.Last.Value, 1e-6); } @@ -101,11 +101,11 @@ public class Sp15Tests const int n = 40; for (int i = 0; i < n; i++) { - double val = 0.1 * i * i + 2.0 * i + 5.0; + double val = (0.1 * i * i) + (2.0 * i) + 5.0; sp15.Update(new TValue(DateTime.UtcNow.AddMinutes(i).Ticks, val)); } int k = n - 1 - 7; - double expected = 0.1 * k * k + 2.0 * k + 5.0; + double expected = (0.1 * k * k) + (2.0 * k) + 5.0; Assert.Equal(expected, sp15.Last.Value, 1e-4); } @@ -116,11 +116,11 @@ public class Sp15Tests const int n = 40; for (int i = 0; i < n; i++) { - double val = 0.001 * i * i * i + 0.1 * i * i + 2.0 * i + 5.0; + double val = (0.001 * i * i * i) + (0.1 * i * i) + (2.0 * i) + 5.0; sp15.Update(new TValue(DateTime.UtcNow.AddMinutes(i).Ticks, val)); } int k = n - 1 - 7; - double expected = 0.001 * k * k * k + 0.1 * k * k + 2.0 * k + 5.0; + double expected = (0.001 * k * k * k) + (0.1 * k * k) + (2.0 * k) + 5.0; Assert.Equal(expected, sp15.Last.Value, 1e-2); } @@ -174,7 +174,7 @@ public class Sp15Tests // Multiple corrections for (int c = 0; c < 5; c++) { - sp15.Update(new TValue(DateTime.UtcNow.Ticks, 500.0 + c * 10), isNew: false); + sp15.Update(new TValue(DateTime.UtcNow.Ticks, 500.0 + (c * 10)), isNew: false); } // Restore sp15.Update(series[19], isNew: false); @@ -527,7 +527,7 @@ public class Sp15Tests // All 100 contributes: 100 * sum(weights) = 100 // Extra 100 at center contributes: 100 * (74/320) = 23.125 // Total = 100 + 23.125 = 123.125 - double expected = 100.0 + 100.0 * 74.0 / 320.0; + double expected = 100.0 + (100.0 * 74.0 / 320.0); Assert.Equal(expected, sp15.Last.Value, 1e-10); } } diff --git a/lib/trends_FIR/sp15/tests/Sp15.Validation.Tests.cs b/lib/trends_FIR/sp15/tests/Sp15.Validation.Tests.cs index bacca47d..7c4d4345 100644 --- a/lib/trends_FIR/sp15/tests/Sp15.Validation.Tests.cs +++ b/lib/trends_FIR/sp15/tests/Sp15.Validation.Tests.cs @@ -68,12 +68,12 @@ public class Sp15ValidationTests for (int i = 0; i < total; i++) { - double val = a + b * i; + double val = a + (b * i); sp15.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } int centerIdx = total - 1 - 7; - double expected = a + b * centerIdx; + double expected = a + (b * centerIdx); Assert.Equal(expected, sp15.Last.Value, 1e-6); } @@ -86,12 +86,12 @@ public class Sp15ValidationTests for (int i = 0; i < total; i++) { - double val = a + b * i + c * i * i; + double val = a + (b * i) + (c * i * i); sp15.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } int centerIdx = total - 1 - 7; - double expected = a + b * centerIdx + c * centerIdx * centerIdx; + double expected = a + (b * centerIdx) + (c * centerIdx * centerIdx); Assert.Equal(expected, sp15.Last.Value, 1e-4); } @@ -104,12 +104,12 @@ public class Sp15ValidationTests for (int i = 0; i < total; i++) { - double val = a + b * i + c * i * i + d * i * i * i; + double val = a + (b * i) + (c * i * i) + (d * i * i * i); sp15.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } int centerIdx = total - 1 - 7; - double expected = a + b * centerIdx + c * centerIdx * centerIdx + d * centerIdx * centerIdx * centerIdx; + double expected = a + (b * centerIdx) + (c * centerIdx * centerIdx) + (d * centerIdx * centerIdx * centerIdx); Assert.Equal(expected, sp15.Last.Value, 1.0); } @@ -172,8 +172,8 @@ public class Sp15ValidationTests double[] reverse = new double[15]; for (int i = 0; i < 15; i++) { - forward[i] = 10.0 + 2.0 * i; - reverse[i] = 10.0 + 2.0 * (14 - i); + forward[i] = 10.0 + (2.0 * i); + reverse[i] = 10.0 + (2.0 * (14 - i)); } TValue fwdResult = default; @@ -186,7 +186,7 @@ public class Sp15ValidationTests // For linear input centered at i=7: forward center = 10+14=24, reverse center = 10+14=24 // Both should give the same result for symmetric weights applied to symmetric-about-center linear data - double expected = 2.0 * (10.0 + 2.0 * 7.0); + double expected = 2.0 * (10.0 + (2.0 * 7.0)); Assert.Equal(expected, fwdResult.Value + revResult.Value, 1e-6); } @@ -199,7 +199,7 @@ public class Sp15ValidationTests for (int i = 0; i < n; i++) { // Pure period-4 sinusoid centered at 100 - double val = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 4.0); + double val = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 4.0)); sp15.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } // After warmup, the output should be ~100 (sinusoid suppressed) @@ -214,7 +214,7 @@ public class Sp15ValidationTests const int n = 60; for (int i = 0; i < n; i++) { - double val = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 5.0); + double val = 100.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / 5.0)); sp15.Update(new TValue(DateTime.UtcNow.AddSeconds(i), val)); } Assert.Equal(100.0, sp15.Last.Value, 0.5); diff --git a/lib/trends_FIR/swma/tests/Swma.Tests.cs b/lib/trends_FIR/swma/tests/Swma.Tests.cs index 0dc373fe..2a0f6df1 100644 --- a/lib/trends_FIR/swma/tests/Swma.Tests.cs +++ b/lib/trends_FIR/swma/tests/Swma.Tests.cs @@ -243,7 +243,6 @@ public class SwmaTests swma.Update(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0)); } - swma.Update(new TValue(DateTime.UtcNow.AddSeconds(5), double.NaN)); // After NaN, last-valid substitution should produce finite result Assert.True(double.IsFinite(swma.Last.Value)); diff --git a/lib/trends_FIR/trima/tests/Trima.Validation.Tests.cs b/lib/trends_FIR/trima/tests/Trima.Validation.Tests.cs index 9b975948..3c931164 100644 --- a/lib/trends_FIR/trima/tests/Trima.Validation.Tests.cs +++ b/lib/trends_FIR/trima/tests/Trima.Validation.Tests.cs @@ -29,7 +29,7 @@ public class TrimaValidationTests var qResult = trima.Update(_testData.Data); // Calculate Skender Composite TRIMA: SMA(SMA(x, p1), p2) - int p1 = period / 2 + 1; + int p1 = (period / 2) + 1; int p2 = (period + 1) / 2; var sma1Results = _testData.SkenderQuotes.GetSma(p1).ToList(); diff --git a/lib/trends_FIR/tsf/tests/Tsf.Tests.cs b/lib/trends_FIR/tsf/tests/Tsf.Tests.cs index e53c1cd9..b369a7d2 100644 --- a/lib/trends_FIR/tsf/tests/Tsf.Tests.cs +++ b/lib/trends_FIR/tsf/tests/Tsf.Tests.cs @@ -102,12 +102,12 @@ public class TsfTests for (int i = 0; i < 30; i++) { - double y = 2.0 * i + 5.0; + double y = (2.0 * i) + 5.0; var result = tsf.Update(new TValue(DateTime.UtcNow, y)); if (i >= period) { - double expected = 2.0 * (i + 1) + 5.0; + double expected = (2.0 * (i + 1)) + 5.0; Assert.Equal(expected, result.Value, 1e-9); } } diff --git a/lib/trends_IIR/adxvma/tests/Adxvma.Quantower.Tests.cs b/lib/trends_IIR/adxvma/tests/Adxvma.Quantower.Tests.cs index feb916fa..e422de48 100644 --- a/lib/trends_IIR/adxvma/tests/Adxvma.Quantower.Tests.cs +++ b/lib/trends_IIR/adxvma/tests/Adxvma.Quantower.Tests.cs @@ -155,7 +155,7 @@ public class AdxvmaIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 200; i++) { - double price = 100 + (i * 0.1) + Math.Sin(i * 0.1) * 2; + double price = 100 + (i * 0.1) + (Math.Sin(i * 0.1) * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/trends_IIR/adxvma/tests/Adxvma.Tests.cs b/lib/trends_IIR/adxvma/tests/Adxvma.Tests.cs index 41559f5e..254cf5e4 100644 --- a/lib/trends_IIR/adxvma/tests/Adxvma.Tests.cs +++ b/lib/trends_IIR/adxvma/tests/Adxvma.Tests.cs @@ -493,7 +493,7 @@ public class AdxvmaTests // Feed strong uptrend bars (large +DM consistently) for (int i = 0; i < 50; i++) { - double price = 100 + i * 2; + double price = 100 + (i * 2); var bar = new TBar(time.AddMinutes(i), price, price + 1, price - 0.5, price + 0.5, 1000); adxvma.Update(bar, isNew: true); } diff --git a/lib/trends_IIR/adxvma/tests/Adxvma.Validation.Tests.cs b/lib/trends_IIR/adxvma/tests/Adxvma.Validation.Tests.cs index 76c566ff..4e1e0203 100644 --- a/lib/trends_IIR/adxvma/tests/Adxvma.Validation.Tests.cs +++ b/lib/trends_IIR/adxvma/tests/Adxvma.Validation.Tests.cs @@ -178,7 +178,7 @@ public class AdxvmaValidationTests // Strong uptrend: each bar H > prev H, L > prev L, consistent +DM for (int i = 0; i < 100; i++) { - double basePrice = 100 + i * 1.5; + double basePrice = 100 + (i * 1.5); var bar = new TBar(time.AddMinutes(i), basePrice, basePrice + 2, basePrice - 1, basePrice + 1, 1000); adxvma.Update(bar, isNew: true); } @@ -208,7 +208,7 @@ public class AdxvmaValidationTests // Feed choppy bars: alternating up/down moves cancel out → ADX stays low for (int i = 50; i < 150; i++) { - double price = 100 + Math.Sin(i * 0.5) * 2; // oscillating around 100 + double price = 100 + (Math.Sin(i * 0.5) * 2); // oscillating around 100 var bar = new TBar(time.AddMinutes(i), price, price + 1, price - 1, price, 1000); adxvma.Update(bar, isNew: true); } diff --git a/lib/trends_IIR/decycler/tests/Decycler.Validation.Tests.cs b/lib/trends_IIR/decycler/tests/Decycler.Validation.Tests.cs index 7e381045..7cb6da2e 100644 --- a/lib/trends_IIR/decycler/tests/Decycler.Validation.Tests.cs +++ b/lib/trends_IIR/decycler/tests/Decycler.Validation.Tests.cs @@ -29,7 +29,7 @@ file static class DecyclerPineReference double arg = 0.707 * 2.0 * Math.PI / period; double cosArg = Math.Cos(arg); double alpha = (cosArg + Math.Sin(arg) - 1.0) / cosArg; - double halfAlpha = 1.0 - alpha * 0.5; + double halfAlpha = 1.0 - (alpha * 0.5); double a1 = halfAlpha * halfAlpha; double oneMinusAlpha = 1.0 - alpha; double b1 = 2.0 * oneMinusAlpha; @@ -48,9 +48,9 @@ file static class DecyclerPineReference } else { - hp[i] = a1 * (src[i] - 2.0 * src[i - 1] + src[i - 2]) - + b1 * hp[i - 1] - + c1 * hp[i - 2]; + hp[i] = (a1 * (src[i] - (2.0 * src[i - 1]) + src[i - 2])) + + (b1 * hp[i - 1]) + + (c1 * hp[i - 2]); result[i] = src[i] - hp[i]; } } @@ -68,7 +68,7 @@ file static class DecyclerPineReference double arg = 0.707 * 2.0 * Math.PI / period; double cosArg = Math.Cos(arg); double alpha = (cosArg + Math.Sin(arg) - 1.0) / cosArg; - double halfAlpha = 1.0 - alpha * 0.5; + double halfAlpha = 1.0 - (alpha * 0.5); double a1 = halfAlpha * halfAlpha; double oneMinusAlpha = 1.0 - alpha; double b1 = 2.0 * oneMinusAlpha; @@ -90,9 +90,9 @@ file static class DecyclerPineReference for (int i = 1; i < src.Length; i++) { // IsInitialized = true from bar 1 onward - double newHp = a1 * (src[i] - 2.0 * src1 + src2) - + b1 * hp - + c1 * hp1; + double newHp = (a1 * (src[i] - (2.0 * src1) + src2)) + + (b1 * hp) + + (c1 * hp1); result[i] = src[i] - newHp; hp1 = hp; diff --git a/lib/trends_IIR/dema/tests/Dema.Tests.cs b/lib/trends_IIR/dema/tests/Dema.Tests.cs index ca0f859e..5e48f113 100644 --- a/lib/trends_IIR/dema/tests/Dema.Tests.cs +++ b/lib/trends_IIR/dema/tests/Dema.Tests.cs @@ -23,7 +23,7 @@ public class DemaTests var e1Val = ema1.Update(tVal); var e2Val = ema2.Update(e1Val); - double expected = 2 * e1Val.Value - e2Val.Value; + double expected = (2 * e1Val.Value) - e2Val.Value; Assert.Equal(expected, dVal.Value, 1e-9); } diff --git a/lib/trends_IIR/dema/tests/Dema.Validation.Tests.cs b/lib/trends_IIR/dema/tests/Dema.Validation.Tests.cs index eeb4a99c..9440be9c 100644 --- a/lib/trends_IIR/dema/tests/Dema.Validation.Tests.cs +++ b/lib/trends_IIR/dema/tests/Dema.Validation.Tests.cs @@ -179,7 +179,7 @@ public sealed class DemaValidationTests : IDisposable // Manual DEMA (Ooples logic) var e1 = ema1.Update(item); var e2 = ema2.Update(e1); // EMA of EMA - double ooplesVal = 2 * e1.Value - e2.Value; + double ooplesVal = (2 * e1.Value) - e2.Value; // Compare // Note: There might be tiny differences due to floating point operations order diff --git a/lib/trends_IIR/hwma/tests/Hwma.Tests.cs b/lib/trends_IIR/hwma/tests/Hwma.Tests.cs index 7829f51b..73df189f 100644 --- a/lib/trends_IIR/hwma/tests/Hwma.Tests.cs +++ b/lib/trends_IIR/hwma/tests/Hwma.Tests.cs @@ -354,7 +354,7 @@ public class HwmaTests double[] prices = new double[30]; for (int i = 0; i < 30; i++) { - prices[i] = 100 + i * 2; // Linear uptrend + prices[i] = 100 + (i * 2); // Linear uptrend } double lastResult = 0; diff --git a/lib/trends_IIR/hwma/tests/Hwma.Validation.Tests.cs b/lib/trends_IIR/hwma/tests/Hwma.Validation.Tests.cs index e8484001..d9b5a0e4 100644 --- a/lib/trends_IIR/hwma/tests/Hwma.Validation.Tests.cs +++ b/lib/trends_IIR/hwma/tests/Hwma.Validation.Tests.cs @@ -46,12 +46,12 @@ public class HwmaValidationTests double prevV = V; double prevA = A; - F = alpha * series[i].Value + (1 - alpha) * (prevF + prevV + 0.5 * prevA); - V = beta * (F - prevF) + (1 - beta) * (prevV + prevA); - A = gamma * (V - prevV) + (1 - gamma) * prevA; + F = (alpha * series[i].Value) + ((1 - alpha) * (prevF + prevV + (0.5 * prevA))); + V = (beta * (F - prevF)) + ((1 - beta) * (prevV + prevA)); + A = (gamma * (V - prevV)) + ((1 - gamma) * prevA); } - double expected = F + V + 0.5 * A; + double expected = F + V + (0.5 * A); Assert.Equal(expected, results.Last.Value, Tolerance); } @@ -183,14 +183,14 @@ public class HwmaValidationTests // Generate uptrend for (int i = 0; i < 30; i++) { - double price = 100 + i * 2; // Strong uptrend + double price = 100 + (i * 2); // Strong uptrend hwma.Update(new TValue(DateTime.UtcNow, price)); ema.Update(new TValue(DateTime.UtcNow, price)); } // HWMA should be closer to current price than EMA in uptrend // (or even ahead due to velocity/acceleration extrapolation) - double currentPrice = 100 + 29 * 2; // 158 + double currentPrice = 100 + (29 * 2); // 158 double hwmaDiff = Math.Abs(hwma.Last.Value - currentPrice); double emaDiff = Math.Abs(ema.Last.Value - currentPrice); diff --git a/lib/trends_IIR/jma/tests/Jma.Tests.cs b/lib/trends_IIR/jma/tests/Jma.Tests.cs index 94aa9a7f..a3a7a752 100644 --- a/lib/trends_IIR/jma/tests/Jma.Tests.cs +++ b/lib/trends_IIR/jma/tests/Jma.Tests.cs @@ -83,7 +83,7 @@ public class JmaTests // Warmup for JMA(10) is approx 203 bars // ceil(20 + 80 * 10^0.36) = 203 - int warmup = (int)Math.Ceiling(20.0 + 80.0 * Math.Pow(10, 0.36)); + int warmup = (int)Math.Ceiling(20.0 + (80.0 * Math.Pow(10, 0.36))); for (int i = 1; i < warmup; i++) { diff --git a/lib/trends_IIR/ltma/tests/Ltma.Tests.cs b/lib/trends_IIR/ltma/tests/Ltma.Tests.cs index 494c805f..907b5356 100644 --- a/lib/trends_IIR/ltma/tests/Ltma.Tests.cs +++ b/lib/trends_IIR/ltma/tests/Ltma.Tests.cs @@ -134,7 +134,7 @@ public class LtmaTests // Multiple corrections for (int c = 0; c < 5; c++) { - ltma.Update(new TValue(baseBar.Time, baseBar.Close + (c + 1) * 2.0), isNew: false); + ltma.Update(new TValue(baseBar.Time, baseBar.Close + ((c + 1) * 2.0)), isNew: false); } // Final correction with original → must restore diff --git a/lib/trends_IIR/ltma/tests/Ltma.Validation.Tests.cs b/lib/trends_IIR/ltma/tests/Ltma.Validation.Tests.cs index 4cbebcc8..6504dea3 100644 --- a/lib/trends_IIR/ltma/tests/Ltma.Validation.Tests.cs +++ b/lib/trends_IIR/ltma/tests/Ltma.Validation.Tests.cs @@ -195,7 +195,7 @@ public sealed class LtmaValidationTests : IDisposable var ltmaVal = ltma.Update(tVal); var e1 = ema1.Update(tVal); var e2 = ema2.Update(e1); - double expected = 2.0 * e1.Value - e2.Value; + double expected = (2.0 * e1.Value) - e2.Value; Assert.Equal(expected, ltmaVal.Value, 1e-9); } diff --git a/lib/trends_IIR/mama/tests/Mama.Tests.cs b/lib/trends_IIR/mama/tests/Mama.Tests.cs index 3976d914..00157018 100644 --- a/lib/trends_IIR/mama/tests/Mama.Tests.cs +++ b/lib/trends_IIR/mama/tests/Mama.Tests.cs @@ -128,7 +128,7 @@ public class MamaTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - data.Add(new TValue(now.AddMinutes(i), 100.0 + Math.Sin(i * 0.1) * 10)); + data.Add(new TValue(now.AddMinutes(i), 100.0 + (Math.Sin(i * 0.1) * 10))); } // Case 1: Update all at once diff --git a/lib/trends_IIR/mavp/tests/Mavp.Tests.cs b/lib/trends_IIR/mavp/tests/Mavp.Tests.cs index aabe7630..8ebe5179 100644 --- a/lib/trends_IIR/mavp/tests/Mavp.Tests.cs +++ b/lib/trends_IIR/mavp/tests/Mavp.Tests.cs @@ -88,7 +88,7 @@ public class MavpTests var bar = gbm.Next(isNew: true); series.Add(bar.Time, bar.Close); // Variable period: oscillate between 5 and 20 - double p = 5 + 15.0 * (0.5 + 0.5 * Math.Sin(i * 0.1)); + double p = 5 + (15.0 * (0.5 + (0.5 * Math.Sin(i * 0.1)))); periodSeries.Add(bar.Time, p); } @@ -343,7 +343,7 @@ public class MavpTests { var bar = gbm.Next(isNew: true); var tv = new TValue(bar.Time, bar.Close); - double period = 5 + 15.0 * (0.5 + 0.5 * Math.Sin(i * 0.1)); + double period = 5 + (15.0 * (0.5 + (0.5 * Math.Sin(i * 0.1)))); // Method 1: Set period, then call Update mavp1.Period = period; diff --git a/lib/trends_IIR/mcnma/tests/Mcnma.Tests.cs b/lib/trends_IIR/mcnma/tests/Mcnma.Tests.cs index e7128aae..c751487c 100644 --- a/lib/trends_IIR/mcnma/tests/Mcnma.Tests.cs +++ b/lib/trends_IIR/mcnma/tests/Mcnma.Tests.cs @@ -34,14 +34,14 @@ public class McnmaTests e1 = Math.FusedMultiplyAdd(e1, decay, alpha * val); e2 = Math.FusedMultiplyAdd(e2, decay, alpha * e1); e3 = Math.FusedMultiplyAdd(e3, decay, alpha * e2); - double tema1 = 3.0 * e1 - 3.0 * e2 + e3; + double tema1 = (3.0 * e1) - (3.0 * e2) + e3; e4 = Math.FusedMultiplyAdd(e4, decay, alpha * tema1); e5 = Math.FusedMultiplyAdd(e5, decay, alpha * e4); e6 = Math.FusedMultiplyAdd(e6, decay, alpha * e5); - double tema2 = 3.0 * e4 - 3.0 * e5 + e6; + double tema2 = (3.0 * e4) - (3.0 * e5) + e6; - double expected = 2.0 * tema1 - tema2; + double expected = (2.0 * tema1) - tema2; Assert.Equal(expected, mVal.Value, 1e-9); } } diff --git a/lib/trends_IIR/mcnma/tests/Mcnma.Validation.Tests.cs b/lib/trends_IIR/mcnma/tests/Mcnma.Validation.Tests.cs index a9925f26..0d01ee46 100644 --- a/lib/trends_IIR/mcnma/tests/Mcnma.Validation.Tests.cs +++ b/lib/trends_IIR/mcnma/tests/Mcnma.Validation.Tests.cs @@ -65,14 +65,14 @@ public sealed class McnmaValidationTests : IDisposable e1 = Math.FusedMultiplyAdd(e1, decay, alpha * val); e2 = Math.FusedMultiplyAdd(e2, decay, alpha * e1); e3 = Math.FusedMultiplyAdd(e3, decay, alpha * e2); - double tema1 = 3.0 * e1 - 3.0 * e2 + e3; + double tema1 = (3.0 * e1) - (3.0 * e2) + e3; e4 = Math.FusedMultiplyAdd(e4, decay, alpha * tema1); e5 = Math.FusedMultiplyAdd(e5, decay, alpha * e4); e6 = Math.FusedMultiplyAdd(e6, decay, alpha * e5); - double tema2 = 3.0 * e4 - 3.0 * e5 + e6; + double tema2 = (3.0 * e4) - (3.0 * e5) + e6; - manualResults.Add(2.0 * tema1 - tema2); + manualResults.Add((2.0 * tema1) - tema2); } for (int i = 0; i < qResult.Count; i++) @@ -181,14 +181,14 @@ public sealed class McnmaValidationTests : IDisposable e1 = Math.FusedMultiplyAdd(e1, decay, alpha * val); e2 = Math.FusedMultiplyAdd(e2, decay, alpha * e1); e3 = Math.FusedMultiplyAdd(e3, decay, alpha * e2); - double tema1 = 3.0 * e1 - 3.0 * e2 + e3; + double tema1 = (3.0 * e1) - (3.0 * e2) + e3; e4 = Math.FusedMultiplyAdd(e4, decay, alpha * tema1); e5 = Math.FusedMultiplyAdd(e5, decay, alpha * e4); e6 = Math.FusedMultiplyAdd(e6, decay, alpha * e5); - double tema2 = 3.0 * e4 - 3.0 * e5 + e6; + double tema2 = (3.0 * e4) - (3.0 * e5) + e6; - double manualVal = 2.0 * tema1 - tema2; + double manualVal = (2.0 * tema1) - tema2; Assert.Equal(manualVal, qVal.Value, ValidationHelper.DefaultTolerance); } } diff --git a/lib/trends_IIR/nma/tests/Nma.Tests.cs b/lib/trends_IIR/nma/tests/Nma.Tests.cs index 125481c7..1632132c 100644 --- a/lib/trends_IIR/nma/tests/Nma.Tests.cs +++ b/lib/trends_IIR/nma/tests/Nma.Tests.cs @@ -147,7 +147,7 @@ public class NmaTests nma.Update(series[^1]); for (int c = 0; c < 5; c++) { - nma.Update(new TValue(series[^1].Time, series[^1].Value * (1.0 + c * 0.01)), isNew: false); + nma.Update(new TValue(series[^1].Time, series[^1].Value * (1.0 + (c * 0.01))), isNew: false); } var corrected = nma.Update(new TValue(series[^1].Time, series[^1].Value + 2.0), isNew: false); diff --git a/lib/trends_IIR/nma/tests/Nma.Validation.Tests.cs b/lib/trends_IIR/nma/tests/Nma.Validation.Tests.cs index 740e4c19..fb6ca48a 100644 --- a/lib/trends_IIR/nma/tests/Nma.Validation.Tests.cs +++ b/lib/trends_IIR/nma/tests/Nma.Validation.Tests.cs @@ -120,7 +120,7 @@ public class NmaValidationTests double lastNma = 0; for (int i = 0; i < 100; i++) { - double price = 100.0 + i * 0.5; + double price = 100.0 + (i * 0.5); lastNma = nma.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)).Value; } diff --git a/lib/trends_IIR/trama/tests/Trama.Tests.cs b/lib/trends_IIR/trama/tests/Trama.Tests.cs index 42ce02aa..aaa96b41 100644 --- a/lib/trends_IIR/trama/tests/Trama.Tests.cs +++ b/lib/trends_IIR/trama/tests/Trama.Tests.cs @@ -416,7 +416,7 @@ public class TramaTests // Fill with simple incrementing values for (int i = 0; i < size; i++) { - source[i] = 100.0 + i * 0.01; + source[i] = 100.0 + (i * 0.01); } Trama.Batch(source, output, DefaultPeriod); diff --git a/lib/trends_IIR/vama/tests/Vama.Quantower.Tests.cs b/lib/trends_IIR/vama/tests/Vama.Quantower.Tests.cs index d08d0eb1..65ea068f 100644 --- a/lib/trends_IIR/vama/tests/Vama.Quantower.Tests.cs +++ b/lib/trends_IIR/vama/tests/Vama.Quantower.Tests.cs @@ -177,7 +177,7 @@ public class VamaIndicatorTests // Start with low volatility period for (int i = 0; i < 30; i++) { - double price = 100 + i * 0.1; + double price = 100 + (i * 0.1); indicator.HistoricalData.AddBar(now, price, price + 1, price - 1, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); now = now.AddMinutes(1); @@ -238,7 +238,7 @@ public class VamaIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 200; i++) { - double price = 100 + (i * 0.1) + Math.Sin(i * 0.1) * 2; + double price = 100 + (i * 0.1) + (Math.Sin(i * 0.1) * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/trends_IIR/vama/tests/Vama.Validation.Tests.cs b/lib/trends_IIR/vama/tests/Vama.Validation.Tests.cs index 225459b1..805b2afb 100644 --- a/lib/trends_IIR/vama/tests/Vama.Validation.Tests.cs +++ b/lib/trends_IIR/vama/tests/Vama.Validation.Tests.cs @@ -124,14 +124,14 @@ public class VamaValidationTests // Feed low volatility bars first for (int i = 0; i < 100; i++) { - var bar = new TBar(time.AddMinutes(i), 100 + i * 0.1, 100.5 + i * 0.1, 99.5 + i * 0.1, 100 + i * 0.1, 1000); + var bar = new TBar(time.AddMinutes(i), 100 + (i * 0.1), 100.5 + (i * 0.1), 99.5 + (i * 0.1), 100 + (i * 0.1), 1000); vamaLowVol.Update(bar, isNew: true); } // Feed high volatility bars for (int i = 0; i < 100; i++) { - var bar = new TBar(time.AddMinutes(i), 100 + i * 0.1, 110 + i * 0.1, 90 + i * 0.1, 100 + i * 0.1, 1000); + var bar = new TBar(time.AddMinutes(i), 100 + (i * 0.1), 110 + (i * 0.1), 90 + (i * 0.1), 100 + (i * 0.1), 1000); vamaHighVol.Update(bar, isNew: true); } diff --git a/lib/trends_IIR/vidya/tests/Vidya.Validation.Tests.cs b/lib/trends_IIR/vidya/tests/Vidya.Validation.Tests.cs index 46ac464a..cde1990f 100644 --- a/lib/trends_IIR/vidya/tests/Vidya.Validation.Tests.cs +++ b/lib/trends_IIR/vidya/tests/Vidya.Validation.Tests.cs @@ -100,7 +100,7 @@ public class VidyaValidationTests } double dynamicAlpha = alpha * vi; - double currentVidya = dynamicAlpha * prices[i] + (1 - dynamicAlpha) * prevVidya; + double currentVidya = (dynamicAlpha * prices[i]) + ((1 - dynamicAlpha) * prevVidya); results.Add(currentVidya); prevVidya = currentVidya; diff --git a/lib/volatility/atrn/tests/Atrn.Tests.cs b/lib/volatility/atrn/tests/Atrn.Tests.cs index 275f634e..1573869d 100644 --- a/lib/volatility/atrn/tests/Atrn.Tests.cs +++ b/lib/volatility/atrn/tests/Atrn.Tests.cs @@ -374,7 +374,7 @@ public class AtrnTests var batch = Atrn.Batch(bars, DefaultPeriod); Assert.NotNull(indicator); - Assert.True(indicator.WarmupPeriod >= DefaultPeriod + 10 * DefaultPeriod); + Assert.True(indicator.WarmupPeriod >= DefaultPeriod + (10 * DefaultPeriod)); Assert.Equal(batch.Count, results.Count); for (int i = 0; i < results.Count; i++) diff --git a/lib/volatility/atrn/tests/Atrn.Validation.Tests.cs b/lib/volatility/atrn/tests/Atrn.Validation.Tests.cs index 2e1c15f4..3c0871eb 100644 --- a/lib/volatility/atrn/tests/Atrn.Validation.Tests.cs +++ b/lib/volatility/atrn/tests/Atrn.Validation.Tests.cs @@ -166,7 +166,7 @@ public sealed class AtrnValidationTests : IDisposable for (int i = 0; i < lookbackWindow + 100; i++) { constantBars.Add(new TBar( - startTime + i * TimeSpan.FromMinutes(1).Ticks, + startTime + (i * TimeSpan.FromMinutes(1).Ticks), price, // Open price + 5.0, // High (constant +5) price - 5.0, // Low (constant -5) @@ -215,7 +215,7 @@ public sealed class AtrnValidationTests : IDisposable double range = 1.0 + (i * 0.1); bars.Add(new TBar( - startTime + i * TimeSpan.FromMinutes(1).Ticks, + startTime + (i * TimeSpan.FromMinutes(1).Ticks), price, price + range, price - range, @@ -261,7 +261,7 @@ public sealed class AtrnValidationTests : IDisposable double range = Math.Max(0.1, 10.0 - (i * 0.05)); bars.Add(new TBar( - startTime + i * TimeSpan.FromMinutes(1).Ticks, + startTime + (i * TimeSpan.FromMinutes(1).Ticks), price, price + range, price - range, diff --git a/lib/volatility/bbw/tests/Bbw.Quantower.Tests.cs b/lib/volatility/bbw/tests/Bbw.Quantower.Tests.cs index beff66c2..6659a477 100644 --- a/lib/volatility/bbw/tests/Bbw.Quantower.Tests.cs +++ b/lib/volatility/bbw/tests/Bbw.Quantower.Tests.cs @@ -59,7 +59,7 @@ public class BbwIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading diff --git a/lib/volatility/bbw/tests/Bbw.Tests.cs b/lib/volatility/bbw/tests/Bbw.Tests.cs index de1d6952..de4e999c 100644 --- a/lib/volatility/bbw/tests/Bbw.Tests.cs +++ b/lib/volatility/bbw/tests/Bbw.Tests.cs @@ -379,7 +379,7 @@ public class BbwTests for (int i = 0; i < 10; i++) { - bbw.Update(new TValue(DateTime.UtcNow, 100 + i * 0.1)); + bbw.Update(new TValue(DateTime.UtcNow, 100 + (i * 0.1))); } double lowVolatilityBbw = bbw.Last.Value; @@ -387,7 +387,7 @@ public class BbwTests for (int i = 0; i < 10; i++) { - bbw.Update(new TValue(DateTime.UtcNow, 100 + i * 10)); + bbw.Update(new TValue(DateTime.UtcNow, 100 + (i * 10))); } double highVolatilityBbw = bbw.Last.Value; diff --git a/lib/volatility/bbwn/tests/Bbwn.Quantower.Tests.cs b/lib/volatility/bbwn/tests/Bbwn.Quantower.Tests.cs index 1af5846c..cbf572d8 100644 --- a/lib/volatility/bbwn/tests/Bbwn.Quantower.Tests.cs +++ b/lib/volatility/bbwn/tests/Bbwn.Quantower.Tests.cs @@ -61,7 +61,7 @@ public class BbwnIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading diff --git a/lib/volatility/bbwp/tests/Bbwp.Quantower.Tests.cs b/lib/volatility/bbwp/tests/Bbwp.Quantower.Tests.cs index d393db1f..f1c3115c 100644 --- a/lib/volatility/bbwp/tests/Bbwp.Quantower.Tests.cs +++ b/lib/volatility/bbwp/tests/Bbwp.Quantower.Tests.cs @@ -61,7 +61,7 @@ public class BbwpIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading diff --git a/lib/volatility/bbwp/tests/Bbwp.Validation.Tests.cs b/lib/volatility/bbwp/tests/Bbwp.Validation.Tests.cs index eff2f5f1..20d3726f 100644 --- a/lib/volatility/bbwp/tests/Bbwp.Validation.Tests.cs +++ b/lib/volatility/bbwp/tests/Bbwp.Validation.Tests.cs @@ -141,7 +141,7 @@ public class BbwpValidationTests // Feed low volatility data first for (int i = 0; i < 25; i++) { - bbwp.Update(new TValue(DateTime.UtcNow.Ticks + i, 100.0 + (i % 2) * 0.1)); + bbwp.Update(new TValue(DateTime.UtcNow.Ticks + i, 100.0 + ((i % 2) * 0.1))); } // Then introduce a high volatility spike diff --git a/lib/volatility/ccv/tests/Ccv.Quantower.Tests.cs b/lib/volatility/ccv/tests/Ccv.Quantower.Tests.cs index 912fe3b0..a488986f 100644 --- a/lib/volatility/ccv/tests/Ccv.Quantower.Tests.cs +++ b/lib/volatility/ccv/tests/Ccv.Quantower.Tests.cs @@ -59,7 +59,7 @@ public class CcvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading diff --git a/lib/volatility/ccv/tests/Ccv.Tests.cs b/lib/volatility/ccv/tests/Ccv.Tests.cs index 01a44380..5d387f70 100644 --- a/lib/volatility/ccv/tests/Ccv.Tests.cs +++ b/lib/volatility/ccv/tests/Ccv.Tests.cs @@ -341,7 +341,7 @@ public class CcvTests // Stable prices (small changes) for (int i = 0; i < 20; i++) { - ccvStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.01)); + ccvStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.01))); } // Volatile prices (alternating) diff --git a/lib/volatility/ccv/tests/Ccv.Validation.Tests.cs b/lib/volatility/ccv/tests/Ccv.Validation.Tests.cs index 7979e6a3..59d98350 100644 --- a/lib/volatility/ccv/tests/Ccv.Validation.Tests.cs +++ b/lib/volatility/ccv/tests/Ccv.Validation.Tests.cs @@ -160,7 +160,7 @@ public class CcvValidationTests double priceLow = 100.0; for (int i = 0; i < 20; i++) { - priceLow *= (1 + 0.001 * (i % 2 == 0 ? 1 : -1)); // ±0.1% + priceLow *= (1 + (0.001 * (i % 2 == 0 ? 1 : -1))); // ±0.1% ccvLow.Update(new TValue(DateTime.UtcNow.AddMinutes(i), priceLow)); } @@ -168,7 +168,7 @@ public class CcvValidationTests double priceHigh = 100.0; for (int i = 0; i < 20; i++) { - priceHigh *= (1 + 0.05 * (i % 2 == 0 ? 1 : -1)); // ±5% + priceHigh *= (1 + (0.05 * (i % 2 == 0 ? 1 : -1))); // ±5% ccvHigh.Update(new TValue(DateTime.UtcNow.AddMinutes(i), priceHigh)); } diff --git a/lib/volatility/cv/tests/Cv.Quantower.Tests.cs b/lib/volatility/cv/tests/Cv.Quantower.Tests.cs index 3f26732b..19363d7b 100644 --- a/lib/volatility/cv/tests/Cv.Quantower.Tests.cs +++ b/lib/volatility/cv/tests/Cv.Quantower.Tests.cs @@ -61,7 +61,7 @@ public class CvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading diff --git a/lib/volatility/cv/tests/Cv.Tests.cs b/lib/volatility/cv/tests/Cv.Tests.cs index 840e2eb0..9bfe7b2f 100644 --- a/lib/volatility/cv/tests/Cv.Tests.cs +++ b/lib/volatility/cv/tests/Cv.Tests.cs @@ -354,7 +354,7 @@ public class CvTests // Stable prices (small changes) for (int i = 0; i < 20; i++) { - cvStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.01)); + cvStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.01))); } // Volatile prices (alternating) @@ -399,7 +399,7 @@ public class CvTests // Low volatility period for (int i = 0; i < 15; i++) { - cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.1)); + cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.1))); } double lowVolResult = cv.Last.Value; @@ -420,7 +420,7 @@ public class CvTests // Establish long-run variance for (int i = 0; i < 15; i++) { - cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.5)); + cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.5))); } // Introduce shock @@ -430,7 +430,7 @@ public class CvTests // Let it decay for (int i = 16; i < 50; i++) { - cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i - 16) * 0.1)); + cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + ((i - 16) * 0.1))); } double decayedVol = cv.Last.Value; diff --git a/lib/volatility/cv/tests/Cv.Validation.Tests.cs b/lib/volatility/cv/tests/Cv.Validation.Tests.cs index 27d2eb7c..93001c5f 100644 --- a/lib/volatility/cv/tests/Cv.Validation.Tests.cs +++ b/lib/volatility/cv/tests/Cv.Validation.Tests.cs @@ -77,7 +77,7 @@ public class CvValidationTests // Warmup with stable prices for (int i = 0; i < 25; i++) { - double price = 100.0 * (1 + 0.001 * (i % 2 == 0 ? 1 : -1)); + double price = 100.0 * (1 + (0.001 * (i % 2 == 0 ? 1 : -1))); cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)); } @@ -95,7 +95,7 @@ public class CvValidationTests double lastVol = shockVol; for (int i = 0; i < 50; i++) { - double price = 120.0 * (1 + 0.0001 * (i % 2 == 0 ? 1 : -1)); // Very stable prices + double price = 120.0 * (1 + (0.0001 * (i % 2 == 0 ? 1 : -1))); // Very stable prices cv.Update(new TValue(DateTime.UtcNow.AddMinutes(31 + i), price)); lastVol = cv.Last.Value; } @@ -117,7 +117,7 @@ public class CvValidationTests // Warmup for (int i = 0; i < 25; i++) { - cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + i * 0.1)); + cv.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100.0 + (i * 0.1))); } // Series of large moves @@ -172,7 +172,7 @@ public class CvValidationTests for (int i = period; i < logReturns.Length; i++) { double prevReturn = logReturns[i - 1]; - variance = omega + alpha * prevReturn * prevReturn + beta * variance; + variance = omega + (alpha * prevReturn * prevReturn) + (beta * variance); } // Expected annualized volatility @@ -331,7 +331,7 @@ public class CvValidationTests // Warmup with stable prices then shock for (int i = 0; i < 25; i++) { - double price = 100.0 + i * 0.1; + double price = 100.0 + (i * 0.1); cvLowBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)); cvHighBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)); } @@ -346,7 +346,7 @@ public class CvValidationTests // Continue with stable prices - track decay for (int i = 0; i < 20; i++) { - double price = 120.0 + i * 0.05; + double price = 120.0 + (i * 0.05); cvLowBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(31 + i), price)); cvHighBeta.Update(new TValue(DateTime.UtcNow.AddMinutes(31 + i), price)); } diff --git a/lib/volatility/cvi/tests/Cvi.Quantower.Tests.cs b/lib/volatility/cvi/tests/Cvi.Quantower.Tests.cs index 7e6eca42..44aa3761 100644 --- a/lib/volatility/cvi/tests/Cvi.Quantower.Tests.cs +++ b/lib/volatility/cvi/tests/Cvi.Quantower.Tests.cs @@ -209,7 +209,7 @@ public class CviIndicatorTests for (int i = 20; i < 35; i++) { double basePrice = 100; - double range = 1 + (i - 20) * 0.5; // Gradually increasing range + double range = 1 + ((i - 20) * 0.5); // Gradually increasing range indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + range, basePrice - range, basePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -240,7 +240,7 @@ public class CviIndicatorTests for (int i = 20; i < 35; i++) { double basePrice = 100; - double range = Math.Max(1, 10 - (i - 20) * 0.5); // Gradually decreasing range + double range = Math.Max(1, 10 - ((i - 20) * 0.5)); // Gradually decreasing range indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + range, basePrice - range, basePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volatility/cvi/tests/Cvi.Tests.cs b/lib/volatility/cvi/tests/Cvi.Tests.cs index 3960c192..17b0bfe1 100644 --- a/lib/volatility/cvi/tests/Cvi.Tests.cs +++ b/lib/volatility/cvi/tests/Cvi.Tests.cs @@ -384,10 +384,10 @@ public class CviTests // Start with small range, expand over time for (int i = 0; i < 20; i++) { - double range = 5 + i * 0.5; // Expanding range + double range = 5 + (i * 0.5); // Expanding range var bar = new TBar( DateTime.UtcNow.AddMinutes(i).Ticks, - 100.0, 100.0 + range / 2, 100.0 - range / 2, 100.0, 1000.0 + 100.0, 100.0 + (range / 2), 100.0 - (range / 2), 100.0, 1000.0 ); cvi.Update(bar); } @@ -404,14 +404,14 @@ public class CviTests // Start with large range, contract over time for (int i = 0; i < 20; i++) { - double range = 20 - i * 0.5; // Contracting range + double range = 20 - (i * 0.5); // Contracting range if (range < 1) { range = 1; } var bar = new TBar( DateTime.UtcNow.AddMinutes(i).Ticks, - 100.0, 100.0 + range / 2, 100.0 - range / 2, 100.0, 1000.0 + 100.0, 100.0 + (range / 2), 100.0 - (range / 2), 100.0, 1000.0 ); cvi.Update(bar); } @@ -451,7 +451,7 @@ public class CviTests // Feed pre-calculated range values via TValue for (int i = 0; i < 20; i++) { - var result = cvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 5.0 + i * 0.1)); + var result = cvi.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 5.0 + (i * 0.1))); Assert.True(double.IsFinite(result.Value)); } diff --git a/lib/volatility/cvi/tests/Cvi.Validation.Tests.cs b/lib/volatility/cvi/tests/Cvi.Validation.Tests.cs index 0a039ec0..ce91c08e 100644 --- a/lib/volatility/cvi/tests/Cvi.Validation.Tests.cs +++ b/lib/volatility/cvi/tests/Cvi.Validation.Tests.cs @@ -87,10 +87,10 @@ public class CviValidationTests // Gradually expanding range for (int i = 0; i < 20; i++) { - double range = 5 + i * 0.5; // Expanding from 5 to 14.5 + double range = 5 + (i * 0.5); // Expanding from 5 to 14.5 var bar = new TBar( DateTime.UtcNow.AddMinutes(i).Ticks, - 100.0, 100.0 + range / 2, 100.0 - range / 2, 100.0, 1000.0 + 100.0, 100.0 + (range / 2), 100.0 - (range / 2), 100.0, 1000.0 ); cvi.Update(bar); } @@ -110,14 +110,14 @@ public class CviValidationTests // Gradually contracting range for (int i = 0; i < 20; i++) { - double range = 20 - i * 0.5; // Contracting from 20 to 10.5 + double range = 20 - (i * 0.5); // Contracting from 20 to 10.5 if (range < 1) { range = 1; } var bar = new TBar( DateTime.UtcNow.AddMinutes(i).Ticks, - 100.0, 100.0 + range / 2, 100.0 - range / 2, 100.0, 1000.0 + 100.0, 100.0 + (range / 2), 100.0 - (range / 2), 100.0, 1000.0 ); cvi.Update(bar); } @@ -144,7 +144,7 @@ public class CviValidationTests emas[0] = ranges[0]; for (int i = 1; i < ranges.Length; i++) { - emas[i] = (ranges[i] - emas[i - 1]) * alpha + emas[i - 1]; + emas[i] = ((ranges[i] - emas[i - 1]) * alpha) + emas[i - 1]; } // Calculate ROC for last point @@ -407,7 +407,7 @@ public class CviValidationTests double range = (i % 2 == 0) ? 5.0 : 20.0; var bar = new TBar( DateTime.UtcNow.AddMinutes(i).Ticks, - 100.0, 100.0 + range / 2, 100.0 - range / 2, 100.0, 1000.0 + 100.0, 100.0 + (range / 2), 100.0 - (range / 2), 100.0, 1000.0 ); cvi.Update(bar); } diff --git a/lib/volatility/ewma/tests/Ewma.Tests.cs b/lib/volatility/ewma/tests/Ewma.Tests.cs index 916de76c..d6efc980 100644 --- a/lib/volatility/ewma/tests/Ewma.Tests.cs +++ b/lib/volatility/ewma/tests/Ewma.Tests.cs @@ -351,7 +351,7 @@ public class EwmaTests // Stable prices (small changes) for (int i = 0; i < 20; i++) { - ewmaStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + i * 0.01)); + ewmaStable.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 100 + (i * 0.01))); } // Volatile prices (alternating) diff --git a/lib/volatility/ewma/tests/Ewma.Validation.Tests.cs b/lib/volatility/ewma/tests/Ewma.Validation.Tests.cs index 515fdbe0..be217f4a 100644 --- a/lib/volatility/ewma/tests/Ewma.Validation.Tests.cs +++ b/lib/volatility/ewma/tests/Ewma.Validation.Tests.cs @@ -295,7 +295,7 @@ public class EwmaValidationTests var ewma = new Ewma(5, false); for (int i = 0; i < 20; i++) { - double price = 0.0001 + (i % 2) * 0.00001; + double price = 0.0001 + ((i % 2) * 0.00001); var result = ewma.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)); Assert.True(double.IsFinite(result.Value)); Assert.True(result.Value >= 0); @@ -308,7 +308,7 @@ public class EwmaValidationTests var ewma = new Ewma(5, false); for (int i = 0; i < 20; i++) { - double price = 1e10 + (i % 2) * 1e9; + double price = 1e10 + ((i % 2) * 1e9); var result = ewma.Update(new TValue(DateTime.UtcNow.AddMinutes(i), price)); Assert.True(double.IsFinite(result.Value)); Assert.True(result.Value >= 0); @@ -398,7 +398,7 @@ public class EwmaValidationTests // Multiple corrections for (int j = 0; j < 10; j++) { - double correctedPrice = 100 + j * 5; + double correctedPrice = 100 + (j * 5); var result = ewma.Update(new TValue(DateTime.UtcNow, correctedPrice), isNew: false); Assert.True(double.IsFinite(result.Value)); Assert.True(result.Value >= 0); diff --git a/lib/volatility/gkv/tests/Gkv.Quantower.Tests.cs b/lib/volatility/gkv/tests/Gkv.Quantower.Tests.cs index 3c490f33..1e44be0e 100644 --- a/lib/volatility/gkv/tests/Gkv.Quantower.Tests.cs +++ b/lib/volatility/gkv/tests/Gkv.Quantower.Tests.cs @@ -227,7 +227,7 @@ public class GkvIndicatorTests // Same data for both for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 0.5; + double basePrice = 100 + (i * 0.5); indicatorRaw.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 3, basePrice - 3, basePrice + 1, 1000); indicatorRaw.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/volatility/gkv/tests/Gkv.Validation.Tests.cs b/lib/volatility/gkv/tests/Gkv.Validation.Tests.cs index 9e9605c8..9516c062 100644 --- a/lib/volatility/gkv/tests/Gkv.Validation.Tests.cs +++ b/lib/volatility/gkv/tests/Gkv.Validation.Tests.cs @@ -25,7 +25,7 @@ public class GkvValidationTests [Fact] public void Gkv_GarmanKlassCoefficient_IsCorrect() { - double expectedCoeff = 2.0 * Math.Log(2) - 1.0; + double expectedCoeff = (2.0 * Math.Log(2)) - 1.0; Assert.Equal(0.38629436111989, expectedCoeff, 10); } @@ -38,7 +38,7 @@ public class GkvValidationTests [InlineData(10, 0.9)] // 1 - 1/10 = 9/10 public void Gkv_RmaDecay_IsCorrect(int period, double expectedDecay) { - double decay = 1.0 - 1.0 / period; + double decay = 1.0 - (1.0 / period); Assert.Equal(expectedDecay, decay, 10); } @@ -59,7 +59,7 @@ public class GkvValidationTests double lnC = Math.Log(close); double term1 = 0.5 * Math.Pow(lnH - lnL, 2); - double coeff = 2.0 * Math.Log(2) - 1.0; + double coeff = (2.0 * Math.Log(2)) - 1.0; double term2 = coeff * Math.Pow(lnC - lnO, 2); double expectedGk = term1 - term2; @@ -87,7 +87,7 @@ public class GkvValidationTests double lnC = Math.Log(price); double term1 = 0.5 * Math.Pow(lnH - lnL, 2); // 0 - double coeff = 2.0 * Math.Log(2) - 1.0; + double coeff = (2.0 * Math.Log(2)) - 1.0; double term2 = coeff * Math.Pow(lnC - lnO, 2); // 0 double gk = term1 - term2; @@ -104,7 +104,7 @@ public class GkvValidationTests [InlineData(14, 100)] // Very late - correction should be minimal public void Gkv_BiasCorrection_WorksCorrectly(int period, int count) { - double decay = 1.0 - 1.0 / period; + double decay = 1.0 - (1.0 / period); double e = Math.Pow(decay, count); double correctionFactor = 1.0 / (1.0 - e); @@ -610,7 +610,7 @@ public class GkvValidationTests double lnC = Math.Log(close); double term1 = 0.5 * Math.Pow(lnH - lnL, 2); - double coeff = 2.0 * Math.Log(2) - 1.0; + double coeff = (2.0 * Math.Log(2)) - 1.0; double term2 = coeff * Math.Pow(lnC - lnO, 2); return term1 - term2; diff --git a/lib/volatility/hlv/tests/Hlv.Quantower.Tests.cs b/lib/volatility/hlv/tests/Hlv.Quantower.Tests.cs index d0758bfc..8903f6f2 100644 --- a/lib/volatility/hlv/tests/Hlv.Quantower.Tests.cs +++ b/lib/volatility/hlv/tests/Hlv.Quantower.Tests.cs @@ -227,7 +227,7 @@ public class HlvIndicatorTests // Same data for both for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 0.5; + double basePrice = 100 + (i * 0.5); indicatorRaw.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 3, basePrice - 3, basePrice + 1, 1000); indicatorRaw.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/volatility/hlv/tests/Hlv.Validation.Tests.cs b/lib/volatility/hlv/tests/Hlv.Validation.Tests.cs index 7578acb7..6712c1b3 100644 --- a/lib/volatility/hlv/tests/Hlv.Validation.Tests.cs +++ b/lib/volatility/hlv/tests/Hlv.Validation.Tests.cs @@ -37,7 +37,7 @@ public class HlvValidationTests [InlineData(10, 0.9)] // 1 - 1/10 = 9/10 public void Hlv_RmaDecay_IsCorrect(int period, double expectedDecay) { - double decay = 1.0 - 1.0 / period; + double decay = 1.0 - (1.0 / period); Assert.Equal(expectedDecay, decay, 10); } @@ -92,7 +92,7 @@ public class HlvValidationTests [InlineData(14, 100)] // Very late - correction should be minimal public void Hlv_BiasCorrection_WorksCorrectly(int period, int count) { - double decay = 1.0 - 1.0 / period; + double decay = 1.0 - (1.0 / period); double e = Math.Pow(decay, count); double correctionFactor = 1.0 / (1.0 - e); diff --git a/lib/volatility/hv/tests/Hv.Quantower.Tests.cs b/lib/volatility/hv/tests/Hv.Quantower.Tests.cs index 7a7afab5..6cc982a7 100644 --- a/lib/volatility/hv/tests/Hv.Quantower.Tests.cs +++ b/lib/volatility/hv/tests/Hv.Quantower.Tests.cs @@ -58,7 +58,7 @@ public class HvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.5 + Math.Sin(i * 0.3) * 2; // Trending with variation + double closePrice = 100 + (i * 0.5) + (Math.Sin(i * 0.3) * 2); // Trending with variation indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); // Process update for each bar to simulate history loading @@ -81,7 +81,7 @@ public class HvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.3; + double closePrice = 100 + (i * 0.3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); } @@ -107,7 +107,7 @@ public class HvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - double closePrice = 100 + i * 0.2 + Math.Sin(i * 0.5) * 3; + double closePrice = 100 + (i * 0.2) + (Math.Sin(i * 0.5) * 3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -191,7 +191,7 @@ public class HvIndicatorTests // Indicator 1: low volatility (small price changes) for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.01; // Small consistent changes + double closePrice = 100 + (i * 0.01); // Small consistent changes indicator1.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 0.5, closePrice + 0.5, closePrice - 0.5, closePrice, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -199,7 +199,7 @@ public class HvIndicatorTests // Indicator 2: high volatility (large price swings) for (int i = 0; i < 30; i++) { - double closePrice = 100 + Math.Sin(i * 0.5) * 10; // Large swings + double closePrice = 100 + (Math.Sin(i * 0.5) * 10); // Large swings indicator2.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 2, closePrice + 2, closePrice - 2, closePrice, 1000); indicator2.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -225,7 +225,7 @@ public class HvIndicatorTests // Same data for both - trending with variation for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.5 + Math.Sin(i * 0.3) * 2; + double closePrice = 100 + (i * 0.5) + (Math.Sin(i * 0.3) * 2); indicatorRaw.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicatorRaw.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -261,7 +261,7 @@ public class HvIndicatorTests // Same close prices but different high/low for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.5; + double closePrice = 100 + (i * 0.5); // Indicator 1: narrow range indicator1.HistoricalData.AddBar(now.AddMinutes(i), closePrice, closePrice + 1, closePrice - 1, closePrice, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -314,7 +314,7 @@ public class HvIndicatorTests for (int i = 0; i < 30; i++) { double rate = (i % 2 == 0) ? 1.02 : 1.005; - double closePrice = 100 * Math.Pow(rate, i / 2 + 1) * (i % 2 == 0 ? 1.0 : rate); + double closePrice = 100 * Math.Pow(rate, (i / 2) + 1) * (i % 2 == 0 ? 1.0 : rate); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 1, closePrice - 1, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volatility/hv/tests/Hv.Validation.Tests.cs b/lib/volatility/hv/tests/Hv.Validation.Tests.cs index f69cfcaf..26dc1d31 100644 --- a/lib/volatility/hv/tests/Hv.Validation.Tests.cs +++ b/lib/volatility/hv/tests/Hv.Validation.Tests.cs @@ -481,7 +481,7 @@ public class HvValidationTests // Multiple corrections on same price for (int j = 0; j < 5; j++) { - var tempPrice = new TValue(prices[19].Time, prices[19].Value * (1.0 + j * 0.01)); + var tempPrice = new TValue(prices[19].Time, prices[19].Value * (1.0 + (j * 0.01))); hv.Update(tempPrice, isNew: false); } diff --git a/lib/volatility/jvolty/tests/Jvolty.Quantower.Tests.cs b/lib/volatility/jvolty/tests/Jvolty.Quantower.Tests.cs index 7bd153c9..cba68290 100644 --- a/lib/volatility/jvolty/tests/Jvolty.Quantower.Tests.cs +++ b/lib/volatility/jvolty/tests/Jvolty.Quantower.Tests.cs @@ -57,7 +57,7 @@ public class JvoltyIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading diff --git a/lib/volatility/jvoltyn/tests/Jvoltyn.Quantower.Tests.cs b/lib/volatility/jvoltyn/tests/Jvoltyn.Quantower.Tests.cs index 21d2f061..8f8e4582 100644 --- a/lib/volatility/jvoltyn/tests/Jvoltyn.Quantower.Tests.cs +++ b/lib/volatility/jvoltyn/tests/Jvoltyn.Quantower.Tests.cs @@ -57,7 +57,7 @@ public class JvoltynIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2 + (i % 2 == 0 ? 5 : -5); // Add some volatility + double basePrice = 100 + (i * 2) + (i % 2 == 0 ? 5 : -5); // Add some volatility indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 5, basePrice - 5, basePrice + 2, 1000); // Process update for each bar to simulate history loading @@ -186,7 +186,7 @@ public class JvoltynIndicatorTests for (int i = 0; i < 100; i++) { // Create varying volatility patterns - double basePrice = 100 + (i % 10) * 5 + (i % 2 == 0 ? 20 : -15); + double basePrice = 100 + ((i % 10) * 5) + (i % 2 == 0 ? 20 : -15); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 10, basePrice - 10, basePrice + 3, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/volatility/rsv/tests/Rsv.Quantower.Tests.cs b/lib/volatility/rsv/tests/Rsv.Quantower.Tests.cs index 7cb2f64e..61f78803 100644 --- a/lib/volatility/rsv/tests/Rsv.Quantower.Tests.cs +++ b/lib/volatility/rsv/tests/Rsv.Quantower.Tests.cs @@ -226,7 +226,7 @@ public class RsvIndicatorTests // Same data for both for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 0.5; + double basePrice = 100 + (i * 0.5); indicatorRaw.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 3, basePrice - 3, basePrice + 1, 1000); indicatorRaw.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -313,7 +313,7 @@ public class RsvIndicatorTests // Strong uptrend with consistent volatility for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2; // Trending up + double basePrice = 100 + (i * 2); // Trending up indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 3, basePrice - 2, basePrice + 1, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volatility/rsv/tests/Rsv.Validation.Tests.cs b/lib/volatility/rsv/tests/Rsv.Validation.Tests.cs index bff14360..0fb98615 100644 --- a/lib/volatility/rsv/tests/Rsv.Validation.Tests.cs +++ b/lib/volatility/rsv/tests/Rsv.Validation.Tests.cs @@ -56,7 +56,7 @@ public class RsvValidationTests double lnLO = Math.Log(price / price); // log(1) = 0 double lnLC = Math.Log(price / price); // log(1) = 0 - double rsVariance = lnHO * lnHC + lnLO * lnLC; // 0 + double rsVariance = (lnHO * lnHC) + (lnLO * lnLC); // 0 Assert.Equal(0.0, rsVariance, 15); } @@ -153,7 +153,7 @@ public class RsvValidationTests // Strongly trending market (continuous up moves) for (int i = 0; i < 30; i++) { - double basePrice = 100 + i * 2; // Strong uptrend + double basePrice = 100 + (i * 2); // Strong uptrend var bar = new TBar( DateTime.UtcNow.AddMinutes(i).Ticks, basePrice, basePrice + 3, basePrice - 2, basePrice + 2, 1000.0 @@ -698,7 +698,7 @@ public class RsvValidationTests double lnLO = Math.Log(low / open); double lnLC = Math.Log(low / close); - return lnHO * lnHC + lnLO * lnLC; + return (lnHO * lnHC) + (lnLO * lnLC); } private static double Variance(List values) diff --git a/lib/volatility/rv/tests/Rv.Quantower.Tests.cs b/lib/volatility/rv/tests/Rv.Quantower.Tests.cs index 54dd677f..43190ecb 100644 --- a/lib/volatility/rv/tests/Rv.Quantower.Tests.cs +++ b/lib/volatility/rv/tests/Rv.Quantower.Tests.cs @@ -57,7 +57,7 @@ public class RvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.5 + Math.Sin(i * 0.3) * 2; + double closePrice = 100 + (i * 0.5) + (Math.Sin(i * 0.3) * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -78,7 +78,7 @@ public class RvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.3; + double closePrice = 100 + (i * 0.3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); } @@ -103,7 +103,7 @@ public class RvIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - double closePrice = 100 + i * 0.2 + Math.Sin(i * 0.5) * 3; + double closePrice = 100 + (i * 0.2) + (Math.Sin(i * 0.5) * 3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -188,7 +188,7 @@ public class RvIndicatorTests // Low volatility for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.01; + double closePrice = 100 + (i * 0.01); indicator1.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 0.5, closePrice + 0.5, closePrice - 0.5, closePrice, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -196,7 +196,7 @@ public class RvIndicatorTests // High volatility for (int i = 0; i < 30; i++) { - double closePrice = 100 + Math.Sin(i * 0.5) * 10; + double closePrice = 100 + (Math.Sin(i * 0.5) * 10); indicator2.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 2, closePrice + 2, closePrice - 2, closePrice, 1000); indicator2.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -221,7 +221,7 @@ public class RvIndicatorTests for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.5 + Math.Sin(i * 0.3) * 2; + double closePrice = 100 + (i * 0.5) + (Math.Sin(i * 0.3) * 2); indicatorRaw.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicatorRaw.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -254,7 +254,7 @@ public class RvIndicatorTests for (int i = 0; i < 30; i++) { - double closePrice = 100 + i * 0.5; + double closePrice = 100 + (i * 0.5); // Narrow range indicator1.HistoricalData.AddBar(now.AddMinutes(i), closePrice, closePrice + 1, closePrice - 1, closePrice, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -303,7 +303,7 @@ public class RvIndicatorTests for (int i = 0; i < 30; i++) { double rate = (i % 2 == 0) ? 1.02 : 1.005; - double closePrice = 100 * Math.Pow(rate, i / 2 + 1) * (i % 2 == 0 ? 1.0 : rate); + double closePrice = 100 * Math.Pow(rate, (i / 2) + 1) * (i % 2 == 0 ? 1.0 : rate); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 1, closePrice - 1, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -326,7 +326,7 @@ public class RvIndicatorTests for (int i = 0; i < 50; i++) { - double closePrice = 100 + Math.Sin(i * 0.3) * 5; + double closePrice = 100 + (Math.Sin(i * 0.3) * 5); indicator1.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 1, closePrice - 1, closePrice, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/volatility/rv/tests/Rv.Validation.Tests.cs b/lib/volatility/rv/tests/Rv.Validation.Tests.cs index 8b4a2690..ca7264dc 100644 --- a/lib/volatility/rv/tests/Rv.Validation.Tests.cs +++ b/lib/volatility/rv/tests/Rv.Validation.Tests.cs @@ -426,7 +426,7 @@ public class RvValidationTests for (int j = 0; j < 5; j++) { - var tempPrice = new TValue(prices[19].Time, prices[19].Value * (1.0 + j * 0.01)); + var tempPrice = new TValue(prices[19].Time, prices[19].Value * (1.0 + (j * 0.01))); rv.Update(tempPrice, isNew: false); } diff --git a/lib/volatility/rvi/tests/Rvi.Quantower.Tests.cs b/lib/volatility/rvi/tests/Rvi.Quantower.Tests.cs index 7322698b..702860ff 100644 --- a/lib/volatility/rvi/tests/Rvi.Quantower.Tests.cs +++ b/lib/volatility/rvi/tests/Rvi.Quantower.Tests.cs @@ -58,7 +58,7 @@ public class RviIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - double closePrice = 100 + i * 0.5 + Math.Sin(i * 0.3) * 2; + double closePrice = 100 + (i * 0.5) + (Math.Sin(i * 0.3) * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -79,7 +79,7 @@ public class RviIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - double closePrice = 100 + i * 0.3; + double closePrice = 100 + (i * 0.3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); } @@ -105,7 +105,7 @@ public class RviIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 60; i++) { - double closePrice = 100 + i * 0.2 + Math.Sin(i * 0.5) * 3; + double closePrice = 100 + (i * 0.2) + (Math.Sin(i * 0.5) * 3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -129,7 +129,7 @@ public class RviIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 60; i++) { - double closePrice = 100 + i * 0.2 + Math.Sin(i * 0.5) * 3; + double closePrice = 100 + (i * 0.2) + (Math.Sin(i * 0.5) * 3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -198,7 +198,7 @@ public class RviIndicatorTests // Strong uptrend: price consistently rising for (int i = 0; i < 60; i++) { - double closePrice = 100 + i * 1.5; // Strong consistent uptrend + double closePrice = 100 + (i * 1.5); // Strong consistent uptrend indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -220,7 +220,7 @@ public class RviIndicatorTests // Strong downtrend: price consistently falling for (int i = 0; i < 60; i++) { - double closePrice = 200 - i * 1.5; // Strong consistent downtrend + double closePrice = 200 - (i * 1.5); // Strong consistent downtrend indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 1, closePrice + 2, closePrice - 2, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -242,7 +242,7 @@ public class RviIndicatorTests // Mixed data with various price movements for (int i = 0; i < 100; i++) { - double closePrice = 100 + Math.Sin(i * 0.2) * 20 + (i % 3 == 0 ? 5 : -3); + double closePrice = 100 + (Math.Sin(i * 0.2) * 20) + (i % 3 == 0 ? 5 : -3); indicator.HistoricalData.AddBar(now.AddMinutes(i), closePrice - 2, closePrice + 3, closePrice - 3, closePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -272,7 +272,7 @@ public class RviIndicatorTests // Same close prices, different open/high/low for (int i = 0; i < 60; i++) { - double closePrice = 100 + i * 0.5; + double closePrice = 100 + (i * 0.5); // Indicator 1: narrow range indicator1.HistoricalData.AddBar(now.AddMinutes(i), closePrice, closePrice + 1, closePrice - 1, closePrice, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/volatility/ui/tests/Ui.Quantower.Tests.cs b/lib/volatility/ui/tests/Ui.Quantower.Tests.cs index dc491b04..f3081cd3 100644 --- a/lib/volatility/ui/tests/Ui.Quantower.Tests.cs +++ b/lib/volatility/ui/tests/Ui.Quantower.Tests.cs @@ -182,7 +182,7 @@ public class UiIndicatorTests // Price rises then drops - creates drawdown for (int i = 0; i < 10; i++) { - double price = 100 + i * 2; // Rise to 118 + double price = 100 + (i * 2); // Rise to 118 indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -190,7 +190,7 @@ public class UiIndicatorTests // Now drop the price for (int i = 10; i < 20; i++) { - double price = 118 - (i - 10) * 3; // Drop from 118 to 88 + double price = 118 - ((i - 10) * 3); // Drop from 118 to 88 indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -219,7 +219,7 @@ public class UiIndicatorTests } for (int i = 10; i < 20; i++) { - double price = 109 - (i - 10) * 0.5; // Small drop + double price = 109 - ((i - 10) * 0.5); // Small drop indicator1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 0.5, price - 0.5, price, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -233,7 +233,7 @@ public class UiIndicatorTests } for (int i = 10; i < 20; i++) { - double price = 109 - (i - 10) * 2; // Large drop + double price = 109 - ((i - 10) * 2); // Large drop indicator2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 0.5, price - 0.5, price, 1000); indicator2.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -311,7 +311,7 @@ public class UiIndicatorTests // Drawdown - price drops significantly for (int i = 10; i < 15; i++) { - double price = 109 - (i - 10) * 4; // Drop from 109 to 89 + double price = 109 - ((i - 10) * 4); // Drop from 109 to 89 indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -322,7 +322,7 @@ public class UiIndicatorTests // Need at least 10 more bars of rising prices to fully replace the drawdown window for (int i = 15; i < 30; i++) { - double price = 89 + (i - 15) * 3; // Rise from 89 to 134 (well past old high of 109) + double price = 89 + ((i - 15) * 3); // Rise from 89 to 134 (well past old high of 109) indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volatility/ui/tests/Ui.Tests.cs b/lib/volatility/ui/tests/Ui.Tests.cs index bbdaadbd..9cc6f96d 100644 --- a/lib/volatility/ui/tests/Ui.Tests.cs +++ b/lib/volatility/ui/tests/Ui.Tests.cs @@ -512,7 +512,7 @@ public class UiTests for (int i = 0; i < dataLen; i++) { - source[i] = 100 + Math.Sin(i * 0.1) * 10; + source[i] = 100 + (Math.Sin(i * 0.1) * 10); } // Should not throw - uses ArrayPool for large period diff --git a/lib/volatility/ui/tests/Ui.Validation.Tests.cs b/lib/volatility/ui/tests/Ui.Validation.Tests.cs index 7045c392..4ed17106 100644 --- a/lib/volatility/ui/tests/Ui.Validation.Tests.cs +++ b/lib/volatility/ui/tests/Ui.Validation.Tests.cs @@ -309,7 +309,7 @@ public class UiValidationTests for (int i = 0; i < 10; i++) { - double price = 100.0 + Math.Sin(i * 0.1) * 0.001; // Tiny movements + double price = 100.0 + (Math.Sin(i * 0.1) * 0.001); // Tiny movements var result = ui.Update(new TValue(time.AddSeconds(i), price)); Assert.True(double.IsFinite(result.Value)); @@ -387,7 +387,7 @@ public class UiValidationTests // Multiple corrections on same bar for (int j = 0; j < 5; j++) { - ui.Update(new TValue(time.AddSeconds(4), 100 + j * 2), isNew: false); + ui.Update(new TValue(time.AddSeconds(4), 100 + (j * 2)), isNew: false); } // Final correction back to original diff --git a/lib/volatility/vov/tests/Vov.Quantower.Tests.cs b/lib/volatility/vov/tests/Vov.Quantower.Tests.cs index de437ed0..e2bc982f 100644 --- a/lib/volatility/vov/tests/Vov.Quantower.Tests.cs +++ b/lib/volatility/vov/tests/Vov.Quantower.Tests.cs @@ -58,7 +58,7 @@ public class VovIndicatorTests for (int i = 0; i < 50; i++) { // Create price movement that generates volatility - double basePrice = 100 + Math.Sin(i * 0.3) * (5 + i * 0.1); + double basePrice = 100 + (Math.Sin(i * 0.3) * (5 + (i * 0.1))); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000); // Process update for each bar to simulate history loading @@ -108,7 +108,7 @@ public class VovIndicatorTests for (int i = 0; i < 60; i++) { // Create price movement with varying amplitude - double basePrice = 100 + Math.Sin(i * 0.2) * 5; + double basePrice = 100 + (Math.Sin(i * 0.2) * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -197,7 +197,7 @@ public class VovIndicatorTests // Low volatility period for (int i = 0; i < 15; i++) { - double price = 100 + (i % 2) * 0.5; // Small oscillations + double price = 100 + ((i % 2) * 0.5); // Small oscillations indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 0.5, price - 0.5, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -205,7 +205,7 @@ public class VovIndicatorTests // High volatility period for (int i = 15; i < 30; i++) { - double price = 100 + (i % 2) * 10; // Large oscillations + double price = 100 + ((i % 2) * 10); // Large oscillations indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -227,7 +227,7 @@ public class VovIndicatorTests // Price with varying close but constant OHLC range for (int i = 0; i < 20; i++) { - double close = 100 + Math.Sin(i * 0.5) * 5; // Varying close + double close = 100 + (Math.Sin(i * 0.5) * 5); // Varying close indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 110, 90, close, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -252,7 +252,7 @@ public class VovIndicatorTests for (int i = 0; i < 60; i++) { - double price = 100 + Math.Sin(i * 0.3) * 5; + double price = 100 + (Math.Sin(i * 0.3) * 5); indicator1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000); indicator2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -303,7 +303,7 @@ public class VovIndicatorTests // Stable volatility regime for (int i = 0; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.5) * 2; + double price = 100 + (Math.Sin(i * 0.5) * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 1, price - 1, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -313,8 +313,8 @@ public class VovIndicatorTests // Transition to variable volatility for (int i = 20; i < 40; i++) { - double amplitude = 2 + (i - 20) * 0.5; // Increasing amplitude - double price = 100 + Math.Sin(i * 0.5) * amplitude; + double amplitude = 2 + ((i - 20) * 0.5); // Increasing amplitude + double price = 100 + (Math.Sin(i * 0.5) * amplitude); indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + amplitude, price - amplitude, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volatility/vov/tests/Vov.Tests.cs b/lib/volatility/vov/tests/Vov.Tests.cs index c62e5701..6c33b60a 100644 --- a/lib/volatility/vov/tests/Vov.Tests.cs +++ b/lib/volatility/vov/tests/Vov.Tests.cs @@ -132,7 +132,7 @@ public class VovTests // First phase: low volatility for (int i = 0; i < 20; i++) { - vov.Update(new TValue(DateTime.UtcNow, 100.0 + (i % 2) * 0.1)); + vov.Update(new TValue(DateTime.UtcNow, 100.0 + ((i % 2) * 0.1))); } double lowVolVov = vov.Last.Value; @@ -145,12 +145,12 @@ public class VovTests // High volatility period for (int j = 0; j < 5; j++) { - vov.Update(new TValue(DateTime.UtcNow, 100.0 + (j % 2) * 10.0)); + vov.Update(new TValue(DateTime.UtcNow, 100.0 + ((j % 2) * 10.0))); } // Low volatility period for (int j = 0; j < 5; j++) { - vov.Update(new TValue(DateTime.UtcNow, 100.0 + (j % 2) * 0.1)); + vov.Update(new TValue(DateTime.UtcNow, 100.0 + ((j % 2) * 0.1))); } } double highVolVov = vov.Last.Value; diff --git a/lib/volatility/vov/tests/Vov.Validation.Tests.cs b/lib/volatility/vov/tests/Vov.Validation.Tests.cs index 24ca7ab5..dbeba199 100644 --- a/lib/volatility/vov/tests/Vov.Validation.Tests.cs +++ b/lib/volatility/vov/tests/Vov.Validation.Tests.cs @@ -127,14 +127,14 @@ public class VovValidationTests // Low volatility period for (int i = 0; i < 10; i++) { - double price = 100 + Math.Sin(i * 0.3) * 0.5; // Small oscillations + double price = 100 + (Math.Sin(i * 0.3) * 0.5); // Small oscillations vov.Update(new TValue(time.AddSeconds(i), price)); } // High volatility period for (int i = 10; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.3) * 10; // Large oscillations + double price = 100 + (Math.Sin(i * 0.3) * 10); // Large oscillations vov.Update(new TValue(time.AddSeconds(i), price)); } @@ -299,7 +299,7 @@ public class VovValidationTests // Multiple corrections on same bar for (int j = 0; j < 5; j++) { - vov.Update(new TValue(time.AddSeconds(9), 100 + j * 5), isNew: false); + vov.Update(new TValue(time.AddSeconds(9), 100 + (j * 5)), isNew: false); } // Final correction back to original @@ -535,7 +535,7 @@ public class VovValidationTests // Stable volatility regime for (int i = 0; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.5) * 2; // Consistent amplitude + double price = 100 + (Math.Sin(i * 0.5) * 2); // Consistent amplitude vov.Update(new TValue(time.AddSeconds(i), price)); } double stableVov = vov.Last.Value; @@ -543,7 +543,7 @@ public class VovValidationTests // Transition to higher volatility for (int i = 20; i < 35; i++) { - double price = 100 + Math.Sin(i * 0.5) * (2 + (i - 20) * 0.5); // Increasing amplitude + double price = 100 + (Math.Sin(i * 0.5) * (2 + ((i - 20) * 0.5))); // Increasing amplitude vov.Update(new TValue(time.AddSeconds(i), price)); } double transitionVov = vov.Last.Value; diff --git a/lib/volatility/vr/tests/Vr.Quantower.Tests.cs b/lib/volatility/vr/tests/Vr.Quantower.Tests.cs index 0e86439c..84ac10e8 100644 --- a/lib/volatility/vr/tests/Vr.Quantower.Tests.cs +++ b/lib/volatility/vr/tests/Vr.Quantower.Tests.cs @@ -56,7 +56,7 @@ public class VrIndicatorTests for (int i = 0; i < 50; i++) { // Create price movement that generates volatility - double basePrice = 100 + Math.Sin(i * 0.3) * (5 + i * 0.1); + double basePrice = 100 + (Math.Sin(i * 0.3) * (5 + (i * 0.1))); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000); // Process update for each bar to simulate history loading @@ -106,7 +106,7 @@ public class VrIndicatorTests for (int i = 0; i < 60; i++) { // Create price movement with varying amplitude - double basePrice = 100 + Math.Sin(i * 0.2) * 5; + double basePrice = 100 + (Math.Sin(i * 0.2) * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -205,7 +205,7 @@ public class VrIndicatorTests // Price with varying HLC for (int i = 0; i < 20; i++) { - double close = 100 + Math.Sin(i * 0.3) * 3; + double close = 100 + (Math.Sin(i * 0.3) * 3); double high = close + 2 + Math.Abs(Math.Sin(i * 0.5)); double low = close - 2 - Math.Abs(Math.Cos(i * 0.5)); indicator.HistoricalData.AddBar(now.AddMinutes(i), close, high, low, close, 1000); @@ -261,7 +261,7 @@ public class VrIndicatorTests for (int i = 0; i < 60; i++) { - double price = 100 + Math.Sin(i * 0.3) * 5; + double price = 100 + (Math.Sin(i * 0.3) * 5); indicator1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000); indicator2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -365,8 +365,8 @@ public class VrIndicatorTests // Normal market with consistent volatility for (int i = 0; i < 100; i++) { - double price = 100 + Math.Sin(i * 0.1) * 2; - double range = 2 + Math.Sin(i * 0.2) * 0.5; // Consistent range + double price = 100 + (Math.Sin(i * 0.1) * 2); + double range = 2 + (Math.Sin(i * 0.2) * 0.5); // Consistent range indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + range, price - range, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); diff --git a/lib/volatility/vr/tests/Vr.Tests.cs b/lib/volatility/vr/tests/Vr.Tests.cs index 4d73555c..a1fd7259 100644 --- a/lib/volatility/vr/tests/Vr.Tests.cs +++ b/lib/volatility/vr/tests/Vr.Tests.cs @@ -614,8 +614,8 @@ public class VrTests // Build up history with varying volatility for (int i = 0; i < 50; i++) { - double range = 2.0 + (i % 5) * 0.5; // Varying range - vr.Update(new TBar(DateTime.UtcNow, 100, 100 + range, 100 - range, 100 + range / 2, 1000)); + double range = 2.0 + ((i % 5) * 0.5); // Varying range + vr.Update(new TBar(DateTime.UtcNow, 100, 100 + range, 100 - range, 100 + (range / 2), 1000)); } // VR should oscillate around 1.0 over time diff --git a/lib/volatility/vr/tests/Vr.Validation.Tests.cs b/lib/volatility/vr/tests/Vr.Validation.Tests.cs index 2d36f774..282c3959 100644 --- a/lib/volatility/vr/tests/Vr.Validation.Tests.cs +++ b/lib/volatility/vr/tests/Vr.Validation.Tests.cs @@ -374,7 +374,7 @@ public class VrValidationTests // Low volatility consolidation for (int i = 0; i < 50; i++) { - vr.Update(new TBar(DateTime.UtcNow, 100, 101, 99, 100 + (i % 2) * 0.5, 1000)); + vr.Update(new TBar(DateTime.UtcNow, 100, 101, 99, 100 + ((i % 2) * 0.5), 1000)); } double consolidationVr = vr.Last.Value; @@ -407,7 +407,7 @@ public class VrValidationTests // Gradually increase volatility for (int i = 0; i < 20; i++) { - double range = 1 + i * 0.5; + double range = 1 + (i * 0.5); var result = vr.Update(new TBar(DateTime.UtcNow, 100, 100 + range, 100 - range, 100, 1000)); vrValues.Add(result.Value); } diff --git a/lib/volatility/yzv/tests/Yzv.Quantower.Tests.cs b/lib/volatility/yzv/tests/Yzv.Quantower.Tests.cs index 3b1e4c0a..f840065d 100644 --- a/lib/volatility/yzv/tests/Yzv.Quantower.Tests.cs +++ b/lib/volatility/yzv/tests/Yzv.Quantower.Tests.cs @@ -56,7 +56,7 @@ public class YzvIndicatorTests for (int i = 0; i < 50; i++) { // Create price movement that generates volatility - double basePrice = 100 + Math.Sin(i * 0.3) * (5 + i * 0.1); + double basePrice = 100 + (Math.Sin(i * 0.3) * (5 + (i * 0.1))); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000); // Process update for each bar to simulate history loading @@ -106,7 +106,7 @@ public class YzvIndicatorTests for (int i = 0; i < 60; i++) { // Create price movement with varying amplitude - double basePrice = 100 + Math.Sin(i * 0.2) * 5; + double basePrice = 100 + (Math.Sin(i * 0.2) * 5); indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -204,10 +204,10 @@ public class YzvIndicatorTests // Price with varying OHLC for (int i = 0; i < 20; i++) { - double open = 100 + Math.Sin(i * 0.3) * 3; + double open = 100 + (Math.Sin(i * 0.3) * 3); double high = open + 2 + Math.Abs(Math.Sin(i * 0.5)); double low = open - 2 - Math.Abs(Math.Cos(i * 0.5)); - double close = open + Math.Sin(i * 0.4) * 2; + double close = open + (Math.Sin(i * 0.4) * 2); indicator.HistoricalData.AddBar(now.AddMinutes(i), open, high, low, close, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -232,7 +232,7 @@ public class YzvIndicatorTests for (int i = 0; i < 60; i++) { - double price = 100 + Math.Sin(i * 0.3) * 5; + double price = 100 + (Math.Sin(i * 0.3) * 5); indicator1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000); indicator2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000); indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); @@ -292,7 +292,7 @@ public class YzvIndicatorTests // Large gap up (open much higher than previous close) for (int i = 10; i < 20; i++) { - double open = 120 + (i - 10) * 2; // Large gaps + double open = 120 + ((i - 10) * 2); // Large gaps indicator.HistoricalData.AddBar(now.AddMinutes(i), open, open + 2, open - 2, open + 1, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -316,7 +316,7 @@ public class YzvIndicatorTests // Low volatility regime for (int i = 0; i < 20; i++) { - double price = 100 + Math.Sin(i * 0.5) * 0.5; // Small movements + double price = 100 + (Math.Sin(i * 0.5) * 0.5); // Small movements indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 0.2, price - 0.2, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } @@ -326,7 +326,7 @@ public class YzvIndicatorTests // High volatility regime for (int i = 20; i < 40; i++) { - double price = 100 + Math.Sin(i * 0.5) * 10; // Large movements + double price = 100 + (Math.Sin(i * 0.5) * 10); // Large movements indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + 5, price - 5, price, 1000); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volatility/yzv/tests/Yzv.Tests.cs b/lib/volatility/yzv/tests/Yzv.Tests.cs index cfbcf125..5547debf 100644 --- a/lib/volatility/yzv/tests/Yzv.Tests.cs +++ b/lib/volatility/yzv/tests/Yzv.Tests.cs @@ -112,14 +112,14 @@ public class YzvTests // Low volatility: small H-L range for (int i = 0; i < 30; i++) { - double price = 100.0 + (i % 2) * 0.1; + double price = 100.0 + ((i % 2) * 0.1); yzvLow.Update(new TBar(DateTime.UtcNow, price, price + 0.05, price - 0.05, price, 1000)); } // High volatility: large H-L range for (int i = 0; i < 30; i++) { - double price = 100.0 + (i % 2) * 5.0; + double price = 100.0 + ((i % 2) * 5.0); yzvHigh.Update(new TBar(DateTime.UtcNow, price, price + 5.0, price - 5.0, price + 2.0, 1000)); } diff --git a/lib/volatility/yzv/tests/Yzv.Validation.Tests.cs b/lib/volatility/yzv/tests/Yzv.Validation.Tests.cs index 608eed76..a3bdc5c0 100644 --- a/lib/volatility/yzv/tests/Yzv.Validation.Tests.cs +++ b/lib/volatility/yzv/tests/Yzv.Validation.Tests.cs @@ -41,12 +41,12 @@ public class YzvValidationTests double sOSq = ro * ro; double sCSq = rc * rc; - double sRsSq = rh * (rh - rc) + rl * (rl - rc); + double sRsSq = (rh * (rh - rc)) + (rl * (rl - rc)); double ratioN = (double)(period + 1) / (period - 1); double kYz = 0.34 / (1.34 + ratioN); - double sSqDaily = sOSq + kYz * sCSq + (1.0 - kYz) * sRsSq; + double sSqDaily = sOSq + (kYz * sCSq) + ((1.0 - kYz) * sRsSq); // First bar: RMA = value, eComp = 1 - alpha double alpha = 1.0 / period; @@ -85,7 +85,7 @@ public class YzvValidationTests double ratioN = (double)(period + 1) / (period - 1); double kYz = 0.34 / (1.34 + ratioN); - double expectedK = 0.34 / (1.34 + 21.0 / 19.0); + double expectedK = 0.34 / (1.34 + (21.0 / 19.0)); Assert.Equal(expectedK, kYz, 10); // Verify k is in reasonable range (0 < k < 0.5) @@ -103,7 +103,7 @@ public class YzvValidationTests double rh = Math.Log(high / open); double rl = Math.Log(low / open); - double sRsSq = rh * (rh - rc) + rl * (rl - rc); + double sRsSq = (rh * (rh - rc)) + (rl * (rl - rc)); // Verify this is positive for typical bar Assert.True(sRsSq >= 0, "Rogers-Satchell should be non-negative for valid OHLC"); @@ -225,8 +225,8 @@ public class YzvValidationTests double moveSmall = 1.0; double moveLarge = 10.0; - yzvSmall.Update(new TBar(DateTime.UtcNow, baseSmall, baseSmall + moveSmall, baseSmall - moveSmall, baseSmall + (i % 2) * moveSmall, 1000)); - yzvLarge.Update(new TBar(DateTime.UtcNow, baseLarge, baseLarge + moveLarge, baseLarge - moveLarge, baseLarge + (i % 2) * moveLarge, 1000)); + yzvSmall.Update(new TBar(DateTime.UtcNow, baseSmall, baseSmall + moveSmall, baseSmall - moveSmall, baseSmall + ((i % 2) * moveSmall), 1000)); + yzvLarge.Update(new TBar(DateTime.UtcNow, baseLarge, baseLarge + moveLarge, baseLarge - moveLarge, baseLarge + ((i % 2) * moveLarge), 1000)); } // Larger moves should produce larger YZV (roughly 10x) @@ -272,7 +272,7 @@ public class YzvValidationTests // No gap scenario for (int i = 0; i < 30; i++) { - double close = 100 + i * 0.1; + double close = 100 + (i * 0.1); yzvNoGap.Update(new TBar(DateTime.UtcNow, close, close + 1, close - 1, close, 1000)); } @@ -297,7 +297,7 @@ public class YzvValidationTests // No gap scenario for (int i = 0; i < 30; i++) { - double close = 100 - i * 0.1; + double close = 100 - (i * 0.1); yzvNoGap.Update(new TBar(DateTime.UtcNow, close, close + 1, close - 1, close, 1000)); } diff --git a/lib/volume/adosc/tests/Adosc.Tests.cs b/lib/volume/adosc/tests/Adosc.Tests.cs index 6b273e56..58e3126f 100644 --- a/lib/volume/adosc/tests/Adosc.Tests.cs +++ b/lib/volume/adosc/tests/Adosc.Tests.cs @@ -156,8 +156,8 @@ public class AdoscTests // Apply 5 corrections with different values for (int i = 0; i < 5; i++) { - var correctedBar = new TBar(bar20.Time, bar20.Open * (1 + i * 0.01), bar20.High * (1 + i * 0.01), - bar20.Low * (1 + i * 0.01), bar20.Close * (1 + i * 0.01), bar20.Volume); + var correctedBar = new TBar(bar20.Time, bar20.Open * (1 + (i * 0.01)), bar20.High * (1 + (i * 0.01)), + bar20.Low * (1 + (i * 0.01)), bar20.Close * (1 + (i * 0.01)), bar20.Volume); adosc.Update(correctedBar, isNew: false); } diff --git a/lib/volume/eom/tests/Eom.Tests.cs b/lib/volume/eom/tests/Eom.Tests.cs index 78de98ff..e30df20d 100644 --- a/lib/volume/eom/tests/Eom.Tests.cs +++ b/lib/volume/eom/tests/Eom.Tests.cs @@ -320,8 +320,8 @@ public class EomTests for (int i = 0; i < size; i++) { - high[i] = 110 + i * 0.1; - low[i] = 90 + i * 0.1; + high[i] = 110 + (i * 0.1); + low[i] = 90 + (i * 0.1); volume[i] = 100000; } @@ -365,5 +365,4 @@ public class EomTests // Different volume scales should produce different results Assert.NotEqual(eom1.Last.Value, eom2.Last.Value); } - } diff --git a/lib/volume/evwma/tests/Evwma.Validation.Tests.cs b/lib/volume/evwma/tests/Evwma.Validation.Tests.cs index 905518d3..2d89b8b0 100644 --- a/lib/volume/evwma/tests/Evwma.Validation.Tests.cs +++ b/lib/volume/evwma/tests/Evwma.Validation.Tests.cs @@ -143,7 +143,7 @@ public class EvwmaValidationTests // prevResult = 4775/45 // result = (35 * (4775/45) + 25 * 120) / 60 double prev = 4775.0 / 45.0; - double expected = (35.0 * prev + 25.0 * 120.0) / 60.0; + double expected = ((35.0 * prev) + (25.0 * 120.0)) / 60.0; Assert.Equal(expected, r3.Value, 10); } @@ -171,7 +171,7 @@ public class EvwmaValidationTests var now = DateTime.UtcNow; for (int i = 0; i < 50; i++) { - bars.Add(new TBar(now.AddMinutes(i), 42.0, 42.0, 42.0, 42.0, 100 + i * 10)); + bars.Add(new TBar(now.AddMinutes(i), 42.0, 42.0, 42.0, 42.0, 100 + (i * 10))); } var result = Evwma.Batch(bars, period); diff --git a/lib/volume/iii/tests/Iii.Tests.cs b/lib/volume/iii/tests/Iii.Tests.cs index bf45a56a..1fc43cae 100644 --- a/lib/volume/iii/tests/Iii.Tests.cs +++ b/lib/volume/iii/tests/Iii.Tests.cs @@ -323,9 +323,9 @@ public class IiiTests for (int i = 0; i < size; i++) { - high[i] = 110 + i * 0.1; - low[i] = 90 + i * 0.1; - close[i] = 100 + i * 0.1; + high[i] = 110 + (i * 0.1); + low[i] = 90 + (i * 0.1); + close[i] = 100 + (i * 0.1); volume[i] = 100000; } diff --git a/lib/volume/kvo/tests/Kvo.Tests.cs b/lib/volume/kvo/tests/Kvo.Tests.cs index ff1dcfc5..802c598b 100644 --- a/lib/volume/kvo/tests/Kvo.Tests.cs +++ b/lib/volume/kvo/tests/Kvo.Tests.cs @@ -79,8 +79,8 @@ public class KvoTests // Simulate uptrend with increasing prices and volume for (int i = 0; i < 100; i++) { - double basePrice = 100 + i * 2; - kvo.Update(new TBar(time.AddMinutes(i), basePrice, basePrice + 5, basePrice - 2, basePrice + 3, 1000000 + i * 100000)); + double basePrice = 100 + (i * 2); + kvo.Update(new TBar(time.AddMinutes(i), basePrice, basePrice + 5, basePrice - 2, basePrice + 3, 1000000 + (i * 100000))); } // After warmup, KVO should have finite values @@ -96,8 +96,8 @@ public class KvoTests // Simulate downtrend with decreasing prices for (int i = 0; i < 100; i++) { - double basePrice = 500 - i * 3; - kvo.Update(new TBar(time.AddMinutes(i), basePrice, basePrice + 2, basePrice - 5, basePrice - 3, 1000000 + i * 100000)); + double basePrice = 500 - (i * 3); + kvo.Update(new TBar(time.AddMinutes(i), basePrice, basePrice + 2, basePrice - 5, basePrice - 3, 1000000 + (i * 100000))); } // After warmup, KVO should have finite values @@ -145,7 +145,7 @@ public class KvoTests // Build up state for (int i = 0; i < 15; i++) { - kvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 10000), isNew: true); + kvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 10000)), isNew: true); } // New bar @@ -232,7 +232,7 @@ public class KvoTests for (int i = 0; i < 20; i++) { - kvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 10000)); + kvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 10000))); } Assert.True(double.IsFinite(kvo.Signal.Value)); diff --git a/lib/volume/mfi/tests/Mfi.Tests.cs b/lib/volume/mfi/tests/Mfi.Tests.cs index fde5ebc5..c8ed4e81 100644 --- a/lib/volume/mfi/tests/Mfi.Tests.cs +++ b/lib/volume/mfi/tests/Mfi.Tests.cs @@ -69,7 +69,7 @@ public class MfiTests // Consistent uptrend should push MFI toward higher values for (int i = 0; i < 20; i++) { - double basePrice = 100 + i * 5; // Consistent price increase + double basePrice = 100 + (i * 5); // Consistent price increase mfi.Update(new TBar(time.AddMinutes(i), basePrice, basePrice + 2, basePrice - 1, basePrice + 1, 100000)); } @@ -86,7 +86,7 @@ public class MfiTests // Consistent downtrend should push MFI toward lower values for (int i = 0; i < 20; i++) { - double basePrice = 500 - i * 5; // Consistent price decrease + double basePrice = 500 - (i * 5); // Consistent price decrease mfi.Update(new TBar(time.AddMinutes(i), basePrice, basePrice + 1, basePrice - 2, basePrice - 1, 100000)); } diff --git a/lib/volume/nvi/tests/Nvi.Tests.cs b/lib/volume/nvi/tests/Nvi.Tests.cs index 1272e9f8..b852d854 100644 --- a/lib/volume/nvi/tests/Nvi.Tests.cs +++ b/lib/volume/nvi/tests/Nvi.Tests.cs @@ -224,7 +224,7 @@ public class NviTests // Process some valid bars first for (int i = 0; i < 10; i++) { - nvi.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 100000 - i * 1000)); + nvi.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 100000 - (i * 1000))); } // Process bar with NaN volume @@ -254,7 +254,7 @@ public class NviTests for (int i = 0; i < 10; i++) { - nvi.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 - i * 5000), isNew: true); + nvi.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 - (i * 5000)), isNew: true); } Assert.True(nvi.IsHot); diff --git a/lib/volume/pvd/tests/Pvd.Quantower.Tests.cs b/lib/volume/pvd/tests/Pvd.Quantower.Tests.cs index 217ce868..8bc911e6 100644 --- a/lib/volume/pvd/tests/Pvd.Quantower.Tests.cs +++ b/lib/volume/pvd/tests/Pvd.Quantower.Tests.cs @@ -74,7 +74,7 @@ public class PvdIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double close = 100 + i * 0.5; + double close = 100 + (i * 0.5); double volume = 100000 + (i % 3 == 0 ? 20000 : -10000); indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 1, close + 1, close - 2, close, volume); @@ -213,7 +213,7 @@ public class PvdIndicatorTests for (int i = 0; i < 20; i++) { double close = 100 + i; - indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 1, close + 2, close - 2, close, 100000 + i * 1000); + indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 1, close + 2, close - 2, close, 100000 + (i * 1000)); indicator.ProcessUpdate(new UpdateArgs(i == 0 ? UpdateReason.HistoricalBar : UpdateReason.NewBar)); } diff --git a/lib/volume/pvd/tests/Pvd.Tests.cs b/lib/volume/pvd/tests/Pvd.Tests.cs index 3dd3725e..65004441 100644 --- a/lib/volume/pvd/tests/Pvd.Tests.cs +++ b/lib/volume/pvd/tests/Pvd.Tests.cs @@ -285,7 +285,7 @@ public class PvdTests // Build up state for (int i = 0; i < 10; i++) { - pvd.Update(new TBar(time.AddMinutes(i), 100.0 + i, 100.0 + i, 100.0 + i, 100.0 + i, 1000.0 + i * 10), isNew: true); + pvd.Update(new TBar(time.AddMinutes(i), 100.0 + i, 100.0 + i, 100.0 + i, 100.0 + i, 1000.0 + (i * 10)), isNew: true); } _ = pvd.Last.Value; @@ -307,7 +307,7 @@ public class PvdTests // Build up state for (int i = 0; i < 10; i++) { - pvd.Update(new TBar(time.AddMinutes(i), 100.0 + i, 100.0 + i, 100.0 + i, 100.0 + i, 1000.0 + i * 10), isNew: true); + pvd.Update(new TBar(time.AddMinutes(i), 100.0 + i, 100.0 + i, 100.0 + i, 100.0 + i, 1000.0 + (i * 10)), isNew: true); } // Update with Infinity @@ -325,7 +325,7 @@ public class PvdTests // Build up state for (int i = 0; i < 10; i++) { - pvd.Update(new TBar(time.AddMinutes(i), 100.0 + i, 100.0 + i, 100.0 + i, 100.0 + i, 1000.0 + i * 10), isNew: true); + pvd.Update(new TBar(time.AddMinutes(i), 100.0 + i, 100.0 + i, 100.0 + i, 100.0 + i, 1000.0 + (i * 10)), isNew: true); } // Update with negative infinity @@ -470,8 +470,8 @@ public class PvdTests for (int i = 0; i < size; i++) { - closes[i] = 100.0 + i * 0.01; - volumes[i] = 1000000.0 + i * 100; + closes[i] = 100.0 + (i * 0.01); + volumes[i] = 1000000.0 + (i * 100); } // Should not stack overflow diff --git a/lib/volume/pvd/tests/Pvd.Validation.Tests.cs b/lib/volume/pvd/tests/Pvd.Validation.Tests.cs index 91bac401..97aef7d5 100644 --- a/lib/volume/pvd/tests/Pvd.Validation.Tests.cs +++ b/lib/volume/pvd/tests/Pvd.Validation.Tests.cs @@ -264,7 +264,7 @@ public class PvdValidationTests // Mix of zero and non-zero volumes for (int i = 0; i < 20; i++) { - double volume = i % 3 == 0 ? 0.0 : 1000.0 + i * 10; + double volume = i % 3 == 0 ? 0.0 : 1000.0 + (i * 10); bars.Add(new TBar(time.AddMinutes(i), 100.0 + i, 101.0 + i, 99.0 + i, 100.5 + i, volume)); } diff --git a/lib/volume/pvi/tests/Pvi.Tests.cs b/lib/volume/pvi/tests/Pvi.Tests.cs index 97ac7ff1..20538cb1 100644 --- a/lib/volume/pvi/tests/Pvi.Tests.cs +++ b/lib/volume/pvi/tests/Pvi.Tests.cs @@ -224,7 +224,7 @@ public class PviTests // Process some valid bars first for (int i = 0; i < 10; i++) { - pvi.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 100000 + i * 1000)); + pvi.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 100000 + (i * 1000))); } // Process bar with NaN volume @@ -254,7 +254,7 @@ public class PviTests for (int i = 0; i < 10; i++) { - pvi.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 5000), isNew: true); + pvi.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 5000)), isNew: true); } Assert.True(pvi.IsHot); diff --git a/lib/volume/pvo/tests/Pvo.Quantower.Tests.cs b/lib/volume/pvo/tests/Pvo.Quantower.Tests.cs index 91713c3c..eac40035 100644 --- a/lib/volume/pvo/tests/Pvo.Quantower.Tests.cs +++ b/lib/volume/pvo/tests/Pvo.Quantower.Tests.cs @@ -156,7 +156,7 @@ public class PvoIndicatorTests for (int i = 0; i < 15; i++) { // Start high and decrease - double volume = 10000 / (1.0 + i * 0.3); + double volume = 10000 / (1.0 + (i * 0.3)); indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 110, 90, 105, volume); indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar)); } diff --git a/lib/volume/pvo/tests/Pvo.Tests.cs b/lib/volume/pvo/tests/Pvo.Tests.cs index 0b2421b1..ff6f08be 100644 --- a/lib/volume/pvo/tests/Pvo.Tests.cs +++ b/lib/volume/pvo/tests/Pvo.Tests.cs @@ -86,7 +86,7 @@ public class PvoTests // Then increasing volume - fast EMA will be higher than slow for (int i = 50; i < 100; i++) { - pvo.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 100000 + (i - 50) * 50000)); + pvo.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 100000 + ((i - 50) * 50000))); } // Fast EMA responds quicker to volume increase, should be positive @@ -108,7 +108,7 @@ public class PvoTests // Then decreasing volume - fast EMA will be lower than slow for (int i = 50; i < 100; i++) { - pvo.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 1000000 - (i - 50) * 15000)); + pvo.Update(new TBar(time.AddMinutes(i), 100, 105, 95, 102, 1000000 - ((i - 50) * 15000))); } // Fast EMA responds quicker to volume decrease, should be negative @@ -156,7 +156,7 @@ public class PvoTests // Build up state for (int i = 0; i < 15; i++) { - pvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 10000), isNew: true); + pvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 10000)), isNew: true); } // New bar @@ -227,7 +227,7 @@ public class PvoTests for (int i = 0; i < 20; i++) { - pvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 10000)); + pvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 10000))); } Assert.True(double.IsFinite(pvo.Signal.Value)); @@ -242,7 +242,7 @@ public class PvoTests for (int i = 0; i < 20; i++) { - pvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 10000)); + pvo.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 10000))); } Assert.True(double.IsFinite(pvo.Histogram.Value)); diff --git a/lib/volume/pvr/tests/Pvr.Tests.cs b/lib/volume/pvr/tests/Pvr.Tests.cs index 4b567015..861707f2 100644 --- a/lib/volume/pvr/tests/Pvr.Tests.cs +++ b/lib/volume/pvr/tests/Pvr.Tests.cs @@ -132,7 +132,7 @@ public class PvrTests // Build up state for (int i = 0; i < 10; i++) { - pvr.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + i * 10000), isNew: true); + pvr.Update(new TBar(time.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i, 100000 + (i * 10000)), isNew: true); } // New bar diff --git a/lib/volume/pvt/tests/Pvt.Validation.Tests.cs b/lib/volume/pvt/tests/Pvt.Validation.Tests.cs index 071a3541..1b06856d 100644 --- a/lib/volume/pvt/tests/Pvt.Validation.Tests.cs +++ b/lib/volume/pvt/tests/Pvt.Validation.Tests.cs @@ -105,11 +105,11 @@ public class PvtValidationTests Assert.Equal(200.0, result1.Value, 1e-10); var result2 = pvt.Update(new TBar(time.AddMinutes(2), 110, 112, 103, 105, 1500)); - double expected2 = 200 + 1500 * (-5.0 / 110.0); // = 131.8181818... + double expected2 = 200 + (1500 * (-5.0 / 110.0)); // = 131.8181818... Assert.Equal(expected2, result2.Value, 1e-10); var result3 = pvt.Update(new TBar(time.AddMinutes(3), 105, 118, 105, 115, 2500)); - double expected3 = expected2 + 2500 * (10.0 / 105.0); // = 369.9134... + double expected3 = expected2 + (2500 * (10.0 / 105.0)); // = 369.9134... Assert.Equal(expected3, result3.Value, 1e-10); } } diff --git a/lib/volume/twap/tests/Twap.Quantower.Tests.cs b/lib/volume/twap/tests/Twap.Quantower.Tests.cs index 293b4bfb..cf9f47dc 100644 --- a/lib/volume/twap/tests/Twap.Quantower.Tests.cs +++ b/lib/volume/twap/tests/Twap.Quantower.Tests.cs @@ -61,7 +61,7 @@ public class TwapIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double close = 100 + i * 0.5; + double close = 100 + (i * 0.5); indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 2, close + 2, close - 3, close, 100000); // Process update for each bar to simulate history loading @@ -191,7 +191,7 @@ public class TwapIndicatorTests // Add 10 bars to both for (int i = 0; i < 10; i++) { - double close = 100 + i * 2; + double close = 100 + (i * 2); noReset.HistoricalData.AddBar(now.AddMinutes(i), close - 2, close + 2, close - 3, close, 10000); period5.HistoricalData.AddBar(now.AddMinutes(i), close - 2, close + 2, close - 3, close, 10000); diff --git a/lib/volume/va/tests/Va.Quantower.Tests.cs b/lib/volume/va/tests/Va.Quantower.Tests.cs index e590eeb7..969c8106 100644 --- a/lib/volume/va/tests/Va.Quantower.Tests.cs +++ b/lib/volume/va/tests/Va.Quantower.Tests.cs @@ -52,7 +52,7 @@ public class VaIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double close = 100 + i * 0.5; + double close = 100 + (i * 0.5); indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 2, close + 2, close - 3, close, 100000); var args = new UpdateArgs(UpdateReason.HistoricalBar); diff --git a/lib/volume/va/tests/Va.Validation.Tests.cs b/lib/volume/va/tests/Va.Validation.Tests.cs index 0d81a11a..22abdfe0 100644 --- a/lib/volume/va/tests/Va.Validation.Tests.cs +++ b/lib/volume/va/tests/Va.Validation.Tests.cs @@ -89,7 +89,7 @@ public class VaValidationTests // Bar 2: close below midpoint var bar2 = new TBar(DateTime.UtcNow.AddMinutes(1), 101, 101, 99, 98, 500); var r2 = va.Update(bar2, isNew: true); - double expectedVa2 = expectedVa1 + 500 * (98 - 100.0); // 2000 + (-1000) = 1000 + double expectedVa2 = expectedVa1 + (500 * (98 - 100.0)); // 2000 + (-1000) = 1000 Assert.Equal(expectedVa1, r1.Value, precision: 10); Assert.Equal(expectedVa2, r2.Value, precision: 10); diff --git a/lib/volume/vf/tests/Vf.Quantower.Tests.cs b/lib/volume/vf/tests/Vf.Quantower.Tests.cs index c299c4fa..662942a4 100644 --- a/lib/volume/vf/tests/Vf.Quantower.Tests.cs +++ b/lib/volume/vf/tests/Vf.Quantower.Tests.cs @@ -60,7 +60,7 @@ public class VfIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double close = 100 + i * 0.5; + double close = 100 + (i * 0.5); indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 2, close + 2, close - 3, close, 100000); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -284,7 +284,7 @@ public class VfIndicatorTests // Mix of up and down days for (int i = 0; i < 50; i++) { - double close = 100 + Math.Sin(i * 0.5) * 10; + double close = 100 + (Math.Sin(i * 0.5) * 10); indicator.HistoricalData.AddBar(now.AddMinutes(i), close - 2, close + 2, close - 3, close, 10000); var args = i == 0 diff --git a/lib/volume/vo/tests/Vo.Quantower.Tests.cs b/lib/volume/vo/tests/Vo.Quantower.Tests.cs index 0c716a27..6d506bcc 100644 --- a/lib/volume/vo/tests/Vo.Quantower.Tests.cs +++ b/lib/volume/vo/tests/Vo.Quantower.Tests.cs @@ -70,7 +70,7 @@ public class VoIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 30; i++) { - double volume = 100000 + i * 1000; + double volume = 100000 + (i * 1000); indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 110, 90, 105, volume); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -139,7 +139,7 @@ public class VoIndicatorTests // Volume increases over time - short MA will exceed long MA for (int i = 0; i < 20; i++) { - double volume = 10000 + i * 5000; // Increasing volume + double volume = 10000 + (i * 5000); // Increasing volume indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); var args = i == 0 @@ -163,7 +163,7 @@ public class VoIndicatorTests // Volume decreases over time - short MA will be below long MA for (int i = 0; i < 20; i++) { - double volume = 100000 - i * 4000; // Decreasing volume + double volume = 100000 - (i * 4000); // Decreasing volume volume = Math.Max(volume, 1000); // Keep positive indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); @@ -226,7 +226,7 @@ public class VoIndicatorTests // Add same data to both for (int i = 0; i < 50; i++) { - double volume = 50000 + Math.Sin(i * 0.3) * 20000; + double volume = 50000 + (Math.Sin(i * 0.3) * 20000); shortPeriods.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); longPeriods.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); @@ -286,7 +286,7 @@ public class VoIndicatorTests // Oscillating volume pattern for (int i = 0; i < 50; i++) { - double volume = 50000 + Math.Sin(i * 0.5) * 30000; + double volume = 50000 + (Math.Sin(i * 0.5) * 30000); indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); var args = i == 0 diff --git a/lib/volume/vo/tests/Vo.Tests.cs b/lib/volume/vo/tests/Vo.Tests.cs index 3e08a50a..80a5e809 100644 --- a/lib/volume/vo/tests/Vo.Tests.cs +++ b/lib/volume/vo/tests/Vo.Tests.cs @@ -198,7 +198,7 @@ public class VoTests // Add several bars for (int i = 0; i < 10; i++) { - var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 500 + i * 10); + var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 500 + (i * 10)); vo.Update(bar, isNew: true); } @@ -207,7 +207,7 @@ public class VoTests // Apply multiple corrections for (int j = 0; j < 5; j++) { - var correctionBar = new TBar(now.AddMinutes(9), 100, 100, 100, 100, 700 + j * 10); + var correctionBar = new TBar(now.AddMinutes(9), 100, 100, 100, 100, 700 + (j * 10)); vo.Update(correctionBar, isNew: false); } diff --git a/lib/volume/vo/tests/Vo.Validation.Tests.cs b/lib/volume/vo/tests/Vo.Validation.Tests.cs index 5f6e35e1..8053aa55 100644 --- a/lib/volume/vo/tests/Vo.Validation.Tests.cs +++ b/lib/volume/vo/tests/Vo.Validation.Tests.cs @@ -56,7 +56,7 @@ public class VoValidationTests // Feed bars with steadily increasing volume for (int i = 0; i < 50; i++) { - double volume = 1000 + i * 100; // increasing + double volume = 1000 + (i * 100); // increasing var bar = new TBar( DateTime.UtcNow.AddMinutes(i), 100, 101, 99, 100, volume); @@ -76,7 +76,7 @@ public class VoValidationTests // Feed bars with steadily decreasing volume for (int i = 0; i < 50; i++) { - double volume = 10000 - i * 100; // decreasing + double volume = 10000 - (i * 100); // decreasing var bar = new TBar( DateTime.UtcNow.AddMinutes(i), 100, 101, 99, 100, volume); diff --git a/lib/volume/vroc/tests/Vroc.Quantower.Tests.cs b/lib/volume/vroc/tests/Vroc.Quantower.Tests.cs index 0b6a692b..0a119f68 100644 --- a/lib/volume/vroc/tests/Vroc.Quantower.Tests.cs +++ b/lib/volume/vroc/tests/Vroc.Quantower.Tests.cs @@ -71,7 +71,7 @@ public class VrocIndicatorTests var now = DateTime.UtcNow; for (int i = 0; i < 20; i++) { - double volume = 100000 + i * 1000; + double volume = 100000 + (i * 1000); indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 110, 90, 105, volume); var args = new UpdateArgs(UpdateReason.HistoricalBar); @@ -217,7 +217,7 @@ public class VrocIndicatorTests // Increasing volumes for (int i = 0; i < 20; i++) { - double volume = 1000 + i * 100; + double volume = 1000 + (i * 100); indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); var args = i == 0 ? new UpdateArgs(UpdateReason.HistoricalBar) @@ -240,7 +240,7 @@ public class VrocIndicatorTests // Decreasing volumes for (int i = 0; i < 20; i++) { - double volume = 5000 - i * 100; + double volume = 5000 - (i * 100); indicator.HistoricalData.AddBar(now.AddMinutes(i), 100, 105, 95, 100, volume); var args = i == 0 ? new UpdateArgs(UpdateReason.HistoricalBar) diff --git a/lib/volume/vroc/tests/Vroc.Tests.cs b/lib/volume/vroc/tests/Vroc.Tests.cs index 4898f427..02929083 100644 --- a/lib/volume/vroc/tests/Vroc.Tests.cs +++ b/lib/volume/vroc/tests/Vroc.Tests.cs @@ -171,7 +171,7 @@ public class VrocTests // Increasing volumes for (int i = 0; i < 10; i++) { - var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 1000 + i * 100); + var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 1000 + (i * 100)); vroc.Update(bar, isNew: true); } @@ -187,7 +187,7 @@ public class VrocTests // Decreasing volumes for (int i = 0; i < 10; i++) { - var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 2000 - i * 100); + var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 2000 - (i * 100)); vroc.Update(bar, isNew: true); } @@ -257,7 +257,7 @@ public class VrocTests // Add several bars for (int i = 0; i < 10; i++) { - var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 1000 + i * 50); + var bar = new TBar(now.AddMinutes(i), 100, 100, 100, 100, 1000 + (i * 50)); vroc.Update(bar, isNew: true); } @@ -266,7 +266,7 @@ public class VrocTests // Apply multiple corrections for (int j = 0; j < 5; j++) { - var correctionBar = new TBar(now.AddMinutes(9), 100, 100, 100, 100, 2000 + j * 100); + var correctionBar = new TBar(now.AddMinutes(9), 100, 100, 100, 100, 2000 + (j * 100)); vroc.Update(correctionBar, isNew: false); } diff --git a/lib/volume/vroc/tests/Vroc.Validation.Tests.cs b/lib/volume/vroc/tests/Vroc.Validation.Tests.cs index e0adb925..4929c01c 100644 --- a/lib/volume/vroc/tests/Vroc.Validation.Tests.cs +++ b/lib/volume/vroc/tests/Vroc.Validation.Tests.cs @@ -101,7 +101,7 @@ public class VrocValidationTests { var bar = new TBar( DateTime.UtcNow.AddMinutes(i), - 100, 101, 99, 100, 1000 + i * 100); + 100, 101, 99, 100, 1000 + (i * 100)); var result = vroc.Update(bar, isNew: true); Assert.Equal(0.0, result.Value, precision: 10); } @@ -115,7 +115,7 @@ public class VrocValidationTests // Feed steadily increasing volume for (int i = 0; i < 50; i++) { - double volume = 1000 + i * 200; // increases by 200 each bar + double volume = 1000 + (i * 200); // increases by 200 each bar var bar = new TBar( DateTime.UtcNow.AddMinutes(i), 100, 101, 99, 100, volume); @@ -136,7 +136,7 @@ public class VrocValidationTests // Feed steadily decreasing volume for (int i = 0; i < 50; i++) { - double volume = 20000 - i * 200; // decreases by 200 each bar + double volume = 20000 - (i * 200); // decreases by 200 each bar var bar = new TBar( DateTime.UtcNow.AddMinutes(i), 100, 101, 99, 100, volume); diff --git a/lib/volume/vwad/tests/Vwad.Validation.Tests.cs b/lib/volume/vwad/tests/Vwad.Validation.Tests.cs index 49eeb330..738a0abe 100644 --- a/lib/volume/vwad/tests/Vwad.Validation.Tests.cs +++ b/lib/volume/vwad/tests/Vwad.Validation.Tests.cs @@ -137,7 +137,7 @@ public class VwadValidationTests // Bar 2: sumVol=450, volWeight=150/450=0.333, MFM=-0.333, weightedMfv=150*(-0.333)*0.333=-16.67 // cumVwad = 44.4 - 16.67 = 27.8 - double expectedBar2 = expectedBar1 + 150 * (-1.0 / 3.0) * (150.0 / 450.0); + double expectedBar2 = expectedBar1 + (150 * (-1.0 / 3.0) * (150.0 / 450.0)); Assert.Equal(expectedBar2, results[2], 6); } diff --git a/lib/volume/vwap/tests/Vwap.Validation.Tests.cs b/lib/volume/vwap/tests/Vwap.Validation.Tests.cs index b6875b9a..91122904 100644 --- a/lib/volume/vwap/tests/Vwap.Validation.Tests.cs +++ b/lib/volume/vwap/tests/Vwap.Validation.Tests.cs @@ -129,12 +129,12 @@ public class VwapValidationTests // Bar 1: VWAP = (11*100 + 13.667*200) / 300 = (1100 + 2733.33) / 300 = 12.778 double tp1 = (15.0 + 12.0 + 14.0) / 3.0; - double expectedBar1 = (tp0 * 100 + tp1 * 200) / 300.0; + double expectedBar1 = ((tp0 * 100) + (tp1 * 200)) / 300.0; Assert.Equal(expectedBar1, results[1], 6); // Bar 2: VWAP = (11*100 + 13.667*200 + 12.333*150) / 450 double tp2 = (14.0 + 11.0 + 12.0) / 3.0; - double expectedBar2 = (tp0 * 100 + tp1 * 200 + tp2 * 150) / 450.0; + double expectedBar2 = ((tp0 * 100) + (tp1 * 200) + (tp2 * 150)) / 450.0; Assert.Equal(expectedBar2, results[2], 6); } @@ -156,7 +156,7 @@ public class VwapValidationTests var result = vwap.Update(bars[1]); // VWAP = (10*1000 + 20*100) / 1100 = 12000/1100 = 10.909 - double expected = (10.0 * 1000.0 + 20.0 * 100.0) / 1100.0; + double expected = ((10.0 * 1000.0) + (20.0 * 100.0)) / 1100.0; Assert.Equal(expected, result.Value, 6); // VWAP should be much closer to 10 than to 20 @@ -218,7 +218,7 @@ public class VwapValidationTests for (int i = 0; i < 100; i++) { - var bar = new TBar(DateTime.UtcNow.AddMinutes(i), 50, 50, 50, 50, 1000 + i * 10); + var bar = new TBar(DateTime.UtcNow.AddMinutes(i), 50, 50, 50, 50, 1000 + (i * 10)); results.Add(vwap.Update(bar).Value); } diff --git a/lib/volume/vwma/tests/Vwma.Validation.Tests.cs b/lib/volume/vwma/tests/Vwma.Validation.Tests.cs index 13947235..233c7a7d 100644 --- a/lib/volume/vwma/tests/Vwma.Validation.Tests.cs +++ b/lib/volume/vwma/tests/Vwma.Validation.Tests.cs @@ -269,11 +269,11 @@ public class VwmaValidationTests Assert.Equal(10.0, results[0], 6); // Bar 1: VWMA = (10*100 + 20*200) / 300 = 5000/300 = 16.667 - double expectedBar1 = (10.0 * 100 + 20.0 * 200) / 300.0; + double expectedBar1 = ((10.0 * 100) + (20.0 * 200)) / 300.0; Assert.Equal(expectedBar1, results[1], 6); // Bar 2: VWMA = (10*100 + 20*200 + 30*150) / 450 = 9500/450 = 21.111 - double expectedBar2 = (10.0 * 100 + 20.0 * 200 + 30.0 * 150) / 450.0; + double expectedBar2 = ((10.0 * 100) + (20.0 * 200) + (30.0 * 150)) / 450.0; Assert.Equal(expectedBar2, results[2], 6); } @@ -309,7 +309,7 @@ public class VwmaValidationTests var result = vwma.Update(new TBar(DateTime.UtcNow.AddMinutes(1), 20, 20, 20, 20, 100)); // VWMA = (10*1000 + 20*100) / 1100 = 12000/1100 = 10.909 - double expected = (10.0 * 1000.0 + 20.0 * 100.0) / 1100.0; + double expected = ((10.0 * 1000.0) + (20.0 * 100.0)) / 1100.0; Assert.Equal(expected, result.Value, 6); // VWMA should be much closer to 10 than to 20 @@ -351,7 +351,7 @@ public class VwmaValidationTests for (int i = 0; i < 100; i++) { - var bar = new TBar(DateTime.UtcNow.AddMinutes(i), 50, 50, 50, 50, 1000 + i * 10); + var bar = new TBar(DateTime.UtcNow.AddMinutes(i), 50, 50, 50, 50, 1000 + (i * 10)); results.Add(vwma.Update(bar).Value); }