예제 #1
0
 private double GetCloseOrHighLow(DowPivotOld _dp, TrendDir trendDir, int _barsAgo)
 {
     if (trendDir == TrendDir.Down)
     {
         if (_dp.UseHighLow)
         {
             return(_dp.Low[_barsAgo]);
         }
         else
         {
             return(_dp.Close[_barsAgo]);
         }
     }
     else if (trendDir == TrendDir.Up)
     {
         if (_dp.UseHighLow)
         {
             return(_dp.High[_barsAgo]);
         }
         else
         {
             return(_dp.Close[_barsAgo]);
         }
     }
     return(0);
 }
예제 #2
0
 public HighLowPoint(DowPivotOld dowPivot, double price, int barIndex, int pointIndex, TrendDir trendDir)
 {
     this.Price      = price;
     this.BarIndex   = barIndex;
     this.PointIndex = pointIndex;
     this.trendDir   = trendDir;
     PrintPoint(dowPivot);
 }
예제 #3
0
        public SwingForwardCalculationOld(DowPivotOld dowPivot) : base(dowPivot)
        {
            strength = (int)dowPivot.Strength;

            lastLowCache  = new ArrayList();
            lastHighCache = new ArrayList();

            lastTrend = TrendDir.Unknown;
        }
예제 #4
0
        public SwingDelayedCalculation(DowPivotOld dowPivot) : base(dowPivot)
        {
            strength = (int)dowPivot.Strength;
            constant = (strength * 2) + 1;

            lastLowCache  = new ArrayList();
            lastHighCache = new ArrayList();

            lastTrend = TrendDir.Unknown;
        }
예제 #5
0
        private void SetPlotBuyOrSell(DowPivotOld dowPivot, TrendDir trendDir)
        {
            switch (trendDir)
            {
            case TrendDir.Down:
                dowPivot.EntrySignal[0] = -1;
                break;

            case TrendDir.Up:
                dowPivot.EntrySignal[0] = 1;
                break;

            case TrendDir.Unknown:
                dowPivot.EntrySignal[0] = 0;
                break;
            }
        }
예제 #6
0
        private void SetProfitTargetPrice(DowPivotOld dowPivot, PivotPoint pp, TrendDir trendDir)
        {
            if (dowPivot.ShowTargetAndStop)
            {
                // Set where will be drawn the finish target line
                const int endLine = -4;
                switch (trendDir)
                {
                case TrendDir.Down:
                    double nDown = pp.SecondHigh.Price - pp.FirstLow.Price < 0 ?
                                   (pp.SecondHigh.Price - pp.FirstLow.Price) * -1 :
                                   pp.SecondHigh.Price - pp.FirstLow.Price;
                    double downTarget = (dowPivot.PercentProfitTargetFibo / 100) * nDown;

                    downTarget -= pp.SecondHigh.Price;
                    downTarget *= -1;     // Inverte valor negativo para positivo

                    Draw.Line(dowPivot, dowPivot.CurrentBar.ToString(), false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, pp.FirstLow.BarIndex),
                              downTarget, endLine, downTarget, Brushes.Red, DashStyleHelper.Solid, 2);

                    dowPivot.ProfitTargetPriceSignal[0] = downTarget;
                    break;

                case TrendDir.Up:
                    double nUp = pp.SecondLow.Price - pp.FirstHigh.Price < 0 ?
                                 (pp.SecondLow.Price - pp.FirstHigh.Price) * -1 :
                                 pp.SecondLow.Price - pp.FirstHigh.Price;
                    double upTarget = (dowPivot.PercentProfitTargetFibo / 100) * nUp;

                    upTarget += pp.SecondLow.Price;

                    Draw.Line(dowPivot, dowPivot.CurrentBar.ToString(), false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, pp.FirstHigh.BarIndex),
                              upTarget, endLine, upTarget, Brushes.Green, DashStyleHelper.Solid, 2);

                    dowPivot.ProfitTargetPriceSignal[0] = upTarget;
                    break;

                case TrendDir.Unknown:
                    dowPivot.ProfitTargetPriceSignal[0] = dowPivot.Input[0];
                    break;
                }
            }
        }
예제 #7
0
        private bool IsOverMinPercentPivotRetracement(DowPivotOld dowPivot, TrendDir trendDir, PivotPoint pp)
        {
            switch (trendDir)
            {
            case TrendDir.Down:
                double nDown = pp.FirstHigh.Price - pp.FirstLow.Price < 0 ?
                               (pp.FirstHigh.Price - pp.FirstLow.Price) * -1 :
                               pp.FirstHigh.Price - pp.FirstLow.Price;
                double downLimit = (dowPivot.FiboPivot.MinPercentOfPivotRetraction / 100) * nDown;

                downLimit += pp.FirstLow.Price;

                if (pp.SecondHigh.Price < downLimit)
                {
                    return(true);
                }

                break;

            case TrendDir.Up:
                double nUp = pp.FirstLow.Price - pp.FirstHigh.Price < 0 ?
                             (pp.FirstLow.Price - pp.FirstHigh.Price) * -1 :
                             pp.FirstLow.Price - pp.FirstHigh.Price;

                double upLimite = (dowPivot.FiboPivot.MinPercentOfPivotRetraction / 100) * nUp;

                upLimite -= pp.FirstHigh.Price;
                upLimite *= -1;     // Inverte valor negativo para positivo

                if (pp.SecondLow.Price > upLimite)
                {
                    return(true);
                }

                break;
            }
            return(false);
        }
예제 #8
0
        public void Calculate(DowPivotOld dowPivot, ZigZag dowPivotZigZag)
        {
            if (dowPivotZigZag.GetLow(1).Price == 0 ||
                dowPivotZigZag.GetLow(0).Price == 0 ||
                dowPivotZigZag.GetHigh(1).Price == 0 ||
                dowPivotZigZag.GetHigh(0).Price == 0)
            {
                return;
            }

            currentPP = new PivotPoint(dowPivotZigZag.GetLow(1), dowPivotZigZag.GetLow(0), dowPivotZigZag.GetHigh(1), dowPivotZigZag.GetHigh(0));

            isFalling = currentPP.SecondLow.Price < currentPP.FirstLow.Price &&
                        currentPP.SecondHigh.Price < currentPP.FirstHigh.Price;

            isRising = currentPP.SecondLow.Price > currentPP.FirstLow.Price &&
                       currentPP.SecondHigh.Price > currentPP.FirstHigh.Price;

            downFilter = !IsOverMaxPercentPivotRetracement(dowPivot, TrendDir.Down, currentPP) &&
                         !IsOverMinPercentPivotRetracement(dowPivot, TrendDir.Down, currentPP);

            upFilter = !IsOverMaxPercentPivotRetracement(dowPivot, TrendDir.Up, currentPP) &&
                       !IsOverMinPercentPivotRetracement(dowPivot, TrendDir.Up, currentPP);

            // Add low pivot
            if (isFalling && downFilter && dowPivotZigZag.GetCurrentHighLowLeg() == TrendDir.Down && lastTrend != TrendDir.Down)
            {
                low.FirstLow   = new HighLowPoint(currentPP.FirstLow);
                low.SecondLow  = new HighLowPoint(currentPP.SecondLow);
                low.FirstHigh  = new HighLowPoint(currentPP.FirstHigh);
                low.SecondHigh = new HighLowPoint(currentPP.SecondHigh);

                PrintPivots(dowPivot, Situation.AddLow);

                lastTrend = TrendDir.Down;

                isDownLine3LegEnd = false;

                SetPlotBuyOrSell(dowPivot, TrendDir.Down);
                SetStopLossPrice(dowPivot, low.SecondHigh.Price);
                SetProfitTargetPrice(dowPivot, currentPP, TrendDir.Down);
            }
            // Add high pivot
            else if (isRising && upFilter && dowPivotZigZag.GetCurrentHighLowLeg() == TrendDir.Up && lastTrend != TrendDir.Up)
            {
                high.FirstLow   = new HighLowPoint(currentPP.FirstLow);
                high.SecondLow  = new HighLowPoint(currentPP.SecondLow);
                high.FirstHigh  = new HighLowPoint(currentPP.FirstHigh);
                high.SecondHigh = new HighLowPoint(currentPP.SecondHigh);

                PrintPivots(dowPivot, Situation.AddHigh);

                lastTrend = TrendDir.Up;

                isUpLine3LegEnd = false;

                SetPlotBuyOrSell(dowPivot, TrendDir.Up);
                SetStopLossPrice(dowPivot, high.SecondLow.Price);
                SetProfitTargetPrice(dowPivot, currentPP, TrendDir.Up);
            }
            // Update low pivot
            else if (isFalling && currentPP.SecondLow.Price < low.SecondLow.Price && !isDownLine3LegEnd && lastTrend == TrendDir.Down)
            {
                low.SecondLow = new HighLowPoint(currentPP.SecondLow);
                PrintPivots(dowPivot, Situation.UpdateLow);
            }
            // Update high pivot
            else if (isRising && currentPP.SecondHigh.Price > high.SecondHigh.Price && !isUpLine3LegEnd && lastTrend == TrendDir.Up)
            {
                high.SecondHigh = new HighLowPoint(currentPP.SecondHigh);
                PrintPivots(dowPivot, Situation.UpdateHigh);
            }

            if (!isDrawingPivots)
            {
                //lastTrend = TrendDir.Unknown;
            }

            // Help to define the pivot end draw
            if (dowPivotZigZag.GetCurrentHighLowLeg() == TrendDir.Up)
            {
                isDownLine3LegEnd = true;
            }
            else if (dowPivotZigZag.GetCurrentHighLowLeg() == TrendDir.Down)
            {
                isUpLine3LegEnd = true;
            }

            // Help to define if is drawing any pivot
            if (lastTrend == TrendDir.Down && isDownLine3LegEnd)
            {
                isDrawingPivots = false;
            }
            else if (lastTrend == TrendDir.Up && isUpLine3LegEnd)
            {
                isDrawingPivots = false;
            }
            else
            {
                isDrawingPivots = true;
            }
        }
예제 #9
0
        public override void Calculate(DowPivotOld dowPivot)
        {
            #region Calcula primeiro ponto
            // Este laço faz o calculo das primeiras barras do gráfico
            if (dowPivot.IsFirstTickOfBar && GetHigh(0) == null && GetLow(0) == null)
            {
                initLowCache.Add(new HighLowAndIndex(dowPivot.Low[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant));
                initHighCache.Add(new HighLowAndIndex(dowPivot.High[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant));

                HighLowAndIndex lowCandidate  = initLowCache[0];
                HighLowAndIndex highCandidate = initHighCache[0];

                if (initLowCache.Count - 1 >= strength)
                {
                    for (int i = 0; i < strength; i++)
                    {
                        if (initLowCache[i].Price < lowCandidate.Price)
                        {
                            lowCandidate = initLowCache[i];
                        }
                    }
                }

                if (initHighCache.Count - 1 >= strength)
                {
                    for (int i = 0; i < strength; i++)
                    {
                        if (initHighCache[i].Price > highCandidate.Price)
                        {
                            highCandidate = initHighCache[i];
                        }
                    }
                }

                if (initLowCache.Count - 1 >= strength && initHighCache.Count - 1 >= strength)
                {
                    if (lowCandidate.Index < highCandidate.Index)
                    {
                        AddLow(dowPivot, lowCandidate.Price, lowCandidate.Index);
                        lastTrend         = TrendDir.Down;
                        calculationEstate = CalculationEstate.SecondValue;
                    }
                    else if (lowCandidate.Index > highCandidate.Index)
                    {
                        AddHigh(dowPivot, highCandidate.Price, highCandidate.Index);
                        lastTrend         = TrendDir.Up;
                        calculationEstate = CalculationEstate.SecondValue;
                    }
                    else
                    {
                        Miscellaneous.PrintError(dowPivot, "In the initial calculation of the 'Low' and 'High', they have the same index," +
                                                 " Low index: " + lowCandidate.Index + "    High index: " + highCandidate.Index);
                    }
                }
            }
            #endregion

            #region Calcula dados históricos e de tempo real
            // Enter only once per bar
            else if (dowPivot.IsFirstTickOfBar && (calculationEstate == CalculationEstate.SecondValue || calculationEstate == CalculationEstate.HistoricalRealTime))
            {
                bool isFalling          = true;
                bool isRising           = true;
                bool isOverLowStrength  = false;
                bool isOverHighStrength = false;

                if (lastTrend == TrendDir.Up && calculationEstate == CalculationEstate.SecondValue)
                {
                    isOverLowStrength = (dowPivot.CurrentBar - GetHigh(0).BarIndex) >= strength;
                    calculationEstate = CalculationEstate.HistoricalRealTime;
                }
                else if (lastTrend == TrendDir.Down && calculationEstate == CalculationEstate.SecondValue)
                {
                    isOverHighStrength = (dowPivot.CurrentBar - GetLow(0).BarIndex) >= strength;
                    calculationEstate  = CalculationEstate.HistoricalRealTime;
                }
                else
                {
                    isOverLowStrength  = (dowPivot.CurrentBar - GetHigh(0).BarIndex) >= strength;
                    isOverHighStrength = (dowPivot.CurrentBar - GetLow(0).BarIndex) >= strength;
                }

                lastLowCache.Add(dowPivot.Low[barsAgoConstant]);
                if (lastLowCache.Count > strength)
                {
                    lastLowCache.RemoveAt(0);
                }
                double swingLowCandidateValue = (double)lastLowCache[lastLowCache.Count - 1];

                lastHighCache.Add(dowPivot.High[barsAgoConstant]);
                if (lastHighCache.Count > strength)
                {
                    lastHighCache.RemoveAt(0);
                }
                double swingHighCandidateValue = (double)lastHighCache[lastHighCache.Count - 1];

                // Low calculations
                if (lastLowCache.Count == strength)
                {
                    for (int i = 0; i < strength; i++)
                    {
                        if (swingLowCandidateValue > (double)lastLowCache[i])
                        {
                            isFalling = false;
                        }
                    }
                }
                // High calculations
                if (lastHighCache.Count == strength)
                {
                    for (int i = 0; i < strength; i++)
                    {
                        if (swingHighCandidateValue < (double)lastHighCache[i])
                        {
                            isRising = false;
                        }
                    }
                }

                // Add low
                if (isFalling && isOverLowStrength && lastTrend != TrendDir.Down)
                {
                    AddLow(dowPivot, dowPivot.Low[barsAgoConstant], dowPivot.CurrentBar - 1);
                    lastLow   = dowPivot.Low[barsAgoConstant];
                    lastTrend = TrendDir.Down;
                }
                // Add high
                else if (isRising && isOverHighStrength && lastTrend != TrendDir.Up)
                {
                    AddHigh(dowPivot, dowPivot.High[barsAgoConstant], dowPivot.CurrentBar - 1);
                    lastHigh  = dowPivot.High[barsAgoConstant];
                    lastTrend = TrendDir.Up;
                }
                // Update low
                else if (isFalling && lastTrend == TrendDir.Down && dowPivot.Low[barsAgoConstant] < lastLow)
                {
                    UpdateLow(dowPivot, dowPivot.Low[barsAgoConstant], dowPivot.CurrentBar - 1);
                    lastLow = dowPivot.Low[barsAgoConstant];
                }
                // Update high
                else if (isRising && lastTrend == TrendDir.Up && dowPivot.High[barsAgoConstant] > lastHigh)
                {
                    UpdateHigh(dowPivot, dowPivot.High[barsAgoConstant], dowPivot.CurrentBar - 1);
                    lastHigh = dowPivot.High[barsAgoConstant];
                }
            }
            #endregion

            #region Calcula todos os ticks em tempo real
            // Este "if" � executado apenas quando lastTrend � iniciada alterando de "Unknow"
            // para "Up" ou "Down" e em todos os ticks com exce��o do primeiro tick
            else if (!dowPivot.IsFirstTickOfBar && GetLow(0) != null && GetHigh(0) != null &&
                     calculationEstate == CalculationEstate.HistoricalRealTime)
            {
                // Low logic
                if (lastTrend == TrendDir.Down && dowPivot.Low[0] < GetLow(0).Price)
                {
                    UpdateLow(dowPivot, dowPivot.Low[0], dowPivot.CurrentBar);
                }

                // High logic
                if (lastTrend == TrendDir.Up && dowPivot.High[0] > GetHigh(0).Price)
                {
                    UpdateHigh(dowPivot, dowPivot.High[0], dowPivot.CurrentBar);
                }
            }
            #endregion
        }
예제 #10
0
 public HighLowPoint(HighLowPoint hlp)
 {
     Price    = hlp.Price;
     BarIndex = hlp.BarIndex;
     trendDir = TrendDir.Unknown;
 }
예제 #11
0
 public HighLowPoint()
 {
     trendDir = TrendDir.Unknown;
 }
예제 #12
0
        public override void Calculate(DowPivotOld dowPivot)
        {
            // Enter only once per bar
            if (dowPivot.IsFirstTickOfBar)
            {
                bool   isSwingLow              = false;
                bool   isSwingHigh             = false;
                double swingLowCandidateValue  = 0;
                double swingHighCandidateValue = 0;

                lastLowCache.Add(dowPivot.Low[0 + barsAgoConstant]);
                if (lastLowCache.Count > constant)
                {
                    lastLowCache.RemoveAt(0);
                }

                lastHighCache.Add(dowPivot.High[0 + barsAgoConstant]);
                if (lastHighCache.Count > constant)
                {
                    lastHighCache.RemoveAt(0);
                }

                // Low calculations
                if (lastLowCache.Count == constant)
                {
                    isSwingLow             = true;
                    swingLowCandidateValue = (double)lastLowCache[strength];

                    for (int i = 0; i < dowPivot.Strength; i++)
                    {
                        if (((double)lastLowCache[i]).ApproxCompare(swingLowCandidateValue) <= 0)
                        {
                            isSwingLow = false;
                        }
                    }

                    for (int i = strength + 1; i < lastLowCache.Count; i++)
                    {
                        if (((double)lastLowCache[i]).ApproxCompare(swingLowCandidateValue) < 0)
                        {
                            isSwingLow = false;
                        }
                    }
                }

                // High calculations
                if (lastHighCache.Count == constant)
                {
                    isSwingHigh             = true;
                    swingHighCandidateValue = (double)lastHighCache[strength];

                    for (int i = 0; i < strength; i++)
                    {
                        if (((double)lastHighCache[i]).ApproxCompare(swingHighCandidateValue) >= 0)
                        {
                            isSwingHigh = false;
                        }
                    }

                    for (int i = strength + 1; i < lastHighCache.Count; i++)
                    {
                        if (((double)lastHighCache[i]).ApproxCompare(swingHighCandidateValue) > 0)
                        {
                            isSwingHigh = false;
                        }
                    }
                }

                // Add low
                if (isSwingLow && lastTrend != TrendDir.Down)
                {
                    AddLow(dowPivot, swingLowCandidateValue, (dowPivot.CurrentBar - strength) - barsAgoConstant);
                    lastLow   = swingLowCandidateValue;
                    lastTrend = TrendDir.Down;
                }
                // Add high
                if (isSwingHigh && lastTrend != TrendDir.Up)
                {
                    AddHigh(dowPivot, swingHighCandidateValue, (dowPivot.CurrentBar - strength) - barsAgoConstant);
                    lastHigh  = swingHighCandidateValue;
                    lastTrend = TrendDir.Up;
                }
                // Update low
                if (isSwingLow && lastTrend == TrendDir.Down && swingLowCandidateValue < lastLow)
                {
                    UpdateLow(dowPivot, swingLowCandidateValue, (dowPivot.CurrentBar - strength) - barsAgoConstant);
                    lastLow = swingLowCandidateValue;
                }
                // Update high
                if (isSwingHigh && lastTrend == TrendDir.Up && swingHighCandidateValue > lastHigh)
                {
                    UpdateHigh(dowPivot, swingHighCandidateValue, (dowPivot.CurrentBar - strength) - barsAgoConstant);
                    lastHigh = swingHighCandidateValue;
                }
            }
        }
        public override void Calculate(DowPivotOld dowPivot)
        {
            ISeries <double> lows;
            ISeries <double> highs;

            if (dowPivot.UseHighLow)
            {
                lows  = dowPivot.Low;
                highs = dowPivot.High;
            }
            else
            {
                lows  = dowPivot.Close;
                highs = dowPivot.Close;
            }

            #region Calcula primeiro ponto
            // Este laço faz o calculo das primeiras barras do gráfico
            if (dowPivot.IsFirstTickOfBar && GetHigh(0) == null && GetLow(0) == null)
            {
                initLowCache.Add(new HighLowAndIndex(lows[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant));
                initHighCache.Add(new HighLowAndIndex(highs[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant));

                HighLowAndIndex lowCandidate  = initLowCache[0];
                HighLowAndIndex highCandidate = initHighCache[0];

                if (initLowCache.Count - 1 >= strength)
                {
                    for (int i = 0; i < strength; i++)
                    {
                        if (initLowCache[i].Price < lowCandidate.Price)
                        {
                            lowCandidate = initLowCache[i];
                        }
                    }
                }

                if (initHighCache.Count - 1 >= strength)
                {
                    for (int i = 0; i < strength; i++)
                    {
                        if (initHighCache[i].Price > highCandidate.Price)
                        {
                            highCandidate = initHighCache[i];
                        }
                    }
                }

                if (initLowCache.Count - 1 >= strength && initHighCache.Count - 1 >= strength)
                {
                    if (lowCandidate.Index < highCandidate.Index)
                    {
                        AddLow(dowPivot, lowCandidate.Price, lowCandidate.Index);
                        lastTrend         = TrendDir.Down;
                        calculationEstate = CalculationEstate.HistoricalRealTime;
                    }
                    else if (lowCandidate.Index > highCandidate.Index)
                    {
                        AddHigh(dowPivot, highCandidate.Price, highCandidate.Index);
                        lastTrend         = TrendDir.Up;
                        calculationEstate = CalculationEstate.HistoricalRealTime;
                    }
                    else
                    {
                        Miscellaneous.PrintError(dowPivot, "In the initial calculation of the 'Low' and 'High', they have the same index," +
                                                 " Low index: " + lowCandidate.Index + "    High index: " + highCandidate.Index);
                    }
                }
            }
            #endregion

            #region Calcula dados históricos e de tempo real
            else if (dowPivot.IsFirstTickOfBar && calculationEstate == CalculationEstate.HistoricalRealTime)
            {
                bool isSwingLow  = lows[barsAgoConstant] < lows[1 + barsAgoConstant];
                bool isSwingHigh = highs[barsAgoConstant] > highs[1 + barsAgoConstant];

                if (isSwingLow)
                {
                    for (int i = 1; i < strength + 1; i++)
                    {
                        if (lows[barsAgoConstant] > lows[i + barsAgoConstant])
                        {
                            isSwingLow = false;
                            break;
                        }
                    }
                }

                if (isSwingHigh)
                {
                    for (int i = 1; i < strength + 1; i++)
                    {
                        if (highs[barsAgoConstant] < highs[i + barsAgoConstant])
                        {
                            isSwingHigh = false;
                            break;
                        }
                    }
                }

                #region CRUD
                // Add low
                if (isSwingLow && lastTrend != TrendDir.Down)
                {
                    AddLow(dowPivot, lows[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant);
                    lastLow   = lows[barsAgoConstant];
                    lastTrend = TrendDir.Down;
                }
                // Add high
                else if (isSwingHigh && lastTrend != TrendDir.Up)
                {
                    AddHigh(dowPivot, highs[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant);
                    lastHigh  = highs[barsAgoConstant];
                    lastTrend = TrendDir.Up;
                }
                // Update Low
                else if (isSwingLow && lastTrend == TrendDir.Down && lows[barsAgoConstant] < lastLow)
                {
                    UpdateLow(dowPivot, lows[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant);
                    lastLow = lows[barsAgoConstant];
                }
                // Update High
                else if (isSwingHigh && lastTrend == TrendDir.Up && highs[barsAgoConstant] > lastHigh)
                {
                    UpdateHigh(dowPivot, highs[barsAgoConstant], dowPivot.CurrentBar - barsAgoConstant);
                    lastHigh = highs[barsAgoConstant];
                }
                #endregion
            }
            #endregion
        }
 public SwingForwardCalculationNew(DowPivotOld dowPivot) : base(dowPivot)
 {
     strength  = (int)dowPivot.Strength;
     lastTrend = TrendDir.Unknown;
 }