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 NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      48 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X