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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      87 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      132 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      118 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X