Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceExit()

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

    BarsSinceExit()

    Hello

    I am trying to implement something in the code which I thought would be somewhat simple, i.e.

    if ('condition 1'
    && 'condition 2'
    && 'condition 3'
    && BarsSinceExit() > 0)

    EnterShort()

    Basically when entering the 'BarsSinceUpdate()' command I get zero orders executed.....removing this line & things go back to normal.


    Clearly the code I have is a little more complicated than the above, but the principle is the same.

    Any ideas as to where I could be going wrong?

    thx
    David

    #2
    Unfortunately we are unable to review actual strategies for bandwidth reasons. NinjaScript consultants are available to help program your custom indicators/strategies or to help our users throughout their learning curve. Additional information is located here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

    Here is a quick hint:
    As I "hit the wall" on some unexpected strategy behavior I usually try to isolate the cause of trouble by building a "simple as possible" variation of my strategy to see if that works as expected. As it does, I add condition by condition to locate where my logic (or the NT framework ?!?) breaks.

    In your case I would start and try something like
    Print (BarsSinceEntry())
    to see if you get the results you would expect.

    Comment


      #3
      Just a hunch. Maybe try BarsSinceExit() >= 1? That shouldn't make a difference though hmm. No errors in logs?
      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
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      345 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
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X