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 futtrader, 04-21-2024, 01:50 AM
        6 responses
        58 views
        0 likes
        Last Post futtrader  
        Started by sgordet, Today, 11:48 AM
        0 responses
        4 views
        0 likes
        Last Post sgordet
        by sgordet
         
        Started by Trader146, Today, 11:41 AM
        0 responses
        5 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        19 views
        0 likes
        Last Post rene69851  
        Started by funk10101, Today, 11:35 AM
        0 responses
        3 views
        0 likes
        Last Post funk10101  
        Working...
        X