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 sidlercom80, 10-28-2023, 08:49 AM
      166 responses
      2,234 views
      0 likes
      Last Post sidlercom80  
      Started by thread, Yesterday, 11:58 PM
      0 responses
      1 view
      0 likes
      Last Post thread
      by thread
       
      Started by jclose, Yesterday, 09:37 PM
      0 responses
      6 views
      0 likes
      Last Post jclose
      by jclose
       
      Started by WeyldFalcon, 08-07-2020, 06:13 AM
      10 responses
      1,414 views
      0 likes
      Last Post Traderontheroad  
      Started by firefoxforum12, Yesterday, 08:53 PM
      0 responses
      11 views
      0 likes
      Last Post firefoxforum12  
      Working...
      X