public static SignalStrength BearishSenkouCross(
            IchimokuKinkoHyo previousIndicator,
            IchimokuKinkoHyo indicator,
            decimal price)
        {
            var signalStrength = SignalStrength.None;

            var cross = previousIndicator.SenkouA > previousIndicator.SenkouB && indicator.SenkouA < indicator.SenkouB;

            if (!cross)
            {
                return(signalStrength);
            }

            var senkouHigh = Math.Max(indicator.SenkouA, indicator.SenkouB);
            var senkouLow  = Math.Min(indicator.SenkouA, indicator.SenkouB);

            if (price > senkouHigh)
            {
                signalStrength = SignalStrength.Weak;
            }
            else if (price <= senkouHigh && price >= senkouLow)
            {
                signalStrength = SignalStrength.Neutral;
            }
            else if (price < senkouLow)
            {
                signalStrength = SignalStrength.Strong;
            }

            return(signalStrength);
        }
        // Signals as defined in http://www.ichimokutrader.com/signals.html

        public static SignalStrength BullishTenkanKijunCross(
            IchimokuKinkoHyo previousIndicator,
            IchimokuKinkoHyo indicator)
        {
            var signalStrength = SignalStrength.None;

            // Tenkan Sen has not crossed Kijun Sen, no signal
            var cross = previousIndicator.Tenkan <previousIndicator.Kijun && indicator.Tenkan> indicator.Kijun;

            if (!cross)
            {
                return(signalStrength);
            }

            var senkouHigh = Math.Max(indicator.SenkouA, indicator.SenkouB);
            var senkouLow  = Math.Min(indicator.SenkouA, indicator.SenkouB);

            // Cross occured below the Kumo (cloud)
            if (indicator.Kijun < senkouLow)
            {
                signalStrength = SignalStrength.Weak;
            }
            // Cross occured inside the Kumo (cloud)
            else if (indicator.Kijun < senkouHigh && indicator.Kijun > senkouLow)
            {
                signalStrength = SignalStrength.Neutral;
            }
            // Cross occured above the Kumo (cloud)
            else if (indicator.Kijun > senkouHigh)
            {
                signalStrength = SignalStrength.Strong;
            }

            return(signalStrength);
        }
        public static SignalStrength BearishTenkanKijunCross(
            IchimokuKinkoHyo previousIndicator,
            IchimokuKinkoHyo indicator)
        {
            var signalStrength = SignalStrength.None;

            var cross = previousIndicator.Tenkan > previousIndicator.Kijun && indicator.Tenkan < indicator.Kijun;

            if (!cross)
            {
                return(signalStrength);
            }

            var senkouHigh = Math.Max(indicator.SenkouA, indicator.SenkouB);
            var senkouLow  = Math.Min(indicator.SenkouA, indicator.SenkouB);

            if (indicator.Kijun > senkouHigh)
            {
                signalStrength = SignalStrength.Weak;
            }
            else if (indicator.Kijun <= senkouHigh && indicator.Kijun >= senkouLow)
            {
                signalStrength = SignalStrength.Neutral;
            }
            else if (indicator.Kijun < senkouLow)
            {
                signalStrength = SignalStrength.Strong;
            }

            return(signalStrength);
        }
        public static SignalStrength BullishKijunCross(
            IchimokuKinkoHyo previousIndicator,
            IchimokuKinkoHyo indicator,
            decimal previousPrice,
            decimal price)
        {
            var signalStrength = SignalStrength.None;

            var cross = previousPrice <previousIndicator.Kijun && price> indicator.Kijun;

            if (!cross)
            {
                return(signalStrength);
            }

            var senkouHigh = Math.Max(indicator.SenkouA, indicator.SenkouB);
            var senkouLow  = Math.Min(indicator.SenkouA, indicator.SenkouB);

            if (indicator.Kijun < senkouLow)
            {
                signalStrength = SignalStrength.Weak;
            }
            else if (indicator.Kijun <= senkouHigh && indicator.Kijun >= senkouLow)
            {
                signalStrength = SignalStrength.Neutral;
            }
            else if (indicator.Kijun > senkouHigh)
            {
                signalStrength = SignalStrength.Strong;
            }

            return(signalStrength);
        }
Esempio n. 5
0
 protected override void OnStart()
 {
     Ichimoku          = Indicators.IchimokuKinkoHyo(Tenkan, Kijun, Senkou);
     cBotLabel         = "Ichi Multi " + Symbol.Code + " " + TimeFrame.ToString();
     Positions.Opened += PositionsOnOpened;
     Positions.Closed += PositionsOnClosed;
 }
 /// <summary>
 /// CALLED WHEN THE ROBOT FIRST STARTS, IT IS ONLY CALLED ONCE.
 /// </summary>
 protected override void OnStart()
 {
     // TRADE MANAGER DECLERATION
     //tm = new TradeManager(this);
     // CONSTRUCT THE INDICATORS
     VindIchi = Indicators.IchimokuKinkoHyo(TenkanSen, KijunSen, SenkouSpanB);
 }
Esempio n. 7
0
        /// <summary>
        /// Creates a new IchimokuKinkoHyo indicator for the symbol. The indicator will be automatically
        /// updated on the given resolution.
        /// </summary>
        /// <param name="symbol">The symbol whose ATR we want</param>
        /// <param name="tenkanPeriod">The period to calculate the Tenkan-sen period</param>
        /// <param name="kijunPeriod">The period to calculate the Kijun-sen period</param>
        /// <param name="senkouAPeriod">The period to calculate the Tenkan-sen period</param>
        /// <param name="senkouBPeriod">The period to calculate the Tenkan-sen period</param>
        /// <param name="senkouADelayPeriod">The period to calculate the Tenkan-sen period</param>
        /// <param name="senkouBDelayPeriod">The period to calculate the Tenkan-sen period</param>
        /// <param name="resolution">The resolution</param>
        /// <returns>A new IchimokuKinkoHyo indicator with the specified periods and delays</returns>
        public IchimokuKinkoHyo ICHIMOKU(string symbol, int tenkanPeriod, int kijunPeriod, int senkouAPeriod, int senkouBPeriod, int senkouADelayPeriod, int senkouBDelayPeriod, Resolution?resolution = null)
        {
            var name     = CreateIndicatorName(symbol, string.Format("ICHIMOKU({0},{1})", tenkanPeriod, kijunPeriod), resolution);
            var ichimoku = new IchimokuKinkoHyo(name, tenkanPeriod, kijunPeriod, senkouAPeriod, senkouBPeriod, senkouADelayPeriod, senkouBDelayPeriod);

            RegisterIndicator(symbol, ichimoku, resolution);
            return(ichimoku);
        }
Esempio n. 8
0
        public void ComparesWithExternalDataDelayedMaximumSenkouB()
        {
            var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26);

            TestHelper.TestIndicator(
                ichimoku,
                "spy_with_ichimoku.csv",
                "DelayedMaximumSenkouB",
                (ind, expected) => Assert.AreEqual(expected, (double)((IchimokuKinkoHyo)ind).DelayedMaximumSenkouB.Current.Value)
                );
        }
Esempio n. 9
0
        public void ComparesWithExternalDataKijunMinimum()
        {
            var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26);

            TestHelper.TestIndicator(
                ichimoku,
                "spy_with_ichimoku.csv",
                "KijunMinimum",
                (ind, expected) => Assert.AreEqual(expected, (double)((IchimokuKinkoHyo)ind).KijunMinimum.Current.Value)
                );
        }
Esempio n. 10
0
        public void ComparesWithExternalDataDelayedTenkanSenkouA()
        {
            var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26);

            TestHelper.TestIndicator(
                ichimoku,
                "spy_with_ichimoku.csv",
                "DelayedTenkanSenkouA",
                (ind, expected) => Assert.Equal(expected, (double)((IchimokuKinkoHyo)ind).DelayedTenkanSenkouA.Current.Price)
                );
        }
Esempio n. 11
0
        public TrendSelectionData(Symbol symbol)
        {
            _symbol = symbol;

            _ich = new IchimokuKinkoHyo(symbol, 7, 22, 22, 44, 22, 22);

            _adx = new AverageDirectionalIndex(symbol, 22);

            _vwap = new VolumeWeightedAveragePriceIndicator(symbol, 22);

            _consolidation = new IchimokuKinkoHyoConsolidated(null, null);
        }
Esempio n. 12
0
        public void ComparesWithExternalDataKijun()
        {
            var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26);

            ichimoku.Current.Occured.ToString();
            TestHelper.TestIndicator(
                ichimoku,
                "spy_with_ichimoku.csv",
                "Kijun",
                (ind, expected) => Assert.Equal(expected, (double)((IchimokuKinkoHyo)ind).Kijun.Current.Price)
                );
        }
Esempio n. 13
0
        public static SignalStrength BearishKumoBreakout(
            IchimokuKinkoHyo previousIndicator,
            IchimokuKinkoHyo indicator,
            decimal previousPrice,
            decimal price)
        {
            var previousSenkouLow = Math.Min(previousIndicator.SenkouA, previousIndicator.SenkouB);
            var senkouLow         = Math.Min(indicator.SenkouA, indicator.SenkouB);

            var cross = previousPrice > previousSenkouLow && price < senkouLow;

            return(cross ? SignalStrength.Neutral : SignalStrength.None);
        }
Esempio n. 14
0
        public static SignalStrength BullishKumoBreakout(
            IchimokuKinkoHyo previousIndicator,
            IchimokuKinkoHyo indicator,
            decimal previousPrice,
            decimal price)
        {
            var previousSenkouHigh = Math.Max(previousIndicator.SenkouA, previousIndicator.SenkouB);
            var senkouHigh         = Math.Max(indicator.SenkouA, indicator.SenkouB);

            var cross = previousPrice <previousSenkouHigh && price> senkouHigh;

            return(cross ? SignalStrength.Neutral : SignalStrength.None);
        }
Esempio n. 15
0
        protected override void OnStart()
        {
            Ichimoku          = Indicators.IchimokuKinkoHyo(Tenkan, Kijun, Senkou);
            cBotLabel         = "Ichi Multi " + Symbol.Code + " " + TimeFrame.ToString();
            Positions.Opened += PositionsOnOpened;
            Positions.Closed += PositionsOnClosed;
            // Start Time is the same day at 07:00:00 Server Time
            _startTime = Server.Time.Date.AddHours(StartTime);

            // Stop Time is the next day at 20:00:00
            _stopTime = Server.Time.Date.AddHours(StopTime);

            Print("Start Time {0},", _startTime);
            Print("Stop Time {0},", _stopTime);
        }
        public void ResetsProperly()
        {
            var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26);

            TestHelper.TestIndicatorReset(ichimoku, "spy_with_ichimoku.csv");
        }
Esempio n. 17
0
 public IchimokuKinkoHyoConsolidated(TradeBar data, IchimokuKinkoHyo indicator)
 {
     _previousData      = data;
     _previousIndicator = indicator;
 }
Esempio n. 18
0
 public void Consolidate(TradeBar data, IchimokuKinkoHyo indicator)
 {
     _data      = data;
     _indicator = indicator;
 }
Esempio n. 19
0
 public void RollConsolidationWindow()
 {
     _previousData      = _data;
     _previousIndicator = _indicator;
 }
Esempio n. 20
0
 protected override void OnStart()
 {
     Ichimoku = Indicators.IchimokuKinkoHyo(Tenkan, Kijun, Senkou);
 }
Esempio n. 21
0
 protected override void OnStart()
 {
     IKHIndicator = Indicators.IchimokuKinkoHyo(Tenkan, Kijun, Senkou);
     TradeList    = new List <Trade>();
 }