From b2841d7f2b8df4e92a3e9a8bce1e141ec2d0d52b Mon Sep 17 00:00:00 2001 From: Sean Date: Tue, 7 Apr 2026 20:43:13 -0400 Subject: [PATCH] Daily + Make UpdatePricesSweepOpenPositions wait 5 minutes before sweeping. --- MarketData/MarketData/Models/CMT20200817.TXT | 8 ++++---- MarketData/MarketData/Models/MGSH20250331.TXT | 18 +++++++++--------- MarketData/MarketData/Services/MainService.cs | 5 +++++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/MarketData/MarketData/Models/CMT20200817.TXT b/MarketData/MarketData/Models/CMT20200817.TXT index cb9b446..2b092a5 100755 --- a/MarketData/MarketData/Models/CMT20200817.TXT +++ b/MarketData/MarketData/Models/CMT20200817.TXT @@ -1,11 +1,11 @@ CMTSESSIONv1.00 -LastUpdated=4/6/2026 8:41:36 PM -TradeDate=4/6/2026 +LastUpdated=4/7/2026 8:40:10 PM +TradeDate=4/7/2026 StartDate=1/1/0001 -AnalysisDate=4/6/2026 +AnalysisDate=4/7/2026 CashBalance=9449.67 NonTradeableCash=6456.42 -SuspendTrading=False|UsePriceSlopeIndicator=True|UsePriceSlopeIndicatorDays=252|AnalysisDate=4/6/2026|BetaMonths=6|TradeDate=4/6/2026|MarketCapLowerLimit=500000000|SidewaysDetection=False|SidewaysAfterDays=30|PriceTrendDays=20|CheckOutliersInReturnStream=True|DailyReturnLimit=0.25|MaxDailyPositions=3|MaxOpenPositions=3|NoTradeSymbols=CODYY,MARUY,CSTM,CS,NATI,QADA,CRTO,GTBIF,CLCT,PRSC,CMD,STAY,GBTC,YOKU,PNY,RFMD,ASAZY,USMO,VNR,STB,XIV,SYNT,DFP|OnlyTradeSymbols=|MinRSI=70|InitialCash=10000|TotalRiskPercentDecimal=0.05|PositionRiskPercentDecimal=0.12|EquityOnly=False|MinPercentReturnProximityTo52WeekHigh=30|MinPercentReturnOver52WeekLow=80|ProfitMarginCheck=True|EPSCheck=True|MinDaysBetweenReholding=30|LiquidityCheck=True|MinVolume=1000|DMA200Horizon=15|MinDaysBetweenStopAdjustments=30|MinDaysBetweenInitialStopAdjustment=5|MaxPricingExceptions=3|MACDSetup=(12,26,9)|MACDSignalDays=5|MACDRejectStrongSells=True|MACDRejectWeakSells=True|UseMarketIndicator=True|Benchmark=SPY|BenchmarkMovingAverageDays=200|BenchmarkMovingAverageHorizon=5|UseMarketIndicatorVolatility=True|UseMarketIndicatorVolatilityHorizon=60|UseMarketIndicatorVolatilityBenchmark=^VIX|UseStopLimitScaling=True|StopLimitScalingType=AverageTrueRange|StopLimitScalingVolatilityDays=30|SellOnDMABreak=True|DMABreakValues=200|DMABreakForceBreak=False|EntryType=OverExtended,MVP,PriceTrend,VolumeTrend|EntryHorizon=30|CandidateExpiryDays=180|VolumeTrendDays=10|ChannelBreakoutHorizon=40|UseOverExtendedIndicatorDays=45|UseOverExtendedIndicatorViolationThreshhold=1|UseOverExtendedIndicatorMarginPercent=1|MaxBeta=10|UseMaxBeta=False|UseProfitMaximization=True|UseProfitMaximizationExpression=R_THRESSHOLD=4;MAX_ATR=3;MULTIPLIER=MAX_ATR;IF(RMultiple>=R_THRESSHOLD){MULTIPLIER=1.2;}|UseTradeOnlySectors=False|UseTradeOnlySectorsSectors=Healthcare,Technology,Basic Materials,Consumer Defensive,Industrials|EvaluateStopOnUpTrend=False +SuspendTrading=False|UsePriceSlopeIndicator=True|UsePriceSlopeIndicatorDays=252|AnalysisDate=4/7/2026|BetaMonths=6|TradeDate=4/7/2026|MarketCapLowerLimit=500000000|SidewaysDetection=False|SidewaysAfterDays=30|PriceTrendDays=20|CheckOutliersInReturnStream=True|DailyReturnLimit=0.25|MaxDailyPositions=3|MaxOpenPositions=3|NoTradeSymbols=CODYY,MARUY,CSTM,CS,NATI,QADA,CRTO,GTBIF,CLCT,PRSC,CMD,STAY,GBTC,YOKU,PNY,RFMD,ASAZY,USMO,VNR,STB,XIV,SYNT,DFP|OnlyTradeSymbols=|MinRSI=70|InitialCash=10000|TotalRiskPercentDecimal=0.05|PositionRiskPercentDecimal=0.12|EquityOnly=False|MinPercentReturnProximityTo52WeekHigh=30|MinPercentReturnOver52WeekLow=80|ProfitMarginCheck=True|EPSCheck=True|MinDaysBetweenReholding=30|LiquidityCheck=True|MinVolume=1000|DMA200Horizon=15|MinDaysBetweenStopAdjustments=30|MinDaysBetweenInitialStopAdjustment=5|MaxPricingExceptions=3|MACDSetup=(12,26,9)|MACDSignalDays=5|MACDRejectStrongSells=True|MACDRejectWeakSells=True|UseMarketIndicator=True|Benchmark=SPY|BenchmarkMovingAverageDays=200|BenchmarkMovingAverageHorizon=5|UseMarketIndicatorVolatility=True|UseMarketIndicatorVolatilityHorizon=60|UseMarketIndicatorVolatilityBenchmark=^VIX|UseStopLimitScaling=True|StopLimitScalingType=AverageTrueRange|StopLimitScalingVolatilityDays=30|SellOnDMABreak=True|DMABreakValues=200|DMABreakForceBreak=False|EntryType=OverExtended,MVP,PriceTrend,VolumeTrend|EntryHorizon=30|CandidateExpiryDays=180|VolumeTrendDays=10|ChannelBreakoutHorizon=40|UseOverExtendedIndicatorDays=45|UseOverExtendedIndicatorViolationThreshhold=1|UseOverExtendedIndicatorMarginPercent=1|MaxBeta=10|UseMaxBeta=False|UseProfitMaximization=True|UseProfitMaximizationExpression=R_THRESSHOLD=4;MAX_ATR=3;MULTIPLIER=MAX_ATR;IF(RMultiple>=R_THRESSHOLD){MULTIPLIER=1.2;}|UseTradeOnlySectors=False|UseTradeOnlySectorsSectors=Healthcare,Technology,Basic Materials,Consumer Defensive,Industrials|EvaluateStopOnUpTrend=False PricingExceptions=0 TotalActivePositions=0 TotalPositions=135 diff --git a/MarketData/MarketData/Models/MGSH20250331.TXT b/MarketData/MarketData/Models/MGSH20250331.TXT index 59e6a4d..d2cf264 100644 --- a/MarketData/MarketData/Models/MGSH20250331.TXT +++ b/MarketData/MarketData/Models/MGSH20250331.TXT @@ -1,20 +1,20 @@ MGSHSESSIONv2.00 -LastUpdated=4/6/2026 8:40:42 PM -TradeDate=4/7/2026 +LastUpdated=4/7/2026 8:00:15 PM +TradeDate=4/8/2026 StartDate=3/31/2025 -AnalysisDate=4/6/2026 +AnalysisDate=4/7/2026 Cycle=13 CashBalance=1883.4900000000005 NonTradeableCash=0 HedgeCashBalance=3000 Verbose=True|KeepSlotPositions=True|BenchmarkMode=False|BenchmarkModeSymbol=SPY|HoldingPeriod=3|MaxPositions=3|NoTradeSymbols=OSB,IBDRY,GBTC,YOKU,PNY,RFMD,ASAZY|NoTradeFinancialSymbols=U.S. Private Equity,U.S. Financials,U.S. Financial Services,U.S. Banking and Investment Services,Trading-Miscellaneous,Trading--Miscellaneous,Trading--Leveraged Equity,Trading--Leveraged Debt,Trading--Leveraged Commodities,Trading--Inverse Equity,Trading--Inverse Commodities,Tactical Allocation,Specialty Finance,Japan Financials,Savings & Cooperative Banks,Option Writing,Insurance Brokers,Insurance - Specialty,Insurance - Reinsurance,Insurance - Property & Casualty,Insurance - Life,Insurance - Diversified,Global Private Equity,Global Financials,Financial Services,Financial Exchanges,Financial,China Financials,Banks - Regional - US,Banks - Regional - Latin America,Banks - Global,Asset Management,Credit Services|Benchmark=SPY|MarketCapLowerLimit=1000000000|UsePEScreen=False|UseEBITDAScreen=True|UseRevenuePerShareScreen=True|UseLowSlopeBetaCheck=True|LowSlopeBetaDays=15|LowSlopeBetaThreshhold=1|UseMACD=True|MACDSetup=(12,26,9)|MACDSignalDays=12|MACDRejectStrongSellSignals=False|MACDRejectWeakSellSignals=True|UseStochastics=True|StochasticsSignalDays=3|StochasticsRejectStrongSells=True|StochasticsRejectWeakSells=True|UseFallbackCandidate=True|FallbackCandidate=SHV|FallbackCandidateBestOf=SHV,NEAR,BIL,GSY,AGG,ACWX,GSY,SCHF,IXUS,DBEF,IEFA,TLT|UseMaxPEScreen=True|MaxPE=40|StrictMaxPE=False|QualityIndicatorType=IDINDICATOR|IncludeTradeMasterForSymbolsHeld=True|UseStopLimits=True|StopLimitRiskPercentDecimal=0.2|StopLimitScalingVolatilityDays=30|MinDaysBetweenInitialStopAdjustment=30|MinDaysBetweenStopAdjustments=30|StopLimitPriceTrendDays=20|StopLimitATRMultiplier=3|UseHedging=True|HedgeBenchmarkSymbol=SPY|HedgeShortSymbol=SH|HedgeRiskPercentDecimal=0.12|HedgeMinDaysBetweenStopAdjustments=1|HedgeInitialCash=3000|HedgeCloseAboveSMANDays=10|HedgeBandBreakCheckDays=3|HedgeATRMultiplier=1|MaxPricingExceptions=3|UseBetaGenerator=True|UseBetaGeneratorMonths=24 TotalActivePositions=6 -Slot=1|Symbol=MDT|PurchaseDate=1/30/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=14|PurchasePrice=102.85|CurrentPrice=86.28|Volume=6046285|Return1D=0|CumReturn252=0|IDIndicator=-10.35856573705179|Score=0.518428403011861|Velocity=0.8652931854199681|PE=26.67|Beta=0.37428296833055014|InitialStopLimit=82.28|TrailingStopLimit=82.28|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=20.592|Comment=Price changed on 2/2/2026 from $102.96 to $102.85 -Slot=2|Symbol=NFG|PurchaseDate=11/28/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=12|PurchasePrice=82.45|CurrentPrice=94.4|Volume=236813|Return1D=0|CumReturn252=0|IDIndicator=-9.561752988047807|Score=1.4787437525170677|Velocity=0.6585998271391531|PE=31.63|Beta=0.04430253825297578|InitialStopLimit=65.96000000000001|TrailingStopLimit=86.54649946212768|LastStopAdjustment=4/1/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.490000000000002|Comment= -Slot=2|Symbol=NWN|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=18|PurchasePrice=53|CurrentPrice=54.55|Volume=468654|Return1D=0|CumReturn252=0|IDIndicator=-17.13147410358566|Score=0.6615960312468072|Velocity=1.0000000000000002|PE=20.04|Beta=-0.020855636842840336|InitialStopLimit=42.4|TrailingStopLimit=50.08750000953674|LastStopAdjustment=4/2/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=10.608|Comment=Price changed on 3/2/2026 from $53.04 to $53.00 -Slot=2|Symbol=ALLE|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=6|PurchasePrice=160.87|CurrentPrice=140.18|Volume=483322|Return1D=0|CumReturn252=0|IDIndicator=-7.5697211155378525|Score=1.0921592452357611|Velocity=0.6599496221662469|PE=24.3|Beta=0.32621889255450337|InitialStopLimit=128.7|TrailingStopLimit=128.7|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=32.230000000000004|Comment=Price changed on 3/2/2026 from $161.15 to $160.87 -Slot=0|Symbol=NYT|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=21|PurchasePrice=83.55|CurrentPrice=85.14|Volume=1771479|Return1D=0|CumReturn252=0|IDIndicator=-13.545816733067738|Score=1.1825972924224726|Velocity=0.9759277833500504|PE=37.88|Beta=0.26107650690592754|InitialStopLimit=66.84|TrailingStopLimit=66.84|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.746000000000002|Comment=Price changed on 4/1/2026 from $83.73 to $83.55 -Slot=0|Symbol=PTGX|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=16|PurchasePrice=105.51|CurrentPrice=102.89|Volume=781528|Return1D=0|CumReturn252=0|IDIndicator=-6.374501992031874|Score=2.1434347022647025|Velocity=0.9681908548707753|PE=128.65|Beta=0.6968595191825934|InitialStopLimit=84.41|TrailingStopLimit=84.41|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=21.080000000000002|Comment=Price changed on 4/1/2026 from $105.40 to $105.51 +Slot=1|Symbol=MDT|PurchaseDate=1/30/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=14|PurchasePrice=102.85|CurrentPrice=86.42|Volume=6046285|Return1D=0|CumReturn252=0|IDIndicator=-10.35856573705179|Score=0.518428403011861|Velocity=0.8652931854199681|PE=26.67|Beta=0.37428296833055014|InitialStopLimit=82.28|TrailingStopLimit=82.28|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=20.592|Comment=Price changed on 2/2/2026 from $102.96 to $102.85 +Slot=2|Symbol=NFG|PurchaseDate=11/28/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=12|PurchasePrice=82.45|CurrentPrice=95.98|Volume=236813|Return1D=0|CumReturn252=0|IDIndicator=-9.561752988047807|Score=1.4787437525170677|Velocity=0.6585998271391531|PE=31.63|Beta=0.04430253825297578|InitialStopLimit=65.96000000000001|TrailingStopLimit=86.54649946212768|LastStopAdjustment=4/1/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.490000000000002|Comment= +Slot=2|Symbol=NWN|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=18|PurchasePrice=53|CurrentPrice=55.04|Volume=468654|Return1D=0|CumReturn252=0|IDIndicator=-17.13147410358566|Score=0.6615960312468072|Velocity=1.0000000000000002|PE=20.04|Beta=-0.020855636842840336|InitialStopLimit=42.4|TrailingStopLimit=50.08750000953674|LastStopAdjustment=4/2/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=10.608|Comment=Price changed on 3/2/2026 from $53.04 to $53.00 +Slot=2|Symbol=ALLE|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=6|PurchasePrice=160.87|CurrentPrice=139.4|Volume=483322|Return1D=0|CumReturn252=0|IDIndicator=-7.5697211155378525|Score=1.0921592452357611|Velocity=0.6599496221662469|PE=24.3|Beta=0.32621889255450337|InitialStopLimit=128.7|TrailingStopLimit=128.7|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=32.230000000000004|Comment=Price changed on 3/2/2026 from $161.15 to $160.87 +Slot=0|Symbol=NYT|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=21|PurchasePrice=83.55|CurrentPrice=85.86|Volume=1771479|Return1D=0|CumReturn252=0|IDIndicator=-13.545816733067738|Score=1.1825972924224726|Velocity=0.9759277833500504|PE=37.88|Beta=0.26107650690592754|InitialStopLimit=66.84|TrailingStopLimit=66.84|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.746000000000002|Comment=Price changed on 4/1/2026 from $83.73 to $83.55 +Slot=0|Symbol=PTGX|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=16|PurchasePrice=105.51|CurrentPrice=103.75|Volume=781528|Return1D=0|CumReturn252=0|IDIndicator=-6.374501992031874|Score=2.1434347022647025|Velocity=0.9681908548707753|PE=128.65|Beta=0.6968595191825934|InitialStopLimit=84.41|TrailingStopLimit=84.41|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=21.080000000000002|Comment=Price changed on 4/1/2026 from $105.40 to $105.51 TotalPositions=22 Symbol=MO|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=5/14/2025 12:00:00 AM|Shares=18|PurchasePrice=59.91|CurrentPrice=56.15|Volume=17335180|Return1D=0|CumReturn252=0|IDIndicator=-15.9362549800797|Score=1.14749269300042|Velocity=0.967136150234742|PE=9|Beta=0.572465642401382|InitialStopLimit=47.93|TrailingStopLimit=56.15650033473968|LastStopAdjustment=5/7/2025 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=12.004|Comment=Closed due to trailing stop. Symbol=EXC|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=5/14/2025 12:00:00 AM|Shares=24|PurchasePrice=45.76|CurrentPrice=42.6|Volume=14993121|Return1D=0|CumReturn252=0|IDIndicator=-8.76494023904382|Score=0.405636492837393|Velocity=1|PE=18.02|Beta=0.248374476251328|InitialStopLimit=36.61|TrailingStopLimit=42.7107857322693|LastStopAdjustment=4/30/2025 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=9.216|Comment=Closed due to trailing stop. diff --git a/MarketData/MarketData/Services/MainService.cs b/MarketData/MarketData/Services/MainService.cs index 87d7cf5..0688eb3 100755 --- a/MarketData/MarketData/Services/MainService.cs +++ b/MarketData/MarketData/Services/MainService.cs @@ -840,10 +840,13 @@ namespace MarketData.Services /// /// This method will be called by UPDATEDAILY2 as a final step to ensure that we have pricing for open positions on the current date. /// If we do not then it will attempt to get prices from BarChart. + /// The method will sleep for waitTimeoutMins before executing /// /// public static void UpdatePricesSweepOpenPositions(DateTime startDate) { + int waitTimeoutMins=5; + int waitTimeMs=1000*60*waitTimeoutMins; try { List fetchSymbolList = new List(); @@ -857,6 +860,8 @@ namespace MarketData.Services } } if(0==fetchSymbolList.Count)return; + MDTrace.WriteLine(LogLevel.DEBUG,$"[UpdatePricesSweepOpenPositions] Waiting: {waitTimeoutMins} minutes before executing sweep for {fetchSymbolList.Count} symbol(s)"); + try{Thread.Sleep(waitTimeMs);}catch(Exception){;} // wait the specified number of minutes before proceeding PricingMarketDataHelper pricingMarketDataHelper = new PricingMarketDataHelper(); pricingMarketDataHelper.UpdatePricesBarChartSweepOpenPositions(fetchSymbolList, startDate); }