Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Including opensource files

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

  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • Hunk86
    replied
    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

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • Hunk86
    started a topic Including opensource files

    Including opensource files

    Hello,

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

    https://github.com/TelegramBots/Telegram.Bot

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by sjeffblack, Today, 01:22 PM
2 responses
16 views
0 likes
Last Post sjeffblack  
Started by Kicks.Spin, Today, 01:24 PM
1 response
13 views
0 likes
Last Post NinjaTrader_Jesse  
Started by JLSwin, Today, 01:07 PM
1 response
7 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by dgee949, Today, 12:11 PM
4 responses
22 views
0 likes
Last Post dgee949
by dgee949
 
Started by jalro, Today, 10:25 AM
1 response
19 views
0 likes
Last Post NinjaTrader_Kate  
Working...
X