Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TickSize and TickCount

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

    #16
    Hello imalil,

    Can you please specify the types of your four variables (ats, askVol, bidVol, tickValue)?

    In the case that they are all ints, your result will be an int. Here is an example:
    Code:
    int answer = 0;
    int firstNumber = 33;
    int secondNumber = 42;
    int thirdNumber = 12;
    
    answer = (firstNumber + secondNumber) / (thirdNumber);
    Print(answer.ToString()); // will print out 6
    Please take a look at this MSDN link: https://msdn.microsoft.com/en-us/library/3b1ff23f.aspx

    "When you divide two integers, the result is always an integer. For example, the result of 7 / 3 is 2."

    Is your ats variable a double? What happens when you cast askVol, bidVol, and tickValue as doubles?

    Example:
    Code:
    double answer = 0;
    int firstNumber = 33;
    int secondNumber = 42;
    int thirdNumber = 12;
    
    answer = (double)(firstNumber + secondNumber) / (double)(thirdNumber);
    Print(answer.ToString()); // will print out 6.25, the correct answer
    More information about division and casting can be found here: http://www.dotnetperls.com/divide
    Zachary G.NinjaTrader Customer Service

    Comment


      #17
      That's the kind of info I need. ats is double, advol, bidvol is private long, tickValue is int. If I change tickValue and askvol, bidvol to doubles you think it might solve the problem?

      Comment


        #18
        Hello imalil,

        It would be up to you if you would like to change them to doubles.

        Alternatively, you can cast them as doubles in your calculation.

        Example:
        Code:
        ats = (double)(askVol + bidVol) / (double)(tickValue);
        Zachary G.NinjaTrader Customer Service

        Comment


          #19
          Yes, I realized that right after I sent the post.

          Thanks again, this solves my problem.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X