public void SetInverseToPriorTrade(CalendarAnalysisTradeRangeResult priorTrade_)
    {
      int count = 0;
      int invertedCount = 0;

      bool yearIsOffset = priorTrade_.StartDate > StartDate;  // need to offset the years if our prior is before us
      // this happens when 'this' trade is at the very beginning of the year, and so the prior trade is the end fo the last year

      foreach (var year in YearlyEntryExitPoints.Keys)
      {
        if(YearlyEntryExitPoints[year]==null || YearlyEntryExitPoints[year].Length<2)continue;

        var priorTradeYear = yearIsOffset ? year - 1 : year;

        if (!priorTrade_.YearlyEntryExitPoints.ContainsKey(priorTradeYear) ||
            priorTrade_.YearlyEntryExitPoints[priorTradeYear] == null ||
            priorTrade_.YearlyEntryExitPoints[priorTradeYear].Length < 2)
          continue;

        if (priorTrade_.YearlyEntryExitPoints.ContainsKey(priorTradeYear))
        {
          var thisYearMove = YearlyEntryExitPoints[year].LastDataValue - YearlyEntryExitPoints[year].Data[0];
          var priorMove = priorTrade_.YearlyEntryExitPoints[priorTradeYear].LastDataValue -
                          priorTrade_.YearlyEntryExitPoints[priorTradeYear].Data[0];

          var isOpposite = (thisYearMove*priorMove) < 0d;

          count += 1;
          invertedCount += isOpposite ? 1 : 0;
        }
      }

      InverseToPriorPeriod = new TimesCorrect((uint)invertedCount, (uint)count);
    }
 protected override void Dispose(bool disposing)
 {
   base.Dispose(disposing);
   Item = null;
 }
 public showPeriodOnPriceGraph(CalendarAnalysisTradeRangeResult item_)
 {
   Item = item_;
   Text = string.Format("View identified period on price graph of '{0}'", item_.Instrument);
 }
 public showDetailContextMenuItem(CalendarAnalysisTradeRangeResult item_)
 {
   Item = item_;
   Text = string.Format("Investigate identified pattern for {0}", item_.Instrument);
 }
 public showFullYear(CalendarAnalysisTradeRangeResult item_)
 {
   Item = item_;
   Text = String.Format("Show full year analysis of '{0}'...", item_.Instrument);
 }