Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy code invoked incorrectly

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

    Strategy code invoked incorrectly

    Using beta 4:
    I had problems with a strategy in beta 4, so I simplified the strategy down so that there is only a single print statement in the Initialize method (see attachment).
    When I go to select the strategy for my chart, the print statement in the Initialize method executes before the strategy is even added to the chart.
    If you have the Output window open whilst opening the Strategies dialog, you will see the test print appear in the output window even though no strategy has been added yet.
    I suspect it may even be normal behaviour, to determine some of the properties to show in the Strategies dialog.
    Please let me know if this is abnormal behaviour.

    thanks.
    Attached Files
    Last edited by astrolobe; 11-29-2007, 06:29 PM.

    #2
    >> I suspect it may even be normal behaviour
    correct
    DierkNinjaTrader Customer Service

    Comment


      #3
      When placing Print statements into the Initialize() method, I find it prevents ambiguity to always include the strategy name as part of what gets printed to the Output window.

      Comment


        #4
        Thanks KBJ. I just found that out through trial and error yesterday. As soon as I had a print statement in the initialize in more than one strategy, they both printed out when I opened the Strategy dialog. I didn't know that the initialize method was actioned for all strategies when the dialog opened.

        Comment


          #5
          I don't know your specific needs regarding printing during an indicator or strategy initialization, but you could defer printing in the Initialize method and wait until the OnBarUpdate method when CurrentBar < 1 is true or make your own one-time switch.

          Regards,

          Whitmark
          whitmark
          NinjaTrader Ecosystem Vendor - Whitmark Development

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ntbone, Today, 02:30 PM
          0 responses
          5 views
          0 likes
          Last Post ntbone
          by ntbone
           
          Started by tuliomgui, Yesterday, 10:07 PM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by Learner Trader, Today, 08:36 AM
          1 response
          24 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by GeorgeW, Today, 03:15 AM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by timko, Today, 11:55 AM
          4 responses
          12 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Working...
          X