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

Entry and exit orders to the same bar

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

    Entry and exit orders to the same bar

    Hi, I'm testing on NT a strategy I developed in tradestation; my question is about entry and exit orders sent at the same time to the same bar.

    Actually my strategy is something like that:

    if (EMA(Veloce)[0] < EMA(Lenta)[0])
    EnterShortLimit()
    ;


    ExitShortLimit()
    ;

    In this case strategy sends an entry order to the first bar and after this an exit order to the next bar.
    I need to send both the limit orders to the first bar; what is really important is to have both orders (the entry and the exit) sent to the same bar.

    How can I solve this problem?

    Thank you.

    #2
    Use SetProfiitTarget() this might help but please read and understand how this method works. Once it is called, it will always send profit target orders once a position is entered.

    RayNinjaTrader Customer Service

    Comment


      #3
      Thank You it works, but I cannot reverse any position once SetProfitTarget is called...can you suggest any way to do it? I mean exit from an entry order and reverse the position....thanx.

      Comment


        #4
        You would have to reverse with a market order such as EnterShort() which will exit a long and open a short.

        Check out the order handling rules for clarification what can/can't be done currently. At bottom of page of the following link.

        RayNinjaTrader Customer Service

        Comment


          #5
          I just do it but it doesn't work. SetProfitTarget cancels every other order sent like an EnterShortLimit to reverse the position.

          If condition
          EnterLongLimit ();
          SetProfitTarget () ;
          EnterShortLimit ();

          After the close position with the profit target there is a new buy order and not a sell short to reverse the position.

          I tried also moving the position of SetProfitTarget in the script but the result is the same.

          Comment


            #6
            It will not ignore Market orders, but will other orders.

            If condition
            EnterLongLimit ();
            SetProfitTarget () ;
            EnterShortLimit ();

            Clearly violate the order handling rules documented in the link I provided in my prior post.
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,603 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X