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

How to Prevent Strategy From Starting Early?

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

    How to Prevent Strategy From Starting Early?

    I open a day chart and begin my strategy. However, the chart loads the entire day and my strategy begins at the start of the day. This interferes with the real time function of the strategy. How can I have the strategy function only in real time?

    When I load the chart, if I choose to load one day or I enter zero, it still loads the current day.

    #2
    Hello ronaldgreene828,

    The most simple way is to add a condition to check the state. If you want to only work in realtime you can add the following condition in OnBarUpdate:

    if(State != State.Realtime) return;

    If you are using the builder you would need to add a condition into each set checking that the Misc -> CurrentState equals Misc -> State -> Realtime.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I'm using the strategy builder. Thanks very much for the advice, it works now in real time only.

      Comment


        #4
        Hello, this has worked well. At times I had to remove "State = State Realtime" from a set to prevent errors when running a strategy. Can you tell me where this line should not be included? Thanks

        Comment


          #5
          Hello ronaldgreene828,

          What errors were you seeing? it would be hard to say what the problem was without that detail.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            I found out that I wasn't using the right signal name in some of the exits. So I found the problem. Thanks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by TheMarlin801, 10-13-2020, 01:40 AM
            21 responses
            3,914 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by timmbbo, 07-05-2023, 10:21 PM
            3 responses
            151 views
            0 likes
            Last Post grayfrog  
            Started by Lumbeezl, 01-11-2022, 06:50 PM
            30 responses
            808 views
            1 like
            Last Post grayfrog  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Johnny Santiago, 10-11-2019, 09:21 AM
            95 responses
            6,194 views
            0 likes
            Last Post xiinteractive  
            Working...
            X