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

Adding References (From Visual Studio)

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

    #16
    Oh ok I've reuploaded the images now (I had the 5 images per post limit issues before)

    I forgot to reference them
    Using 3rd Party Indicators

    I checked from the script in Ninjascript editor > right click > references
    but the new .dlls don't show up.
    The only .dll showing from the Custom folder is Ninjatrader.Vendor.dll
    Any reason why? Thanks!

    I saw the same .dll showing at this timestamp
    10 Benefits of Using Visual Studio with NinjaTrader - Ninja Mastery
    Last edited by PaulMohn; 03-10-2022, 04:57 PM.

    Comment


      #17
      Hello PaulMohn,

      but the new .dlls don't show up.
      The only .dll showing from the Custom folder is Ninjatrader.Vendor.dll
      Are you clicking Add to browse to the bin/custom folder? The dlls don't add themselves to the list, you have to add each dll manually.

      JesseNinjaTrader Customer Service

      Comment


        #18
        Thanks Jesse I didn't look for the add.
        I got it on now!

        Click image for larger version

Name:	add.png
Views:	55
Size:	96.6 KB
ID:	1193380

        Comment


          #19
          Ok so it does load but I got these error

          NinjaScript File Error Code Line Column
          Testa.cs 'NinjaTrader.NinjaScript.Series<double>' does not contain a definition for 'Median' and the best extension method overload 'MathNet.Numerics.Statistics.Statistics.Median(Sys tem.Collections.Generic.IEnumerable<double>)' has some invalid arguments CS1928 939 21
          NinjaScript File Error Code Line Column
          Testa.cs Instance argument: cannot convert from 'NinjaTrader.NinjaScript.Series<double>' to 'System.Collections.Generic.IEnumerable<double>' CS1929 939 21
          The package ref for the median
          https://numerics.mathdotnet.com/api/...ics.htm#Median
          states
          double Median(this IEnumerable<double> data)

          Estimates the sample median from the provided samples (R8).
          Parameters

          IEnumerable<double> data


          The data sample sequence.
          I use a list for the data
          PHP Code:
                  private Series<doubleRng0Rng1;

                  
          Rng0Rng1[Rng0Index] = Rng0[Rng0Index] - Rng1[Rng1Index];

                  
          double median Rng0Rng1.Median();

                  
          double var02b Instrument.MasterInstrument.RoundToTickSize(median TickSize); 

          Is there a way to use the list as/with IEnumerable<double> ?

          Or what other solution would you suggest? Thanks!

          Comment


            #20
            Hello PaulMohn,

            I won't be able to tell you what you need for the library to work or be able to help with that libraries use, adding the reference assumes you have something working with that library externally or know exactly what you need already. You may need other libraries referenced based on the error.

            If you are using nuget that generally entails that you make your own external project to collect needed resources or even form a test C# application to ensure you have something working beforehand. Once you have all the requirements you could copy the requirements like the dlls to NinjaTrader folders and then try and reference it.

            JesseNinjaTrader Customer Service

            Comment


              #21
              Ok thanks Jesse.

              I found a way from this helping post
              Why can't I assign List<int> to IEnumerable<object> in .NET 4.0

              I had to formulate it this way
              PHP Code:
              namespace NinjaTrader.NinjaScript.Indicators
              {
                public class 
              TestaIndicator
                
              {
                  private List<
              doublelistOfSeriesValues;

                  
              IEnumerable<doublemedian;


                  protected 
              override void OnStateChange()
                  {
                    if (
              State == State.SetDefaults)
                    {
                      
              //properties etc. here
                    
              }
                    else if (
              State == State.Configure)
                    {
                    }
                    else if (
              State == State.DataLoaded)
                    {        
                      
              listOfSeriesValues = new List<double>();

                      
              median = new List<double>();
                    }



                  protected 
              override void OnBarUpdate()
                  {
                    
              Rng0Rng1[Rng0Index] = Rng0[Rng0Index] - Rng1[Rng1Index];

                    
              listOfSeriesValues.Add(Rng0Rng1[0]);


                    
              double meds listOfSeriesValues.Median();

                    
              double var02b Instrument.MasterInstrument.RoundToTickSize(meds TickSize); 

              It is returning a value for the variable meds (please see attached images), though I'm not sure if that's right as there seems to be no connection between the

              PHP Code:
              IEnumerable<doublemedian; / median = new List<double>(); 

              and the

              PHP Code:
              double meds listOfSeriesValues.Median(); 

              Click image for larger version  Name:	meds.png Views:	0 Size:	1.21 MB ID:	1193422

              And when I comment out the

              PHP Code:
              IEnumerable<doublemedian; / median = new List<double>(); 

              it's not returning the value.

              Any advice on what the connection is? Thanks!
              Last edited by PaulMohn; 03-11-2022, 11:19 AM.

              Comment


                #22
                Hello PaulMohn,

                I won't be able to tell what is happening with that library.

                The line you mentioned seems that it is creating a new list, that is really all i can tell from that code.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by neo302, 11-25-2022, 03:33 PM
                4 responses
                40 views
                0 likes
                Last Post neo302
                by neo302
                 
                Started by crystalet, Today, 06:59 AM
                0 responses
                1 view
                0 likes
                Last Post crystalet  
                Started by Bidder, Today, 06:47 AM
                0 responses
                3 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by Mindset, 12-01-2022, 05:43 AM
                10 responses
                71 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by vapala, Yesterday, 06:22 AM
                2 responses
                26 views
                0 likes
                Last Post vapala
                by vapala
                 
                Working...
                X