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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          89 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          135 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
          119 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          69 views
          0 likes
          Last Post PaulMohn  
          Working...
          X