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 algospoke, Yesterday, 06:40 PM
        2 responses
        23 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        22 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X