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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      63 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      54 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      61 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      48 views
      0 likes
      Last Post CarlTrading  
      Working...
      X