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

sample code wanted - submit customized ATM OCO bracket order upon manual trade entry

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

    sample code wanted - submit customized ATM OCO bracket order upon manual trade entry

    Hi, I checked "SampleAtmStrategy" strategy script, but it does not respond to manual trade entry.

    What I wanted to do is simple: Upon a manual buy entry, submit an OCO stop order below previous bar, and a limit order at say 5 points up.

    Is there existing sample code on this? I guess it is a very common ask.

    Thank you.

    #2
    Hello leontancfa,

    Thanks for your post.

    NinjaScript strategies are designed for fully automated trading and are not designed to handle manual entries. (Strategy positions are unique from Account positions and the strategy is not aware of any manual order submissions.) If your goal is to place an OCO stop and target a few ticks away from an entry, this does not require NinjaScript programming at all, it can be done with ATM strategies.

    ATM 201 - https://www.youtube.com/watch?v=0eXP_-cfR2Q

    ATM 301 - https://www.youtube.com/watch?v=qZUOoAZq35E

    ATM strategy Documentation - https://ninjatrader.com/support/help...gement_atm.htm

    If you are looking for a more robust way to handle this with programming and with NinjaScript, you could monitor the Account OrderUpdate event to detect when an order is manually submitted. This is only available in NinjaTrader 8 and there would not be a way we could suggest to do the same in NT7.

    Account.OrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello leontancfa,

      Thanks for your post.

      NinjaScript strategies are designed for fully automated trading and are not designed to handle manual entries. (Strategy positions are unique from Account positions and the strategy is not aware of any manual order submissions.) If your goal is to place an OCO stop and target a few ticks away from an entry, this does not require NinjaScript programming at all, it can be done with ATM strategies.

      ATM 201 - https://www.youtube.com/watch?v=0eXP_-cfR2Q

      ATM 301 - https://www.youtube.com/watch?v=qZUOoAZq35E

      ATM strategy Documentation - https://ninjatrader.com/support/help...gement_atm.htm

      If you are looking for a more robust way to handle this with programming and with NinjaScript, you could monitor the Account OrderUpdate event to detect when an order is manually submitted. This is only available in NinjaTrader 8 and there would not be a way we could suggest to do the same in NT7.

      Account.OrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

      Please let us know if we can be of further assistance.
      Thanks for the reply. I watched the video and doc, but what I wanted to do is "submit an OCO stop order below previous bar, and a limit order at same distance from stop price to entry."
      So the stop price is not a fixed tick nor a fixed price.
      That's why I want to program it.

      Could you further advise?
      Thank you.

      Comment


        #4
        Hello leontancfa,

        Thanks for your message.

        The Unmanaged Approach can be used to submit orders with your own OCO ID's but we are still at the limitation where we do not have any supported means for the strategy to monitor manual entries. A workaround may be to have the strategy add buttons that the user would use for manual entries instead of Chart Trader/SuperDOM, but this also falls into the realm of unsupported code with NinjaTrader 7.

        I will provide a link to a NinjaTrader 7 example strategy with that incorporates buttons for manual order submissions that are actually handled by the strategy for further insight. Please note that any WinForms modifications are outside of our realm of support and we cannot offer any additional direction with such modifications.

        Long Short Buttons NT7 (Unsupported) - https://ninjatraderecosystem.com/use...olbar-buttons/

        Unmanaged Approach NT7 - https://ninjatrader.com/support/help...d_approach.htm

        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

        If you have any additional NinjaTrader inquiries, please do not hesitate to open a new thread.
        JimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Hello leontancfa,

          Thanks for your message.

          The Unmanaged Approach can be used to submit orders with your own OCO ID's but we are still at the limitation where we do not have any supported means for the strategy to monitor manual entries. A workaround may be to have the strategy add buttons that the user would use for manual entries instead of Chart Trader/SuperDOM, but this also falls into the realm of unsupported code with NinjaTrader 7.

          I will provide a link to a NinjaTrader 7 example strategy with that incorporates buttons for manual order submissions that are actually handled by the strategy for further insight. Please note that any WinForms modifications are outside of our realm of support and we cannot offer any additional direction with such modifications.

          Long Short Buttons NT7 (Unsupported) - https://ninjatraderecosystem.com/use...olbar-buttons/

          Unmanaged Approach NT7 - https://ninjatrader.com/support/help...d_approach.htm

          The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

          If you have any additional NinjaTrader inquiries, please do not hesitate to open a new thread.
          sorry I just found that I posted in NT7 forum... Do above replies apply to NT8 also? Or do NT8 have improvements than above?

          Comment


            #6
            Hello leontancfa,

            The information I provided in post #2 regarding Account.OrderUpdate events could be used to have the strategy read manual order submissions. This information is relevant to NinjaTrader 8.

            You could also follow an approach adding button controls to the strategy so the strategy can submit orders from the button presses. This would likely be easier to accomplish.

            Long Short Toolbar (NT8) - https://ninjatraderecosystem.com/use...bar-buttons-2/

            Unmanaged Approach (NT8) - https://ninjatrader.com/support/help...d_approach.htm

            The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

            Let us know if you have any questions.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by f.saeidi, Today, 11:02 AM
            1 response
            1 view
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by geotrades1, Today, 10:02 AM
            4 responses
            12 views
            0 likes
            Last Post geotrades1  
            Started by rajendrasubedi2023, Today, 09:50 AM
            3 responses
            15 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by lorem, Today, 09:18 AM
            2 responses
            11 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by geddyisodin, Today, 05:20 AM
            4 responses
            30 views
            0 likes
            Last Post geddyisodin  
            Working...
            X