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

Submit Order after 3 bars after the Signal confirmation

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

    Submit Order after 3 bars after the Signal confirmation

    Hi,

    I would like to submit an entry order after 3 bars(or X bars) after the signal is generated. At the moment , I submit a buystop or a sellstop order at the end of the bar that triggers signal and it works fine. However, I do not know how to effectively defer order submission until X bars after signal occurred. I am using only one Primary series on the Chart.

    Example: if I Close[0] > Close[1], then enter Long and vice-versa. One way to defer order submission is to check for Close[3] > Close[4] and submit at the end of Close[0], which is three bars away from entry signal. I will also add a check to see if Close[0] > Close[1] and Close[1]>Close[2] and Close[2]> Close[3]

    Can some one please review and advise if there is a better way to control order submission after X bars (1,2,3 or 4 bars )

    Thanks,
    Nag


    #2
    Hello ebnag,

    Thanks for your post.

    This appears to be a duplicate of this thread where I have already provided a response: https://ninjatrader.com/support/foru...lid-for-x-bars
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul,

      Please note this is not a duplicate thread. The other thread is about placing an order and keeping it active at the same price for next 3 bars. This thread is about placing the order after threebars at the closing price of third bar.

      Thanks,Nag

      Comment


        #4
        Hello ebnag,

        Thanks for your reply and clarification.

        I apologize for my oversight.

        You can use basically the same method as I pointed out in the other thread except the psudeo code would be more like:

        (if your signal condition)
        {
        savedBar = CurrentBar; //save the signal bar number

        mysignal = true;
        }

        if (CurrentBar - savedBar == 3 && mysignal == true)
        {
        // place order here
        mysignal = false; // reset signal
        }
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        2 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        40 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X