Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit condition being "missed" in multi instrument strategy

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

    Exit condition being "missed" in multi instrument strategy

    Hi. I'm trying to debug a strategy (multi- instrument, actually multi timeframe, daily and 5 min bars on the same instrument), and I noticed that my exit condition wasn't being hit where expected. I added some debugging code in visual studio, and sure enough, it looks like a range of data/ dates isn't being hit or recognized in my code. To clarify, the trade in question enters on 5/17/12. My debugging code checks to see if I'm long a position. If I am, I have another condition to check if the date of the current bar is > 5/31/12. The condition is never hit, and the trade exits on 8/1/12. So from 6/1/12-7/31/12, I miss my exit point, and can't even debug it. What am I missing? Here's the relevant debugging code:

    if(Position.MarketPosition==MarketPosition.Long)
    {
    if(DateTime.Compare(DateTime.Parse("5/31/12"),Time[0].Date)<0)
    {
    //misc code here, never gets hit.
    }
    }

    I can step through it bar by bar up to 5/31, then from 7/31 on.

    #2
    Hello CSharpTrader,
    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X