No announcement yet.

Partner 728x90


Including opensource files

  • Filter
  • Time
  • Show
Clear All
new posts

    Including opensource files


    I'm working on a telegram messanger integration for ninjatrader and found following project for this

    My understanding is that I can programm normal c# in the strategy editor ? And can also include other projects? For that I copied this src code in my strategy directory and tried to compile it.

    But I get a syntax error for

            /// <summary>
            /// Send a request to Bot API
            /// </summary>
            /// <typeparam name="TResponse">Type of expected result in the response object</typeparam>
            /// <param name="request">API request object</param>
            /// <param name="cancellationToken"></param>
            /// <returns>Result of the API request</returns>
            Task<TResponse> MakeRequestAsync<TResponse>(
                IRequest<TResponse> request,
                CancellationToken cancellationToken = default);
    Which seems totaly correct for me. When I'm using Visual Studio for compiling i get a better error message :

    Severity Code Description Project File Line Suppression State
    Error CS8107 Feature 'default literal' is not available in C# 7.0. Please use language version 7.1 or greater. NinjaTrader.Custom \Documents\NinjaTrader 8\bin\Custom\Strategies\TelegramBot\TelegramBotCli ent.cs 195 Active

    It is possible to use c#7.1 with ninjatrader?

    Thanks for your help


    Thank you for the post.

    You have hit the nail on the head so to speak with the error, you cannot use C# 7.0 syntax in NinjaTrader. Default literal is not a type that is acceptable for C# 4.5.

    you would very likely need to download the source code from the github you linked, open the solution and reduce the target platform in the project and rebuild. This would very likely generate errors if they have used C# > 4.5 syntax as NinjaTrader requires 4.5 or less. Depending on the complexity, it may be easiest for you to "fork" their project and make these modifications on your local machine. If any other developer needed to use this in the future they could reference your specific modification on github. I am not sure what the reverse option for default is as we don't use 7.0, you would likely need to do a google search for this information if you do a downgrade.

    Otherwise, there would not be a way for this to work as it uses 7.0 specific syntax.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service


      thank your very much for the fast answer.

      I have two more question :

      1. But it is possible and designed that I can use other c# files ? Where is the beste place for ninjatrader to store them ? (Some common c# code files which I want to share with different strategys or addons )

      2. Do your scheduled an update for c# to a current version ? Like c#7.2 ?Because c#4.5 is really old ( 2010 )

      Thanks for your help



        Thank you for the reply.

        Yes C# is used for NinjaScript, so you can execute standard C# code in the platform. I would suggest using the NinjaScript editor to place the item in the appropriate folder for the use, for example, an addon should go in the addon folder. Misc/shared/common files would likely be best in the addons folder although you can use Partial classes for the various types in the individual folders also. For third-party DLLs, those need to go in the documents/NinjaTrader 8/bin/custom folder and then referenced using the right click -> References menu.

        Regarding C# 7.0, there is currently nothing public that I can provide that may indicate we would upgrade to this, it would be noted in the release notes if this becomes a possibility. I will put in a feature request for this as well.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service


        Latest Posts


        Topics Statistics Last Post
        Started by smcllr, Today, 02:41 PM
        2 responses
        Last Post smcllr
        by smcllr
        Started by Balage0922, Today, 01:25 AM
        1 response
        Last Post Balage0922  
        Started by Skechers, Yesterday, 04:35 PM
        1 response
        Last Post Tasker-182  
        Started by Gmonte, Today, 08:28 AM
        1 response
        Last Post Gmonte
        by Gmonte
        Started by akvevo, 09-20-2017, 03:53 PM
        35 responses
        1 like
        Last Post MisterTee