Commit Latest

This commit is contained in:
2025-07-07 21:07:26 -04:00
parent 9ebd316b1d
commit 552aebfc23

View File

@@ -35,7 +35,7 @@ namespace PortfolioManager.Renderers
{
public enum OffsetType
{
VerticalOffset15PC, VerticalOffset10PC, VerticalOffset5PC, VerticalOffset3PC, VerticalOffset1PC, HorizontalOffset5PC, HorizontalOffset3PC, HorizontalOffset1PC,
VerticalOffset15PC, VerticalOffset10PC, VerticalOffset7PC, VerticalOffset6P5PC, VerticalOffset6PC, VerticalOffset5PC, VerticalOffset3PC, VerticalOffset1PC, HorizontalOffset5PC, HorizontalOffset3PC, HorizontalOffset1PC,
MinBollingerDate, MaxBollingerDate, MinBollingerValue, MaxBollingerValue
};
@@ -196,6 +196,9 @@ namespace PortfolioManager.Renderers
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset1PC,spreadVert * .01);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset3PC,spreadVert *.03);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset5PC,spreadVert * .05);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset6PC,spreadVert * .06);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset6P5PC,spreadVert * .065);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset7PC,spreadVert * .07);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset10PC,spreadVert * .10);
offsets.Add(OffsetDictionary.OffsetType.VerticalOffset15PC,spreadVert * .15);
}
@@ -243,7 +246,8 @@ namespace PortfolioManager.Renderers
double parityOffsetPercent = (latestPrice.Close - zeroPrice.Close) / zeroPrice.Close;
sb.Append("(").Append(parityOffsetPercent < 0 ? "" : "+").Append(Utility.FormatPercent(parityOffsetPercent)).Append(")");
image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), FontFactor.FontSize);
coordinates = new Coordinates(dates[0].ToOADate() - offsets.Offset(OffsetDictionary.OffsetType.HorizontalOffset3PC), values[0] - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset5PC));
coordinates = new Coordinates(dates[0].ToOADate() - offsets.Offset(OffsetDictionary.OffsetType.HorizontalOffset3PC),
values[0] - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
}
@@ -263,7 +267,7 @@ namespace PortfolioManager.Renderers
}
(DateTime[] dates, double[] values) = StopLimits.ToXYData();
// Add the markers
// Add the image markers
Image imageStopLimitMarker = TextMarkerImageGenerator.ToSPImage(ImageCache.GetInstance().GetImage(ImageCache.ImageType.RedTriangleUp));
for (int index = 0; index < dates.Length; index++)
{
@@ -292,7 +296,8 @@ namespace PortfolioManager.Renderers
sb.Append(" (").Append(percentOffsetFromLow > 0 ? "+" : "").Append(Utility.FormatPercent(percentOffsetFromLow)).Append(")");
}
Image image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), FontFactor.FontSize);
Coordinates coordinates = new Coordinates(limit.EffectiveDate.ToOADate(), limit.StopPrice - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset5PC));
Coordinates coordinates = new Coordinates(limit.EffectiveDate.ToOADate(),
limit.StopPrice - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
}
}
@@ -308,7 +313,8 @@ namespace PortfolioManager.Renderers
sb.Append(Utility.FormatCurrency(stopLimit.StopPrice));
sb.Append(" (").Append(percentOffsetFromLow > 0 ? "+" : "").Append(Utility.FormatPercent(percentOffsetFromLow)).Append(")");
Image image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), FontFactor.FontSize);
Coordinates coordinates = new Coordinates(latestPrice.Date.ToOADate() - offsets.Offset(OffsetDictionary.OffsetType.HorizontalOffset3PC), stopLimit.StopPrice - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset5PC));
Coordinates coordinates = new Coordinates(latestPrice.Date.ToOADate() - offsets.Offset(OffsetDictionary.OffsetType.HorizontalOffset3PC),
stopLimit.StopPrice - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
}
}
@@ -319,6 +325,7 @@ namespace PortfolioManager.Renderers
private void GenerateTradePoints()
{
if (null == portfolioTradesLots || 0 == portfolioTradesLots.Count) return;
// Here we add the image markers
Image tradePointMarker = TextMarkerImageGenerator.ToSPImage(ImageCache.GetInstance().GetImage(ImageCache.ImageType.YellowTriangleUp));
for (int index = 0; index < portfolioTradesLots.Count; index++)
@@ -339,9 +346,9 @@ namespace PortfolioManager.Renderers
sb.Append(Utility.FormatNumber(portfolioTrade.Shares));
sb.Append("@");
sb.Append(Utility.FormatCurrency(portfolioTrade.Price));
// Image image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), 130, 24, FontFactor.FontSize);
Image image = TextMarkerImageGenerator.GenerateImage(sb.ToString(), FontFactor.FontSize);
Coordinates coordinates = new Coordinates(portfolioTrade.TradeDate.ToOADate(), portfolioTrade.Price - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset5PC));
Coordinates coordinates = new Coordinates(portfolioTrade.TradeDate.ToOADate(),
portfolioTrade.Price - offsets.Offset(OffsetDictionary.OffsetType.VerticalOffset6P5PC));
ImageMarker imageMarker = Plotter.Plot.Add.ImageMarker(coordinates, image);
}
}