NexusFi: Find Your Edge


Home Menu

 





Help using Twitterizer in an indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one cunparis with 3 posts (0 thanks)
    2. looks_two gomi with 2 posts (0 thanks)
    3. looks_3 sam028 with 1 posts (0 thanks)
    4. looks_4 Flexer with 1 posts (0 thanks)
    1. trending_up 2,696 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

Help using Twitterizer in an indicator

  #1 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,094

I'm trying to add Twitter capability to an indicator but I'm really stuck. I'm using Twitterizer which seems to be the leading .NET Twitter API.

I've copied their code from the samples:



And I add a reference to the Twitterizer DLL and it's JSON dependancy:



But when my code executes I get an error:

Could not load file or assembly 'Twitterizer2, Version=2.4.0.2028, Culture=neutral, PublicKeyToken=xxx' or one of its dependencies. The system cannot find the file specified.
So now I'm stuck. I posted at the ninja forums but so far no response. There are a few other files that come with it, I can't add references to them because they're not DLL files. I put them in the same directory as the twitterizer DLL.



I think Ninja is not picking these up. I'm not sure where else I can put them.

If anyone has any ideas I'd be very grateful. Thanks.

Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Twitterizer libs, did you recompile them in .Net 3.5 ?
It's .Net 4.0 by default, that will be your next problem .
I work on this last week, and ended by creating a .Net 4.0 console .exe, called asynchronously byt my NT strats.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #4 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,094


sam028 View Post
Twitterizer libs, did you recompile them in .Net 3.5 ?
It's .Net 4.0 by default, that will be your next problem .
I work on this last week, and ended by creating a .Net 4.0 console .exe, called asynchronously byt my NT strats.

Thanks Sam I hadn't even thought of that. I don't have .NET experience outside of Ninjascript. This is going to be a tough one.

I don't think I can do asynchronous because I want my indicator to display tweets on the chart window.

Follow me on Twitter Started this thread Reply With Quote
  #5 (permalink)
 gomi 
Paris
Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,505

Ninja doesn't load libraries in My Documents/Ninjatrader 7 ..... at runtime. You need to put the libs in Ninja binaries folder.

Reply With Quote
  #6 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,094


gomi View Post
Ninja doesn't load libraries in My Documents/Ninjatrader 7 ..... at runtime. You need to put the libs in Ninja binaries folder.

I put them there and got the same result. I'll restart Ninja after the close and see if that makes a difference.

Next task is to find someone with Twitterizer compiled for .NET 3.5 or a volunteer to compile it. The developer told me it should compile for 3.5 without any problems, but I don't have visual studio.

Follow me on Twitter Started this thread Reply With Quote
  #7 (permalink)
 gomi 
Paris
Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,505

You should try to run process monitor to see what file it's trying to load and why it's not finding it.
Process Monitor

Concerning Visual Studio, you can download VS express for free.
Free Developer Tools - Visual Studio 2010 Express | Microsoft Visual Studio

Reply With Quote
  #8 (permalink)
Flexer
Philippines
 
Posts: 7 since Sep 2014
Thanks Given: 1
Thanks Received: 0

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

any can help pls??
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-------------");
}

Reply With Quote




Last Updated on September 29, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts