From 230d84904a4293905c0a3a737f45dc1cd8c6bb6e Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 10 Feb 2025 08:02:49 -0500 Subject: [PATCH] Changes to support MGSHMomentumView --- MainWindowResources.xaml | 4 + Model/MGSHPositionModel.cs | 34 ++- TradeBlotter.csproj | 23 +- UIUtils/CMTTrendModelEditPositionDialog.xaml | 66 ---- .../CMTTrendModelEditPositionDialog.xaml.cs | 228 -------------- Utility/UIUtils.cs | 13 +- ViewModels/BollingerBandViewModel.cs | 13 +- ViewModels/CMTTrendViewModel.cs | 88 ++++-- ViewModels/MGSHMomentumViewModel.cs | 287 ++++++++++++------ Views/MGSHMomentumView.xaml | 4 +- 10 files changed, 324 insertions(+), 436 deletions(-) delete mode 100644 UIUtils/CMTTrendModelEditPositionDialog.xaml delete mode 100644 UIUtils/CMTTrendModelEditPositionDialog.xaml.cs diff --git a/MainWindowResources.xaml b/MainWindowResources.xaml index 7b053d9..66cb65c 100644 --- a/MainWindowResources.xaml +++ b/MainWindowResources.xaml @@ -84,6 +84,10 @@ This resource dictionary is used by the MainWindow. + + + + diff --git a/Model/MGSHPositionModel.cs b/Model/MGSHPositionModel.cs index 5072ff1..b5df854 100644 --- a/Model/MGSHPositionModel.cs +++ b/Model/MGSHPositionModel.cs @@ -16,6 +16,7 @@ using MarketData.Generator.Momentum; using MarketData.DataAccess; using System.CodeDom; using MarketData.Generator.MGSHMomentum; +using TradeBlotter.Interface; namespace TradeBlotter.Model { @@ -47,7 +48,7 @@ namespace TradeBlotter.Model base.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset,null)); } } - public class MGSHPositionModel : ModelBase + public class MGSHPositionModel : ModelBase, IPositionModel { private MGSHPosition position = new MGSHPosition(); private int slot; @@ -111,6 +112,37 @@ namespace TradeBlotter.Model Comment=position.Comment; } + public MGSHPosition Position + { + get{return position;} + set + { + Slot=-1; + Symbol=position.Symbol; + PurchaseDate=position.PurchaseDate; + SellDate=position.SellDate; + Shares=position.Shares; + PurchasePrice=position.PurchasePrice; + CurrentPrice=position.CurrentPrice; + Volume=position.Volume; + Return1D=position.Return1D; + CumReturn252=position.CumReturn252; + IDIndicator=position.IDIndicator; + Score=position.Score; + MaxDrawdown=position.MaxDrawdown; + MaxUpside=position.MaxUpside; + Velocity=position.Velocity; + PE=position.PE; + Beta=position.Beta; + ZacksRank=position.ZacksRank; + InitialStopLimit=position.InitialStopLimit; + TrailingStopLimit=position.TrailingStopLimit; + LastStopAdjustment=position.LastStopAdjustment; + Comment=position.Comment; + this.position.R=position.R; + } + } + private void UpdateProperties() { base.OnPropertyChanged("CurrentPrice"); diff --git a/TradeBlotter.csproj b/TradeBlotter.csproj index 9bb66d6..c73565c 100644 --- a/TradeBlotter.csproj +++ b/TradeBlotter.csproj @@ -110,10 +110,13 @@ + + FloatingWindow.xaml + @@ -142,8 +145,8 @@ CMTTrendModelClosePositionDialog.xaml - - CMTTrendModelEditPositionDialog.xaml + + EditPositionDialog.xaml ProformaAddPositionDialog.xaml @@ -154,6 +157,8 @@ + + @@ -181,7 +186,6 @@ - @@ -213,6 +217,9 @@ BlotterView.xaml + + BollingerBandPositionView.xaml + BollingerBandView.xaml @@ -340,7 +347,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile @@ -360,9 +367,13 @@ Designer MSBuild:Compile - - Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer Designer diff --git a/UIUtils/CMTTrendModelEditPositionDialog.xaml b/UIUtils/CMTTrendModelEditPositionDialog.xaml deleted file mode 100644 index 61dca4a..0000000 --- a/UIUtils/CMTTrendModelEditPositionDialog.xaml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Symbol - - - - - - - - - - 100.00 - Sync Trailing Stop - - - - - 100.00 - - -