• 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.

    #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.

      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 tshidsmre, Today, 06:06 AM
        0 responses
        3 views
        0 likes
        Last Post tshidsmre  
        Started by KetoProPlus123, Today, 06:05 AM
        0 responses
        3 views
        0 likes
        Last Post KetoProPlus123  
        Started by vdhsdkhl, Today, 03:00 AM
        0 responses
        5 views
        0 likes
        Last Post vdhsdkhl  
        Started by fluffier, Yesterday, 11:49 PM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by GARZONJ, Yesterday, 09:02 PM
        0 responses
        10 views
        0 likes
        Last Post GARZONJ
        by GARZONJ
         
        Working...
        X