Add framework for BollingerBandView

This commit is contained in:
2025-06-13 16:54:40 -04:00
parent b337170c39
commit 9d7a18df54
13 changed files with 916 additions and 67 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Runtime.CompilerServices;
using System.Text;
using Avalonia.Threading;
using MarketData.Cache;
@@ -94,6 +95,7 @@ namespace PortfolioManager.ViewModels
{
return new List<CommandViewModel>()
{
new CommandViewModel("Bollinger Bands", new MyRelayCommand(ParamArrayAttribute => this.ViewBollingerBands())),
new CommandViewModel("Gain/Loss", new MyRelayCommand(ParamArrayAttribute => this.ViewGainLoss())),
new CommandViewModel("Momentum Model", new MyRelayCommand(ParamArrayAttribute => this.ViewMomentum())),
new CommandViewModel("MGSHMomentum Model", new MyRelayCommand(ParamArrayAttribute => this.ViewMGSHMomentum())),
@@ -101,18 +103,34 @@ namespace PortfolioManager.ViewModels
new CommandViewModel("CMTrend Model", new MyRelayCommand(ParamArrayAttribute => this.ViewCMTrend()))
};
}
private void ViewCMTrend()
private void ViewBollingerBands()
{
CMTrendViewModel workspace = null;
BollingerBandViewModel workspace = null;
if (null == workspace)
{
workspace = new CMTrendViewModel();
workspace = new BollingerBandViewModel();
workspace.WorkspaceInstantiator = InstantiateWorkspace;
workspace.Referer = GetReferal();
// AddMenuItem(workspace);
this.Workspaces.Add(workspace);
this.Workspaces.Add(workspace);
}
this.SetActiveWorkspace(workspace);
}
private void ViewCMTrend()
{
CMTrendViewModel workspace = null;
if (null == workspace)
{
workspace = new CMTrendViewModel();
workspace.WorkspaceInstantiator = InstantiateWorkspace;
workspace.Referer = GetReferal();
// AddMenuItem(workspace);
this.Workspaces.Add(workspace);
}
this.SetActiveWorkspace(workspace);
}
private void ViewGainLoss()
{
@@ -121,8 +139,9 @@ namespace PortfolioManager.ViewModels
{
workspace = new GainLossViewModel();
workspace.WorkspaceInstantiator = InstantiateWorkspace;
workspace.Referer = GetReferal();
// AddMenuItem(workspace);
this.Workspaces.Add(workspace);
this.Workspaces.Add(workspace);
}
this.SetActiveWorkspace(workspace);
}
@@ -134,6 +153,7 @@ namespace PortfolioManager.ViewModels
{
workspace = new MGSHMomentumViewModel();
workspace.WorkspaceInstantiator = InstantiateWorkspace;
workspace.Referer = GetReferal();
// AddMenuItem(workspace);
this.Workspaces.Add(workspace);
}
@@ -147,8 +167,9 @@ namespace PortfolioManager.ViewModels
{
workspace = new MomentumViewModel();
workspace.WorkspaceInstantiator = InstantiateWorkspace;
workspace.Referer = GetReferal();
// AddMenuItem(workspace);
this.Workspaces.Add(workspace);
this.Workspaces.Add(workspace);
}
this.SetActiveWorkspace(workspace);
}
@@ -160,9 +181,11 @@ namespace PortfolioManager.ViewModels
{
workspace = new CMMomentumViewModel();
workspace.WorkspaceInstantiator = InstantiateWorkspace;
workspace.Referer = GetReferal();
// AddMenuItem(workspace);
this.Workspaces.Add(workspace);
this.Workspaces.Add(workspace);
}
this.SetActiveWorkspace(workspace);
}
@@ -220,20 +243,26 @@ namespace PortfolioManager.ViewModels
SelectedIndex = itemIndex;
}
private WorkspaceViewModel GetReferal()
{
if (null == workspaces || 0 == workspaces.Count) return null;
return workspaces[workspaces.Count-1];
}
public int SelectedIndex
{
get
{
get
{
return selectedIndex;
}
set
{
selectedIndex = value;
TabIndexArgs args = new TabIndexArgs() { Index = selectedIndex };
OnIndexChangeEventHandler.Invoke(this, args);
base.OnPropertyChanged("SelectedIndex");
}
return selectedIndex;
}
set
{
selectedIndex = value;
TabIndexArgs args = new TabIndexArgs() { Index = selectedIndex };
OnIndexChangeEventHandler.Invoke(this, args);
base.OnPropertyChanged("SelectedIndex");
}
}
public void InstantiateWorkspace(SaveParameters saveParameters)
{