Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

script strategy - days to load

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

    script strategy - days to load

    Hello,

    I´m finished with everything in my scripts and ready to trade now with the script-strategies.

    Now it occurs that when I enable a strategy in a chart with eg 100 days-to-load (my 60 minute chart with support and resistances) it takes an incredible long time to be enabled and working, or NinjaTrader needs to be closed.

    But when I do enable in a chart with only 5 days dataseries days-to-load it works fine and it takes only few seconds to start.




    WHEN does a strategy check or calculate the days-to-load in the dataseries or what do I have to add, change or remove in script-strategies so that it is not a criteria and problem how many days are in the chart.


    Thanks
    Tony

    #2
    Hello Tony,

    There is no supported way to check the "Days to load" from NinjaScript. Does your NinjaScript need to be calculated on Historical data?
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi,

      this is a simple "strategy" only to do an entry that way I can continue to manage everything with my customized buttons (instead of using chart-trader).

      protected override void Initialize()
      {
      TraceOrders = true;
      RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;
      EntriesPerDirection = 1;
      EntryHandling = EntryHandling.UniqueEntries;
      CalculateOnBarClose = true;
      }

      protected override void OnBarUpdate()
      {

      #region Entry Rules

      if ( Position.MarketPosition == MarketPosition.Flat
      && GetCurrentAsk() > GetCurrentBid())

      {
      entryOrder1 = EnterShort(3000, "M1");
      //entryOrder2 = EnterShort(2000, "M1b");
      }

      I think the most simple "strategy" ever. Why does it work on a chart with 5 days but when enabled in a 60 min chart with 180 days Ninja needs to shut down?

      Best
      Tony



      Originally posted by NinjaTrader_JC View Post
      Hello Tony,

      There is no supported way to check the "Days to load" from NinjaScript. Does your NinjaScript need to be calculated on Historical data?

      Comment


        #4
        Hello Tony,

        Thanks for the snippet of your code.

        I do not see anything with your code that would cause NinjaTrader to need to shutdown.

        How large is your database file? You can check this by going to (My) Documents -> NinjaTrader 7 -> db and right click on the "NinjaTrader.sdf" file and select properties. (Example: X.XX MB).

        Do you have other 3rd Party Custom Indicators that you are loading on the chart?

        Happy to be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          Hi,

          I have REMOVED ALL INDICATORS in the 60 min chart (with 180 days-to-load)

          On the 5 range chart with 5 days-to-load I have a lot of - also 3rd party - indicators.

          The strategy is enabled in the 5 range chart within seconds.

          In the 60 min chart it takes minutes to enable 1(!) strategy or doesnt react then anymore and needs to shut down.

          What is the reason in a script-strategy for this? What in a script strategy is referring to dataseries-days-to-load?

          There must be something as you can see with this information.

          db size is 5.852 KB

          I have worked now 3 years on everything and finished now and there occurs this!

          Best
          Tony

          Originally posted by NinjaTrader_JC View Post
          Hello Tony,

          Thanks for the snippet of your code.

          I do not see anything with your code that would cause NinjaTrader to need to shutdown.

          How large is your database file? You can check this by going to (My) Documents -> NinjaTrader 7 -> db and right click on the "NinjaTrader.sdf" file and select properties. (Example: X.XX MB).

          Do you have other 3rd Party Custom Indicators that you are loading on the chart?

          Happy to be of further assistance.
          Last edited by tonynt; 03-16-2013, 05:42 AM.

          Comment


            #6
            Tony,

            The more historical data you ask the strategy to calculate on, the longer it is going to take to process.

            If you only want the strategy to caculate on real-time data, you can disable the historical processing:

            Code:
            if(Historical)
            return;
            MatthewNinjaTrader Product Management

            Comment


              #7
              Hello,

              I have added the "if historical...." to unbarupdate, it needs now about 1 min to enable the strategy (OK, this is better of course now) in my 60 min chart with no 3rd party and no NinjaTrader indicator on!

              In my 5 range with about 10 indicators (even with 3rd party) it is enabled in few seconds.

              Why does it still take so long? What might be the issues when I try to enable 30 strategies?

              The only "condition" eg in this strategy is if (Position.MarketPosition == MarketPosition.Flat && GetCurrentAsk() > GetCurrentBid())

              So, I dont think even with this condition I ask the strategy to calculate a lot - referring to historical data (flat and ask>bid??)


              PS: Again, I want to inform you that after all the work of 3 years - thank you for your support again - I´m finished with my tools, buttons and strategies. Please let us solve this problem. Thanks.

              Best
              Tony

              Originally posted by NinjaTrader_Matthew View Post
              Tony,

              The more historical data you ask the strategy to calculate on, the longer it is going to take to process.

              If you only want the strategy to caculate on real-time data, you can disable the historical processing:

              Code:
              if(Historical)
              return;
              http://www.ninjatrader.com/support/h...historical.htm
              Last edited by tonynt; 03-18-2013, 07:53 AM.

              Comment


                #8
                Would you be able to upload the .cs file so I can test this on my end?
                MatthewNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Haiasi, Today, 06:53 PM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ScottWalsh, Today, 06:52 PM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ScottW, Today, 06:09 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ftsc2022, 10-25-2022, 12:03 PM
                5 responses
                256 views
                0 likes
                Last Post KeyonMatthews  
                Started by Board game geek, 10-29-2023, 12:00 PM
                14 responses
                244 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Working...
                X