Inheritance: MonoBehaviour
Beispiel #1
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            //DonchianChannel dc = DonchianChannel(20);
            hma   = HMA(hmaPeriod);
            zz    = ZigZag(deviationType, deviationValue, useHighLow);
            zzFib = ZigZagFib(deviationType, deviationValue, useHighLow);
//			ReadZigZag();

            swingHigh = zzFib.Upper[0];
            swingLow  = zzFib.Lower[0];
            double upperTrade = zzFib.LowerFib[0];
            double lowerTrade = zzFib.LowerFib[0];


            //if (enableDebug) DrawText(CurrentBar + "currentHigh", barsAgoHigh+"", 0, High[0] + 5 * TickSize, Color.White);
            //if (enableDebug) DrawText(CurrentBar +  "currentLow",  barsAgoLow+"", 0,  Low[0] - 5 * TickSize, Color.White);

            if (swingHigh <= 0 || swingLow <= 0)
            {
                return;
            }

            //DrawDot(CurrentBar + "zz", true, 0, zz.ZigZagHigh[0], Color.Purple);

            //if (swingLow > currentZigZagLow && currentZigZagLow > 0)
            //	swingLow = currentZigZagLow;

            //RemoveDrawObjects();
            //Print("HighestBar(High, period): " + HighestBar(High, 30) + " swingHigh: " + swingHigh);
            //DrawHorizontalLine("SwingHigh", swingHigh, Color.White);
            //DrawHorizontalLine("SwingLow", swingLow, Color.White);
            //DrawHorizontalLine("UpperTrade", false, upperTrade, Color.Blue, DashStyle.Dash, 1);
            //DrawHorizontalLine("LowerTrade", false, lowerTrade, Color.Red, DashStyle.Dash, 1);

            //if (ToTime(Time[0]) > ToTime(7, 04, 0)) {
            if (Position.MarketPosition == MarketPosition.Flat)
            {
                //if (barsAgoHigh > barsAgoLow) // && Rising(hma))
                if (Rising(hma) &&
                    Close[0] <= zzFib.LowerFib[0]
                    //&& (zzFib.Lower[20] - zzFib.Lower[0]) <= 0 * TickSize
                    // may potentially need to ignore new lows due to expired old lows
                    )
                {
                    triggeredStopMove = false;
                    GoLong(zzFib.LowerFib[0], zzFib.LowerFib[0]);
                    DrawDot(CurrentBar + "tLong", true, 0, zzFib.LowerFib[0], Color.Green);
                    DrawDot(CurrentBar + "tStop", true, 0, zzFib.UpperFib[0], Color.LightGreen);
                }


                if (Falling(hma) && AtTop(Close[0]))
                {
                    openHigh = swingHigh;
                    openLow  = swingLow;

                    GoShort(upperTrade, upperTrade);

                    DrawDot(CurrentBar + "tShort", true, 0, zzFib.UpperFib[0], Color.Yellow);
                    DrawDot(CurrentBar + "tStop", true, 0, zzFib.LowerFib[0], Color.LightYellow);
                }
            }

            ManageTrade();
        }
Beispiel #2
0
 public short ReadShort(int bitCount = 16)
 {
     return((short)ZigZag.Zag(ReadUInt32(bitCount)));
 }
Beispiel #3
0
 public long ReadLong(int bitCount = 64)
 {
     return(ZigZag.Zag(ReadULong(bitCount)));
 }
Beispiel #4
0
 public void WriteShort(short value, int bitCount = 16)
 {
     Write(ZigZag.Zig(value), bitCount);
 }
Beispiel #5
0
 public void WriteLong(long value, int bitCount = 64)
 {
     Write(ZigZag.Zig(value), bitCount);
 }
Beispiel #6
0
 public short PeekShort(int bitCount = 16)
 {
     return((short)ZigZag.Zag(PeekUInt32(bitCount)));
 }
Beispiel #7
0
 public long PeekLong(int bitCount = 64)
 {
     return(ZigZag.Zag(PeekULong(bitCount)));
 }
Beispiel #8
0
        protected override void Init()
        {       //dt1=Bars[Bars.Range.To-1].Time;
            k   = 0;
            dlt = dl * Instrument.Point;
            dt1 = dt1.AddHours(-3);
            iFT = TimeToIndex(dt1, Timeframe);

            //Print("Init - {0} - {1} - {2} - k={3}",dt1,Bars[Bars.Range.To-1].Time,Bars[iFT].Time,k);

            //toolPolyLine = Tools.Create<PolyLine>(); toolPolyLine.Color=Color.Aqua;
            toolRectangle  = Tools.Create <Rectangle>(); toolRectangle.BorderColor = Color.Aqua; toolRectangle.Color = Color.DarkSeaGreen;
            toolRectangle1 = Tools.Create <Rectangle>(); toolRectangle1.BorderColor = Color.Aqua; toolRectangle1.Color = Color.DarkSeaGreen;
            //toolRectangle2 = Tools.Create<Rectangle>(); toolRectangle1.BorderColor=Color.Aqua; toolRectangle1.Color=Color.DarkSeaGreen;

            _frInd           = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            first            = true;
            _wprInd          = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
            _wprInd.ExtDepth = 5;
            // 15/05/2018
            if (Instrument.Name == "EURUSD")
            {
                NKZ = 462;
            }
            if (Instrument.Name == "GBPUSD")
            {
                NKZ = 792;
            }
            if (Instrument.Name == "AUDUSD")
            {
                NKZ = 343;
            }
            if (Instrument.Name == "NZDUSD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "USDJPY")
            {
                NKZ = 527;
            }
            if (Instrument.Name == "USDCAD")
            {
                NKZ = 491;
            }
            if (Instrument.Name == "USDCHF")
            {
                NKZ = 608;
            }
            if (Instrument.Name == "AUDJPY")
            {
                NKZ = 550;
            }
            if (Instrument.Name == "AUDNZD")
            {
                NKZ = 412;
            }
            if (Instrument.Name == "CHFJPY")
            {
                NKZ = 1430;
            }
            if (Instrument.Name == "EURAUD")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "AUDCAD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "EURCAD")
            {
                NKZ = 762;
            }
            if (Instrument.Name == "EURCHF")
            {
                NKZ = 539;
            }
            if (Instrument.Name == "EURGBP")
            {
                NKZ = 484;
            }
            if (Instrument.Name == "EURJPY")
            {
                NKZ = 715;
            }
            if (Instrument.Name == "GBPCHF")
            {
                NKZ = 924;
            }
            if (Instrument.Name == "GBPJPY")
            {
                NKZ = 1045;
            }

            var posActiveMineB = Trade.GetActivePositions(mgB, true);

            if (posActiveMineB != null && posActiveMineB.Length > 0)
            {
                posGuidBuy = posActiveMineB[0].Id;
            }
            var posActiveMineS = Trade.GetActivePositions(mgS, true);

            if (posActiveMineS != null && posActiveMineS.Length > 0)
            {
                posGuidSell = posActiveMineS[0].Id;
            }
        }
        /// <summary>
        /// Encodes the image with no subsampling.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="pixels">The pixel accessor providing access to the image pixels.</param>
        /// <param name="cancellationToken">The token to monitor for cancellation.</param>
        /// <param name="emitBufferBase">The reference to the emit buffer.</param>
        private void Encode444 <TPixel>(Image <TPixel> pixels, CancellationToken cancellationToken, ref byte emitBufferBase)
            where TPixel : unmanaged, IPixel <TPixel>
        {
            // TODO: Need a JpegScanEncoder<TPixel> class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.)
            // (Partially done with YCbCrForwardConverter<TPixel>)
            Block8x8F temp1 = default;
            Block8x8F temp2 = default;

            Block8x8F onStackLuminanceQuantTable   = this.luminanceQuantTable;
            Block8x8F onStackChrominanceQuantTable = this.chrominanceQuantTable;

            var unzig = ZigZag.CreateUnzigTable();

            // ReSharper disable once InconsistentNaming
            int prevDCY = 0, prevDCCb = 0, prevDCCr = 0;

            var pixelConverter = YCbCrForwardConverter <TPixel> .Create();

            ImageFrame <TPixel> frame       = pixels.Frames.RootFrame;
            Buffer2D <TPixel>   pixelBuffer = frame.PixelBuffer;
            RowOctet <TPixel>   currentRows = default;

            for (int y = 0; y < pixels.Height; y += 8)
            {
                cancellationToken.ThrowIfCancellationRequested();
                currentRows.Update(pixelBuffer, y);

                for (int x = 0; x < pixels.Width; x += 8)
                {
                    pixelConverter.Convert(frame, x, y, ref currentRows);

                    prevDCY = this.WriteBlock(
                        QuantIndex.Luminance,
                        prevDCY,
                        ref pixelConverter.Y,
                        ref temp1,
                        ref temp2,
                        ref onStackLuminanceQuantTable,
                        ref unzig,
                        ref emitBufferBase);

                    prevDCCb = this.WriteBlock(
                        QuantIndex.Chrominance,
                        prevDCCb,
                        ref pixelConverter.Cb,
                        ref temp1,
                        ref temp2,
                        ref onStackChrominanceQuantTable,
                        ref unzig,
                        ref emitBufferBase);

                    prevDCCr = this.WriteBlock(
                        QuantIndex.Chrominance,
                        prevDCCr,
                        ref pixelConverter.Cr,
                        ref temp1,
                        ref temp2,
                        ref onStackChrominanceQuantTable,
                        ref unzig,
                        ref emitBufferBase);
                }
            }
        }
        private void InitOverlays()
        {
            defaultSeries = new FinancialSeries()
            {
                Name = "Box"
            };
            bollingerBands = new BollingerBands()
            {
                Name = "Bollinger Bands"
            };
            envelopes = new Envelopes()
            {
                Name = "Envoloper"
            };
            ichimokuCloud = new IchimokuCloud()
            {
                Name = "Ichimoku Cloud",
                ConversionLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Orange
                },
                BaseLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Blue
                },
                LaggingLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Black
                },
                LeadingSpanALineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.LightGreen
                },
                LeadingSpanBLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.IndianRed
                },
                BullishCloudColor = new SolidBrush(Color.LightGreen),
                BearishCloudColor = new SolidBrush(Color.IndianRed)
            };

            zigZag = new ZigZag()
            {
                Name = "ZigZag"
            };
            zigZag.Style.StrokeColor = Color.Green;
            zigZag.Style.StrokeWidth = 0.8f;

            alligator = new Alligator()
            {
                Name         = "Alligator",
                JawLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.LightGreen
                },
                TeethLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.IndianRed
                },
                LipsLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Black
                },
            };
        }
        /// <summary>
        /// от двух пар последних точек ЗЗ построить проекции
        /// </summary>
        public void BuildSeries(ChartControl chart)
        {
            spans.data.Clear();
            //spans.ExtendYAxis = ExtendChartBounds;
            // получить точки Зиг-Зага
            var pivots = ZigZag.GetPivots(chart.StockSeries.Data.Candles, ThresholdPercent, ZigZagSourceType);

            if (pivots.Count < 3)
            {
                return;
            }
            // построить проекции
            var pointA = pivots[pivots.Count - 3];
            var pointB = pivots[pivots.Count - 2];
            var pointC = pivots[pivots.Count - 1];

            var spanA = new ProjectionPair(pointA.index, pointA.price)
            {
                HideFarParts     = false,
                Color            = pointB.price > pointA.price ? ColorLineLower : ColorLineUpper,
                ProjectionLength = ProjectionBars,
                LevelsProj       = LevelsProj,
                Markers          = Markers
            };

            spanA.AddPoint(pointB.index, pointB.price);
            var spanB = new ProjectionPair(pointB.index, pointB.price)
            {
                HideFarParts     = false,
                Color            = pointB.price < pointA.price ? ColorLineLower : ColorLineUpper,
                ProjectionLength = ProjectionBars,
                LevelsProj       = LevelsProj,
                Markers          = Markers
            };

            spanB.AddPoint(pointC.index, pointC.price);
            spans.data.Add(spanA);
            spans.data.Add(spanB);
            // коррекции?
            if (!CorrectionEnabled)
            {
                return;
            }
            if (correctionBcLength > 0)
            {
                var spanC = new ProjectionPair(pointB.index, pointB.price)
                {
                    HideFarParts     = false,
                    Color            = pointB.price < pointA.price ? ColorLineLower : ColorLineUpper,
                    ProjectionLength = CorrectionBcLength,
                    LevelsCorr       = LevelsCorr,
                    IsExtension      = false,
                    IsCorrection     = true,
                    Markers          = Markers
                };
                spanC.AddPoint(pointC.index, pointC.price);
                spans.data.Add(spanC);
            }
            if (correctionAbLength > 0)
            {
                var spanC = new ProjectionPair(pointA.index, pointA.price)
                {
                    HideFarParts     = false,
                    Color            = pointB.price < pointA.price ? ColorLineLower : ColorLineUpper,
                    ProjectionLength = CorrectionAbLength,
                    LevelsCorr       = LevelsCorr,
                    IsExtension      = false,
                    IsCorrection     = true,
                    Markers          = Markers
                };
                spanC.AddPoint(pointB.index, pointB.price);
                spans.data.Add(spanC);
            }
        }
Beispiel #12
0
 protected override void OnStart()
 {
     _zigzag = Indicators.GetIndicator <ZigZag>(ZzDepth, ZzDeviation, ZzBackStep, MarketSeries);
 }
Beispiel #13
0
        protected override void Init()
        {
            _wprInd          = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
            _wprInd.ExtDepth = dept;

            if (Instrument.Name == "EURUSD")
            {
                NKZ = 506;
            }
            if (Instrument.Name == "GBPUSD")
            {
                NKZ = 792;
            }
            if (Instrument.Name == "AUDUSD")
            {
                NKZ = 343;
            }
            if (Instrument.Name == "NZDUSD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "USDJPY")
            {
                NKZ = 539;
            }
            if (Instrument.Name == "USDCAD")
            {
                NKZ = 573;
            }
            if (Instrument.Name == "USDCHF")
            {
                NKZ = 603;
            }
            if (Instrument.Name == "AUDJPY")
            {
                NKZ = 550;
            }
            if (Instrument.Name == "AUDNZD")
            {
                NKZ = 412;
            }
            if (Instrument.Name == "CHFJPY")
            {
                NKZ = 1430;
            }
            if (Instrument.Name == "EURAUD")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "AUDCAD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "EURCAD")
            {
                NKZ = 762;
            }
            if (Instrument.Name == "EURCHF")
            {
                NKZ = 627;
            }
            if (Instrument.Name == "EURGBP")
            {
                NKZ = 484;
            }
            if (Instrument.Name == "EURJPY")
            {
                NKZ = 781;
            }
            if (Instrument.Name == "GBPCHF")
            {
                NKZ = 924;
            }
            if (Instrument.Name == "GBPJPY")
            {
                NKZ = 1045;
            }

            toolRectangle             = Tools.Create <Rectangle>();
            toolRectangle.BorderColor = Color.Aqua;
            toolRectangle.Color       = Color.DarkSeaGreen;

            toolRectangle1             = Tools.Create <Rectangle>();
            toolRectangle1.BorderColor = Color.Aqua;
            toolRectangle1.Color       = Color.DarkSeaGreen;
            k = 0; first = true;
        }
Beispiel #14
0
 protected override void Init()
 {
     _wprInd          = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
     _wprInd.ExtDepth = ED;
     _ftoInd          = GetIndicator <FisherTransformOscillator>(Instrument.Id, Timeframe);
 }
Beispiel #15
0
        /// <summary>
        /// Encodes the image with subsampling. The Cb and Cr components are each subsampled
        /// at a factor of 2 both horizontally and vertically.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="pixels">The pixel accessor providing access to the image pixels.</param>
        private void Encode420 <TPixel>(Image <TPixel> pixels)
            where TPixel : struct, IPixel <TPixel>
        {
            // TODO: Need a JpegScanEncoder<TPixel> class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.)
            Block8x8F b = default;

            BlockQuad cb    = default;
            BlockQuad cr    = default;
            var       cbPtr = (Block8x8F *)cb.Data;
            var       crPtr = (Block8x8F *)cr.Data;

            Block8x8F temp1 = default;
            Block8x8F temp2 = default;

            Block8x8F onStackLuminanceQuantTable   = this.luminanceQuantTable;
            Block8x8F onStackChrominanceQuantTable = this.chrominanceQuantTable;

            var unzig = ZigZag.CreateUnzigTable();

            var pixelConverter = YCbCrForwardConverter <TPixel> .Create();

            // ReSharper disable once InconsistentNaming
            int prevDCY = 0, prevDCCb = 0, prevDCCr = 0;

            for (int y = 0; y < pixels.Height; y += 16)
            {
                for (int x = 0; x < pixels.Width; x += 16)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        int xOff = (i & 1) * 8;
                        int yOff = (i & 2) * 4;

                        pixelConverter.Convert(pixels.Frames.RootFrame, x + xOff, y + yOff);

                        cbPtr[i] = pixelConverter.Cb;
                        crPtr[i] = pixelConverter.Cr;

                        prevDCY = this.WriteBlock(
                            QuantIndex.Luminance,
                            prevDCY,
                            &pixelConverter.Y,
                            &temp1,
                            &temp2,
                            &onStackLuminanceQuantTable,
                            unzig.Data);
                    }

                    Block8x8F.Scale16X16To8X8(&b, cbPtr);
                    prevDCCb = this.WriteBlock(
                        QuantIndex.Chrominance,
                        prevDCCb,
                        &b,
                        &temp1,
                        &temp2,
                        &onStackChrominanceQuantTable,
                        unzig.Data);

                    Block8x8F.Scale16X16To8X8(&b, crPtr);
                    prevDCCr = this.WriteBlock(
                        QuantIndex.Chrominance,
                        prevDCCr,
                        &b,
                        &temp1,
                        &temp2,
                        &onStackChrominanceQuantTable,
                        unzig.Data);
                }
            }
        }
Beispiel #16
0
        static void Main(string[] args)
        {
            ValuesDataTaken data;
            string          method = "";

            Console.WriteLine("Escriba la ruta del archivo: ", data.File);
            Console.ReadLine();

            Console.WriteLine("Escriba nombre del nuevo archivo ", data.Name);
            Console.ReadLine();

            Console.WriteLine("Escriba la ruta del metodo a utilizar: ", method);
            Console.ReadLine();

            //Eleccion de cifrado.
            switch (method)
            {
            case "cipher/cesar":
                Console.WriteLine("Escriba la clave: ", data.word);
                Console.ReadLine();

                Cesar.Cipher(data);
                break;

            case "cipher/zigzag":
                Console.WriteLine("Escriba la cantidad de olas: ", data.levels);
                Console.ReadLine();

                ZigZag.Cipher(new NumbersDataTaken {
                    File = data.File, Name = data.Name, levels = Convert.ToInt32(data.levels)
                });
                break;

            case "cipher/route":
                Console.WriteLine("Escriba la cantidad de olas: ", data.rows);
                Console.ReadLine();

                Console.WriteLine("Escriba la cantidad de olas: ", data.columns);
                Console.ReadLine();

                Route.Cipher(new NumbersDataTaken {
                    File = data.File, Name = data.Name, rows = Convert.ToInt32(data.rows), columns = Convert.ToInt32(data.columns)
                });
                break;

            case "decipher/cesar":
                Console.WriteLine("Escriba la clave: ", data.word);
                Console.ReadLine();

                Cesar.Decipher(data);
                break;

            case "decipher/zigzag":
                Console.WriteLine("Escriba la cantidad de olas: ", data.levels);
                Console.ReadLine();

                ZigZag.Decipher(new NumbersDataTaken {
                    File = data.File, Name = data.Name, levels = Convert.ToInt32(data.levels)
                });
                break;

            case "decipher/route":
                Console.WriteLine("Escriba la cantidad de olas: ", data.rows);
                Console.ReadLine();

                Console.WriteLine("Escriba la cantidad de olas: ", data.columns);
                Console.ReadLine();

                Route.Decipher(new NumbersDataTaken {
                    File = data.File, Name = data.Name, rows = Convert.ToInt32(data.rows), columns = Convert.ToInt32(data.columns)
                });
                break;
            }
        }
Beispiel #17
0
 public sbyte PeekSByte(int bitCount = 8)
 {
     return((sbyte)ZigZag.Zag(PeekUInt32(bitCount)));
 }
        public void ZigZagConversionMethod1()
        {
            string value = ZigZag.ConvertZigZag("PAYPALISHIRING", 1);

            Assert.AreEqual("PAYPALISHIRING", value);
        }
Beispiel #19
0
 public int PeekInt32(int bitCount = 32)
 {
     return(ZigZag.Zag(PeekUInt32(bitCount)));
 }
        public void ZigZagConversionMethod2()
        {
            string value = ZigZag.ConvertZigZag("PAYPALISHIRING", 3);

            Assert.AreEqual("PAHNAPLSIIGYIR", value);
        }
Beispiel #21
0
 public void WriteSByte(sbyte value, int bitCount = 8)
 {
     Write(ZigZag.Zig(value), bitCount);
 }
        public void ZigZagConversionMethod3()
        {
            string value = ZigZag.ConvertZigZag("PAYPALISHIRING", 4);

            Assert.AreEqual("PINALSIGYAHRPI", value);
        }
Beispiel #23
0
 public void WriteInt32(int value, int bitCount = 32)
 {
     Write(ZigZag.Zig(value), bitCount);
 }
Beispiel #24
0
        protected override void Init()
        {       //dt1=Bars[Bars.Range.To-1].Time;
            k = 0;
            _wprInd.ReInit();
            dt1 = dt1.AddHours(-3);
            iFT = TimeToIndex(dt1, Timeframe);

            //Print("Init - {0} - {1} - {2} - k={3}",dt1,Bars[Bars.Range.To-1].Time,Bars[iFT].Time,k);

            //toolPolyLine = Tools.Create<PolyLine>(); toolPolyLine.Color=Color.Aqua;
            toolRectangle  = Tools.Create <Rectangle>(); toolRectangle.BorderColor = Color.Aqua; toolRectangle.Color = Color.DarkSeaGreen;
            toolRectangle1 = Tools.Create <Rectangle>(); toolRectangle1.BorderColor = Color.Aqua; toolRectangle1.Color = Color.DarkSeaGreen;
            //toolRectangle2 = Tools.Create<Rectangle>(); toolRectangle1.BorderColor=Color.Aqua; toolRectangle1.Color=Color.DarkSeaGreen;

            _frInd           = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            first            = true;
            _wprInd          = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
            _wprInd.ExtDepth = 5;
            // 15/05/2018
            if (Instrument.Name == "EURUSD")
            {
                NKZ = 462;
            }
            if (Instrument.Name == "GBPUSD")
            {
                NKZ = 792;
            }
            if (Instrument.Name == "AUDUSD")
            {
                NKZ = 343;
            }
            if (Instrument.Name == "NZDUSD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "USDJPY")
            {
                NKZ = 527;
            }
            if (Instrument.Name == "USDCAD")
            {
                NKZ = 491;
            }
            if (Instrument.Name == "USDCHF")
            {
                NKZ = 608;
            }
            if (Instrument.Name == "AUDJPY")
            {
                NKZ = 550;
            }
            if (Instrument.Name == "AUDNZD")
            {
                NKZ = 412;
            }
            if (Instrument.Name == "CHFJPY")
            {
                NKZ = 1430;
            }
            if (Instrument.Name == "EURAUD")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "AUDCAD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "EURCAD")
            {
                NKZ = 762;
            }
            if (Instrument.Name == "EURCHF")
            {
                NKZ = 539;
            }
            if (Instrument.Name == "EURGBP")
            {
                NKZ = 484;
            }
            if (Instrument.Name == "EURJPY")
            {
                NKZ = 715;
            }
            if (Instrument.Name == "GBPCHF")
            {
                NKZ = 924;
            }
            if (Instrument.Name == "GBPJPY")
            {
                NKZ = 1045;
            }
        }
Beispiel #25
0
 public sbyte ReadSByte(int bitCount = 8)
 {
     return((sbyte)ZigZag.Zag(ReadUInt32(bitCount)));
 }
Beispiel #26
0
        protected override void Init()
        {
            dlt     = dl * Instrument.Point;
            nu      = false; nd = false; frac = 7;
            _ftoInd = GetIndicator <FisherTransformOscillator>(Instrument.Id, Timeframe);

            toolPolyLine   = Tools.Create <PolyLine>(); toolPolyLine.Color = Color.Aqua;
            toolRectangle  = Tools.Create <Rectangle>(); toolRectangle.BorderColor = Color.Aqua; toolRectangle.Color = Color.DarkSeaGreen;
            toolRectangle1 = Tools.Create <Rectangle>(); toolRectangle1.BorderColor = Color.Aqua; toolRectangle1.Color = Color.DarkSeaGreen;

            zmax             = 0.0; zmin = 1000.0;
            per              = false;
            first            = true; t1 = true; t2 = true;
            _wprInd          = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
            _wprInd.ExtDepth = 5;
            // 15/05/2018
            if (Instrument.Name == "EURUSD")
            {
                NKZ = 462;  mgB = 101; mgS = 201;
            }
            if (Instrument.Name == "GBPUSD")
            {
                NKZ = 792;  mgB = 102; mgS = 202;
            }
            if (Instrument.Name == "AUDUSD")
            {
                NKZ = 343;  mgB = 103; mgS = 203;
            }
            if (Instrument.Name == "NZDUSD")
            {
                NKZ = 357;  mgB = 104; mgS = 204;
            }
            if (Instrument.Name == "USDJPY")
            {
                NKZ = 527;  mgB = 105; mgS = 205;
            }
            if (Instrument.Name == "USDCAD")
            {
                NKZ = 491;  mgB = 106; mgS = 206;
            }
            if (Instrument.Name == "USDCHF")
            {
                NKZ = 608;  mgB = 107; mgS = 207;
            }
            if (Instrument.Name == "AUDJPY")
            {
                NKZ = 550;  mgB = 108; mgS = 208;
            }
            if (Instrument.Name == "AUDNZD")
            {
                NKZ = 412;  mgB = 109; mgS = 209;
            }
            if (Instrument.Name == "CHFJPY")
            {
                NKZ = 1430; mgB = 110; mgS = 210;
            }
            if (Instrument.Name == "EURAUD")
            {
                NKZ = 682;  mgB = 111; mgS = 211;
            }
            if (Instrument.Name == "AUDCAD")
            {
                NKZ = 357;  mgB = 112; mgS = 212;
            }
            if (Instrument.Name == "EURCAD")
            {
                NKZ = 762;  mgB = 113; mgS = 213;
            }
            if (Instrument.Name == "EURCHF")
            {
                NKZ = 539;  mgB = 114; mgS = 214;
            }
            if (Instrument.Name == "EURGBP")
            {
                NKZ = 484;  mgB = 115; mgS = 215;
            }
            if (Instrument.Name == "EURJPY")
            {
                NKZ = 715;  mgB = 116; mgS = 216;
            }
            if (Instrument.Name == "GBPCHF")
            {
                NKZ = 924;  mgB = 117; mgS = 217;
            }
            if (Instrument.Name == "GBPJPY")
            {
                NKZ = 1045; mgB = 118; mgS = 218;
            }

            var posActiveMineB = Trade.GetActivePositions(mgB, true);

            if (posActiveMineB != null && posActiveMineB.Length > 0)
            {
                posGuidBuy = posActiveMineB[0].Id;
            }
            var posActiveMineS = Trade.GetActivePositions(mgS, true);

            if (posActiveMineS != null && posActiveMineS.Length > 0)
            {
                posGuidSell = posActiveMineS[0].Id;
            }
        }
Beispiel #27
0
 public int ReadInt32(int bitCount = 32)
 {
     return(ZigZag.Zag(ReadUInt32(bitCount)));
 }
Beispiel #28
0
 protected override void Init()
 {
     _wprInd = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
     var vr = Tools.Create <VerticalLine>(); vr.Color = Color.Red; vr.Width = 5; vr.Time = Bars[Bars.Range.To - 1].Time;
 }
Beispiel #29
0
 protected override void Init()
 {
     _wprInd          = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
     _wprInd.ExtDepth = ED;
 }
Beispiel #30
0
 public void TestZigZag()
 {
     ZigZag zz  = new ZigZag();
     var    res = zz.Convert("PAYPALISHIRING", 2);
 }