Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Twitter API added to Ninja... please?

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

    #16
    Output a Tweet to Twitter

    To output to twitter: Add this function changing paths, etc .... you will also need to install the TweetWSH.wsf following the application registering instructions in this file for twitter to comply with the new OAuth login mechanism of twitter. Works fine for me.

    private void updatetwitter(string txt)
    {
    txt = "Robo trade signal: " + txt;
    txt = txt + @"..Live internet TV: http://blue-point-trading.com/";
    string prog = @"c:\Jts\TweetWSH.wsf ";
    string cmd = '"' + txt + '"';

    Process scriptProc = new Process();
    scriptProc.StartInfo.FileName = prog;
    scriptProc.StartInfo.Arguments = cmd;
    scriptProc.Start();
    scriptProc.WaitForExit();
    scriptProc.Close();
    }
    Attached Files

    Comment


      #17
      Thank you for contributing this, Bluepoint.
      Ryan M.NinjaTrader Customer Service

      Comment


        #18
        Hi Bluepoint,

        I am wanting to apply twitter to NT7 for trade alerts when I am away from my computer have you got step by step instructions for installing the script.
        Thanks Raef

        Comment


          #19
          Rtfm

          Originally posted by raefon72 View Post
          Hi Bluepoint,

          I am wanting to apply twitter to NT7 for trade alerts when I am away from my computer have you got step by step instructions for installing the script.
          Thanks Raef
          I think you need to read the script file instructions and twitter instructions and put it together. If they are too difficult for you then you may want to consider employing someone that can....sorry. Have you actually read this information?

          I am not a top programmer and I could figure it out so give it a try yourself...if you have a specific question I can answer....but a step by step means I would have to do your project.

          Comment


            #20
            I think you need to read the script file instructions and twitter instructions and put it together.
            Hi thanks its ok thats the sort of thing I meant. I am totally new to twitter but have some experience programming NT7 script. I tried to open the zip file but my computer doesn't recognise it. I had a brief look at the twitterize forum and will go back there.

            Thanks again raef

            Comment


              #21
              Hello,

              I'm bringing up an old thread but I'm trying to add Twitter to an indicator and I can't get it to run. My code is simple, just to do the request token. but apparently it's not loading a DLL it needs.

              here's my code:



              here is where I added the Twitterizer2.dll and the Newtonsoft.Json.dll to the references:



              this is the error I get:

              Code:
              Could not load file or assembly 'Twitterizer2, Version=2.4.0.2028, Culture=neutral, PublicKeyToken=69d1469eac671567' or one of its dependencies. The system cannot find the file specified.
              Any help would be greatly appreciated.

              Comment


                #22
                Hi,

                The other guys may know more but you have to reference the script .wsf on your C drive.

                string prog = @"c:\Jts\TweetWSH.wsf ";

                You creat a trigger to call the .wsf script that contacts your twitter account that sends you the tweet.
                txt = "Robo trade signal: " + txt;

                If that make sense.
                I use an app from my broker that notifies me when I enter a trade so I dont use the tweet at all.
                Raef

                Comment


                  #23
                  I think the problem with Twitterizer is Ninjatrader is not finding the extra files. They're not DLL's so I can't add references to them. I put them with the DLLs but Ninja isn't finding them. Any other place I can put them?

                  Comment


                    #24
                    I dont believe you need them but you need the .wsf file to be on your C drive.

                    string prog = @"c:\ any folder you choose \TweetWSH.wsf ";

                    Thats all thats required along with your twitter account setup etc.

                    Comment


                      #25
                      Originally posted by raefon72 View Post
                      I dont believe you need them but you need the .wsf file to be on your C drive.

                      string prog = @"c:\ any folder you choose \TweetWSH.wsf ";

                      Thats all thats required along with your twitter account setup etc.
                      This may work for sending tweets but I want my indicator to subscribe to tweets.

                      I was told that part of the problem may be because Twitterizer uses .NET 4.0 and Ninja uses 4.0. If anyone has an older Twitterizer compiled in 3.5 you can share, I'd be very grateful. I don't have visual studio.

                      Comment


                        #26
                        No worries I only know of OnFundamentalData() in the help section

                        Comment


                          #27
                          Twitter Update

                          In post on this thread the script has changed due to twitter. They changed the paths to the API.....so you will now have to use this script instead....Good luck.....
                          Attached Files

                          Comment


                            #28
                            BluePoint now that Twitter also supports posting images as part of the message, I was wondering if you could help the update the script for that feature too. Hope its not too big an ask of you.

                            Comment


                              #29
                              Post To Twitter

                              hello everyone.. need help, I'd tried to post a tweet in the twitter in the using ninjatrader Indicator, this code was working in the ASP.NET but not in the ninja,,, I got this error when I compile it.

                              The name 'Response' does not exist in the current context
                              The name 'Request' does not exist in the current context

                              anyone can help pls??
                              This is my code..

                              try
                              {

                              var oauth_consumer_key = "consumerKey";
                              var oauth_consumer_secret = "ConsumerSecret";


                              if (Request["oauth_token"] == null)
                              {
                              OAuthTokenResponse reqToken = OAuthUtility.GetRequestToken(
                              oauth_consumer_key,
                              oauth_consumer_secret,
                              Request.Url.AbsoluteUri);

                              Response.Redirect(string.Format("This is a Link to reconize if it is Success or not",
                              reqToken.Token));

                              }
                              else
                              {
                              string requestToken = Request["oauth_token"].ToString();
                              string pin = Request["oauth_verifier"].ToString();

                              var tokens = OAuthUtility.GetAccessToken(
                              oauth_consumer_key,
                              oauth_consumer_secret,
                              requestToken,
                              pin);

                              OAuthTokens accesstoken = new OAuthTokens()
                              {
                              AccessToken = tokens.Token,
                              AccessTokenSecret = tokens.TokenSecret,
                              ConsumerKey = oauth_consumer_key,
                              ConsumerSecret = oauth_consumer_secret
                              };

                              TwitterResponse<TwitterStatus> response = TwitterStatus.Update(
                              accesstoken,
                              "status = " + msg +"Instrument = " +Instrument.FullName
                              +"Direction = " +SignalType +"Close Price = " +Close[0] +"Date/Time = " +SignalTime);

                              if (response.Result == RequestResult.Success)
                              {
                              Response.Write("we did it!");
                              }
                              else
                              {
                              Response.Write("its all bad.");
                              }
                              }
                              }
                              catch( Exception ex )
                              {
                              Console.WriteLine(ex);
                              Print("----------end-------------");
                              }

                              Comment


                                #30
                                Flexer, welcome to our forums - looks to me like you miss a reference dll (WebServices)? This could be set if right click in your source code in the NinjaScript editor > References > Add.
                                BertrandNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Vietanhnguyen2hotmailcom, Yesterday, 10:29 AM
                                4 responses
                                23 views
                                0 likes
                                Last Post Vietanhnguyen2hotmailcom  
                                Started by PhillT, 04-19-2024, 02:16 PM
                                4 responses
                                35 views
                                0 likes
                                Last Post PhillT
                                by PhillT
                                 
                                Started by ageeholdings, 05-01-2024, 05:22 AM
                                5 responses
                                37 views
                                0 likes
                                Last Post ageeholdings  
                                Started by reynoldsn, Today, 02:34 PM
                                0 responses
                                13 views
                                0 likes
                                Last Post reynoldsn  
                                Started by nightstalker, Today, 02:05 PM
                                0 responses
                                23 views
                                0 likes
                                Last Post nightstalker  
                                Working...
                                X