Announcement

Collapse
No announcement yet.

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.

      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:	232
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

          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<double> Rng0Rng1;
          
                  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.

            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 Testa: Indicator
                {
                  private List<double> listOfSeriesValues;
              
                  IEnumerable<double> median;
              
              
                  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<double> median; / 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<double> median; / 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.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                601 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                347 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                559 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                558 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X