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!
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
NinjaTrader
Adding References (From Visual Studio)
Collapse
X
-
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.
-
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();
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.
Leave a comment:
-
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.
Leave a comment:
-
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 21NinjaScript 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
states
double Median(this IEnumerable<double> data)
Estimates the sample median from the provided samples (R8).
Parameters
IEnumerable<double> data
The data sample sequence.
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!
Leave a comment:
-
Hello PaulMohn,
but the new .dlls don't show up.
The only .dll showing from the Custom folder is Ninjatrader.Vendor.dll
- Likes 1
Leave a comment:
-
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 MasteryLast edited by PaulMohn; 03-10-2022, 04:57 PM.
Leave a comment:
-
Hello PaulMohn,
Not all of your images loaded from post 12 on. From the details I can see you would need to copy the dlls from the addon projects build folder into to the bin/custom folder and then reference any dlls which are needed to use that namespace. The addon project has a bin/debug sub folders and the build data for visual studio exists there.
Leave a comment:
-
I've added
PHP Code:using MathNet.Numerics.Statistics;
NinjaScript File Error Code Line Column
Testa.cs The type or namespace name 'MathNet' could not be found (are you missing a using directive or an assembly reference?) CS0246 25 7
Leave a comment:
-
6.Copy the files you need to the bin/custom folder so you can reference any needed dlls.
Are the ones needed only the new files from the bin/Custom or are there new files elsewhere I should also copy to Documents\NinjaTrader 8\bin\Custom? Thanks!Last edited by PaulMohn; 03-10-2022, 04:39 PM.
Leave a comment:
-
4. F6 build the solution
5. You can now view the bin/debug folder from that solution to see what files got copied, some nuget packages have extra files or build actions that require copying or creating specific files/structures.
Last edited by PaulMohn; 03-10-2022, 04:45 PM. Reason: I found there are only 2 new files (the left window is the new folder bin/debug folder, while the right window is the folder still in the archive)
Leave a comment:
-
Thanks.
I had to download 4.8, install it, then close visual studio and relaunch it for it to load the addon project.
1. Go to the following link and download the addon visual studio project:
2. Open the project in visual studio
3. Add the nuget reference that you wanted to use by using visual studios nuget manager.
Last edited by PaulMohn; 03-10-2022, 04:42 PM.
Leave a comment:
-
Hello PaulMohn,
NT8 is now 4.8, to develop 4.8 assemblies you would need to install the targeting pack.
- Likes 1
Leave a comment:
-
Thanks Jesse,
I've downloaded the Addon archive, unziped on my desktop and double clicked the .sln file.
I'm getting this
What should I do next? Isn't NT8 4.5? Thanks!
Leave a comment:
-
Hello PaulMohn,
I wouldn't really be able to say because I am not familiar with that library, you can however find out by using visual studio. The easiest way to get nuget references for NinjaTrader would be the following process:- Go to the following link and download the addon visual studio project: https://ninjatrader.com/support/help...t_overview.htm
- Open the project in visual studio
- Add the nuget reference that you wanted to use by using visual studios nuget manager.
- F6 build the solution
- You can now view the bin/debug folder from that solution to see what files got copied, some nuget packages have extra files or build actions that require copying or creating specific files/structures.
- Copy the files you need to the bin/custom folder so you can reference any needed dlls.
This process does copy the addon dll to the bin/custom folder as well, to delete that open the folder Documents\NinjaTrader 8\bin\Custom and remove the addon dll that was copied.
This also makes sure the target .net version is the correct one for NT8.
- Likes 1
Leave a comment:
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by alifarahani, Today, 09:40 AM
|
6 responses
31 views
0 likes
|
Last Post
by alifarahani
Today, 03:18 PM
|
||
Started by Waxavi, Today, 02:10 AM
|
1 response
17 views
0 likes
|
Last Post Today, 03:03 PM | ||
Started by Kaledus, Today, 01:29 PM
|
5 responses
14 views
0 likes
|
Last Post Today, 02:56 PM | ||
Started by Waxavi, Today, 02:00 AM
|
1 response
12 views
0 likes
|
Last Post Today, 02:53 PM | ||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
3 responses
17 views
0 likes
|
Last Post Today, 02:41 PM |
Leave a comment: