Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BIP for Exit conditions..

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

    BIP for Exit conditions..

    For the following code below for the exit conditions I'm using Index 2, do I need the BIP ==2 in there like I have below, or seeing I designated Highs with Highs[2] already will I not need the BIP in there?

    if(Position.MarketPosition == MarketPosition.Long
    && (BarsInProgress == 2)
    && SMA(Highs[2], fast)[0] < SMA(Highs[2], slow)[1] -.75)

    {
    ExitLong(0, 1, "", "");
    }

    #2
    Hi zachj, you could change the Highs[2] to just High, since you are accessing those series in BIP == 2 context. You can remove the BIP context call as well, however that would change the event timing, so when you statement will be evaluated - currently with the BIP == 2 check in that would be when the second added series calls OnBarUpdate().

    Comment


      #3
      So you say this will change the event timing, what are the consequences of this? I'm still not quite clear. Is it more accurate to use BIP or just have the index worked right into the High ie Highs[2]?

      Comment


        #4
        Well, there's no right or wrong - it depends what you wish to do, on which bars update to act with your code. If you want to act on the BIP == 2 update > then this filter would need to be in the part of code.

        If you just wish to access the data, then accessing High in BIP == 2 context would equal the access of Highs[2] without context.

        Comment


          #5
          To add some light, all I'm really trying to do is make it exit when a lower high is formed on Index 2. Is there any negatives or advantages to use one or the other in this case? Maybe one is slower/faster or something? I did notice it's changes my profit a little bit so there is definately a difference.

          Comment


            #6
            'To add some light, all I'm really trying to do is make it exit when a lower high is formed on Index 2'

            Then I would work in BIP ==2. That's your index 2 update event...

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X