people with nt,
i have been working with nt on a modest, 4 gb laptop lately, so running optimization processes is not practical in the least.
instead of running 100 or 150 generations with generation size of 100 or 150 as would be desirable, i have had to run 30 generations with generation size of 100. and when trying to run an optimization for a strategy that includes code for a breakeven stop i really had to scale these parameters to the minimum. i ended up running 5 generations with a size of 100 and this process still took 5 hours - 300 minutes. if i try to run 100 - 150 by 100 - 150 processes, the platform will abort the processes and display incomplete and useless results.
supposedly, setting IsInstantiatedOnEachOptimizationIteration to false is the one change that should make the biggest difference in the performance of the platform and i'm interested in evaluating whether this is of any help when running optimizations. i had had the idea of modifying my strategies for a very long time so that this parameter could be set to false but have never done this up to now because it is a really difficult undertaking for any non programmer and i haven't been able to get started. i have read all the posts in these fora where the IsInstantiatedOnEachOptimizationIteration setting is discussed and there are no helpful explanations or working samples anywhere.
so, for this sample strategy i include below, i would like the people with nt support to help me by providing a list of which components must be converted to what and some explanation. i will then search on the internet for more extensive c# resources and will also try to make do with the minimal moving average crossover sample strategy that nt has made available on its help guides.
this sample strategy does not include any day of the week or time of the day components, but i do have several strategies which use code of this kind, so i want to know whether it is necessary to also reset these components. and it's an identical situation with all the code that goes inside the onorderupdate and onexecutionupdate methods, i also have strategies which include this code.
#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.Indicators; using NinjaTrader.NinjaScript.DrawingTools; #endregion //This namespace holds Strategies in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Strategies { public class tesampletrimod : Strategy { private SMA SMA1; private Momentum Momentum1; private ADX ADX1; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"te sample tri mod."; Name = "tesampletrimod"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.UniqueEntries; IsExitOnSessionCloseStrategy = false; ExitOnSessionCloseSeconds = 90; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 25; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = true; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelCloseIgnoreRejects ; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 65; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true; Posi = 1; Smap = 20; Momp = 20; Adxp = 20; Moml1 = -.5; Moml2 = .5; Adxl = 30; } else if (State == State.Configure) { } else if (State == State.DataLoaded) { SMA1 = SMA(Close, Convert.ToInt32(Smap)); Momentum1 = Momentum(Close, Convert.ToInt32(Momp)); ADX1 = ADX(Close, Convert.ToInt32(Adxp)); } } protected override void OnBarUpdate() { if (BarsInProgress != 0) return; if (CurrentBars[0] < 1) return; // Set 1 if ((Position.MarketPosition != MarketPosition.Short) && (SMA1[0] < SMA1[1]) && (Momentum1[0] < Moml1) && (ADX1[0] > Adxp)) { EnterShort(Convert.ToInt32(Posi), @"sp01"); } else // Set 4 if ((Position.MarketPosition == MarketPosition.Long) && (SMA1[0] < SMA1[1])) { ExitLong(Convert.ToInt32(Posi), @"elp01", @"lp01"); } // Set 3 if ((Position.MarketPosition != MarketPosition.Long) && (SMA1[0] > SMA1[1]) && (Momentum1[0] > Moml2) && (ADX1[0] > Adxp)) { EnterLong(Convert.ToInt32(Posi), @"lp01"); } else // Set 2 if ((Position.MarketPosition == MarketPosition.Short) && (SMA1[0] > SMA1[1])) { ExitShort(Convert.ToInt32(Posi), @"esp01", @"sp01"); } } #region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Posi", Description="posi.", Order=1, GroupName="Parameters")] public int Posi { get; set; } [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Smap", Order=2, GroupName="Parameters")] public int Smap { get; set; } [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Momp", Order=3, GroupName="Parameters")] public int Momp { get; set; } [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Adxp", Order=4, GroupName="Parameters")] public int Adxp { get; set; } [NinjaScriptProperty] [Range(-100, double.MaxValue)] [Display(Name="Moml1", Order=5, GroupName="Parameters")] public double Moml1 { get; set; } [NinjaScriptProperty] [Range(-100, double.MaxValue)] [Display(Name="Moml2", Order=6, GroupName="Parameters")] public double Moml2 { get; set; } [NinjaScriptProperty] [Range(1, double.MaxValue)] [Display(Name="Adxl", Order=7, GroupName="Parameters")] public double Adxl { get; set; } #endregion } }
very well, regards.
Comment