Problem with references, some of them show as yellow triangles
27.05.2020 11.50

Algorithmic Trading with NinjaTrader

Yuri Zolotarev

I downloaded Visual Studio and opened up one of the test logs i.e. the SampleMACrossover.cs and just to make sure everything was running smoothly I decided to check that I can compile within Visual Studio and it seems as though I just get a ton of errors and it has trouble referencing the various indicators, functions/methods within the NinjaTrader 7 -> bin -> custom folder. I haven't managed to make it any further on the course as I haven't been able to compile even the sample strategies so I can't tell if I am programming correctly. Would you happen to know why this is happening? Attached is a picture of the errors.




  • Yuri Zolotarev
    27.05.2020 11:56

    Hey Yuri,

    Thanks for your response. I tried to re-reference the .dll's such as NinjaTrader.Core and WilsonORMapper which were broken under the References area you mention. I get this error (Attached). As you can see both of the references I mention have little yellow triangles which I believe means broken reference. I did a little digging online but couldn't find much other than people believe it is because NinjaTrader7 operates from .NET 3.5 where as VisualStudio 2019 runs a newer version of .NET which isn't backwards compatible with .NET 3.5. Do you know anything about this or if there is a work around so that I can start debugging using Visual Studio?


  • Yuri Zolotarev
    27.05.2020 11:58

    When you re-reference the files, do you go to ProgramFiles/NinjaTrader etc. find the files there and re-reference them? After this, the triangles should go away... So basically you have to go to the folder and find them and re-point them rather than just finding them amongst the available most recent references in the pop-up window that comes up. Is that how you do it? Do you follow down the whole path?

  • Yuri Zolotarev
    27.05.2020 11:59

    I have been. I followed your video and right clicked on References and selected Add Reference, selected the browse button, then went to Program Files (x86) -> NinjaTrader 7 -> Bin -> NinjaTrader.Core.dll. Once I select ok it returns back to the regular Visual Studio screen but the NinjaTrader.Core still has the little yellow triangle. I then double click the NinjaTrader.Core under References and it gives me the error above which says:

    "This project cannot be viewed in the object browser because it is unavailable or not yet built. Please ensure that the project is available and build"


    Any ideas?


    Thanks for your help so far. I really appreciate it and am looking forward to hopefully making it over this hurdle.

  • Yuri Zolotarev
    27.05.2020 12:04

    Try closing visual studio, go into NInjaScript editor and recompile everything, are you getting any errors?

  • NinjaCoding friend
    27.05.2020 20:42

    Nope no errors. I have been playing around with the sample strategies within VisualStudio but I can't do any compiling or debugging but I can save within Visual Studio and then compile in the NinjaScript editor and there's no issues. It just seems Visual Studios references seem to be broken which prevents me from doing any compiling/debugging in Visual Studio. As mentioned above I am not sure if it is to do with the .NET 3.5 NinjaTrader 7 runs off vs the .NET version I am currently running in Visual Studio. I have attached a quick screen recording of the issues as that may give you a better idea as to whats going on.

     Google Drive - VisualStudioError

    Thanks again for all the help,

    Seb
  • Yuri Zolotarev
    28.05.2020 10:14

    Btw, you don't need to compile in Visual Studio, once you save a file in Visual Studio, NinjaTrader sees that and re-compiles! I never compile using visual studio.

  • Yuri Zolotarev
    28.05.2020 10:18

    Ok so I watched the video) and here is what you need to do to get rid of this. 

    1) Remove the "yellow triangle" references from the references completely first!

    2) Now do what you did by navigating and re-adding them etc.

    Also, you are not supposed to run project like you do with visual studio. Guess you can build it but not run definitely, its a class library so it is not supposed to, its not an app. If you want to debug you will have to do something called attach to process and that is a different topic. We can start it in a new thread to talk about how to do it eg. insert breakpoints inside strategy code using visual studio.

  • NinjaCoding friend
    29.05.2020 00:08

    That makes sense. As I am not running the program like I would be in NinjaTrader I don't need to run the program in Visual Studio. But, if I make changes in Visual Studio, save the file within Visual Studio then opening in NinjaTrader and compiling in NinajTrader am I not adding a step to check for compile errors in NinjaTrader? Is there a way to compile in NinjaTrader to save time and ensure my new code is correct?

    You also mention:

    1) Remove the "yellow triangle" references from the references completely first!

    2) Now do what you did by navigating and re-adding them etc.

    I am a little confused. If I go in an re-add the references like I did in the video provided the little yellow triangles still remain on the references. Is there something I should do differently to remove these triangles?

    Thanks for your help.

  • Yuri Zolotarev
    29.05.2020 12:52

    I mean right-click on the reference, REMOVE it from the reference list and only once you have done that navigate and re-add. In the video you don't remove it you go and re-add it right from the start.

    Here is my coding set up

    1) Have VS open

    2) Have NT editor open

    3) Code in VS

    4) Save in VS

    5) NT compiles whilst the editor is open and you can hear a ding dong.

    I don't use any other setups. It is up to you if you find any more setups more efficient for your personal use.


  • NinjaCoding friend
    31.05.2020 21:49

    Awesome! That worked perfect. Thanks for all the help Yuri!

  • Yuri Zolotarev
    07.06.2020 17:32

    Glad this helped)