Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data Type changed from int to long?

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

    Data Type changed from int to long?

    Hello

    I'm having a problem with moving one of my scripts from NT6.5 to NT7
    I eventually discovered that the problem lies with the change in data type for volume, which I don't really understand.

    What does it mean when the data type has changed from int to long?

    This is what I have

    private int LEntrySize = 0;

    if (GetCurrentAskVolume() > 1000000)
    {
    LEntrySize = 1000000
    }
    else
    {
    LEntrySize = GetCurrentAskVolume();
    }

    My script works without problem on NT6.5, what do I need to change for it to work on NT7?

    Thanks
    Last edited by John833; 04-16-2010, 10:29 AM.

    #2
    Try changing this line

    private int LEntrySize = 0;

    to

    private long LEntrySize = 0;

    We now use a long since it accomodate larger numbers.

    Sorry, I accidentally edited your original post vs replying to it.
    RayNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ray View Post
      Try changing this line

      private int LEntrySize = 0;

      to

      private long LEntrySize = 0;

      We now use a long since it accomodate larger numbers.

      Sorry, I accidentally edited your original post vs replying to it.
      Thanks Ray, unfortunately I've tried this and it doesn't work. Following on from the code I wrote in my original post, I use LEntrySize in one of my entries...

      EnterLong(0, LEntrySize, "");

      The error that comes up when I compile is...

      'Cannot convert from "long" to "int"

      In which case how can I use the LEntrySize in my entry, if the entry only accepts type 'int' not 'long' ?

      Comment


        #4
        John833,

        If you are trying to use GetCurrentAskVolume() you would need to use a long variable. If you are trying to submit an order, the quantity would need to be an int. Since you are determining your quantity from a long you could try casting the variable to an int. Please be aware though if your long variable contains far more values than an int variable can hold, you would lose that level of detail when you try to cast it to an int and that may or may not be an issue for you.

        EnterLong(0, (int) LEntrySize, "");
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh, that's a great help thank you, my script now compiles in NT7

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Pattontje, Yesterday, 11:54 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Pattontje, Today, 12:10 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by llanqui, Yesterday, 03:51 PM
          1 response
          18 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by kujista, Yesterday, 12:39 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by nleitman, Yesterday, 11:46 AM
          9 responses
          28 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X