Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

OnMarketData issue

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

    OnMarketData issue

    Hello Im trying to convert a script to NT8 from NT7.
    I copied some parts of BuySellPressure and its seems it should be working. But it says
    "Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)CS0266 - When accessing the error it also says i need authorization.

    Im attaching the indicator maybe you can help me figure whats wrong.

    Thank You
    Attached Files

    #2
    Hello,

    Thank you for the post.

    In this case you can utilize the NinjaScript editor to understand the problem.

    If you double click one of the errors it will bring you to the line in question. Here is one of the error lines:

    Code:
     totBuy += e.Volume;
    If you hold your Mouse over Volume, it shows the Volume is of type "long", Now if you hold the mouse over the variable totBuy, it shows it is of type "int".

    These are two different types, you would need to change the variable to match the type of the Volume object.
    Code:
     private int totBuy;
    would change to

    Code:
    private long totBuy;
    You would need to repeat this for each error that is listed where the type does not match.

    You could additionally cast the Long to an int if you wanted to keep the variables the same:

    Code:
     totBuy += (int)e.Volume;
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank You

      Thank You so much!
      Still learning!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by merc410, Today, 03:41 AM
      1 response
      6 views
      0 likes
      Last Post davidoff99  
      Started by sugalt, 04-30-2024, 04:02 AM
      2 responses
      13 views
      0 likes
      Last Post sugalt
      by sugalt
       
      Started by Ndakotan1313, 03-14-2024, 05:02 PM
      2 responses
      60 views
      0 likes
      Last Post blaise_code  
      Started by claxxical, 05-30-2017, 12:30 PM
      37 responses
      4,458 views
      0 likes
      Last Post Padan
      by Padan
       
      Started by SugarDefwebsite, Today, 02:18 AM
      0 responses
      4 views
      0 likes
      Last Post SugarDefwebsite  
      Working...
      X