• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Wait until flat not working..??

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

    Wait until flat not working..??

    Hello,

    Please assist... I have built the attached script and it enters multiple orders (including open positions BEFORE strat is enabled), seemingly ignoring the "Wait until flat" option I have selected..

    Thank You.
    Attached Files

    #2
    Hello Rashid Garuba,

    Are you referring to historical trades or real-time trades?

    The Wait until flat does not prevent historical trades from being placed. It simply waits until the historical position is closed before it will start placing real-time orders.

    Below is a link to a forum post that describes the start up behavior.
    https://ninjatrader.com/support/foru...541#post811541

    If you want to prevent historical trades, use if (State == State.Historical) return; at the beginning of OnBarUpdate().

    Below is a public link to the help guide.
    https://ninjatrader.com/support/help...n-us/state.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      Real-time... I want only one execution per enable.

      Thanks.

      Comment


        #4
        Hello Rashid Garuba,

        Thanks for the reply.

        If you wanted to ignore the historical orders that a strategy takes before it is enabled on live data, place this logic at the top of your OnBarUpdate method:

        if (State == State.Historical)
        return;

        To limit the strategy to one trade per enablement only, use the SystemPerformance class to read how many trades your strategy has taken, if it has taken a trade, and the trade has exited, call CloseStrategy()

        Please let me know if I can assist further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Maxwell123, Today, 12:34 AM
        0 responses
        3 views
        0 likes
        Last Post Maxwell123  
        Started by esquissa, Yesterday, 11:59 PM
        0 responses
        2 views
        0 likes
        Last Post esquissa  
        Started by i2w8am9ii2, Yesterday, 04:41 PM
        1 response
        8 views
        0 likes
        Last Post Lancer
        by Lancer
         
        Started by vivekniwas, Yesterday, 10:21 PM
        0 responses
        2 views
        0 likes
        Last Post vivekniwas  
        Started by saltminer, Yesterday, 06:22 PM
        0 responses
        2 views
        0 likes
        Last Post saltminer  
        Working...
        X