• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 suggestion: new State before State.Terminated

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    NT8 suggestion: new State before State.Terminated

    Hello.

    In NT7, from withing OnTermination() method, we can get access to all data: price series, indicator series, DataSeries, etc.

    It was obvious and very convenient separate place for gathering statistics, analyse deals, prepare data samples for machine learning, ... etc.

    Once, my friend, QA engineer, asked me to help to parse a site. And I did it using OnTermination() method of strategy. It was really more convenient than to create project in VisualStudio )))

    So, I suggest to create once more Sate, triggered before State.Terminated. And this state should give access to all objects, accessible in OnBarUpdate() method.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello,

    Thank you for the post.

    State.Terminated has taken the place of OnTermination, can you provide more detail on what specifically was not working that you tried?

    OnTermination/Terminated state should not have any relevance whether you are using Visual Studio or the NinjaScript editor, you would be using NinjaScript in both and both have the same states.

    As your post does not show specific syntax I am unsure of the problem at this point. If you can provide a simple example that shows the problem I could assist further.


    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      For example, I can't do this:
      PHP Code:
      Print( Close[0] ); 
      Attached Files
      Last edited by fx.practic; 08-22-2017, 03:24 PM.
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello,

        This should work fine in NT8, are you currently checking which Terminated event you are trying to print from?

        Just as NT7 has the Terminated and Initialize called multiple times, NT8 also calls these states multiple times as you open the menu, apply the indicator etc..

        If you are not checking that there was actually data loaded, you may not be printing from the correct instance causing an error.

        you could try something as simple as the following:

        Code:
        public class Tests : Strategy
        	{
        		bool hasLoaded;
        Code:
        else if (State == State.Historical)
        {
        	hasLoaded = true;
        }
        else if (State == State.Terminated)
        {
        	if(hasLoaded)
        	    Print( Close[0] );  
        }

        This would set the bool to true to let you know that the script was actually run if it was not run Close should not have any values.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by UltraNIX, Today, 12:31 AM
        1 response
        9 views
        0 likes
        Last Post NT-Roland  
        Started by hedgeplay, Yesterday, 08:04 PM
        0 responses
        4 views
        0 likes
        Last Post hedgeplay  
        Started by DTSSTS, Yesterday, 07:02 PM
        0 responses
        6 views
        0 likes
        Last Post DTSSTS
        by DTSSTS
         
        Started by arguru, Yesterday, 04:07 PM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by lakersfan, Yesterday, 06:02 PM
        0 responses
        14 views
        0 likes
        Last Post lakersfan  
        Working...
        X