Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Consecutive Bars

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

    Consecutive Bars

    Hello - how would I program, "exit trade, if 7 consecutive bars do not increase P&L"

    The consecutive bars portion is where I am struggling.

    Thank you

    #2
    titleistbb22,

    Unfortunately we cannot work through the full logic for you, but here are a few hints:

    -You need to keep track of the previous bar's PnL.
    -When the current bar's PnL is not > last bar's then increase a counter
    -If current bar's PnL is > last bar's then reset counter to 0
    -When counter reaches 7, ExitLong.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      thank you that is helpful

      Comment


        #4
        titleistbb22: Did you manage to successfully program this strategy?
        If you did, I would love to see how you did it, since I am currently trying to program a similar strategy that involves PnL and consecutive bars.

        Comment


          #5
          No I never did - still like to figure it out if you or someone else could provide some hints. thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PhillT, Today, 02:16 PM
          2 responses
          6 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by Kaledus, Today, 01:29 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frankthearm, Yesterday, 09:08 AM
          14 responses
          47 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by gentlebenthebear, Today, 01:30 AM
          2 responses
          14 views
          0 likes
          Last Post gentlebenthebear  
          Started by PaulMohn, Today, 12:36 PM
          2 responses
          17 views
          0 likes
          Last Post PaulMohn  
          Working...
          X