예제 #1
0
        /// <summary>
        /// This should work from the 1508 tick chart
        /// </summary>
        private void SetHigherHighsAndLowerLowers(int barArrayIndex)
        {
            // The occurrence to check for (1 is the most recent, 2 is the 2nd most recent etc...)
            int instance       = 1;
            int lookBackPeriod = 100;
            int barsAgoHigh    = 0;
            int barsAgoLow     = 0;

            barsAgoHigh = zz.HighBar(barsAgoHigh, instance, lookBackPeriod);
            barsAgoLow  = zz.LowBar(barsAgoLow, instance, lookBackPeriod);

            instance = 2;
            int previousBarsAgoHigh = zz.HighBar(0, instance, lookBackPeriod);
            int previousBarsAgoLow  = zz.LowBar(0, instance, lookBackPeriod);

            //double zzHigh = Instrument.MasterInstrument.Round2TickSize(zz.ZigZagHigh[barsAgoHigh]);
            //DrawText(CurrentBar + "xx", barsAgoHigh+","+previousBarsAgoHigh, 0, High[0] + 7 * TickSize, Color.Black);
            //DrawText(CurrentBar + "yy", barsAgoLow+","+previousBarsAgoLow, 0, Low[0] - 7 * TickSize, Color.Black);

            if (barsAgoHigh == 1 && High[0] <= High[barsAgoHigh])
            {
                if (High[barsAgoHigh] > High[previousBarsAgoHigh])
                {
                    DrawText(CurrentBar + "HH", "HH", barsAgoHigh, High[barsAgoHigh] + 5 * TickSize, Color.Black);
                    hh = true;
                    lh = false;
                }
                else if (High[barsAgoHigh] < High[previousBarsAgoHigh])
                {
                    DrawText(CurrentBar + "LH", "LH", barsAgoHigh, High[barsAgoHigh] + 5 * TickSize, Color.Black);
                    hh = false;
                    lh = true;
                }
                else
                {
                    DrawText(CurrentBar + "DH", "DH", barsAgoHigh, High[barsAgoHigh] + 5 * TickSize, Color.Black);
                }
            }

            if (barsAgoLow == 1 && Low[0] >= Low[barsAgoLow])
            {
                if (Low[barsAgoLow] > Low[previousBarsAgoLow])
                {
                    DrawText(CurrentBar + "HL", "HL", barsAgoLow, Low[barsAgoLow] - 5 * TickSize, Color.Black);
                    hl = true;
                    ll = false;
                    if (hh)
                    {
                        BackColorAll = Color.Green;
                    }
                }
                else if (Low[barsAgoLow] < Low[previousBarsAgoLow])
                {
                    DrawText(CurrentBar + "LL", "LL", barsAgoLow, Low[barsAgoLow] - 5 * TickSize, Color.Black);
                    hl = false;
                    ll = true;
                }
                else
                {
                    DrawText(CurrentBar + "DL", "DL", barsAgoLow, Low[barsAgoLow] - 5 * TickSize, Color.Black);
                }
            }

            // SpanB is the base, where SpanA is the more active value.
            if (ic.SenkouSpanA[0] > ic.SenkouSpanB[0])
            {
                blueCloud = true;
            }

            if (hh && hl && (Low[0] > ic.SenkouSpanA[0]))
            {
                //DrawDot(CurrentBar + "DL", false, 0, Low[barsAgoLow] - 2 * TickSize, Color.Green);
                BackColorAll = Color.LightGreen;
            }
        }