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 horacioofman, Today, 04:43 PM
        0 responses
        4 views
        0 likes
        Last Post horacioofman  
        Started by David Hill, 07-18-2024, 07:41 AM
        4 responses
        29 views
        0 likes
        Last Post David Hill  
        Started by aban1alpha, Today, 02:01 PM
        0 responses
        9 views
        0 likes
        Last Post aban1alpha  
        Started by jaybedreamin, Today, 01:08 PM
        0 responses
        7 views
        0 likes
        Last Post jaybedreamin  
        Started by Rheiverson, 07-18-2024, 04:28 PM
        2 responses
        20 views
        0 likes
        Last Post Rheiverson  
        Working...
        X