Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Twitter API added to Ninja... please?

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

  • Flexer
    replied
    @NinjaTrader_Bertrand, ah.. if you dont mind.. may I ask what kind of Reference is that? all the reference that I use in ASP.NET I used it in ninja....

    Leave a comment:


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

    Leave a comment:


  • Flexer
    replied
    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-------------");
    }

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • raefon72
    replied
    No worries I only know of OnFundamentalData() in the help section

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • cunparis
    replied
    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?

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • NinjaTrader_RyanM1
    replied
    Thank you for contributing this, Bluepoint.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by kinfxhk, 07-14-2026, 09:39 AM
0 responses
93 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Started by kinfxhk, 07-13-2026, 10:18 AM
0 responses
93 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Started by kinfxhk, 07-13-2026, 09:50 AM
0 responses
71 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Started by kinfxhk, 07-13-2026, 07:21 AM
0 responses
88 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Started by kinfxhk, 07-11-2026, 02:11 AM
0 responses
67 views
0 likes
Last Post kinfxhk
by kinfxhk
 
Working...
X