Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Twitter API added to Ninja... please?
Collapse
X
-
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();
}
-
It tried to reproduce the steps but the version is changes and I do not get it working? Please can anybody helpOriginally posted by i001962 View PostIf you use this really pretty simple to accomplish.
http://code.google.com/p/twitterizer/ will help.
1) Download zip to your NT computer.
2) Add the downloaded framework to your custom indicator/strategy (hint from edit scrip uset right mouse button and 'preferences' 'add' this new dll
3) Start coding...
e.g.
#region Using declarations
...
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
using Twitterizer.Framework;
#endregion
....
#region Variables
....
Twitter t = new Twitter("YourUserName", "YourPassword");
#endregion
//logic that tells you went to enter/exit goes here
TwitterStatus newStatus = t.Status.Update("NinjaTrader to Twitter Trade 1 test - wow that was easy! *smiles");
//Of course you'll want to put your trade details into the msg but that's simple enough
That's it!
Trade well.
Kevin
Leave a comment:
-
It tried to do the same but they release a new version 2 BETA and it does not work anymore.Originally posted by loadednrg View PostHi Guys,
I place my trades in Ninja, and then type them in twitter.
It would be great if Ninja automatically tweeted entry, profit and stop.
As an educator I'm sure a few of us would find this useful.
(I noticed its been done for MT4 https://www.myfxbook.com/ , )
Twitter APIs are simple and you could add it in, in no time.
Leave a comment:
-
Example of Twitter into NT
http://www.youtube.com/watch?v=3n9DFx634Es
The above vid is a demo of a NT indicator I've created (er...mashed together) that uses the Twitterizer framework to pull in Tweets.
I use the indicator with Market Replay to insert some 'noise' into my practise session. Since I persist the Twitter stream after it's read I haven't posted the indicator to the forum as of yet. One of these days I'll polish the code and release it. In the meantime feel free to contact me if you have any questions about it.
Leave a comment:
-
BluePoint - Glad to hear you found a way around the issue.
DiggitallyBorn - Glad to hear I was doing it correctly - BTW thanks for the awesome framework. Looking forward to the oAuth!
It occurred to me while adding a dll ref. for another project that I needed to restart NT after adding the reference in order for the namespace to be recognized and compile correctly. Not certain if that will help you BluePoint but thought I'd share it.
Leave a comment:
-
Hi, This is Ricky, creator of the Twitterizer framework. I'm not familiar with Ninja, but if there are any issues integrating the framework, I'd be more than happy.
@i001962: You're correct that OAuth is the preferred authentication method and our framework does not (yet) support it, but we weren't 'grandfathered' in, per-se. Basic authentication is still fully supported.
Regardless, the code posted looks correct. We have a few methods of determining what (if any) issues may have occurred. Feel free to reply here, PM me, or contact our mailing list if you have any questions or suggestions.
Mailing list: http://groups.google.com/group/twitterizer
Leave a comment:
-
Brut force solution for twitter integration
Using a command line programme found by a google search (see attached). Don't forget to set the execution permisions on the executable, the location that u put it in and change the id and password of ur twitter account accordingly .... u can then change the string manipulations as u like.
Have fun...tested and works...
private void updatetwitter(string txt)
{
string twitterid = "twitterid";
string twitterpw = "password";
txt = "Blue trading robot: " + txt;
txt = txt + @" http://blue-point-trading.com/";
string prog = @"c:\temp\twimmando.exe ";
string cmd = @"-uri /statuses/update.json -f status ";
cmd = cmd + '"' + txt + '"';
cmd = cmd + " -post -u " + twitterid + " -p " + twitterpw;
Process p = new Process();
p.StartInfo.FileName = prog;
p.StartInfo.Arguments = cmd;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();
}Attached FilesLast edited by Bluepoint; 12-23-2009, 07:48 PM.
Leave a comment:
-
Twitter integration
Nope, it compiles but it must compiles into to guk. It definetly sees the framework...when not load it does not compile. When I comment out the define variable statement "Twitter t = new Twitter("blue_point", "xxxxx");" it then works, but then i dont have the structure code to work with obviously.......
Tried as well to make in public and private variable.....no go .... using the latest version of ninja 6.5 as well.
Originally posted by i001962 View PostDon't know what to tell you other than it works as an indicator (for me) Can you get it to show up and select it as an indicator when viewing a chart?
I'm using the latest NT version 6.5 something (sorry not at my trading computer to check the full details).
Leave a comment:
-
Don't know what to tell you other than it works as an indicator (for me) Can you get it to show up and select it as an indicator when viewing a chart?
I'm using the latest NT version 6.5 something (sorry not at my trading computer to check the full details).
Leave a comment:
-
Sorry not that easy ... no i mean the script does not run at all !!!!
Sorry not that easy ... no i mean the script does not run at all !!!!
Yes I know what you said in ur response. The issue is that it does not run at ALL with this framework. The script does not even show up as an option in the backtest window....it simple when compiles screws something up...Yes it does compile...correctly...strange. There something in the dll or something specific to that package that Ninja does not like at run time....
Originally posted by i001962 View PostIt looks like you have initialized everything correctly but have not called the API to update the status.
This line of code should be inserted in order to send a Twitter status update.
//Insert your own text that includes the trade details
TwitterStatus newStatus = t.Status.Update("NinjaTrader to Twitter Trade 1 test - wow that was easy!");
A couple words of caution -
You only get 150 requests to the Twitter API per hour. It is very easy to blow this limit out if you are calling the line of code above on bar updates. Also, you may wish to catch exceptions and toss them to the output window. This may help you figure out if you are actually authorizing at Twitter's site or not.
This framework does not use oAuth at this point in time. oAuth is Twitter's preferred method of authorizing application users with the Twitter API. This framework is grandfather'd in to access the API without oAuth. - FROM WHAT I CAN TELL
Maybe somebody that knows NT better than me could comment here-- I have only used this code successfully in Indicators. I have not tried it in strategies. SO when I fire off a Twitter status it's sending a status update to Twitter for a buy or sell 'signal' rather than an actual trade execution. It would be nice to see some sample code for the actual executions.
Leave a comment:
-
More 411
It looks like you have initialized everything correctly but have not called the API to update the status.
This line of code should be inserted in order to send a Twitter status update.
//Insert your own text that includes the trade details
TwitterStatus newStatus = t.Status.Update("NinjaTrader to Twitter Trade 1 test - wow that was easy!");
A couple words of caution -
You only get 150 requests to the Twitter API per hour. It is very easy to blow this limit out if you are calling the line of code above on bar updates. Also, you may wish to catch exceptions and toss them to the output window. This may help you figure out if you are actually authorizing at Twitter's site or not.
This framework does not use oAuth at this point in time. oAuth is Twitter's preferred method of authorizing application users with the Twitter API. This framework is grandfather'd in to access the API without oAuth. - FROM WHAT I CAN TELL
Maybe somebody that knows NT better than me could comment here-- I have only used this code successfully in Indicators. I have not tried it in strategies. SO when I fire off a Twitter status it's sending a status update to Twitter for a buy or sell 'signal' rather than an actual trade execution. It would be nice to see some sample code for the actual executions.
Leave a comment:
-
Twitter integration
Hello can you help...I did what you said in your post. It compiles. But the script simply does not run. It does not even show up as an option in the backtest window.
It does compile ok though. I added the dll as said. Though its not properties its called references on the right click in the editor.
Any idea what I am doing wrong? Compatibility issues? Code snipets:
#region Using declarations
using System;
using System.IO;
using System.Text;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Strategy;
using NinjaTrader.Gui.Chart;
using Twitterizer.Framework;
#endregion
#region Variables
private int fast = 14;
private int slow = 28;
private int trailstop = 16;
private int baroffset = 6;
private int profittarget = 16;
private bool trailstopflag = false;
private bool doubletradeflag = false;
private bool starttradeflag = false;
private bool closetradeflag = false;
private string positionflag;
private double trailstopprice;
private double entryprice;
private int loopcounter = 999;
Twitter t = new Twitter("blue_point", "xxxxx");
private bool oopsdebug = true;
private int tradelogflag = 0;
#endregion
No other twitter code exists ....
Leave a comment:
-
This is really very simple
If you use this really pretty simple to accomplish.
http://code.google.com/p/twitterizer/ will help.
1) Download zip to your NT computer.
2) Add the downloaded framework to your custom indicator/strategy (hint from edit scrip uset right mouse button and 'preferences' 'add' this new dll
3) Start coding...
e.g.
#region Using declarations
...
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
using Twitterizer.Framework;
#endregion
....
#region Variables
....
Twitter t = new Twitter("YourUserName", "YourPassword");
#endregion
//logic that tells you went to enter/exit goes here
TwitterStatus newStatus = t.Status.Update("NinjaTrader to Twitter Trade 1 test - wow that was easy! *smiles");
//Of course you'll want to put your trade details into the msg but that's simple enough
That's it!
Trade well.
Kevin
Leave a comment:
-
Hello loadednrg,
Thank you for your post.
I will forward this idea to development for possible inclusion on the list of possible future enhancement.
Leave a comment:
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by kinfxhk, 07-14-2026, 09:39 AM
|
0 responses
91 views
0 likes
|
Last Post
by kinfxhk
07-14-2026, 09:39 AM
|
||
|
Started by kinfxhk, 07-13-2026, 10:18 AM
|
0 responses
93 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 10:18 AM
|
||
|
Started by kinfxhk, 07-13-2026, 09:50 AM
|
0 responses
70 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 09:50 AM
|
||
|
Started by kinfxhk, 07-13-2026, 07:21 AM
|
0 responses
87 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 07:21 AM
|
||
|
Started by kinfxhk, 07-11-2026, 02:11 AM
|
0 responses
66 views
0 likes
|
Last Post
by kinfxhk
07-11-2026, 02:11 AM
|

Leave a comment: