예제 #1
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "ConstanceBrown";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
                AddDataSeries(Data.BarsPeriodType.Second, 5);

                stochasticsFast_14_3 = StochasticsFast(3, 14);
                stochasticsFast_14_3.Plots[0].Brush = Brushes.Transparent;
                stochasticsFast_14_3.Plots[1].Brush = Brushes.Red;
                AddChartIndicator(stochasticsFast_14_3);

                compositeIndex = CompositeIndex(14, 9, 3, 3);
                AddChartIndicator(compositeIndex);

                List <DisasbleTimeRange> disableTimeRanges = new List <DisasbleTimeRange>();
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 0, StartMinute = 0, EndHour = 9, EndMinute = 59 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 12, StartMinute = 30, EndHour = 24, EndMinute = 59 });

                foreach (DisasbleTimeRange d in disableTimeRanges)
                {
                    disableManager.AddRange(DayOfWeek.Sunday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Monday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Tuesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Wednesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Thursday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Friday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                }
            }
        }
예제 #2
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "HeikenAshiPullbacks";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;
                ProfitTicks                  = 3;
                StopLossTicks                = 8;
                TrendStrength                = 5;
                InitialQuantity              = 2;
                LetItRideQuantity            = 1;
                TrailingBarsStop             = 3;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
                AddDataSeries(Data.BarsPeriodType.Second, 1);

                autoTrend = AutoTrendHNT8(false, this.TrendStrength, true, false, 60, Brushes.DarkRed, Brushes.Chartreuse, Brushes.DarkRed, Brushes.Chartreuse);
                AddChartIndicator(autoTrend);

                swing = Swing(this.TrendStrength);
                AddChartIndicator(swing);

                momentum = Momentum(14);
                AddChartIndicator(momentum);

                stochasticsFast_14_3 = EnhancedStochasticsFast(3, 14, Brushes.Chartreuse, Brushes.Transparent, true, 1);
                AddChartIndicator(stochasticsFast_14_3);

                greenBarStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.GreenBar, 0, 0);
                AddChartIndicator(greenBarStick);

                redBarStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.RedBar, 0, 0);
                AddChartIndicator(redBarStick);

                List <DisasbleTimeRange> disableTimeRanges = new List <DisasbleTimeRange>();
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 6, StartMinute = 0, EndHour = 18, EndMinute = 00
                });

                foreach (DisasbleTimeRange d in disableTimeRanges)
                {
                    disableManager.AddRange(DayOfWeek.Sunday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Monday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Tuesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Wednesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Thursday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Friday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                }
            }
        }
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"ThaAdxRideTheTrend";
                Name                         = "ThaAdxRideTheTrend";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;

                TradingAccountId           = 0;
                ExitPeriod                 = 3;
                AdxPeriod                  = 14;
                MinAdx                     = 25;
                ExitSlopeThreshold         = -15;
                UseBoundaryHours           = true;
                StartHour                  = 7;
                StartMinute                = 30;
                EndHour                    = 12;
                EndMinute                  = 30;
                LossExitTicks              = 8;
                EnterPeriod                = 3;
                EnterSlopeThreshold        = 20;
                RecordHistoricalTrades     = false;
                EnterBarsLength            = 2;
                ExitBarsLength             = 2;
                EnterViaLimit              = true;
                EnterViaStop               = true;
                ExitStopBuffer             = 2;
                ExitLimitBuffer            = 2;
                Quantity                   = 2;
                MinTickRange               = 8;
                FireSns                    = false;
                MinTrendLength             = 1;
                TargetDollars              = 0;
                TrailingStopMinDollars     = 0;
                TrailingStopDivisorDollars = 0;
                TrailingStopCushionDollars = 0;
                OverrideRealTimeOnly       = false;
            }
            else if (State == State.Configure)
            {
                //SetOrderQuantity = SetOrderQuantity.DefaultQuantity;

                trailingStopEnabled = TrailingStopMinDollars > 0;

                if (trailingStopEnabled)
                {
                    AddDataSeries(BarsPeriodType.Tick, 300);
                }

                tickCounter = TickCounter(true, false);
                AddChartIndicator(tickCounter);

                rangeIndicator = MyRange(14, MinTickRange);
                //AddChartIndicator(rangeIndicator);

                adxIndicator = EnhancedADX(AdxPeriod, MinAdx);
                AddChartIndicator(adxIndicator);

                if (EnterPeriod > 1)
                {
                    enterAdxSlopeIndicator = AdxSlope(AdxPeriod, EnterPeriod, EnterSlopeThreshold);
                    AddChartIndicator(enterAdxSlopeIndicator);
                }

                if (ExitPeriod > 1)
                {
                    exitAdxSlopeIndicator = AdxSlope(AdxPeriod, ExitPeriod, ExitSlopeThreshold);
                    //AddChartIndicator(exitAdxSlopeIndicator);
                }

                disableManager.AddRange(DayOfWeek.Monday, 6, 25, 6, 50);
                disableManager.AddRange(DayOfWeek.Tuesday, 6, 25, 6, 50);
                disableManager.AddRange(DayOfWeek.Wednesday, 6, 25, 6, 50);
                disableManager.AddRange(DayOfWeek.Thursday, 6, 25, 6, 50);
                disableManager.AddRange(DayOfWeek.Friday, 6, 25, 6, 50);

                //                disableManager.AddRange(DayOfWeek.Sunday, 15, 45, 24, 0);
                //                disableManager.AddRange(DayOfWeek.Monday, 15, 45, 24, 0);
                //                disableManager.AddRange(DayOfWeek.Tuesday, 15, 45, 24, 0);
                //                disableManager.AddRange(DayOfWeek.Wednesday, 15, 45, 24, 0);
                //                disableManager.AddRange(DayOfWeek.Thursday, 15, 45, 24, 0);
                //                disableManager.AddRange(DayOfWeek.Friday, 15, 45, 24, 0);
            }
            else if (State == State.DataLoaded)
            {
            }
        }
예제 #4
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "ThaAdxOneBar";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;

                TradingAccountId       = 0;
                ExitPeriod             = 3;
                AdxPeriod              = 14;
                MinAdx                 = 25;
                ExitSlopeThreshold     = -15;
                UseBoundaryHours       = true;
                StartHour              = 7;
                StartMinute            = 30;
                EndHour                = 12;
                EndMinute              = 30;
                LossExitTicks          = 8;
                EnterPeriod            = 3;
                EnterSlopeThreshold    = 20;
                RecordHistoricalTrades = false;
                EnterBarsLength        = 2;
                ExitBarsLength         = 2;
                EnterViaLimit          = true;
                EnterViaStop           = true;
                ExitStopBuffer         = 2;
                ExitLimitBuffer        = 2;
                Quantity               = 2;
                MinTickRange           = 8;
//                FastMaPeriod = 5;
//                SlowMaPeriod = 10;
//                MinMaDiff = 0.4;
            }
            else if (State == State.Configure)
            {
                //SetOrderQuantity = SetOrderQuantity.DefaultQuantity;

                adxIndicator = EnhancedADX(AdxPeriod, MinAdx);
                AddChartIndicator(adxIndicator);

                if (EnterPeriod > 1)
                {
                    enterAdxSlopeIndicator = AdxSlope(AdxPeriod, EnterPeriod, EnterSlopeThreshold);
                    //AddChartIndicator(enterAdxSlopeIndicator);
                }

                if (ExitPeriod > 1)
                {
                    exitAdxSlopeIndicator = AdxSlope(AdxPeriod, ExitPeriod, ExitSlopeThreshold);
                    //AddChartIndicator(exitAdxSlopeIndicator);
                }

                rangeIndicator = MyRange(EnterBarsLength, MinTickRange);
                //AddChartIndicator(rangeIndicator);

                disableManager.AddRange(DayOfWeek.Sunday, 12, 45, 24, 0);
                disableManager.AddRange(DayOfWeek.Monday, 12, 45, 24, 0);
                disableManager.AddRange(DayOfWeek.Tuesday, 12, 45, 24, 0);
                disableManager.AddRange(DayOfWeek.Wednesday, 12, 45, 24, 0);
                disableManager.AddRange(DayOfWeek.Thursday, 12, 45, 24, 0);
                disableManager.AddRange(DayOfWeek.Friday, 12, 45, 24, 0);


//                disableManager.AddRange(DayOfWeek.Monday, 0, 0, 5, 0);
//                disableManager.AddRange(DayOfWeek.Tuesday, 0, 0, 5, 0);
//                disableManager.AddRange(DayOfWeek.Wednesday, 0, 0, 5, 0);
//                disableManager.AddRange(DayOfWeek.Thursday, 0, 0, 5, 0);
//                disableManager.AddRange(DayOfWeek.Friday, 0, 0, 5, 0);


                //disableManager.AddRange(DayOfWeek.Monday, 6, 30, 6, 45);
                //disableManager.AddRange(DayOfWeek.Tuesday, 6, 30, 6, 45);
                //disableManager.AddRange(DayOfWeek.Wednesday, 6, 30, 6, 45);
                //disableManager.AddRange(DayOfWeek.Thursday, 6, 30, 6, 45);
                //disableManager.AddRange(DayOfWeek.Friday, 6, 30, 6, 45);

                //				fastMaIndicator = EMA(FastMaPeriod);
                //                slowMaIndicator = EMA(SlowMaPeriod);

                //                slowMaIndicator.Plots[0].Brush = Brushes.White;
                //                slowMaIndicator.Plots[0].Width = 2;

                //                fastMaIndicator.Plots[0].Width = 2;

                //                AddChartIndicator(fastMaIndicator);
                //                AddChartIndicator(slowMaIndicator);
            }
            else if (State == State.DataLoaded)
            {
            }
        }
예제 #5
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "ScalpTick";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 2;
                ProfitTicks                  = 4;
                StopLossTicks                = 15;
                TradeSecondTrade             = true;
                TradeTails                   = true;
                TradeBigBars                 = true;
                Trade0Period                 = true;
                Trade1Period                 = true;
                TradeOpen                    = true;
                TickProfileMinThreshold      = 12;
                BreakevenThreshold           = .5;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
                //SetProfitTarget(CalculationMode.Ticks, 4);
                //SetStopLoss(CalculationMode.Ticks, 25);

                AddHeikenAshi("NQ 12-18", BarsPeriodType.Tick, 400, MarketDataType.Last);
                AddDataSeries(Data.BarsPeriodType.Second, 5);

                guerillaTickProfile = GuerillaTickProfile(BarsArray[0], Brushes.MediumVioletRed, Brushes.LightGray, this.TickProfileMinThreshold, 2000);
                AddChartIndicator(guerillaTickProfile);

                greenBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.GreenBar, 0, 0);
                AddChartIndicator(greenBarStick);

                redBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.RedBar, 0, 0);
                AddChartIndicator(redBarStick);

                fiftyHammerStick = GuerillaStickSimple(BarsArray[0], Brushes.HotPink, Brushes.HotPink, GuerillaChartPattern.FiftyHammer, 0, 0);
                AddChartIndicator(fiftyHammerStick);

                fiftyManStick = GuerillaStickSimple(BarsArray[0], Brushes.HotPink, Brushes.HotPink, GuerillaChartPattern.FiftyMan, 0, 0);
                AddChartIndicator(fiftyManStick);

                fiftyBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.FiftyBar, 0, 0);
                AddChartIndicator(fiftyBarStick);

                bigBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Blue, Brushes.Blue, GuerillaChartPattern.BigBar, 0, 0);
                AddChartIndicator(bigBarStick);

                List <DisasbleTimeRange> disableTimeRanges = new List <DisasbleTimeRange>();
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 5, StartMinute = 30, EndHour = 6, EndMinute = 29 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 7, StartMinute = 0, EndHour = 7, EndMinute = 29 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 9, StartMinute = 0, EndHour = 11, EndMinute = 29 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 9, StartMinute = 0, EndHour = 9, EndMinute = 29 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 10, StartMinute = 0, EndHour = 10, EndMinute = 29 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 9, StartMinute = 0, EndHour = 10, EndMinute = 59 });
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 12, StartMinute = 46, EndHour = 16, EndMinute = 29
                });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 20, StartMinute = 0, EndHour = 20, EndMinute = 59 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 17, StartMinute = 30, EndHour = 18, EndMinute = 29 });
                //disableTimeRanges.Add(new DisasbleTimeRange() { Day = DayOfWeek.Monday, StartHour = 19, StartMinute = 30, EndHour = 20, EndMinute = 59 });

                foreach (DisasbleTimeRange d in disableTimeRanges)
                {
                    disableManager.AddRange(DayOfWeek.Sunday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Monday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Tuesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Wednesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Thursday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Friday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                }

                trailingStopManager.AddItem((int)(this.ProfitTicks * this.BreakevenThreshold), (int)(this.ProfitTicks * this.BreakevenThreshold));
            }
        }
예제 #6
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "Fastigium";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;

                RecordHistoricalTrades = false;
                TradingAccountId       = 0;
                Quantity          = 2;
                FireSns           = false;
                Contrarian        = false;
                StochasticsFilter = false;
                Conservative      = true;
                StopLossTicks     = 15;
                ProfitTakerTicks  = 10;

                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
                shootingStarIndicator = GuerillaStickIndicator(GuerillaChartPattern.ShootingStar, false, false, false, 0);
                AddChartIndicator(shootingStarIndicator);

                hammerIndicator = GuerillaStickIndicator(GuerillaChartPattern.Hammer, false, false, false, 0);
                AddChartIndicator(hammerIndicator);

                dojiIndicator = GuerillaStickIndicator(GuerillaChartPattern.Doji, false, false, false, 0);
                AddChartIndicator(dojiIndicator);

                indecisionBarIndicator = GuerillaStickIndicator(GuerillaChartPattern.IndecisionBar, false, false, false, 0);
                AddChartIndicator(indecisionBarIndicator);

                bullishTrendBarIndicator = GuerillaStickIndicator(GuerillaChartPattern.BullishTrendBar, false, false, false, 0);
                AddChartIndicator(bullishTrendBarIndicator);

                bearishTrendBarIndicator = GuerillaStickIndicator(GuerillaChartPattern.BearishTrendBar, false, false, false, 0);
                AddChartIndicator(bearishTrendBarIndicator);

                greenBarIndicator = GuerillaStickIndicator(GuerillaChartPattern.GreenBar, false, false, false, 0);
                AddChartIndicator(greenBarIndicator);

                redBarIndicator = GuerillaStickIndicator(GuerillaChartPattern.RedBar, false, false, false, 0);
                AddChartIndicator(redBarIndicator);

                stochastics = Stochastics(7, 14, 3);
                AddChartIndicator(stochastics);

                disableManager.AddRange(DayOfWeek.Sunday, 13, 30, 24, 0);
                disableManager.AddRange(DayOfWeek.Monday, 13, 30, 16, 40);
                disableManager.AddRange(DayOfWeek.Tuesday, 13, 30, 16, 40);
                disableManager.AddRange(DayOfWeek.Wednesday, 13, 30, 16, 40);
                disableManager.AddRange(DayOfWeek.Thursday, 13, 30, 16, 40);
                disableManager.AddRange(DayOfWeek.Friday, 13, 30, 16, 40);
            }
        }
예제 #7
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"ThaAdxFixed";
                Name                         = "ThaAdxFixed";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;

                TradingAccountId       = 0;
                AdxPeriod              = 14;
                MinAdx                 = 25;
                UseBoundaryHours       = true;
                StartHour              = 7;
                StartMinute            = 30;
                EndHour                = 12;
                EndMinute              = 30;
                EnterPeriod            = 3;
                EnterSlopeThreshold    = 20;
                RecordHistoricalTrades = false;
                EnterBarsLength        = 2;
                ExitStopBuffer         = 2;
                ExitLimitBuffer        = 2;
                Quantity               = 1;
                UseDynamicQuantity     = false;
                MaxDynamicQuantity     = 5;
                Contrarian             = false;
            }
            else if (State == State.Configure)
            {
                SetProfitTarget(CalculationMode.Ticks, this.ExitLimitBuffer);
                SetStopLoss(CalculationMode.Ticks, this.ExitStopBuffer);
                //SetOrderQuantity = SetOrderQuantity.DefaultQuantity;

                adxIndicator = EnhancedADX(AdxPeriod, MinAdx);
                AddChartIndicator(adxIndicator);

                if (EnterPeriod > 1)
                {
                    enterAdxSlopeIndicator = AdxSlope(AdxPeriod, EnterPeriod, EnterSlopeThreshold);
                    //AddChartIndicator(enterAdxSlopeIndicator);
                }

                rangeIndicator = MyRange(EnterBarsLength, 3);
                //AddChartIndicator(rangeIndicator);

                disableManager.AddRange(DayOfWeek.Sunday, 13, 30, 24, 0);
                disableManager.AddRange(DayOfWeek.Monday, 13, 30, 24, 0);
                disableManager.AddRange(DayOfWeek.Tuesday, 13, 30, 24, 0);
                disableManager.AddRange(DayOfWeek.Wednesday, 13, 30, 24, 0);
                disableManager.AddRange(DayOfWeek.Thursday, 13, 30, 24, 0);
                disableManager.AddRange(DayOfWeek.Friday, 13, 30, 24, 0);


                disableManager.AddRange(DayOfWeek.Monday, 0, 0, 5, 0);
                disableManager.AddRange(DayOfWeek.Tuesday, 0, 0, 5, 0);
                disableManager.AddRange(DayOfWeek.Wednesday, 0, 0, 5, 0);
                disableManager.AddRange(DayOfWeek.Thursday, 0, 0, 5, 0);
                disableManager.AddRange(DayOfWeek.Friday, 0, 0, 5, 0);
            }
            else if (State == State.DataLoaded)
            {
            }
        }
예제 #8
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "ScalpTheCrowd";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 1;
                ProfitTicks                  = 5;
                StopLossTicks                = 4;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
                AddDataSeries(Data.BarsPeriodType.Second, (int)(shortTimePeriod * 60));
                AddDataSeries(Data.BarsPeriodType.Tick, 1);

                guerillaTickProfile = GuerillaTickProfile(BarsArray[0], Brushes.MediumVioletRed, Brushes.LightGray, 13, 2000);
                AddChartIndicator(guerillaTickProfile);

                #region Primary Sticks
                primaryGreenBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.GreenBar, 0, 0);
                AddChartIndicator(primaryGreenBarStick);

                primaryRedBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.RedBar, 0, 0);
                AddChartIndicator(primaryRedBarStick);

                primaryFiftyHammerStick = GuerillaStickSimple(BarsArray[0], Brushes.HotPink, Brushes.HotPink, GuerillaChartPattern.FiftyHammer, 0, 0);
                AddChartIndicator(primaryFiftyHammerStick);

                primaryFiftyManStick = GuerillaStickSimple(BarsArray[0], Brushes.HotPink, Brushes.HotPink, GuerillaChartPattern.FiftyMan, 0, 0);
                AddChartIndicator(primaryFiftyManStick);

                primaryFiftyBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.FiftyBar, 0, 0);
                AddChartIndicator(primaryFiftyBarStick);

                primaryBigBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Blue, Brushes.Blue, GuerillaChartPattern.BigBar, 0, 0);
                AddChartIndicator(primaryBigBarStick);
                #endregion

                #region Secondary Sticks
                secondaryGreenBarStick = GuerillaStickSimple(BarsArray[1], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.GreenBar, 0, 0);
                AddChartIndicator(secondaryGreenBarStick);

                secondaryRedBarStick = GuerillaStickSimple(BarsArray[1], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.RedBar, 0, 0);
                AddChartIndicator(secondaryRedBarStick);

                secondaryFiftyHammerStick = GuerillaStickSimple(BarsArray[1], Brushes.HotPink, Brushes.HotPink, GuerillaChartPattern.FiftyHammer, 0, 0);
                AddChartIndicator(secondaryFiftyHammerStick);

                secondaryFiftyManStick = GuerillaStickSimple(BarsArray[1], Brushes.HotPink, Brushes.HotPink, GuerillaChartPattern.FiftyMan, 0, 0);
                AddChartIndicator(secondaryFiftyManStick);

                secondaryFiftyBarStick = GuerillaStickSimple(BarsArray[1], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.FiftyBar, 0, 0);
                AddChartIndicator(secondaryFiftyBarStick);

                secondaryBigBarStick = GuerillaStickSimple(BarsArray[1], Brushes.Blue, Brushes.Blue, GuerillaChartPattern.BigBar, 0, 0);
                AddChartIndicator(secondaryBigBarStick);
                #endregion

                List <DisasbleTimeRange> disableTimeRanges = new List <DisasbleTimeRange>();
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 5, StartMinute = 30, EndHour = 7, EndMinute = 44
                });
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 12, StartMinute = 46, EndHour = 16, EndMinute = 29
                });

                foreach (DisasbleTimeRange d in disableTimeRanges)
                {
                    disableManager.AddRange(DayOfWeek.Sunday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Monday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Tuesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Wednesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Thursday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Friday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                }
            }
        }
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "DayTradingRockStar";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 20;
                ProfitTicks                  = 3;
                StopLossTicks                = 5;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
                AddDataSeries(Data.BarsPeriodType.Second, 5);
                //AddDataSeries(Data.BarsPeriodType.Minute, 5);

                autoTrend = AutoTrendHNT8(false, 5, true, false, 60, Brushes.DarkRed, Brushes.Chartreuse, Brushes.DarkRed, Brushes.Chartreuse);
                AddChartIndicator(autoTrend);

                stochasticsFast_14_3 = EnhancedStochasticsFast(3, 14, Brushes.Chartreuse, Brushes.Transparent, true, 1);
                AddChartIndicator(stochasticsFast_14_3);

                //stochasticsFast_14_3_5min = StochasticsFast(BarsArray[2], 3, 14);
                //AddChartIndicator(stochasticsFast_14_3_5min);

                stochastics_60_10_1 = EnhancedStochastics(1, 60, 10, Brushes.Transparent, Brushes.DodgerBlue);
                AddChartIndicator(stochastics_60_10_1);

                stochasticsFast_40_4 = EnhancedStochasticsFast(4, 40, Brushes.Violet, Brushes.Transparent, false, 1);
                AddChartIndicator(stochasticsFast_40_4);

                stochasticsFast_9_3 = EnhancedStochasticsFast(3, 9, Brushes.DarkRed, Brushes.Transparent, false, 1);
                AddChartIndicator(stochasticsFast_9_3);

                ema20 = EMA(20);
                ema20.Plots[0].Brush = Brushes.Green;
                AddChartIndicator(ema20);

                ema50 = EMA(50);
                ema50.Plots[0].Brush = Brushes.DodgerBlue;
                AddChartIndicator(ema50);

                ema200 = EMA(200);
                ema200.Plots[0].Brush = Brushes.Red;
                AddChartIndicator(ema200);

                greenBarStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.GreenBar, 0, 0);
                AddChartIndicator(greenBarStick);

                redBarStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.RedBar, 0, 0);
                AddChartIndicator(redBarStick);

                fiftyHammerStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.FiftyHammer, 0, 0);
                AddChartIndicator(fiftyHammerStick);

                fiftyManStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.FiftyMan, 0, 0);
                AddChartIndicator(fiftyManStick);

                bigBarStick = GuerillaStickSimple(Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.BigBar, 0, 0);
                AddChartIndicator(bigBarStick);

                List <DisasbleTimeRange> disableTimeRanges = new List <DisasbleTimeRange>();
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 0, StartMinute = 0, EndHour = 9, EndMinute = 59
                });
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 12, StartMinute = 30, EndHour = 24, EndMinute = 59
                });

                foreach (DisasbleTimeRange d in disableTimeRanges)
                {
                    disableManager.AddRange(DayOfWeek.Sunday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Monday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Tuesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Wednesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Thursday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Friday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                }
            }
        }
예제 #10
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description                  = @"Enter the description for your new custom Strategy here.";
                Name                         = "ResearchSignals";
                Calculate                    = Calculate.OnBarClose;
                EntriesPerDirection          = 1;
                EntryHandling                = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds    = 30;
                IsFillLimitOnTouch           = false;
                MaximumBarsLookBack          = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution          = OrderFillResolution.Standard;
                Slippage                     = 0;
                StartBehavior                = StartBehavior.WaitUntilFlat;
                TimeInForce                  = TimeInForce.Gtc;
                TraceOrders                  = false;
                RealtimeErrorHandling        = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling           = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade          = 2;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
                StartTradingHour   = 7;
                StartTradingMinute = 45;
                StopTradingHour    = 12;
                StopTradingMinute  = 45;
                ProfitTicks        = 5;
                HoldPeriods        = 1;
            }
            else if (State == State.Configure)
            {
                //SetProfitTarget(CalculationMode.Ticks, 50);
                //SetStopLoss(CalculationMode.Ticks, 40);
                //SetTrailStop(CalculationMode.Ticks, 40);

                AddDataSeries(Data.BarsPeriodType.Second, (int)(shortTimePeriod * 60));
                AddDataSeries(Data.BarsPeriodType.Second, 5);

                guerillaTickProfile = GuerillaTickProfile(BarsArray[0], Brushes.MediumVioletRed, Brushes.LightGray, 12, 2000);
                AddChartIndicator(guerillaTickProfile);

                greenBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.GreenBar, 0, 0);
                AddChartIndicator(greenBarStick);

                redBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Transparent, Brushes.Transparent, GuerillaChartPattern.RedBar, 0, 0);
                AddChartIndicator(redBarStick);

                fiftyHammerStick = GuerillaStickSimple(BarsArray[0], Brushes.Chartreuse, Brushes.Firebrick, GuerillaChartPattern.FiftyHammer, 0, 0);
                AddChartIndicator(fiftyHammerStick);

                fiftyManStick = GuerillaStickSimple(BarsArray[0], Brushes.Chartreuse, Brushes.Firebrick, GuerillaChartPattern.FiftyMan, 0, 0);
                AddChartIndicator(fiftyManStick);

                fiftyBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Yellow, Brushes.Yellow, GuerillaChartPattern.FiftyBar, 0, 0);
                AddChartIndicator(fiftyBarStick);

                bigBarStick = GuerillaStickSimple(BarsArray[0], Brushes.Blue, Brushes.Blue, GuerillaChartPattern.BigBar, 0, 0);
                AddChartIndicator(bigBarStick);

                List <DisasbleTimeRange> disableTimeRanges = new List <DisasbleTimeRange>();
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 6, StartMinute = 30, EndHour = 7, EndMinute = 59
                });
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 8, StartMinute = 30, EndHour = 9, EndMinute = 29
                });
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 10, StartMinute = 0, EndHour = 11, EndMinute = 29
                });
                disableTimeRanges.Add(new DisasbleTimeRange()
                {
                    Day = DayOfWeek.Monday, StartHour = 12, StartMinute = 46, EndHour = 14, EndMinute = 0
                });

                foreach (DisasbleTimeRange d in disableTimeRanges)
                {
                    disableManager.AddRange(DayOfWeek.Monday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Tuesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Wednesday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Thursday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                    disableManager.AddRange(DayOfWeek.Friday, d.StartHour, d.StartMinute, d.EndHour, d.EndMinute);
                }
            }
        }