Include the new and the legacy bollinger bands.
This commit is contained in:
@@ -79,6 +79,7 @@ namespace TradeBlotter.ViewModels
|
|||||||
private RelayCommand relativeStrengthCommandPosition;
|
private RelayCommand relativeStrengthCommandPosition;
|
||||||
private RelayCommand macdCommandPosition;
|
private RelayCommand macdCommandPosition;
|
||||||
private RelayCommand bollingerBandCommandPosition;
|
private RelayCommand bollingerBandCommandPosition;
|
||||||
|
private RelayCommand bollingerBandCommandPositionAll;
|
||||||
private RelayCommand priceHistoryCommandPosition;
|
private RelayCommand priceHistoryCommandPosition;
|
||||||
private RelayCommand stickerValuationCommandPosition;
|
private RelayCommand stickerValuationCommandPosition;
|
||||||
private RelayCommand dcfValuationCommandPosition;
|
private RelayCommand dcfValuationCommandPosition;
|
||||||
@@ -212,7 +213,8 @@ namespace TradeBlotter.ViewModels
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
ObservableCollection<MenuItem> collection = new ObservableCollection<MenuItem>();
|
ObservableCollection<MenuItem> collection = new ObservableCollection<MenuItem>();
|
||||||
collection.Add(new MenuItem() { Text = "Display Bollinger Band", MenuItemClickedCommand = DisplayBollingerBandPosition, StaysOpenOnClick = false });
|
collection.Add(new MenuItem() { Text = "Display Bollinger Band Model Position", MenuItemClickedCommand = DisplayBollingerBandPosition, StaysOpenOnClick = false });
|
||||||
|
collection.Add(new MenuItem() { Text = "Display Bollinger Band All", MenuItemClickedCommand = DisplayBollingerBandPositionAll, StaysOpenOnClick = false });
|
||||||
collection.Add(new MenuItem() { Text = "Display Headlines", MenuItemClickedCommand = DisplayHeadlinesPosition, StaysOpenOnClick = false });
|
collection.Add(new MenuItem() { Text = "Display Headlines", MenuItemClickedCommand = DisplayHeadlinesPosition, StaysOpenOnClick = false });
|
||||||
collection.Add(new MenuItem() { Text = "Display Dividend History", MenuItemClickedCommand = DisplayDividendHistoryPosition, StaysOpenOnClick = false });
|
collection.Add(new MenuItem() { Text = "Display Dividend History", MenuItemClickedCommand = DisplayDividendHistoryPosition, StaysOpenOnClick = false });
|
||||||
collection.Add(new MenuItem() { Text = "Display Sticker Valuation", MenuItemClickedCommand = DisplayStickerValuationPosition, StaysOpenOnClick = false });
|
collection.Add(new MenuItem() { Text = "Display Sticker Valuation", MenuItemClickedCommand = DisplayStickerValuationPosition, StaysOpenOnClick = false });
|
||||||
@@ -878,6 +880,18 @@ namespace TradeBlotter.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand DisplayBollingerBandPositionAll
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (bollingerBandCommandPositionAll == null)
|
||||||
|
{
|
||||||
|
bollingerBandCommandPositionAll = new RelayCommand(param => this.DisplayBollingerBandCommandPositionAll(), param => { return null != selectedPosition && null != selectedPosition.Symbol; });
|
||||||
|
}
|
||||||
|
return bollingerBandCommandPositionAll;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand AddToWatchListPosition
|
public ICommand AddToWatchListPosition
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -1113,14 +1127,36 @@ namespace TradeBlotter.ViewModels
|
|||||||
WorkspaceInstantiator.Invoke(saveParams);
|
WorkspaceInstantiator.Invoke(saveParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetDayCountSelectionForBollingerBands(MGSHPositionModel selectedPosition)
|
public void DisplayBollingerBandCommandPositionAll()
|
||||||
|
{
|
||||||
|
MarketData.MarketDataModel.StopLimits stopLimits = GetHistoricalStopLimitsMarketDataModel();
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
SaveParameters saveParams = null;
|
||||||
|
sb = new StringBuilder();
|
||||||
|
sb.Append("Type,TradeBlotter.ViewModels.BollingerBandViewModel,SelectedSymbol,");
|
||||||
|
sb.Append(selectedPosition.Symbol).Append(",");
|
||||||
|
sb.Append("SelectedWatchList,{All},SelectedDayCount,");
|
||||||
|
sb.Append(GetDayCountSelectionForBollingerBands(selectedPosition, true));
|
||||||
|
saveParams = SaveParameters.Parse(sb.ToString());
|
||||||
|
SaveParameters stopLimitParams = StopLimitsExtensions.FromStopLimits(stopLimits);
|
||||||
|
saveParams.AddRange(stopLimitParams);
|
||||||
|
saveParams.Referer=this;
|
||||||
|
WorkspaceInstantiator.Invoke(saveParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetDayCountSelectionForBollingerBands(MGSHPositionModel selectedPosition,bool ignoreActivePosition=false)
|
||||||
{
|
{
|
||||||
DateGenerator dateGenerator=new DateGenerator();
|
DateGenerator dateGenerator=new DateGenerator();
|
||||||
|
DateTime maxDate = DateTime.Today;
|
||||||
|
|
||||||
DateTime maxDate = PricingDA.GetLatestDate(selectedPosition.Symbol);
|
if(!ignoreActivePosition)
|
||||||
if(!selectedPosition.IsActivePosition)
|
|
||||||
{
|
{
|
||||||
maxDate = selectedPosition.SellDate;
|
maxDate = PricingDA.GetLatestDate(selectedPosition.Symbol);
|
||||||
|
if(!selectedPosition.IsActivePosition)
|
||||||
|
{
|
||||||
|
maxDate = selectedPosition.SellDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int daysBetween=dateGenerator.DaysBetween(selectedPosition.PurchaseDate, maxDate);
|
int daysBetween=dateGenerator.DaysBetween(selectedPosition.PurchaseDate, maxDate);
|
||||||
if(daysBetween<90)return 90;
|
if(daysBetween<90)return 90;
|
||||||
|
|||||||
Reference in New Issue
Block a user