Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with ExitLong and BarsInProgress

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

    Help with ExitLong and BarsInProgress

    I have read the documentation for EnterLong/EnterShort/ExitLong/ExitShort and BarsInProgress, and I hope that using these in multi timeframe strategies can be described to me a little differently - because I do not think I understand.

    Suppose I have a strategy that runs on two time frames: 240 minutes and 1 minute, BarsArray[0] and BarsArray[1], respectively. Basically, I am using the 1 minute bars to achieve more-realistic backtest results (as described in one of the NT help files on this forum). So, on BarsInProgress == 0 or BarsInProgress == 1, I want to check entrance and exit conditions so as to be able to possibly enter and/or exit intrabar the 240 minute bars.

    If I call EnterLong(0,myQuantity,"Long Enter") and ExitLong(0,myQuantity,"Long Exit","Long Enter"), will I only enter and exit on BarsArray[0], the 240 minute bars?

    For example:

    if ((BarsInProgress == 1) || (BarsInProgress == 2))
    {
    if (myLongEntranceCriteriaIsTrue && notInMarket)
    {
    EnterLong(0,myQuantity,"Long Enter")
    }
    .
    .
    .
    if (myLongExitCriteriaIsTrue && !notInMarket)
    {
    ExitLong(0,myQuantity,"Long Exit","Long Enter")
    }
    }

    So, will the above, only enter and exit on the 240 minute bars, even though I can hit it on BarsInProgress == 2?

    Do I need to do something like this: EnterLong(BarsInProgress ,myQuantity,"Long Enter") and ExitLong(BarsInProgress ,myQuantity,"Long Exit","Long Enter")?
    Using EnterLong(0,myQuantity,"Long Enter") or EnterLong(1,myQuantity,"Long Enter") gives wildly different results in my strategy, so I need to understand this distinction.

    Help?

    Thanks!

    #2
    Hi Serac,

    If I call EnterLong(0,myQuantity,"Long Enter") and ExitLong(0,myQuantity,"Long Exit","Long Enter"), will I only enter and exit on BarsArray[0], the 240 minute bars?
    Yes, you're submitting to BIP = 0 or your 240 minute bars. The reference for bar/indicator objects could be BIP 1 or 2.

    if (myLongExitCriteriaIsTrue && !notInMarket)
    {
    ExitLong(0,myQuantity,"Long Exit","Long Enter")
    }
    So, will the above, only enter and exit on the 240 minute bars, even though I can hit it on BarsInProgress == 2?
    Yes, you're submitting to BIP = 0.

    Using EnterLong(0,myQuantity,"Long Enter") or EnterLong(1,myQuantity,"Long Enter") gives wildly different results in my strategy, so I need to understand this distinction.
    In one case you submit to BIP = 0, and in the other to BIP = 1, so there could be different results.

    There is this to be aware of:
    In a multi-series strategy the following steps are taken on every single BIP update event:

    1. Process pending orders
    2. Amend stop targets
    3. Cancel expired orders
    4. Process backtest orders (*)

    *This means if there are BIPs that are identical or multiples of each other, it is possible to process the orders twice because it would go through BIP0 and then BIP1 again.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X