Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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, 07:29 PM.

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

    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 Vietanhnguyen2hotmailcom, 05-03-2024, 10:29 AM
          4 responses
          24 views
          0 likes
          Last Post Vietanhnguyen2hotmailcom  
          Started by PhillT, 04-19-2024, 02:16 PM
          4 responses
          36 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by ageeholdings, 05-01-2024, 05:22 AM
          5 responses
          38 views
          0 likes
          Last Post ageeholdings  
          Started by reynoldsn, Yesterday, 02:34 PM
          0 responses
          14 views
          0 likes
          Last Post reynoldsn  
          Started by nightstalker, Yesterday, 02:05 PM
          0 responses
          25 views
          0 likes
          Last Post nightstalker  
          Working...
          X