Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help! Strategy cuasing looping effect in live sim

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

    Help! Strategy cuasing looping effect in live sim

    Hi.

    I have written a strategy which utilizes the Darvis Box Theory. In backtest it looks fine, but in live simulation it often enters into a looping buy/sell pattern which completely decimates profit in a matter of seconds. I was wondering if someone could help me fix this.

    #2
    markp77,

    Try running it with CalculateOnBarClose = true. Otherwise you will want to reprogram your strategy to prevent reentries constantly. You can use something like this:
    Code:
    if (BarsSinceEntry() > 1)
         // Then allow for entries/exits;
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I've tried with calculate on close to no avail. I have now added the BarsSinceEntry greater than one to my exit signals and will try that. I'll get back to you once I've determined whether it will work or not. Thanks for the help

      Comment


        #4
        If you have multiple entries and exits it may be advisable to use unique signal names for your entries so you can tie the conditions together with the BarsSinceEntry().



        Say your signal name was Long1.
        Code:
        if (BarsSinceEntry("Long1") > 1)
             ExitLong("Exit-Long1", "Long1");
        Something like that.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I've encountered a problem with using the bars since entry/exit method.

          Say I have a script in which I dont want to enter into another trade until 5 bars have passed since the exit. However, when I start this script, it never enter into a trade to start with because it cannot fulfill the requirement of exiting a trade. How can I get around this?

          Comment


            #6
            When you have never entered a trade before BarsSinceExit() will return a -1. What you can try is using an || for "or" to combo your conditions like this:

            Code:
            if (BarsSinceExit() == -1 || BarsSinceExit() >=  5)
                 EnterLong();
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            582 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            338 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X