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 Aviram Y, Today, 05:29 AM
      0 responses
      1 view
      0 likes
      Last Post Aviram Y  
      Started by quantismo, 04-17-2024, 05:13 PM
      3 responses
      25 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      7 responses
      34 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cls71, Today, 04:45 AM
      0 responses
      6 views
      0 likes
      Last Post cls71
      by cls71
       
      Started by mjairg, 07-20-2023, 11:57 PM
      3 responses
      216 views
      1 like
      Last Post PaulMohn  
      Working...
      X