To clarify: I do an optimization and get results in the summary tab under performance. Then I restart NT8 and the data in the summary tab are totally different without having changed anything.
What did NT8 do?
#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 NT8Test : Strategy { private double Initial_Stop_Long_Price; private double Initial_Stop_Short_Price; private double Breakeven_Trigger_Price_Store; private bool BreakevenBool; private RSI RSI1; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "NT8Test"; Calculate = Calculate.OnPriceChange; EntriesPerDirection = 9; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 120; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; StartBehavior = StartBehavior.WaitUntilFlatSynchronizeAccount; TimeInForce = TimeInForce.Gtc; TraceOrders = true; 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; Position_Size = 1; Start_Time = DateTime.Parse("00:00", System.Globalization.CultureInfo.InvariantCulture); Stop_Time = DateTime.Parse("23:00", System.Globalization.CultureInfo.InvariantCulture); SL_Long = -50; SL_Short = 50; TP_Long = 50; TP_Short = -50; Initial_Stop_Long_Price = 0; Initial_Stop_Short_Price = 0; } else if (State == State.Configure) { } else if (State == State.DataLoaded) { RSI1 = RSI(Close, 14, 3); RSI1.Plots[0].Brush = Brushes.DodgerBlue; RSI1.Plots[1].Brush = Brushes.Goldenrod; AddChartIndicator(RSI1); } } protected override void OnBarUpdate() { if (BarsInProgress != 0) return; if (CurrentBars[0] < 1) return; // Set 1 if ((Position.MarketPosition == MarketPosition.Flat) && (Times[0][0].TimeOfDay >= Start_Time.TimeOfDay) && (Times[0][0].TimeOfDay <= Stop_Time.TimeOfDay) && (CrossAbove(RSI1.Default, 20, 1))) { EnterLong(Convert.ToInt32(Position_Size), @"L"); } // Set 2 if ((Position.MarketPosition == MarketPosition.Flat) && (Times[0][0].TimeOfDay >= Start_Time.TimeOfDay) && (Times[0][0].TimeOfDay <= Stop_Time.TimeOfDay) && (CrossBelow(RSI1.Default, 80, 1))) { EnterShort(Convert.ToInt32(Position_Size), @"S"); } // Set 3 if (Position.MarketPosition == MarketPosition.Long) { Initial_Stop_Long_Price = (Position.AveragePrice + (SL_Long * TickSize)) ; Print(@"TAB4-" + Convert.ToString(new DateTime(2023, 12, 31)) + "-" + Convert.ToString(new TimeSpan(19, 13, 0)) + @"-InitialStopLong-" + Convert.ToString(Initial_Stop_Long_Price)); } // Set 4 if (Position.MarketPosition == MarketPosition.Short) { Initial_Stop_Short_Price = (Position.AveragePrice + (SL_Short * TickSize)) ; Print(@"TAB5-" + Convert.ToString(new DateTime(2023, 12, 31)) + "-" + Convert.ToString(new TimeSpan(19, 7, 0)) + @"-InitialStopShort-" + Convert.ToString(Initial_Stop_Short_Price)); } // Set 5 if (Position.MarketPosition == MarketPosition.Long) { ExitLongLimit(Convert.ToInt32(Position_Size), (Position.AveragePrice + (TP_Long * TickSize)) , @"TPL", @"L"); ExitLongStopMarket(Convert.ToInt32(Position_Size), Initial_Stop_Long_Price, @"SLL", @"L"); } // Set 6 if (Position.MarketPosition == MarketPosition.Short) { ExitShortLimit(Convert.ToInt32(Position_Size), (Position.AveragePrice + (TP_Short * TickSize)) , @"TPS", @"S"); ExitShortStopMarket(Convert.ToInt32(Position_Size), Initial_Stop_Short_Price, @"SLS", @"S"); } } #region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Position_Size", Order=1, GroupName="Parameters")] public int Position_Size { get; set; } [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")] [Display(Name="Start_Time", Order=2, GroupName="Parameters")] public DateTime Start_Time { get; set; } [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")] [Display(Name="Stop_Time", Order=3, GroupName="Parameters")] public DateTime Stop_Time { get; set; } [NinjaScriptProperty] [Display(Name="SL_Long", Order=4, GroupName="Parameters")] public int SL_Long { get; set; } [NinjaScriptProperty] [Display(Name="SL_Short", Order=5, GroupName="Parameters")] public int SL_Short { get; set; } [NinjaScriptProperty] [Display(Name="TP_Long", Order=6, GroupName="Parameters")] public int TP_Long { get; set; } [NinjaScriptProperty] [Display(Name="TP_Short", Order=7, GroupName="Parameters")] public int TP_Short { get; set; } #endregion } }
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by PH_GMT, 02-12-2025, 12:40 PM
|
6 responses
36 views
0 likes
|
Last Post
![]()
by PH_GMT
Today, 10:20 AM
|
||
Started by defa0009, 12-13-2024, 09:19 AM
|
24 responses
265 views
1 like
|
Last Post
![]()
by adtsystems
Today, 10:01 AM
|
||
Started by gustavobp, Yesterday, 05:30 AM
|
2 responses
20 views
0 likes
|
Last Post
![]()
by gustavobp
Today, 07:02 AM
|
||
Started by preqc, 04-10-2022, 01:26 PM
|
2 responses
208 views
0 likes
|
Last Post
![]() |
||
Started by srtrader, 02-12-2025, 09:01 PM
|
3 responses
28 views
0 likes
|
Last Post
![]()
by rockmanx00
Yesterday, 10:21 PM
|
Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one’s financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.
CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates.
Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.
Comment