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 andrewtrades, Today, 04:57 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          5 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X