コード例 #1
0
 protected override void OnStateChange()
 {
     if (State == State.SetDefaults)
     {
         Description                  = @"Enter the description for your new custom Strategy here.";
         Name                         = "FibStrat";
         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)
     {
     }
     else if (State == State.DataLoaded)
     {
         GZT_GoldenFibs_MTF1 = GZT_GoldenFibs_MTF(Close);
     }
 }
コード例 #2
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description             = @"Enter the description for your new custom Indicator here.";
                Name                    = "FibStrategy";
                Calculate               = Calculate.OnBarClose;
                IsOverlay               = true;
                DisplayInDataBox        = true;
                DrawOnPricePanel        = true;
                DrawHorizontalGridLines = true;
                DrawVerticalGridLines   = true;
                PaintPriceMarkers       = true;
                ScaleJustification      = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                //See Help Guide for additional information.
                IsSuspendedWhileInactive = true;

                AddPlot(Brushes.Red, "Upper");
                AddPlot(Brushes.DodgerBlue, "Lower");
            }
            else if (State == State.Configure)
            {
                AddDataSeries(BarsPeriodType.Minute, 5);
                AddDataSeries(BarsPeriodType.Minute, 15);
                AddDataSeries(BarsPeriodType.Minute, 30);
                AddDataSeries(BarsPeriodType.Minute, 60);
                AddDataSeries(BarsPeriodType.Day, 1);
            }
            else if (State == State.DataLoaded)
            {
                GZT_GoldenFibs_MTF1 = GZT_GoldenFibs_MTF(Close);
                MAEnvelopes1        = MAEnvelopes(Close, 0.125, 1, 34);
                ClearOutputWindow();
                mpeAvg = new Series <double>(this, MaximumBarsLookBack.Infinite);
            }
        }