• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 Nat11, Today, 04:30 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Option Whisperer, Yesterday, 11:50 AM
          2 responses
          10 views
          0 likes
          Last Post Option Whisperer  
          Started by TraderJim618, Yesterday, 01:20 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by drpapp, 01-24-2019, 06:57 AM
          6 responses
          72 views
          1 like
          Last Post brucerobinson  
          Started by ttodua, 12-06-2019, 11:40 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X