Ejemplo n.º 1
0
        public static Reptile CreateReptile(ReptileSpecies Species)
        {
            Reptile animalObj = null;//Animaltype unknown at this time.

            //Lets determine users choice of animal.
            switch (Species)
            {
                case ReptileSpecies.Alligator:
                    animalObj = new Alligator();
                    break;
                case ReptileSpecies.Cobra:
                    animalObj = new Cobra();
                    break;
                case ReptileSpecies.Komodo:
                    animalObj = new Komodo();
                    break;

                default:
                    Debug.Assert(false, "Not implemented");
                    break;
            }

            //Set animal category
            animalObj.Category = CategoryType.Reptile;

            return animalObj;//Return created instance of object.
        }
Ejemplo n.º 2
0
        public static Reptile CreateReptile(ReptileSpecies Species)
        {
            Reptile animalObj = null;//Animaltype unknown at this time.

            //Lets determine users choice of animal.
            switch (Species)
            {
            case ReptileSpecies.Alligator:
                animalObj = new Alligator();
                break;

            case ReptileSpecies.Cobra:
                animalObj = new Cobra();
                break;

            case ReptileSpecies.Komodo:
                animalObj = new Komodo();
                break;

            default:
                Debug.Assert(false, "Not implemented");
                break;
            }

            //Set animal category
            animalObj.Category = CategoryType.Reptile;

            return(animalObj);//Return created instance of object.
        }
Ejemplo n.º 3
0
        public StrategyBillWilliams(string name, StartProgram startProgram)
            : base(name, startProgram)
        {
            TabCreate(BotTabType.Simple);
            _tab = TabsSimple[0];

            _tab.CandleFinishedEvent += Bot_CandleFinishedEvent;

            Regime                    = CreateParameter("Regime", "Off", new[] { "Off", "On", "OnlyLong", "OnlyShort", "OnlyClosePosition" });
            Slippage                  = CreateParameter("Slipage", 0, 0, 20, 1);
            VolumeFirst               = CreateParameter("FirstInterVolume", 3, 1.0m, 50, 1);
            VolumeSecond              = CreateParameter("SecondInterVolume", 1, 1.0m, 50, 1);
            MaximumPositions          = CreateParameter("MaxPoses", 1, 1, 10, 1);
            AlligatorFastLineLength   = CreateParameter("AlligatorFastLineLength", 3, 3, 30, 1);
            AlligatorMiddleLineLength = CreateParameter("AlligatorMiddleLineLength", 10, 10, 70, 5);
            AlligatorSlowLineLength   = CreateParameter("AlligatorSlowLineLength", 40, 40, 150, 10);

            _alligator = new Alligator(name + "Alligator", false);
            _alligator = (Alligator)_tab.CreateCandleIndicator(_alligator, "Prime");
            _alligator.Save();

            _alligator.LenghtDown = AlligatorSlowLineLength.ValueInt;
            _alligator.LenghtBase = AlligatorMiddleLineLength.ValueInt;
            _alligator.LenghtUp   = AlligatorFastLineLength.ValueInt;

            _fractal = new Fractal(name + "Fractal", false);
            _fractal = (Fractal)_tab.CreateCandleIndicator(_fractal, "Prime");

            _aO = new AwesomeOscillator(name + "AO", false);
            _aO = (AwesomeOscillator)_tab.CreateCandleIndicator(_aO, "AoArea");
            _aO.Save();

            ParametrsChangeByUser += StrategyBillWilliams_ParametrsChangeByUser;
        }
Ejemplo n.º 4
0
 protected override void Init()
 {   // Вставить индикатор Alligator
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     // Вставить индикатор Fractals
     _frInd       = GetIndicator <Fractals>(Instrument.Id, Timeframe);
     _frInd.Range = fRan;
 }
Ejemplo n.º 5
0
        protected override void Init()
        {
            // Event occurs once at the start of the strategy
            // Вставить индикатор Alligator
            _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
            // Вставить индикатор Fractals
            _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);

            hline     = Tools.Create <HorizontalLine>();
            lline     = Tools.Create <HorizontalLine>();
            vlR       = Tools.Create <VerticalLine>();
            vlR.Color = Color.Red;
            vlB       = Tools.Create <VerticalLine>();
            vlB.Color = Color.Blue;
            vlY       = Tools.Create <VerticalLine>();
            vlY.Color = Color.Yellow;
            vlG       = Tools.Create <VerticalLine>();
            vlG.Color = Color.DarkGreen;

            //periodM15 = new Period(PeriodType.Minute, 15);
            //_barSeries = GetCustomSeries(Instrument.Id, Period.H1);
            //_barM15 = GetCustomSeries(Instrument.Id,periodM15);
            //_ftoInd   = GetIndicator<FisherTransformOscillator>(Instrument.Id, Period.H1);
            //_ftoIndM15= GetIndicator<FisherTransformOscillator>(Instrument.Id, periodM15);
        }
Ejemplo n.º 6
0
        public void AlligatorCanSpeakAndEat()
        {
            Alligator seeYaLater = new Alligator();

            Assert.Equal("Rrrrrrrrrrrrrrrrr...", seeYaLater.Speak());
            Assert.Equal("Employees are feeding the alligators.", seeYaLater.StaffFeedAnimal());
        }
Ejemplo n.º 7
0
        public void AlligatorIsASwimmingAnimal()
        {
            Alligator seeYaLater = new Alligator();

            Assert.Equal("I'm an alligator and I can swim!", seeYaLater.Swim());
            Assert.IsAssignableFrom <Animals>(seeYaLater);
        }
Ejemplo n.º 8
0
 protected override void Init()
 {
     // Event occurs once at the start of the strategy
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     _frInd  = GetIndicator <Fractals>(Instrument.Id, Timeframe);
     _awoInd = GetIndicator <AwesomeOscillator>(Instrument.Id, Timeframe);
     //_aoInd =  GetIndicator<AcceleratorOscillator>(Instrument.Id, Timeframe);
 }
Ejemplo n.º 9
0
 protected override void Init()
 {
     // Event occurs once at the start of the strategy
     // Вставить индикатор Alligator
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     // Вставить индикатор Fractals
     _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);
 }
Ejemplo n.º 10
0
        public void ToStringTest()
        {
            //count initialized to 1.
            Alligator target   = new Alligator();
            var       expected = "1 alligator";
            var       actual   = target.ToString();

            Assert.AreEqual(actual, expected);
        }
Ejemplo n.º 11
0
        public void GetCountTest()
        {
            //count initialized to 1.
            Alligator target   = new Alligator();
            var       expected = 1;
            var       actual   = target.GetCount();

            Assert.AreEqual(actual, expected);
        }
        double fr_all_Down;           // Цена последней свечи с фракталом - полностью ниже Аллигатора

        protected override void Init()
        {
            // Event occurs once at the start of the strategy
            Print("Starting TS on account: {0}, comment: {1}", this.Account.Number, CommentText);
            // Вставить индикатор Alligator
            _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
            // Вставить индикатор Fractals
            _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);
        }
Ejemplo n.º 13
0
 protected override void Init()
 {
     // Вставить индикатор Alligator
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     // Вставить индикатор Fractals
     _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);
     // начальные значения для фракталов не касающиеся алигатора
     fr_all_Up   = Bars[Bars.Range.To - 1].High;
     fr_all_Down = Bars[Bars.Range.To - 1].Low;
 }
Ejemplo n.º 14
0
 protected override void Init()
 {
     // Event occurs once at the start of the strategy
     // Вставить индикатор Alligator
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     // Вставить индикатор Fractals
     _frInd  = GetIndicator <Fractals>(Instrument.Id, Timeframe);
     _awoInd = GetIndicator <AwesomeOscillator>(Instrument.Id, Timeframe);
     //_aoInd =  GetIndicator<AcceleratorOscillator>(Instrument.Id, Timeframe);
     _ftoInd = GetIndicator <FisherTransformOscillator>(Instrument.Id, Timeframe);
 }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            var americanAlligator = new Alligator(100);

            americanAlligator.IsAquatic = true;

            var africanAlligator = new Alligator(2);

            africanAlligator.IsAquatic = false;

            americanAlligator.Run(75);
            africanAlligator.Run(4);

            americanAlligator.Run(40);
        }
Ejemplo n.º 16
0
        protected override void Init()
        {
            // Event occurs once at the start of the strategy
            // Вставить индикатор Alligator
            _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
            // Вставить индикатор Fractals
            _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);


            periodM15  = new Period(PeriodType.Minute, 15);
            _barSeries = GetCustomSeries(Instrument.Id, Period.H1);
            _barM15    = GetCustomSeries(Instrument.Id, periodM15);
            _ftoInd    = GetIndicator <FisherTransformOscillator>(Instrument.Id, Period.H1);
            _ftoIndM15 = GetIndicator <FisherTransformOscillator>(Instrument.Id, periodM15);
        }
Ejemplo n.º 17
0
        protected override void Init()
        {
            // Event occurs once at the start of the strategy
            Print("Starting TS on account: {0}, comment: {1}", this.Account.Number, CommentText);
            // Вставить индикатор Alligator
            _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
            // Вставить индикатор Fractals
            _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);

            vlR         = Tools.Create <VerticalLine>();
            vlR.Color   = Color.Red;
            vlB         = Tools.Create <VerticalLine>();
            vlB.Color   = Color.Blue;
            hline       = Tools.Create <HorizontalLine>();
            hline.Price = Bars[Bars.Range.To - 1].Close;
        }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            var americanAlligator = new Alligator(6000);

            americanAlligator.isAquatic = true;

            var fictionalAlligator = new Alligator(200);

            fictionalAlligator.isAquatic = false;

            americanAlligator.Grunt();
            fictionalAlligator.Grunt();

            americanAlligator.Run(80);
            fictionalAlligator.Run(500);
            americanAlligator.Run(5930);
        }
Ejemplo n.º 19
0
        protected override void Init()
        {
            // Event occurs once at the start of the strategy
            Print("Starting TS on account: {0}, comment: {1}", this.Account.Number, CommentText);
            // Вставить индикатор Alligator
            _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
            // Вставить индикатор Fractals
            _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            // начальные значения для фракталов не касающиеся алигатора
            fr_all_Up   = Bars[Bars.Range.To - 1].High;
            fr_all_Down = Bars[Bars.Range.To - 1].Low;

            vlR = Tools.Create <VerticalLine>(); vlR.Color = Color.Red;
            vlB = Tools.Create <VerticalLine>(); vlB.Color = Color.Blue;
            vlY = Tools.Create <VerticalLine>(); vlY.Color = Color.Yellow;
            vlG = Tools.Create <VerticalLine>(); vlG.Color = Color.DarkGreen;
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            var americanAlligator = new Alligator(100);

            americanAlligator.IsAquatic = true;

            var africanAlligator = new Alligator(2);

            africanAlligator.IsAquatic = false;

            americanAlligator.Run(75);
            africanAlligator.Run(4);

            americanAlligator.Run(40);
            //africanAlligator.Grunt();
            //americanAlligator.Grunt();
            //Called instantion... alligator is the constructor
        }
Ejemplo n.º 21
0
 protected override void Init()
 {
     // Event occurs once at the start of the strategy
     // Вставить индикатор Alligator
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     // Вставить индикатор Fractals
     _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);
     // Набор линий для визуального контроля стратегии
     hline     = Tools.Create <HorizontalLine>();
     lline     = Tools.Create <HorizontalLine>();
     vlR       = Tools.Create <VerticalLine>();
     vlR.Color = Color.Red;
     vlB       = Tools.Create <VerticalLine>();
     vlB.Color = Color.Blue;
     vlY       = Tools.Create <VerticalLine>();
     vlY.Color = Color.Yellow;
     vlG       = Tools.Create <VerticalLine>();
     vlG.Color = Color.DarkGreen;
 }
Ejemplo n.º 22
0
 protected override void Init()
 {
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     // Fractals
     _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe); _frInd.Range = 5;
     // AO   - определяет движущую силу рынка
     _awoInd = GetIndicator <AwesomeOscillator>(Instrument.Id, Timeframe);
     // Fisher
     _ftoInd = GetIndicator <FisherTransformOscillator>(Instrument.Id, Timeframe);
     // Stohastic
     _stoInd = GetIndicator <StochasticOscillator>(Instrument.Id, Timeframe);
     // Moving Average
     _ma1 = GetIndicator <MovingAverage>(Instrument.Id, Timeframe, 85, 0, MaMethods.Lwma, PriceMode.Close);
     // MACD
     _macd = GetIndicator <MovingAverageConvergenceDivergence> (Instrument.Id, Timeframe);
     _macd.FastEmaPeriod = 15;  _macd.AppliedPrice = PriceMode.Low; _macd.SlowEmaPeriod = 26; _macd.SmaPeriod = 1;
     //
     _wprInd = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
 }
Ejemplo n.º 23
0
    public AliggatorPuddle(float puddleWidth, float x, float y) : base("puddle.png", false, false)
    {
        SetXY(x, y);
        width = (int)puddleWidth;

        visuals = new DeathTrigger(10, 10, (int)puddleWidth - 20);

        AddChild(visuals);

        int alligatorIndex = 0;

        for (int xPos = 0 + (int)puddleWidth / 6; xPos < puddleWidth; xPos += (int)puddleWidth / 3)
        {
            triggers[alligatorIndex] = new Alligator(xPos, -10);
            triggers[alligatorIndex].SetScaleXY(0.5f, 0.5f);
            triggers[alligatorIndex].SetOrigin(triggers[alligatorIndex].width / 2, 0);
            AddChild(triggers[alligatorIndex]);
            Console.WriteLine(triggers[alligatorIndex]);
            alligatorIndex++;
        }
    }
Ejemplo n.º 24
0
        protected override void Init()
        {
            SL = SL_ / 100;
            TP = TP_ / 100;
            // Event occurs once at the start of the strategy
            Print("Starting TS on account:{2} {3} {0}, comment: {1}", this.Account.Number, CommentText, TP, SL);
            // Вставить индикатор Alligator
            _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
            // Вставить индикатор Fractals
            _frInd = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            // начальные значения для фракталов не касающиеся алигатора
            fr_all_Up   = Bars[Bars.Range.To - 1].High;
            fr_all_Down = Bars[Bars.Range.To - 1].Low;

            _wprInd = GetIndicator <ZigZag>(Instrument.Id, Timeframe);
            Print("ZigZag - ExtBackStep={0} ExtDepth={1} ExtDeviation={2} SecurityExceptionOccurred={3}", _wprInd.ExtBackStep, _wprInd.ExtDepth, _wprInd.ExtDeviation, _wprInd.SecurityExceptionOccurred);

            vlR = Tools.Create <VerticalLine>(); vlR.Color = Color.Red;
            vlB = Tools.Create <VerticalLine>(); vlB.Color = Color.Blue;
            vlY = Tools.Create <VerticalLine>(); vlY.Color = Color.Yellow;
            vlG = Tools.Create <VerticalLine>(); vlG.Color = Color.DarkGreen;
        }
Ejemplo n.º 25
0
        // below is a function, more specifically a method
        static void Main(string[] args)
        {
            // creating instance to have access to Alligator class. This process is called instantiation - calls constructor of alligator and gets copy of class
            var americanAlligator = new Alligator(100);

            // statically defining property
            americanAlligator.IsAquatic = true;

            // different data of the same copy. Same class, different data
            var africanAlligator = new Alligator(2);

            africanAlligator.IsAquatic = false;

            // get access to method
            //alligator.Grunt();
            //africanAlligator.Grunt();
            //americanAlligator.Grunt();
            americanAlligator.Run(75);
            africanAlligator.Run(4);

            americanAlligator.Run(40);

            Console.ReadKey();
        }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            // Brown bear instance
            BrownBear yogi = new BrownBear();

            yogi.AnimalCount++;
            Console.WriteLine($"{yogi.Speak()} I'm a brown bear!");
            Console.WriteLine($"There are {yogi.AnimalCount} brown bears in the Zoo.");
            Console.WriteLine($"Is the brown bear a warm blooded animal? {yogi.IsWarmBlooded}");
            Console.WriteLine(yogi.BearHug());
            Console.WriteLine(yogi.GuestFeedAnimal());

            Console.WriteLine();

            // Tiger instance
            Tiger tony = new Tiger();

            Console.WriteLine(tony.Feed());
            Console.WriteLine(tony.StaffFeedAnimal());
            Console.WriteLine(tony.Swim());

            Console.WriteLine();

            // Black bear instance
            BlackBear baloo = new BlackBear();

            Console.WriteLine($"{baloo.Speak()} I'm a black bear!");
            Console.WriteLine(baloo.Swim());

            Console.WriteLine();

            // Platypus instance
            Platypus abomination = new Platypus();

            Console.WriteLine($"I'm a platypus! Am I venomous? {abomination.IsVenomous}");
            Console.WriteLine(abomination.Feed());

            Console.WriteLine();

            // Alligator instance
            Alligator seeYaLater = new Alligator();

            Console.WriteLine($"There are {seeYaLater.AnimalCount} alligators in the zoo.");
            Console.WriteLine($"Do gators lay eggs? {seeYaLater.LaysEggs}");
            Console.WriteLine(seeYaLater.Feed());

            Console.WriteLine();

            // Sea Turtle instance
            SeaTurtle timmy = new SeaTurtle();

            Console.WriteLine($"I'm a sea turtle! Do I lay eggs? {timmy.LaysEggs}");
            Console.WriteLine(timmy.Swim());

            Console.WriteLine();

            // Box Turtle instance
            BoxTurtle michaelangelo = new BoxTurtle();

            Console.WriteLine($"I'm a box turtle! Can I swim? {michaelangelo.LivesInWater}");
            Console.WriteLine(michaelangelo.Feed());

            Console.WriteLine();

            // King Cobra instance
            KingCobra commander = new KingCobra();

            Console.WriteLine($"I'm a king cobra! Am I venomous? {commander.IsVenomous}");
            Console.WriteLine($"Do I lay eggs? {commander.LaysEggs}");
            Console.WriteLine(commander.Feed());
        }
Ejemplo n.º 27
0
        static void Main(string[] args)
        {
            var jericho = new Snake("Jericho", "Boa Constrictor");

            jericho.FeedReptile();
            jericho.Speak();
            jericho.Slither();

            var rogue = new Iguana("Rogue", "Green Iguana");

            rogue.FeedReptile();
            rogue.Speak();
            rogue.Dislike();

            var snuggles = new Alligator("Snuggles", "American Alligator");

            snuggles.FeedReptile();
            snuggles.Speak();
            snuggles.DeathRoll();

            var fgfc820 = new Industrial("FGFC820", "Aggrotech")
            {
                AlbumNumber = 10
            };

            fgfc820.RockOut("Bridgestone Arena");
            fgfc820.CheckAlbums();
            fgfc820.Bringit();

            var vnvNation = new Industrial("VNV Nation", "EBM")
            {
                AlbumNumber = 20
            };

            vnvNation.RockOut("Exit/In");
            vnvNation.CheckAlbums();
            vnvNation.Bringit();

            var bach = new Classical("Johan Sebestian Bach", "Baroque");

            bach.Encore();

            var theGrapesOfWrath = new Novel("The Grapes of Wrath", 525, "John Steinbeck")
            {
                HaveRead = true
            };

            theGrapesOfWrath.Open();
            theGrapesOfWrath.Read();

            var braveNewWorld = new Novel("Brave New World", 452, "Aldous Huxley")
            {
                HaveRead = false
            };

            braveNewWorld.Read();

            var verdi = new PictureBook("Verdi", 15, "Janell Cannon");

            verdi.Read();

            var worldOfWarcraft = new VideoGames("World of Warcraft", new DateTime(2004, 11, 24))
            {
                Developer = "Blizzard",
                GameGenre = GameGenre.MMO
            };

            worldOfWarcraft.Play();
            worldOfWarcraft.Return();

            var doom = new VideoGames("Doom", new DateTime(1993, 12, 10))
            {
                Developer = "id Software",
                GameGenre = GameGenre.Shooter
            };

            doom.Play();
            doom.Return();

            Console.ReadKey();
        }
Ejemplo n.º 28
0
 protected override void Init()
 {
     // Event occurs once at the start of the strategy
     _allInd = GetIndicator <Alligator>(Instrument.Id, Timeframe);
     _frInd  = GetIndicator <Fractals>(Instrument.Id, Timeframe);
 }
        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
                },
            };
        }