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

When in the process of an algo do stops get tested and actioned?

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

    When in the process of an algo do stops get tested and actioned?

    Hi,

    In OnBarUpdate(), an algo checks for entry signals and then updates a trailing stop value if applicable and in OnExecution() the algo handles the entry and sets the initial stop prices. If we get an entry signal and an entry is executed with the stop set, where in the steps of the algo does a stop get tested and eventually actioned? Does the stop get implicitly tested in OnBarUpdate prior to any of the code in OnBarUpdate? And if the stop is to be actioned, does the code move to OnExecution to do this and then back to OnBarUpdate to continue looping over each bar?

    Thanks,
    darmbk.

    #2
    Hi Darmbk,

    Thank you for your post.

    The OnBarUpdate() will finish processing the code int the method before the code in the OnExection() is then called and tested.

    Example - In an OnBarUpdate(), halfway through the code an order gets submitted and filled. The filled calls the OnExecution, however the OnBarUpdate() will finish process the rest of the code in the method before testing the OnExecution code.

    Let me know if this if the answer you are looking for.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your response.

      If OnExecution is called after OnBarUpdate, what is the difference between handling new entries and their stops at the start of the next OnBarUpdate rather than during OnExecution? What would you most usually code to occur during OnExecution that can't be done during OnBarUpdate?

      Cheers,
      darmbk.

      Comment


        #4
        The OnExecution will allow you to pass different parameters from the IExection to test against. This also allows you to utilize the IOrder class as well and be able to tell when your execution gets filled, part filled and so forth.

        Below is a link on IExection -
        http://www.ninjatrader.com/support/h...iexecution.htm
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X