예제 #1
0
        /// <summary>
        /// One last check to filter out bad buys.
        /// </summary>
        /// <param name="currentBar">Current bar of the simulation</param>
        /// <returns>Returns true if the situation passes and we should buy</returns>
        private bool ShouldBuy(int currentBar)
        {
            AverageVolume vol = (AverageVolume)_dependents[2];

            if (vol.Avg[currentBar] < 250000)
            {
                return(false);
            }

            if (currentBar - _barLastZoneHit > 5)
            {
                return(false);
            }

            //GavalasZones zones = (GavalasZones)_dependents[0];
            //if (zones.DidBarTouchZone(Data.Low[currentBar], Data.High[currentBar], currentBar) == false)
            //{
            //	return false;
            //}

            //ZigZagWaves.WaveData waveData = zones.GetWaveData(currentBar);
            //double avgWaveHeight = (Math.Abs(waveData.Points[0].Retracement) + Math.Abs(waveData.Points[1].Retracement) + Math.Abs(waveData.Points[2].Retracement)) / 3;
            //if (avgWaveHeight < 4)
            //{
            //	return false;
            //}

            return(true);
        }
 public string ToCsv()
 {
     return($"F,{Symbol},{ExchangeId},{PE.ToInvariantString()},{AverageVolume.ToInvariantString()},{FiftyTwoWeekHigh.ToInvariantString()},{FiftyTwoWeekLow.ToInvariantString()},{CalendarYearHigh.ToInvariantString()},{CalendarYearLow.ToInvariantString()},{DividendYield.ToInvariantString()}," +
            $"{DividendAmount.ToInvariantString()},{DividendRate.ToInvariantString()},{PayDate.ToInvariantString(FundamentalDateTimeFormat)},{ExDividendDate.ToInvariantString(FundamentalDateTimeFormat)},{string.Empty},{string.Empty},{string.Empty},{ShortInterest},{string.Empty}," +
            $"{CurrentYearEarningsPerShare.ToInvariantString()},{NextYearEarningsPerShare.ToInvariantString()},{FiveYearGrowthPercentage.ToInvariantString()},{FiscalYearEnd.ToInvariantString()},{string.Empty},{CompanyName},{RootOptionSymbol},{PercentHeldByInstitutions.ToInvariantString()}," +
            $"{Beta.ToInvariantString()},{Leaps},{CurrentAssets.ToInvariantString()},{CurrentLiabilities.ToInvariantString()},{BalanceSheetDate.ToInvariantString(FundamentalDateTimeFormat)},{LongTermDebt.ToInvariantString()},{CommonSharesOutstanding.ToInvariantString()}," +
            $"{string.Empty},{SplitFactor1},{SplitFactor2},{string.Empty},{string.Empty},{FormatCode},{Precision.ToInvariantString()},{SIC.ToInvariantString()},{HistoricalVolatility.ToInvariantString()},{SecurityType},{ListedMarket},{FiftyTwoWeekHighDate.ToInvariantString(FundamentalDateTimeFormat)}," +
            $"{FiftyTwoWeekLowDate.ToInvariantString(FundamentalDateTimeFormat)},{CalendarYearHighDate.ToInvariantString(FundamentalDateTimeFormat)},{CalendarYearLowDate.ToInvariantString(FundamentalDateTimeFormat)},{YearEndClose.ToInvariantString()},{MaturityDate.ToInvariantString(FundamentalDateTimeFormat)}," +
            $"{CouponRate.ToInvariantString()},{ExpirationDate.ToInvariantString(FundamentalDateTimeFormat)},{StrikePrice.ToInvariantString()},{NAICS.ToInvariantString()},{ExchangeRoot},{OptionsPremiumMultiplier.ToInvariantString()},{OptionsMultipleDeliverables.ToInvariantString()},");
 }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Owner?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DepartureTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CurrentStatus?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Temperature?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (LoadPercentage?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalVolume?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AverageVolume?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (MaxTravelTime?.GetHashCode() ?? 0);
            return(hashCode);
        }
예제 #4
0
        /// <summary>
        /// One last check to filter out bad buys.
        /// </summary>
        /// <param name="currentBar">Current bar of the simulation</param>
        /// <returns>Returns true if the situation passes and we should buy</returns>
        private bool ShouldBuy(int currentBar)
        {
            AverageVolume vol = (AverageVolume)_dependents[0];

            if (vol.Avg[currentBar] < 250000)
            {
                return(false);
            }

            // Make sure we are trading a stock with the right volitility.
            //double atrNormalized = Data.HigherTimeframeValues["Atr"][currentBar] / Data.HigherTimeframeValues["Close"][currentBar];
            //if (atrNormalized < 0.06 || atrNormalized > 0.10)
            //{
            //	return false;
            //}

            return(true);
        }