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 twitch251, Today, 05:14 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by robforee2, Today, 05:07 PM
          0 responses
          1 view
          0 likes
          Last Post robforee2  
          Started by blar58, Today, 03:16 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Melissa  
          Started by alcorr247, Today, 02:52 PM
          2 responses
          7 views
          0 likes
          Last Post robforee2  
          Started by Radano, Today, 02:30 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X