예제 #1
0
        public ConnorsRSI(DataSeries ds, int periodRSI, int periodStreak, int periodPR, string description)
            : base(ds, description)
        {
            base.FirstValidValue = Math.Max(Math.Max(periodRSI, periodStreak), periodPR);
            if (FirstValidValue <= 1)
            {
                return;
            }

            ConsecDaysDown cdd    = ConsecDaysDown.Series(ds, 0);
            ConsecDaysUp   cdu    = ConsecDaysUp.Series(ds, 0);
            DataSeries     streak = new DataSeries(ds, "streak");

            for (int bar = 0; bar < ds.Count; bar++)
            {
                streak[bar] = cdd[bar] > 0 ? -cdd[bar] : cdu[bar] > 0 ? cdu[bar] : 0;
            }

            RSI        rsi3       = RSI.Series(ds, periodRSI);
            RSI        rsiStreak  = RSI.Series(streak, periodStreak);
            ROC        ret        = ROC.Series(ds, 1);
            DataSeries pr         = PercentRank.Series(ret, periodPR) * 100.0;
            DataSeries connorsRSI = (rsi3 + rsiStreak + pr) / 3;

            for (int bar = base.FirstValidValue; bar < ds.Count; bar++)
            {
                base[bar] = connorsRSI[bar];
            }
        }
예제 #2
0
파일: DyMoI.cs 프로젝트: ToniTsai/LeetCode
        public DyMoI(Bars bars, string description)
            : base(bars, description)
        {
            base.FirstValidValue = 14 * 3; // RSI is being used: an 'unstable' indicator
            StdDev     SD5 = StdDev.Series(bars.Close, 5, StdDevCalculation.Population);
            DataSeries VIX = SD5 / Community.Indicators.FastSMA.Series(SD5, 10);

            for (int bar = FirstValidValue; bar < bars.Count; bar++)
            {
                int per = (int)(14 / VIX[bar]);
                base[bar] = per > 0 ? RSI.Series(bars.Close, per)[bar] : 50;
            }
        }
예제 #3
0
        public DerivativeOscillator(DataSeries ds, int periodRSI, int periodEMA1, int periodEMA2, int periodSMA, string description)
            : base(ds, description)
        {
            base.FirstValidValue = Math.Max(Math.Max(Math.Max(periodEMA1, periodEMA2), periodSMA), periodRSI);
            if (FirstValidValue <= 1)
            {
                return;
            }

            EMACalculation em       = EMACalculation.Modern;
            RSI            rsi      = RSI.Series(ds, periodRSI);
            EMA            rsiEma1  = EMA.Series(rsi, periodEMA1, em);
            EMA            rsiEma2  = EMA.Series(rsiEma1, periodEMA2, em);
            DataSeries     rsiSma   = Community.Indicators.FastSMA.Series(rsiEma2, periodSMA);
            DataSeries     derivOsc = rsiEma2 - rsiSma;

            for (int bar = base.FirstValidValue; bar < ds.Count; bar++)
            {
                base[bar] = derivOsc[bar];
            }
        }
예제 #4
0
        protected override void Execute()
        {
            int level;

            signleToSell     = false;
            priceAtCross     = 0;
            firstUp          = false;
            firstDown        = false;
            priceAtCrossDown = 0;
            rocAtCrossDown   = 0;

            topPrice   = 0;
            lastTop    = 0;
            breakPrice = 0;
            rocPrice   = 0;

            //Create and plot  period RSI
            RSI        rsi20       = RSI.Series(Close, 29);
            DataSeries senkouSpanA = SenkouSpanA.Series(Bars);
            DataSeries senkouSpanB = SenkouSpanB.Series(Bars);
            ChartPane  rsiPane     = CreatePane(50, true, true);

            PlotSeries(rsiPane, rsi20, Color.Navy, LineStyle.Solid, 3);
            DrawHorzLine(rsiPane, overbought.Value, Color.Green, LineStyle.Dotted, 2);


            ChartPane paneROC1 = CreatePane(40, true, true);

            PlotSeries(paneROC1, ROC.Series(Close, 20), Color.FromArgb(255, 112, 128, 144), LineStyle.Dotted, 2);
            DrawHorzLine(paneROC1, 0, Color.Red, LineStyle.Solid, 2);

            int period = Math.Max(29, 20);


            if (initPosition)
            {
                // init starting state to force buy into the market
                priceAtCrossDown = Close[period + 1];
                rocAtCrossDown   = ROC.Value(period + 1, Close, 20);
                firstDown        = true;
            }

            //Trading system main loop
            for (int bar = period + 1; bar < Bars.Count; bar++)
            {
                if (Close[bar] > topPrice)
                {
                    topPrice = Close[bar];
                }


                // Ichimoku  start
                if (
                    CrossOver(bar, Close, senkouSpanA))
                //				if (CrossUnder(bar, rsi20, level))
                {
                    if (!firstDown)
                    {
                        // first time to go below
                        // set cross happen and record the targit price
                        firstDown        = true;
                        priceAtCrossDown = Close[bar];
                        rocAtCrossDown   = ROC.Value(bar, Close, 20);
                    }
                }

                // play trayling
                int  addToPosition = 0;
                bool rsiOk         = false;
                bool priceOK       = false;
                if (firstDown)
                {
                    // ROC must improve by delta
                    double delta = Math.Abs(rocAtCrossDown * 0.2);

                    double newrocSMA = ROC.Value(bar, Close, 20);


                    if (bar == Bars.Count - 1)
                    {
                        rocPrice = rocAtCrossDown + delta;
                    }

                    if (newrocSMA <= (rocAtCrossDown + delta))
                    {
                        if (newrocSMA < rocAtCrossDown)
                        {
                            rocAtCrossDown = newrocSMA;
                        }
                    }
                    else
                    {
                        rsiOk = true;
                    }

                    double riseV = 2;
                    delta = priceAtCrossDown * (riseV / 1000.0 + 0.00017);

                    if (bar == Bars.Count - 1)
                    {
                        breakPrice = priceAtCrossDown + delta;
                    }

                    if (Close[bar] < (priceAtCrossDown + delta))
                    {
                        // DrawLabel(PricePane, "ready to buy, price is not rising: " + Close[bar].ToString() + " less than " + (priceAtCrossDown + delta).ToString());

                        if (Close[bar] < priceAtCrossDown)
                        {
                            priceAtCrossDown = Close[bar];
                        }
                    }
                    else
                    {
                        priceOK = true;
                    }

                    if (priceOK && rsiOk)
                    {
                        addToPosition++;
                        firstDown = false;
                    }
                }


                // you can  have only one active position
                foreach (Position pos in Positions)
                {
                    if (pos.Active && pos.PositionType == PositionType.Long)
                    {
                        addToPosition = 0;
                        break;
                    }
                }


                if (addToPosition > 0)
                {
                    // Close all shorts
                    foreach (Position pos in Positions)
                    {
                        if (pos.Active && pos.PositionType == PositionType.Short)
                        {
                            CoverAtMarket(bar + 1, pos);
                        }
                    }

                    //	    DrawLabel(PricePane, "buy at bar = " + bar.ToString());
                    Position p = BuyAtMarket(bar + 1);
                    firstUp = false;
                }


                level = overbought.ValueInt;
                int ClosedTrades = 0;
                signleToSell = false;
                if (CrossOver(bar, rsi20, overbought.ValueInt))
                {
                    if (!firstUp)
                    {
                        // first time to go above
                        // set cross happen and record the targit price
                        firstUp      = true;
                        priceAtCross = Close[bar];
                    }
                }

                if (firstUp)
                {
                    double riseV = 2;

                    double delta = priceAtCross * (riseV / 1000 + 0.00017);

                    priceOK = true;
                    if (Close[bar] >= (priceAtCross - delta))
                    {
                        if (Close[bar] > priceAtCross)
                        {
                            priceAtCross = Close[bar];
                        }
                    }
                    else
                    {
                        priceOK = false;
                    }

                    // keep as long ROC over zero
                    if (ROC.Value(bar, Close, 20) <= 0 && !priceOK)
                    {
                        signleToSell = true;
                        firstUp      = false;
                    }
                }


                // wait until price either move up or stopped out
                if (signleToSell)
                {
                    firstUp = false;
                    //DrawLabel(PricePane, ActivePositions.Count.ToString());
                    foreach (Position pos in Positions)
                    {
                        if (pos.Active && pos.PositionType == PositionType.Long)
                        {
                            SellAtMarket(bar + 1, pos);
                            ClosedTrades++;
                        }
                    }
                    signleToSell = false;
                }
                if (!IsLastPositionActive)
                {
                    if (CrossUnder(bar, Close, senkouSpanB))
                    {
                        // Short only after sell long position
                        if (!trend)
                        {
                            ShortAtMarket(bar + 1);
                        }
                    }
                }

                // sell on % lose
                foreach (Position pos in Positions)
                {
                    if (pos.Active &&
                        pos.PositionType == PositionType.Long &&
                        pos.EntryPrice > (Close[bar] + pos.EntryPrice * (0.008 + 0 * 0.001)) &&
                        bar >= pos.EntryBar
                        )
                    {
                        SellAtMarket(bar + 1, pos, "stop lose");
                        signleToSell = false;
                        firstUp      = false;
                        firstDown    = false;
                        continue;
                    }
                    if (pos.Active &&
                        pos.PositionType == PositionType.Short &&
                        Close[bar] > (pos.EntryPrice + pos.EntryPrice * (0.008 + 0 * 0.001)) &&
                        bar >= pos.EntryBar
                        )
                    {
                        CoverAtMarket(bar + 1, pos, "stop lose Short");
                    }
                }
            }
            double currentPrice = Close[Bars.Count - 1];

            DrawLabel(paneROC1, "Top: " + topPrice.ToString(), Color.Red);
            DrawLabel(paneROC1, "Current Price: " + currentPrice.ToString());

            DrawLabel(paneROC1, "Goal : " + " At +5%  " + (currentPrice * 1.05).ToString(), Color.BlueViolet);
            DrawLabel(paneROC1, "Goal : " + " At +8%  " + (currentPrice * 1.08).ToString(), Color.MediumSpringGreen);
            DrawLabel(paneROC1, "Goal : " + " At +10% " + (currentPrice * 1.10).ToString(), Color.DarkOliveGreen);


            DrawLabel(PricePane, "Drop          : " + " At -5%  " + (topPrice * 0.95).ToString(), Color.DarkGreen);
            DrawLabel(PricePane, "Correction   : " + " At -8%  " + (topPrice * 0.92).ToString(), Color.DarkBlue);
            DrawLabel(PricePane, "Correction   : " + " At -10% " + (topPrice * 0.90).ToString(), Color.Red);
            DrawLabel(PricePane, "Bear market: " + " At -20% " + (topPrice * 0.80).ToString(), Color.DarkRed);

            if (breakPrice > 0)
            {
                DrawLabel(PricePane, "Break above Price: " + breakPrice.ToString(), Color.DarkGoldenrod);
            }
            if (rocPrice > 0)
            {
                DrawLabel(PricePane, "Break above Momuntem: " + rocPrice.ToString(), Color.DarkGoldenrod);
            }


            DrawHorzLine(PricePane, currentPrice * 1.05, Color.BlueViolet, LineStyle.Solid, 6);
            DrawHorzLine(PricePane, currentPrice * 1.08, Color.MediumSpringGreen, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, currentPrice * 1.10, Color.DarkOliveGreen, LineStyle.Solid, 3);


            DrawHorzLine(PricePane, topPrice * 0.95, Color.DarkGreen, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, topPrice * 0.92, Color.DarkBlue, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, topPrice * 0.90, Color.Red, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, topPrice * 0.80, Color.DarkRed, LineStyle.Solid, 3);


            if (breakPrice > 0)
            {
                DrawHorzLine(PricePane, breakPrice, Color.DarkGoldenrod, LineStyle.Solid, 4);
            }

            //Pushed indicator PlotSeries statements
            PlotSeries(PricePane, KijunSen.Series(Bars), Color.FromArgb(255, 128, 0, 128), LineStyle.Solid, 3);
            PlotSeriesFillBand(PricePane, SenkouSpanA.Series(Bars), SenkouSpanB.Series(Bars), Color.FromArgb(255, 128, 0, 255), Color.FromArgb(63, 0, 0, 255), LineStyle.Solid, 3);
            PlotSeriesFillBand(PricePane, SenkouSpanB.Series(Bars), SenkouSpanA.Series(Bars), Color.FromArgb(255, 255, 0, 0), Color.FromArgb(63, 255, 0, 0), LineStyle.Solid, 3);
            PlotSeries(PricePane, TenkanSen.Series(Bars), Color.FromArgb(255, 0, 64, 128), LineStyle.Solid, 3);
        }
예제 #5
0
        protected override void Execute()
        {
            int level;

            signleToSell     = false;
            priceAtCross     = 0;
            firstUp          = false;
            firstDown        = false;
            priceAtCrossDown = 0;
            rocAtCrossDown   = 0;

            topPrice   = 0;
            lastTop    = 0;
            breakPrice = 0;
            rocPrice   = 0;

            //Create and plot  period RSI
            RSI       rsi20   = RSI.Series(Close, rsiPeriod.ValueInt);
            ChartPane rsiPane = CreatePane(50, true, true);

            PlotSeries(rsiPane, rsi20, Color.Navy, LineStyle.Solid, 3);
            DrawHorzLine(rsiPane, oversold.Value, Color.Red, LineStyle.Dotted, 2);
            DrawHorzLine(rsiPane, overbought.Value, Color.Green, LineStyle.Dotted, 2);


            ChartPane paneROC1 = CreatePane(40, true, true);

            PlotSeries(paneROC1, ROC.Series(Close, rocPeriod.ValueInt), Color.FromArgb(255, 112, 128, 144), LineStyle.Dotted, 2);
            DrawHorzLine(paneROC1, 0, Color.Red, LineStyle.Solid, 2);

            int period = Math.Max(rsiPeriod.ValueInt, rocPeriod.ValueInt);


            if (initPosition)
            {
                // init starting state to force buy into the market
                priceAtCrossDown = Close[period + 1];
                rocAtCrossDown   = ROC.Value(period + 1, Close, rocPeriod.ValueInt);
                firstDown        = true;
            }

            double High60           = 0;
            double Low60            = 0;
            int    n                = Bars.BarInterval;
            int    num              = (60 / n) - 1; // the first hour bar
            int    firstIntradayBar = -1;


            //Trading system main loop
            for (int bar = period + 1; bar < Bars.Count; bar++)
            {
                if (Bars.IntradayBarNumber(bar) == 0)
                {
                    firstIntradayBar = bar;
                }

                if (Bars.IntradayBarNumber(bar) <= num)                    // highlight the first hour
                {
                    SetBarColor(bar, Color.Silver);
                }

                if (Bars.IntradayBarNumber(bar) == num)                    // get the highest high and the lowest low after first hour
                {
                    High60 = Highest.Series(Bars.High, num + 1)[bar];
                    Low60  = Lowest.Series(Bars.Low, num + 1)[bar];

                    if (firstIntradayBar > -1)
                    {
                        DrawLine(PricePane, bar, High60, firstIntradayBar, High60, Color.Blue, LineStyle.Dashed, 1);
                        DrawLine(PricePane, bar, Low60, firstIntradayBar, Low60, Color.Red, LineStyle.Dashed, 1);
                    }
                }

                if (Close[bar] > topPrice)
                {
                    topPrice = Close[bar];
                }

                level = oversold.ValueInt;

                if (CrossUnder(bar, rsi20, level))
                {
                    if (!firstDown)
                    {
                        // first time to go below
                        // set cross happen and record the targit price
                        firstDown        = true;
                        priceAtCrossDown = Close[bar];
                        rocAtCrossDown   = ROC.Value(bar, Close, rocPeriod.ValueInt);
                    }
                }

                // play trayling
                int  addToPosition = 0;
                bool rsiOk         = false;
                bool priceOK       = false;
                if (firstDown)
                {
                    // ROC must improve by delta
                    double delta = Math.Abs(rocAtCrossDown * 0.2);

                    double newrocSMA = ROC.Value(bar, Close, rocPeriod.ValueInt);


                    if (bar == Bars.Count - 1)
                    {
                        rocPrice = rocAtCrossDown + delta;
                    }

                    if (newrocSMA <= (rocAtCrossDown + delta))
                    {
                        if (newrocSMA < rocAtCrossDown)
                        {
                            rocAtCrossDown = newrocSMA;
                        }
                    }
                    else
                    {
                        rsiOk = true;
                    }

                    double riseV = priceRise.ValueInt;
                    delta = priceAtCrossDown * (riseV / 1000.0 + 0.00017);

                    if (bar == Bars.Count - 1)
                    {
                        breakPrice = priceAtCrossDown + delta;
                    }

                    if (Close[bar] < (priceAtCrossDown + delta))
                    {
                        // DrawLabel(PricePane, "ready to buy, price is not rising: " + Close[bar].ToString() + " less than " + (priceAtCrossDown + delta).ToString());

                        if (Close[bar] < priceAtCrossDown)
                        {
                            priceAtCrossDown = Close[bar];
                        }
                    }
                    else
                    {
                        priceOK = true;
                    }

                    if (priceOK && rsiOk)
                    {
                        addToPosition++;
                        firstDown = false;
                    }
                }

                // you can  have only one active position
                foreach (Position pos in Positions)
                {
                    if (pos.Active && pos.PositionType == PositionType.Long)
                    {
                        addToPosition = 0;
                        break;
                    }
                }

                if (addToPosition > 0)
                {
                    // OverSold
                    // Close all shorts
                    foreach (Position pos in Positions)
                    {
                        if (pos.Active && pos.PositionType == PositionType.Short)
                        {
                            CoverAtMarket(bar + 1, pos);
                        }
                    }

                    //	    DrawLabel(PricePane, "buy at bar = " + bar.ToString());
                    Position p = BuyAtMarket(bar + 1);
                    firstUp = false;
                }


                level = overbought.ValueInt;
                int ClosedTrades = 0;
                signleToSell = false;
                if (CrossOver(bar, rsi20, overbought.ValueInt))
                {
                    if (!firstUp)
                    {
                        // first time to go above
                        // set cross happen and record the targit price
                        firstUp      = true;
                        priceAtCross = Close[bar];
                    }
                }

                if (firstUp)
                {
                    double riseV = priceRise.ValueInt;

                    double delta = priceAtCross * (riseV / 1000 + 0.00017);

                    priceOK = true;
                    if (Close[bar] >= (priceAtCross - delta))
                    {
                        if (Close[bar] > priceAtCross)
                        {
                            priceAtCross = Close[bar];
                        }
                    }
                    else
                    {
                        priceOK = false;
                    }

                    // keep as long ROC over zero
                    if (ROC.Value(bar, Close, rocPeriod.ValueInt) <= 0 && !priceOK)
                    {
                        signleToSell = true;
                        firstUp      = false;
                    }
                }

                // sync real account with strategy
                //			if (Bars.Date[bar] == syncDate)
                //			{
                //				signleToSell = true;  // close postions
                //			}

                // Over Bought
                // wait until price either move up or stopped out
                if (signleToSell)
                {
                    firstUp = false;
                    //DrawLabel(PricePane, ActivePositions.Count.ToString());
                    foreach (Position pos in Positions)
                    {
                        if (pos.Active && pos.PositionType == PositionType.Long)
                        {
                            SellAtMarket(bar + 1, pos);
                            ClosedTrades++;
                        }
                    }
                    signleToSell = false;

                    if (ClosedTrades > 0)
                    {
                        // Short only after sell long position
                        if (!trend)
                        {
                            ShortAtMarket(bar + 1);
                        }
                    }
                }
                // sell on % lose
                foreach (Position pos in Positions)
                {
                    if (pos.Active &&
                        pos.PositionType == PositionType.Long &&
                        pos.EntryPrice > (Close[bar] + pos.EntryPrice * (0.01 + stopLose.ValueInt * 0.001)) &&
                        bar >= pos.EntryBar
                        )
                    {
                        SellAtMarket(bar + 1, pos, "stop lose");
                        signleToSell = false;
                        firstUp      = false;
                        firstDown    = false;
                        continue;
                    }
                    if (pos.Active &&
                        pos.PositionType == PositionType.Short &&
                        Close[bar] > (pos.EntryPrice + pos.EntryPrice * (0.01 + stopLose.ValueInt * 0.001)) &&
                        bar >= pos.EntryBar
                        )
                    {
                        CoverAtMarket(bar + 1, pos, "stop lose Short");
                    }
                }
            }
            double currentPrice = Close[Bars.Count - 1];

            DrawLabel(paneROC1, "Top: " + topPrice.ToString(), Color.Red);
            DrawLabel(paneROC1, "Current Price: " + currentPrice.ToString());

            DrawLabel(paneROC1, "Goal : " + " At +5%  " + (currentPrice * 1.05).ToString(), Color.BlueViolet);
            DrawLabel(paneROC1, "Goal : " + " At +8%  " + (currentPrice * 1.08).ToString(), Color.MediumSpringGreen);
            DrawLabel(paneROC1, "Goal : " + " At +10% " + (currentPrice * 1.10).ToString(), Color.DarkOliveGreen);


            DrawLabel(PricePane, "Drop          : " + " At -5%  " + (topPrice * 0.95).ToString(), Color.DarkGreen);
            DrawLabel(PricePane, "Correction   : " + " At -8%  " + (topPrice * 0.92).ToString(), Color.DarkBlue);
            DrawLabel(PricePane, "Correction   : " + " At -10% " + (topPrice * 0.90).ToString(), Color.Red);
            DrawLabel(PricePane, "Bear market: " + " At -20% " + (topPrice * 0.80).ToString(), Color.DarkRed);

            if (breakPrice > 0)
            {
                DrawLabel(PricePane, "Break above Price: " + breakPrice.ToString(), Color.DarkGoldenrod);
            }
            if (rocPrice > 0)
            {
                DrawLabel(PricePane, "Break above Momuntem: " + rocPrice.ToString(), Color.DarkGoldenrod);
            }


            DrawHorzLine(PricePane, currentPrice * 1.05, Color.BlueViolet, LineStyle.Solid, 6);
            DrawHorzLine(PricePane, currentPrice * 1.08, Color.MediumSpringGreen, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, currentPrice * 1.10, Color.DarkOliveGreen, LineStyle.Solid, 3);


            DrawHorzLine(PricePane, topPrice * 0.95, Color.DarkGreen, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, topPrice * 0.92, Color.DarkBlue, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, topPrice * 0.90, Color.Red, LineStyle.Solid, 3);
            DrawHorzLine(PricePane, topPrice * 0.80, Color.DarkRed, LineStyle.Solid, 3);


            if (breakPrice > 0)
            {
                DrawHorzLine(PricePane, breakPrice, Color.DarkGoldenrod, LineStyle.Solid, 4);
            }
        }
예제 #6
0
        public InSyncIndex(Bars bars, string description)
            : base(bars, description)
        {
            base.FirstValidValue = 20;

            if (bars.Count < 20)
            {
                return;
            }

            DataSeries BOLInSLB = StdDev.Series(bars.Close, 20, StdDevCalculation.Sample) * 2;

            BOLInSLB = Community.Indicators.FastSMA.Series(bars.Close, 20) - BOLInSLB;

            DataSeries BOLInSUB = StdDev.Series(bars.Close, 20, StdDevCalculation.Sample) * 2;

            BOLInSUB = Community.Indicators.FastSMA.Series(bars.Close, 20) + BOLInSUB;

            DataSeries BOLInS2 = BOLInSUB - BOLInSLB;

            BOLInS2 = (bars.Close - BOLInSLB) / BOLInS2;

            EMV        emv     = EMV.Series(bars, 13);
            DataSeries EMVSer  = Community.Indicators.FastSMA.Series(emv, 10);
            DataSeries EMVInS2 = EMVSer - Community.Indicators.FastSMA.Series(EMVSer, 10);

            DataSeries MACDSer  = Community.Indicators.FastSMA.Series(MACD.Series(bars.Close), 10);
            DataSeries MACDInS2 = MACD.Series(bars.Close) - MACDSer;

            int        Period    = 18;
            DataSeries DPOSeries = bars.Close - (Community.Indicators.FastSMA.Series(bars.Close, Period) >> ((Period / 2) + 1));

            DataSeries PDOSer  = Community.Indicators.FastSMA.Series(DPOSeries, 10);
            DataSeries PDOInS2 = DPOSeries - PDOSer;

            DataSeries ROCSer  = EMA.Series(ROC.Series(bars.Close, 10), 10, EMACalculation.Modern);
            DataSeries ROCInS2 = ROC.Series(bars.Close, 10) - ROCSer;

            DataSeries BOLInSLL = bars.Close * 0;
            DataSeries CCInS    = bars.Close * 0;
            DataSeries EMVInSB  = bars.Close * 0;
            DataSeries EMVInSS  = bars.Close * 0;
            DataSeries MACDInSB = bars.Close * 0;
            DataSeries MACDInSS = bars.Close * 0;
            DataSeries MFIInS   = bars.Close * 0;
            DataSeries PDOInSB  = bars.Close * 0;
            DataSeries PDOInSS  = bars.Close * 0;
            DataSeries ROCInSB  = bars.Close * 0;
            DataSeries ROCInSS  = bars.Close * 0;
            DataSeries RSIInS   = bars.Close * 0;
            DataSeries STODInS  = bars.Close * 0;
            DataSeries STOKInS  = bars.Close * 0;

            for (int bar = base.FirstValidValue; bar < bars.Count; bar++)
            {
                if (BOLInS2[bar] < 0.05)
                {
                    BOLInSLL[bar] = -5;
                }
                else
                if (BOLInS2[bar] > 0.95)
                {
                    BOLInSLL[bar] = +5;
                }

                if (CCI.Series(bars, 14)[bar] > +100)
                {
                    CCInS[bar] = +5;
                }
                else
                if (CCI.Series(bars, 14)[bar] < -100)
                {
                    CCInS[bar] = -5;
                }

                if ((EMVInS2[bar] < 0) & (EMVSer[bar] < 0))
                {
                    EMVInSB[bar] = -5;
                }
                if ((EMVInS2[bar] > 0) & (EMVSer[bar] > 0))
                {
                    EMVInSS[bar] = +5;
                }

                if ((MACDInS2[bar] < 0) & (MACDSer[bar] < 0))
                {
                    MACDInSB[bar] = -5;
                }
                if ((MACDInS2[bar] > 0) & (MACDSer[bar] > 0))
                {
                    MACDInSS[bar] = +5;
                }

                if (MFI.Series(bars, 20)[bar] > 80)
                {
                    MFIInS[bar] = +5;
                }
                else
                if (MFI.Series(bars, 20)[bar] < 20)
                {
                    MFIInS[bar] = -5;
                }

                if ((PDOInS2[bar] < 0) & (PDOSer[bar] < 0))
                {
                    PDOInSB[bar] = -5;
                }
                if ((PDOInS2[bar] > 0) & (PDOSer[bar] > 0))
                {
                    PDOInSS[bar] = +5;
                }

                if ((ROCInS2[bar] < 0) & (ROCSer[bar] < 0))
                {
                    ROCInSB[bar] = -5;
                }
                if ((ROCInS2[bar] > 0) & (ROCSer[bar] > 0))
                {
                    ROCInSS[bar] = +5;
                }

                if (RSI.Series(bars.Close, 14)[bar] > 70)
                {
                    RSIInS[bar] = +5;
                }
                else
                if (RSI.Series(bars.Close, 14)[bar] < 30)
                {
                    RSIInS[bar] = -5;
                }

                if (StochD.Series(bars, 14, 3)[bar] > 80)
                {
                    STODInS[bar] = +5;
                }
                else
                if (StochD.Series(bars, 14, 3)[bar] < 20)
                {
                    STODInS[bar] = -5;
                }

                if (StochK.Series(bars, 14)[bar] > 80)
                {
                    STOKInS[bar] = +5;
                }
                else
                if (StochK.Series(bars, 14)[bar] < 20)
                {
                    STOKInS[bar] = -5;
                }

                base[bar] = 50 +
                            CCInS[bar] + BOLInSLL[bar] + RSIInS[bar]
                            + STODInS[bar] + MFIInS[bar] + EMVInSB[bar]
                            + EMVInSS[bar] + ROCInSS[bar] + ROCInSB[bar]
                            + STOKInS[bar] + MACDInSS[bar] + MACDInSB[bar]
                            + PDOInSS[bar - 10] + PDOInSB[bar - 10];
            }
        }