Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Previous bar status

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

    Previous bar status

    Hi everyone

    Let's say that my (discretionary) strategy indicates (however this is indicated: by a change of bar color, for example) a number of consecutive long trades (say) on a range bar chart.

    What I really want to do is to be able to set up a numbering system (using text on the chart - I know how to do this) so the first indicated bar in the sequence (after a 'flat' bar) is numbered '1', the next one '2', etc. Bars not indicating trades would be numbered '0'.

    The reason for doing this would be, as an example, to trade 3 lots on bar 1, 2 lots on bar 2, etc.

    I'd much appreciate learning about the most effective way of achieving this.

    Many thanks in advance.

    #2
    Originally posted by arbuthnot View Post
    Hi everyone

    Let's say that my (discretionary) strategy indicates
    Do you mean you're manually executing these orders?

    (however this is indicated: by a change of bar color, for example) a number of consecutive long trades (say) on a range bar chart.
    I'm not sure what you mean here, can you clarify? Is it currently doing this, or is this just an example?


    What I really want to do is to be able to set up a numbering system (using text on the chart - I know how to do this) so the first indicated bar in the sequence (after a 'flat' bar) is numbered '1', the next one '2', etc. Bars not indicating trades would be numbered '0'.
    Do the bar numbers have anything to do with the qty, or are you just counting the number of bars since your entry?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Matthew - thanks very much for getting back to me and I'm happy to clarify my questions as you requested:

      Do you mean you're manually executing these orders?
      Yes - I will be executing orders manually.

      (however this is indicated: by a change of bar color, for example) a number of consecutive long trades (say) on a range bar chart.
      I'm not sure what you mean here, can you clarify? Is it currently doing this, or is this just an example?
      Yes, I can give the bars (as examples) blue for long and red for short. I mentioned this purely for illustration.

      What I really want to do is to be able to set up a numbering system (using text on the chart - I know how to do this) so the first indicated bar in the sequence (after a 'flat' bar) is numbered '1', the next one '2', etc. Bars not indicating trades would be numbered '0'.
      Do the bar numbers have anything to do with the qty, or are you just counting the number of bars since your entry?
      I can confirm that the numbering system I'm aiming for has nothing to do with order quantity: again, I was just illustrating usage. (Maybe I overdid the 'illustrations', as it were. If so, I apologize for the confusion.)

      The essential point of the question is really to find out how to set up code in NinjaScript so as to to number the bars since the first entry in the sequence.

      Thanks for any clues as to how to do this.

      Comment


        #4
        The first part is going to prevent you from doing this: there is no supported NinjaScript methods to call a trade collection for manually executed trades. You would only be able to pull executions/trades from a single strategy instance. This instance would not be aware of any trades that happened outside of it.

        If you're looking to do this through an automated NS strategy, you can use BarsSinceEntry() to count the number of bars (since entry)
        MatthewNinjaTrader Product Management

        Comment


          #5
          Much obliged for your answers here, Matthew. I've learnt quite a bit about how Ninja approaches automated v. non-automated trading and esp. the use of BarsSinceEntry().

          I suppose a 'cheat' here would be to set up the system as for automated trading - without being connected to a broker (doing the actual trading from another PC). This would enable BarsSinceEntry to be used - I guess.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          630 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          566 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X