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!
See more
See less

Partner 728x90

Collapse

public static async Tasks Method

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

    public static async Tasks Method

    Hi EV, why I can't create method like this one belowin NinjaScript
    Code:
    	public static async Task sendMessage()
            {
                
            }
    It compiles with no problem in VS but in NinjaScript editor gives CS1002 error

    #2
    Hello dv926844,

    Thank you for your post and welcome to the Support Forum!

    Can you clarify a few points here? Are you performing this in NinjaTrader 7 or 8? And what namespace is this defined in?

    Can you attach a screenshot of the compile with the message column expanded?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

    Click here for instructions: http://windows.microsoft.com/en-us/w...#1TC=windows-8

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    Click here for detailed instruction: http://take-a-screenshot.org/

    I look forward to your response.

    Comment


      #3
      hi

      namespace NinjaTrader.Strategy

      It's Ninja Trader 7

      Attaching a screenshot:
      Attached Files

      Comment


        #4
        Code:
        public static async Task sendMessage(string destID, string text)
                {
                    try
                    {
                        var bot = new Telegram.Bot.TelegramBotClient("302755276:AAHsV9EDFMwe8125hH-UK-WmXuTDeLZMYks");
                        await bot.SendTextMessageAsync(destID, text);
                    }
                    catch (Exception e)
                    {
                    }
                }
        here code of whole method

        Comment


          #5
          Hello dv926844,

          Thank you for your response.

          May we test the full code? If you prefer you can send the file to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

          You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

          I look forward to your response.
          Last edited by NinjaTrader_PatrickH; 01-24-2017, 07:25 AM. Reason: Corrected email address.

          Comment


            #6
            ATTN: Patrick H

            I'm sorry but it can't find such address as you left(it's on screenshot, sry if it's wrong) so i send you all information here

            I'm trying to send message using telegram bot but problem is not in bot, it seems to be something wrong in System.Threading
            Attached Files

            Comment


              #7
              Hello dv926844,

              Thank you for your response.

              async Task is not supported in NinjaTrader 7 as it requires .Net 4 and NinjaTrader 7 uses .Net 3.5. If you wish to perform Asynchronous Programming you can look to NinjaTrader 8 which supports .Net 4.

              Please let me know if you have any questions.

              Comment


                #8
                Hi

                Thank you for your reply

                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
                20 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                180 views
                0 likes
                Last Post jeronymite  
                Working...
                X