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 DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        11 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        7 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X