More changes for BollingerBands.

This commit is contained in:
2025-06-16 19:59:04 -04:00
parent a46d507c7a
commit e8d3f68b3d
11 changed files with 117 additions and 77 deletions

View File

@@ -112,6 +112,7 @@ namespace PortfolioManager.ViewModels
get
{
ObservableCollection<MenuItem> collection = new ObservableCollection<MenuItem>();
collection.Add(new MenuItem() { Header = "Bollinger Bands...", Command = BollingerBandsCommand, StaysOpenOnClick = false });
collection.Add(new MenuItem() { Header = "Close Position...", Command = CloseCommand, StaysOpenOnClick = false });
collection.Add(new MenuItem() { Header = "Edit Position...", Command = EditCommand, StaysOpenOnClick = false });
collection.Add(new MenuItem() { Header = "Add To WatchList", Command = AddToWatchListCommand, StaysOpenOnClick = false });
@@ -122,6 +123,12 @@ namespace PortfolioManager.ViewModels
// ********************************************************************* R E L A Y S *****************************************************************
[RelayCommand(CanExecute = nameof(CanExecuteBollingerBands))]
public async Task BollingerBands()
{
await ExecuteBollingerBands();
}
[RelayCommand(CanExecute = nameof(CanClosePosition))]
public async Task Close()
{
@@ -140,6 +147,12 @@ namespace PortfolioManager.ViewModels
await OpenEditDialog();
}
public bool CanExecuteBollingerBands()
{
if (null == selectedPosition || null == selectedPosition.Symbol) return false;
return true;
}
public bool CanEdit()
{
if (null == selectedPosition || null == selectedPosition.Symbol || !Utility.IsEpoch(selectedPosition.SellDate)) return false;
@@ -164,6 +177,14 @@ namespace PortfolioManager.ViewModels
await ReloadTradeFile();
}
public async Task ExecuteBollingerBands()
{
SaveParameters saveParams = SaveParameters.Parse("Type,PortfolioManager.ViewModels.BollingerBandViewModel,SelectedSymbol," + selectedPosition.Symbol + ",SelectedWatchList,{All},SelectedDayCount,360");
saveParams.Referer=this;
WorkspaceInstantiator.Invoke(saveParams);
await Task.FromResult(true);
}
public async Task ReloadTradeFile()
{
LoadSessionFile();