Commit Latest
This commit is contained in:
@@ -31,6 +31,13 @@ namespace PortfolioManager.Renderers
|
||||
public const int FontSize = 11;
|
||||
}
|
||||
|
||||
public class OffsetDictionary
|
||||
{
|
||||
enum OffsetType {VerticalOffset5PC, VerticalOffset3PC, VerticalOffset1PC,HorizontalOffset5PC,HorizontalOffset3PC,HorizontalOffset1PC};
|
||||
private Dictionary<int, double> offsetDictionary;
|
||||
}
|
||||
|
||||
|
||||
public class BollingerBandRenderer : ModelBase
|
||||
{
|
||||
private String selectedSymbol = default;
|
||||
@@ -146,10 +153,10 @@ namespace PortfolioManager.Renderers
|
||||
}
|
||||
bollingerBands = BollingerBandGenerator.GenerateBollingerBands(prices);
|
||||
|
||||
double maxBollingerDate = bollingerBands.Max(x=>x.Date).ToOADate();
|
||||
double minBollingerDate = bollingerBands.Min(x=>x.Date).ToOADate();
|
||||
double maxBollingerValue = bollingerBands.Max(x=>x.K);
|
||||
double minBollingerValue = bollingerBands.Min(x=>x.L);
|
||||
double maxBollingerDate = bollingerBands.Max(x => x.Date).ToOADate();
|
||||
double minBollingerDate = bollingerBands.Min(x => x.Date).ToOADate();
|
||||
double maxBollingerValue = bollingerBands.Max(x => x.K);
|
||||
double minBollingerValue = bollingerBands.Min(x => x.L);
|
||||
|
||||
double spreadHorz = (maxBollingerDate - minBollingerDate);
|
||||
double spreadVert = (maxBollingerValue - minBollingerValue);
|
||||
@@ -211,7 +218,7 @@ namespace PortfolioManager.Renderers
|
||||
}
|
||||
(DateTime[] dates, double[] values) = StopLimits.ToXYData();
|
||||
|
||||
// Add the markers
|
||||
// Add the markers
|
||||
Image imageStopLimitMarker = TextMarkerImageGenerator.ToSPImage(ImageCache.GetInstance().GetImage(ImageCache.ImageType.RedTriangleUp));
|
||||
for (int index = 0; index < dates.Length; index++)
|
||||
{
|
||||
@@ -221,7 +228,7 @@ namespace PortfolioManager.Renderers
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, imageStopLimitMarker, SizeFactor.Normal);
|
||||
}
|
||||
|
||||
// Add the text marker
|
||||
// Add the text marker
|
||||
if (null != stopLimits)
|
||||
{
|
||||
for (int index = 0; index < stopLimits.Count; index++)
|
||||
@@ -238,7 +245,7 @@ namespace PortfolioManager.Renderers
|
||||
sb.Append(" (").Append(percentOffsetFromLow > 0 ? "+" : "").Append(Utility.FormatPercent(percentOffsetFromLow)).Append(")");
|
||||
}
|
||||
Image image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), 155, 24, FontFactor.FontSize);
|
||||
// Coordinates coordinates = new Coordinates(dates[0].ToOADate()-1, values[0] - 5.00);
|
||||
// Coordinates coordinates = new Coordinates(dates[0].ToOADate()-1, values[0] - 5.00);
|
||||
Coordinates coordinates = new Coordinates(limit.EffectiveDate.ToOADate(), limit.StopPrice - 5.00);
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
|
||||
}
|
||||
@@ -256,8 +263,8 @@ namespace PortfolioManager.Renderers
|
||||
sb.Append(" (").Append(percentOffsetFromLow > 0 ? "+" : "").Append(Utility.FormatPercent(percentOffsetFromLow)).Append(")");
|
||||
|
||||
Image image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), 155, 24, FontFactor.FontSize);
|
||||
// Coordinates coordinates = new Coordinates(latestPrice.Date.ToOADate()/(1+onePercent), stopLimit.StopPrice - 5.00);
|
||||
Coordinates coordinates = new Coordinates(latestPrice.Date.ToOADate()-percentShiftHorz3PC, stopLimit.StopPrice - 5.00);
|
||||
// Coordinates coordinates = new Coordinates(latestPrice.Date.ToOADate()/(1+onePercent), stopLimit.StopPrice - 5.00);
|
||||
Coordinates coordinates = new Coordinates(latestPrice.Date.ToOADate() - percentShiftHorz3PC, stopLimit.StopPrice - 5.00);
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
|
||||
}
|
||||
}
|
||||
@@ -268,7 +275,7 @@ namespace PortfolioManager.Renderers
|
||||
private void GenerateTradePoints()
|
||||
{
|
||||
if (null == portfolioTradesLots || 0 == portfolioTradesLots.Count || !showTradeLabels) return;
|
||||
// Here we add the image markers
|
||||
// Here we add the image markers
|
||||
Image tradePointMarker = TextMarkerImageGenerator.ToSPImage(ImageCache.GetInstance().GetImage(ImageCache.ImageType.YellowTriangleUp));
|
||||
for (int index = 0; index < portfolioTradesLots.Count; index++)
|
||||
{
|
||||
@@ -277,7 +284,7 @@ namespace PortfolioManager.Renderers
|
||||
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, tradePointMarker, SizeFactor.Normal);
|
||||
}
|
||||
|
||||
// This adds the text markers
|
||||
// This adds the text markers
|
||||
for (int index = 0; index < portfolioTradesLots.Count; index++)
|
||||
{
|
||||
PortfolioTrade portfolioTrade = portfolioTradesLots[index];
|
||||
|
||||
Reference in New Issue
Block a user