Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
As part of my testing philosophy I'd like to be able to read the current NinjaScript parameter window (including not only the user defined Parameters section but also the Data Series, Time Frame, General, Historical Fill Processing, Order Handling and Order Properties sections) so that I can validate them and also so that I can write them out to a text file that is associated with the testing output logs for future reference.
Far too often I've done hours of testing (or even live trading) and then seen something significant when reviewing the logs that my strategies are made to create and puzzled over what the parameters were which created it. I've tried taking screen shots of the Parameters window but that's just clumsy. There HAS to be a better way!
I believe most everything you mentioned is accessible programatically with the right keywords. My NinjaScript is rusty, so others will have to chime in with the necessary info.
I wrote some custom scripts to help me with saving and loading parameters of NinjaScript Indicators and Strategies and decided to share them here in the Elite Circle (so please keep it in the Elite only).
(I am attaching the beta version of the NinjaScript …
It provides what you need for loading/saving parameters to/from XML file for strategies and such.
Thanks Big Mike. At first blush this seems fairly intense for what I'm desiring to do but I'll definitely have a look at it.
I note in that thread that you mentioned loading parameters from a text file on startup. Were these parameters just your own custom parameters or were they system-wide items?
It really surprises me that NT doesn't expose the system-wide parameters in some supported way. I can't believe that I'm the only person who wants to do what I want to do!
I'm not really looking to save and load parameters (although that is unquestionably a cool thing!) I'm more looking to record the current values in a text file so that when I'm looking at my logs I can say with confidence that this was the setup which generated this result.
They do. I just can't remember all the keyword/reserve word names right now and don't have time to go look at my old Ninja source code on another computer. You'll need to ask around, but it is programatically available in NinjaScript.
Is there any supplementary or third-party documentation or web sites (other than futures.io (formerly BMT) of course!) that you recommend for NinjaScript? The Version 7 Help Guide only goes so far.
Nope. Basically it doesn't exist. I would suggest your 2 main routes are to learn C# from books and the web, and learn NinjaScript techniques from downloadable code here on futures.io (formerly BMT). There's plenty of both, but as is traditional with programs writtens by programmers, there's bugger all else for users. There may be a few third-party courses and such if you want to go hunting.
For the record, and for anyone else who wants to access this information, here are the elements that I've found (many converted to strings for consistent reference). The only one that I have not yet been able to find is the "Price based on" field from the Data Series group. You need to assign these to an appropriate variable in order to actually use them:
--- Data Series
ChartControl.BarsArray[0].BarsData.Period.MarketDataType.ToString(); //Price based on (Unsupported code according to NinjaTrader_Cal)
this.BarsPeriod.Value.ToString(); //Type
this.BarsPeriod.Id; // Value
this.Instrument.ToString(); //Instrument
--- Time Frame
this.Days2Load.ToString(); // Days to load
this.SessionData.ToString(); // Session Template
--- General
this.Account.Name; //Account
this.StrategyData.Strategy.CalculateOnBarClose // Calculate on Bars Close
this.Name; //Label
this.MaximumBarsLookBack.ToString(); //Maximum bars look back
this.BarsRequired.ToString(); //Min Bars Required
--- Historical Fill Processing
this.FillType.ToString(); //Fill type
this.Slippage.ToString(); //Slippage
--- Order Handling
this.EntriesPerDirection.ToString(); //Entries per direction
this.EntryHandling.ToString(); //Entry Handling
this.ExitOnClose.ToString(); // Exit on Close
this.ExitOnCloseSeconds.ToString(); // Exit on Close Seconds
this.StopTargetHandling.ToString(); //Stop & Target Submission
this.SyncAccountPosition.ToString(); //Sync Account Position
--- Order properties
this.QuantityType.ToString(); //Set Order Quantity
this.AccountSize.ToString(); // Account Size (for Order Quantity by account size)
this.DefaultQuantity.ToString(); // Default quantity (for Order quantity by default)
this.TimeInForce.ToString(); //Time in Force