Esempio n. 1
0
        protected override bool verifyTrigger(List<Position> positions)
        {
            bool verified = base.verifyTrigger(positions);
            if (verified)
            {
                // Verify that the start and end points are near the bottom, to avoid confusion with Tarantallegra
                var stats = new PositionStatistics(positions);

                if ((Math.Abs(stats.Start().point.Y - stats.yMin) > Math.Abs(stats.Start().point.Y - stats.yMax))
                    || (Math.Abs(stats.End().point.Y - stats.yMin) > Math.Abs(stats.End().point.Y - stats.yMax)))
                {
                    verified = false;
                }
            }

            return verified;
        }
Esempio n. 2
0
        protected virtual bool verifyTrigger(List<Position> positions)
        {
            PositionStatistics stats = new PositionStatistics(positions);

            StrokeDirection direction = StrokeDecomposer.determineDirection(stats.Start(), stats.End());
            double distance = stats.Diagonal();
            double relativeStartAndEndDistance = stats.FractionOfTotal(stats.Start(), stats.End());

            /*
            if (this.GetType() == typeof(Ascendio))
            {
                Console.WriteLine(
                    "Confidence: " + confidence
                    + " direction: " + direction
                    + " (" + stats.Start().point.ToString() + " -> " + stats.End().point.ToString() + ")"
                    + " distance: " + distance + " (" + relativeStartAndEndDistance + ")");
            }
            */

            bool verified = false;

            foreach (StrokeDirection dir in acceptableDirectionsFromStartToEndPoint)
            {
                if (dir == direction)
                {
                    verified = true;
                }
            }

            verified = verified && confidence >= minConfidence;

            verified = verified && distance >= 400.0;
            verified = verified && (relativeStartAndEndDistance * 100) >= minPercentOfTotalBetweenStartAndEndPoints;
            verified = verified && (relativeStartAndEndDistance * 100) <= maxPercentOfTotalBetweenStartAndEndPoints;

            return verified;
        }