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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            177 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            332 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            254 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            356 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            184 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X