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 rexsole, Today, 08:39 AM
      0 responses
      4 views
      0 likes
      Last Post rexsole
      by rexsole
       
      Started by trilliantrader, Yesterday, 03:01 PM
      3 responses
      30 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      4 responses
      26 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Brevo, Today, 01:45 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by rjbtrade1, 11-30-2023, 04:38 PM
      2 responses
      74 views
      0 likes
      Last Post DavidHP
      by DavidHP
       
      Working...
      X