Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding a point system

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

    Adding a point system

    I have a bunch of rules that I want to assign a point system to if the its true and get a total point at the end.

    For example,

    If 3 of my rules are

    Code:
    Close[0] > Open[0]
    VOL1[0] > VOLMA[0]
    ADX1 > 25
    And only 2 of them are true, then total point will be 2 points
    If all 3 are true, then total point will be 3 points, etc.

    Is this possible? If so, how to achieve this?

    Thanks!

    #2
    Hello Ousher,

    Thank you for your reply.

    I would create a counter variable to hold the current number of points in and reset it to zero, then check each rule and if true, add 1 to your counter variable. Then, when you've checked each set of rules, you can get the total points from your counter variable.

    For example:

    Code:
    int myCount = 0;
    
    if (Close[0] > Open[0])
    {
    myCount++;
    }
    
    if (Vol1[0] > VOLMA[0])
    {
    myCount++;
    }
    
    if (ADX1 > 25)
    {
    myCount++;
    }
    
    Print("Total points: " + myCount);
    If two of the three rules are true, you would see "Total Points: 2" printed in the NinjaScript Output window using the above code.

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello Ousher,

      Thank you for your reply.

      I would create a counter variable to hold the current number of points in and reset it to zero, then check each rule and if true, add 1 to your counter variable. Then, when you've checked each set of rules, you can get the total points from your counter variable.

      For example:

      Code:
      int myCount = 0;
      
      if (Close[0] > Open[0])
      {
      myCount++;
      }
      
      if (Vol1[0] > VOLMA[0])
      {
      myCount++;
      }
      
      if (ADX1 > 25)
      {
      myCount++;
      }
      
      Print("Total points: " + myCount);
      If two of the three rules are true, you would see "Total Points: 2" printed in the NinjaScript Output window using the above code.

      Please let us know if we may be of further assistance to you.
      THanks! That works.

      Question, is it possible to assign a custom value to each rule/statement instead of everything being 1?

      Comment


        #4
        "myCount++" simply increments by 1. "myCount--" would decrement by 1. And "myCount = myCount + increment" would increment by the value of "increment", and similarly to decrement (using minus, of course). Finally, there's "myCount = amount" where the amount is simply a specific value you choose.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment


          #5
          Originally posted by jeronymite View Post
          "myCount++" simply increments by 1. "myCount--" would decrement by 1. And "myCount = myCount + increment" would increment by the value of "increment", and similarly to decrement (using minus, of course). Finally, there's "myCount = amount" where the amount is simply a specific value you choose.
          Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          54 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
          72 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
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X