diff --git a/MarketData/MarketData/Models/runbacktest.sh b/MarketData/MarketData/Models/runbacktest.sh new file mode 100755 index 0000000..356075f --- /dev/null +++ b/MarketData/MarketData/Models/runbacktest.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# RUN THE BASLINE AND THEN SUBSTITUTE BETACALC36 FOR BETA IN THE MG MODEL AND RERUN THE TEST AND THEN COMPARE THE RESULTS + +export DOTNET_ROOT=/opt/dotnet +RUNDATE="$1" +#PATHMODEL="/home/pi/ARM64/MarketData/MarketData/Models/MGBACKTEST_BETA.TXT" +PATHMODEL="/home/pi/ARM64/MarketData/MarketData/Models/MGBACKTEST_BETA_CALC36.TXT" +/home/pi/ARM64/MarketData/MarketData/bin/Debug/net8.0/mk RUNBACKTEST /USELOWSLOPEBETACHECK:FALSE /STARTDATE:12/31/2018 /ENDDATE:03/31/2025 /INITIALCASH:10000 /MAXPOSITIONS:3 /HOLDINGPERIOD:3 /SESSIONFILE:$PATHMODEL /QUALITYINDICATORTYPE:SCOREINDICATOR diff --git a/MarketData/MarketDataLib/Generator/Momentum/MomentumGenerator.cs b/MarketData/MarketDataLib/Generator/Momentum/MomentumGenerator.cs index c3fc548..c7a1617 100755 --- a/MarketData/MarketDataLib/Generator/Momentum/MomentumGenerator.cs +++ b/MarketData/MarketDataLib/Generator/Momentum/MomentumGenerator.cs @@ -208,7 +208,9 @@ namespace MarketData.Generator.Momentum // Get the benchmark pricing low pricing data and check the slope of previous lows; only if Beta of candidate is >= LowSlopeBetaThreshhold // The idea behind this check is that a high beta stock will track to the benchmark. So if the benchmark lows are forming a downward pattern then we // assume that this is a somewhat bearish condition. The config has the setting at a 15 day check and the threshold beta set to 1.00 - if(config.UseLowSlopeBetaCheck && fundamental.Beta>=config.LowSlopeBetaThreshhold) +// The BetaCalc36 is calculated as part of the monthly fundamental run. + double beta = fundamental.BetaCalc36; + if(config.UseLowSlopeBetaCheck && beta >= config.LowSlopeBetaThreshhold) { Prices benchmarkPrices=GBPriceCache.GetInstance().GetPrices(config.Benchmark,tradeDate,config.LowSlopeBetaDays); pricesArray=Numerics.ToDouble(benchmarkPrices.GetPricesLow()); @@ -324,7 +326,7 @@ namespace MarketData.Generator.Momentum highPECandidate.MaxDrawdown=prices.MaxDrawdown(); highPECandidate.MaxUpside=prices.MaxUpside(); highPECandidate.PE=fundamental.PE; - highPECandidate.Beta=fundamental.Beta; + highPECandidate.Beta=beta; highPECandidate.Velocity=velocity; highPECandidate.Volume=price.Volume; highPECandidate.Return1D=return1D; @@ -344,7 +346,7 @@ namespace MarketData.Generator.Momentum momentumCandidate.MaxDrawdown=prices.MaxDrawdown(); momentumCandidate.MaxUpside=prices.MaxUpside(); momentumCandidate.PE=fundamental.PE; - momentumCandidate.Beta=fundamental.Beta; + momentumCandidate.Beta=beta; momentumCandidate.Velocity=velocity; momentumCandidate.Volume=price.Volume; momentumCandidate.Return1D=return1D;