Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Including opensource files

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

    Including opensource files

    Hello,

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

    .NET Client for Telegram Bot API. Contribute to TelegramBots/Telegram.Bot development by creating an account on GitHub.


    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

    Code:
            /// <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

    #2
    Hello,

    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

    Comment


      #3
      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

      Comment


        #4
        Hello,

        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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        19 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        21 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X