Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss, MTF, and the first Bars context of that instrument

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

    SetStopLoss, MTF, and the first Bars context of that instrument

    I am looking at language in the example ProfitChaseStopTrailSetMethodsExample found at the following page:

    https://ninjatrader.com/support/foru...s-cs-expecting

    Code:
    [URL="https://ninjatrader.com/support/forum/forum/ninjatrader-8/platform-technical-support-aa/97419-priceos-cs-expecting"]protected override void OnStateChange()
    {
                else if (State == State.Configure)
                {
                    AddDataSeries(BarsPeriodType.Tick, 1);
                 }
    
    
    }  
    
    
    if (BarsInProgress == 1 && Position.MarketPosition == MarketPosition.Long)
                {
    
                    if (UseStopLoss && TrailStopLoss && Close[0] > currentSlPrice + StopLossDistance * TickSize)
                    {
                        currentSlPrice = Close[0] - StopLossDistance * TickSize;
                        SetStopLoss(CalculationMode.Price, currentSlPrice);
                    }
                }[/URL]
    The SetStopLoss documentation states the following:
    • Should you have multiple Bars objects of the same instrument while using SetStopLoss() in your strategy, you should only submit orders for this instrument to the first Bars context of that instrument. This is to ensure your order logic is processed correctly and any necessary order amendments are done properly.
    In the above example, the second Bars object is called for SetStopLoss. Can you please clearly define "first Bars context of that instrument"? Does that mean the most granular resolution or does that mean the primary Bars?

    Thanks
    Last edited by Epistemophilic; 06-17-2020, 04:59 PM.

    #2
    Hello Epistemophilic,

    Thanks for your post.

    Just to let you know we are looking into this and will be updating this thread later.

    Comment


      #3
      Hello Epistemophilic,

      Thanks for your patience.

      Set methods will use the primary data series to fill orders and the next bar in that series is used to determine how the order will fill. If we adjust the stop loss on a secondary series, this will then affect how the stop loss gets processed. The approach mentioned here will work fine in realtime and while backtesting for most cases, but you may see some discrepancies with how the stop loss gets placed and filled when backtesting before the trailing behavior starts.

      For consistency with backtesting and realtime trading, Exit orders specifying the BarsInProgress for the single tick data series can be used to consistently have orders filled with intrabar granularity.

      Further details can be found here - https://ninjatrader.com/support/help...ionInformation

      We look forward to assisting.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X