Пример #1
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBars[0] < length)
            {
                return;
            }

            SQZresult.Set(SJCRSU(Input, length, 4, 4)[0]);

            EMAInputData1.Set(SJCRSU(Input, length, 3.5, 3.5)[0]);
            EMAresult.Set(EMA(EMAInputData1, 7)[0]);

            double SqueezeValue = SQZresult[0];

            Squeeze.Set(100 * SqueezeValue);

            Print("Squeeze = " + SQZresult[0]);

            if (SQZresult[0] > SQZresult[1] && SQZresult[0] > 0)
            {
                _SqzColor = buyColor1;
            }

            if (SQZresult[0] < SQZresult[1] && SQZresult[0] < 0)
            {
                _SqzColor = sellColor1;
            }

            if (SQZresult[0] > SQZresult[1] && SQZresult[0] < 0)
            {
                _SqzColor = sellColor2;
            }

            if (SQZresult[0] < SQZresult[1] && SQZresult[0] > 0)
            {
                _SqzColor = buyColor2;
            }


            Print("ctTrend = " + ctTrend);

            if (ctTrend && SQZresult[0] > 0 && SQZresult[0] < EMAresult[0])
            {
                _SqzColor = sellColor2;
            }
            if (ctTrend && SQZresult[0] < 0 && SQZresult[0] > EMAresult[0])
            {
                _SqzColor = buyColor2;
            }
            PlotColors[1][0] = _SqzColor;

            BIASresult.Set(SJC_NLR(0, 9).NLRprice[0] - KAMA(Typical, 2, 11, 11)[0]);
            //BIASresult.Set(SJC_NLR.NLRprice[0] - KAMA(Typical, 2, 11, 11)[0]);
            //double BiasValue = BIASresult[0];
            Bias.Set(0);

            if (BIASresult[0] > 0)
            {
                _BiasColor = biasUpColor;
            }
            if (BIASresult[0] < 0)
            {
                _BiasColor = biasDnColor;
            }

            PlotColors[0][0] = _BiasColor;


            //Print("Bias = " + BIASresult[0]);
        }