Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

custom series to calculate how many times event has occurred

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

    custom series to calculate how many times event has occurred

    I'm struggling with the logic to limit my strategy to x number of entries after each reversal, using Builder. I've read the following, as well as downloaded the strategy example BarCounterBuilderExample.exe:



    I've created a custom series that resets to zero at reversals, but it's not limiting the entries as intended. I also don't understand what "bar value" refers to in these instructions. Is that the same as "bars ago"?

    Can you please show me the Builder logic for the following items in bold:

    1. In order to populate a counter in a custom series, the very first set of the strategy needs to have no conditions and the only action is to assign the previous bar value of the custom series to the current bar value of the custom series. This action is needed to keep the value current with the current bar.

    2. Once you determine an event that starts the counter (such as a crossover), you can set a bool variable true that can be used to increment the counter. In a set, you check that the bool is true and the action would be to add 1 to the current bar value of the custom series and assign that to the current bar of the custom series.​

    #2
    Hello 2inthebush,

    For your first question that is shown in the sample however it is set 2 in the sample, set 1 is used to set a default value on the first bar. Set 2 shows how to persist the value.

    For the second question that is also shown in the sample, that is set 3, a condition is used and increments the counter. If you are looking for the sample it can be found here: https://forum.ninjatrader.com/forum/...er#post1099186

    Comment


      #3
      Thank you, Jesse.

      After experimenting with EventCounterExample.zip​, I've been able to accomplish my intentions. So far, so good
      Last edited by 2inthebush; 10-31-2024, 06:33 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      41 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X