Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsInProgress and SetStopLoss

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

    BarsInProgress and SetStopLoss

    Dear Support:

    I'm having difficulty determining how to set the BarsInProgress index for my setstoploss, and setprofittarget.

    Unlike for ExitShort and ExitLong, the NT7 help doesn't show that I can specify a barsinprogress index for setstoploss and setprofittarget.

    Could I accomplish this by ....
    Say I'm on 60min MSFT and have added AAPL in initialize. I've got a position in MSFT and I want to exit using a stoploss that tracks AAPL price would this work when setting my stop:

    if (BarsInProgress==1 //&& other sensible conditions)
    {
    SetStopLoss(blah blah $1 lower);
    }

    Would that stop then exit MSFT position if AAPL price hits the stop i define?

    Thanks!

    #2
    Hello Entropy,

    Welcome to the NinjaTrader forums! Set stop loss doesn't have a BarsInProgress input, but I don't think you need one in this case. Check BIP = 1 if you want to make adjustment based on AAPL prices, and then set the price to the new level. Set statements will be applied to either all entries or a specific entry, depending on whether you specify a fromEntrySignal parameter.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan!

      Just to be sure I understand ...

      So if I make sure that BIP==1 when setstoploss is called, then that stoploss will track AAPL prices (however added in initialize) and if the aapl price triggers the stop as i've set it in that specific call while BIP==1, the MSFT position will close (assuming parameters to close whole position)?

      Comment


        #4
        Yes, when you check BIP ==1, then you're filtering updates for the first added series (APPL, in your example). So the values you're checking for will be AAPL, but you can still make changes here to the stop loss level for orders submitted to Microsoft.

        Submitting exit statements works differently though since they will look to pair an entry that was placed in a different BIP. You have to use the Exit overload that allows submission to a specific BIP.

        ExitLong(int barsInProgressIndex, int quantity, string signalName, string fromEntrySignal)
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        23 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        22 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X