Posting to Twitter - NinjaTrader Programming | futures io social day trading
futures io futures trading


Posting to Twitter
Updated: Views / Replies:5,617 / 29
Created: by shodson Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 1  
 
Thread Tools Search this Thread
 

Posting to Twitter

  #21 (permalink)
Trading Apprentice
Philippines
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 7 since Sep 2014
Thanks: 1 given, 0 received

Post to twitter

why is it that the my code cannot go down to the PostToTwitter? I put it under the OnBarUpdate, did I put it correcty? or I made a mistake.. I copy all the staf that posted on the postTwitter code. I used the code that not use curl.exe..

Reply With Quote
 
  #22 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


Flexer View Post
why is it that the my code cannot go down to the PostToTwitter? I put it under the OnBarUpdate, did I put it correcty? or I made a mistake.. I copy all the staf that posted on the postTwitter code. I used the code that not use curl.exe..

The method used by shodson was made redundant by Twitter some time ago - if you know how to program you may need want to look at some generic c# examples/discussion, like the one here:

c# - Twitter POST problems using api 1.1 - Stack Overflow

Twitter API added to Ninja... please? - Page 2 - NinjaTrader Support Forum

Otherwise you need to hope someone will post new working example here.

Reply With Quote
The following 3 users say Thank You to gregid for this post:
 
  #23 (permalink)
Elite Member
Toronto, Canada
 
Futures Experience: Advanced
Platform: NinjaTrader, MT4
Broker/Data: Amp/CQG, Citibank
Favorite Futures: CL, GC, 6E, ES, TF, EURUSD, GBPJPY, AUDUSD
 
Beljevina's Avatar
 
Posts: 349 since Sep 2010
Thanks: 379 given, 564 received


I have been using simple SendMail commands from within my Ninjascript, to email to a TwitterMail address, with NinjaTrader configured via gmail's SMTP server (smtp.gmail.com, port 587, SSL), for well over a year now. The "tweet" is uniformly "received" within a second, and, other than what was a twittermail problem some months ago (was down for a few days), the solution works flawlessly and around the clock.

Reply With Quote
The following 4 users say Thank You to Beljevina for this post:
 
  #24 (permalink)
Trading Apprentice
Philippines
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 7 since Sep 2014
Thanks: 1 given, 0 received

thank you....

I also have another problem.

I use this as my code:
Twitter t = new Twitter(Username, Password);
t.Status.Update("status = " + msg +"Instrument = " +Instrument.FullName
+"Direction = " +SignalType +"Close Price = " +Close[0] +"Date/Time = " +SignalTime);

but wen I compile this code it says that Object refferences not set of an object what does it mean?

im glad if some can answer me...

Reply With Quote
 
  #25 (permalink)
Trading Apprentice
Philippines
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 7 since Sep 2014
Thanks: 1 given, 0 received

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

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 find if the result 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
 
  #26 (permalink)
Elite Member
barcelona
 
Futures Experience: Advanced
Platform: ninjatrader
Favorite Futures: futures
 
Pristine's Avatar
 
Posts: 6 since Nov 2013
Thanks: 1 given, 1 received


Beljevina View Post
I have been using simple SendMail commands from within my Ninjascript, to email to a TwitterMail address, with NinjaTrader configured via gmail's SMTP server (smtp.gmail.com, port 587, SSL), for well over a year now. The "tweet" is uniformly "received" within a second, and, other than what was a twittermail problem some months ago (was down for a few days), the solution works flawlessly and around the clock.

What scrip are using to resend by mail?

Thanks!

Reply With Quote
 
  #27 (permalink)
Elite Member
Toronto, Canada
 
Futures Experience: Advanced
Platform: NinjaTrader, MT4
Broker/Data: Amp/CQG, Citibank
Favorite Futures: CL, GC, 6E, ES, TF, EURUSD, GBPJPY, AUDUSD
 
Beljevina's Avatar
 
Posts: 349 since Sep 2010
Thanks: 379 given, 564 received


Pristine View Post
What scrip are using to resend by mail?

Thanks!

When a possible trigger/alert point has been hit, my code would issue something like the following code, to "tweet" out to me:

 
Code
SendMail ("<FullFormSourceFromEmailAddress>","<YourEmailonTwittermail>@twittermail.com", Instrument.MasterInstrument.Name + " Trigger signal printed on " + BarsPeriod.Value.ToString()   +  BarsPeriod.Id.ToString().Substring(0,3) + " chart @ " + Time[0].ToString() ,"Possible Buy. Close Price was " + Close[0].ToString() + ". Bar low was " + Low[0].ToString() + "."  );

Reply With Quote
 
  #28 (permalink)
Elite Member
Brampton, ON
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: futures, forex
 
Posts: 4 since Jan 2010
Thanks: 0 given, 0 received

Please Help With Error In Code

Hello Trader,

I have used your code to perform the same function but running into an error, can you share your full code or help in fixing the error, here is my code:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml.Serialization;
using Microsoft.Win32;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Design;
using NinjaTrader.Indicator;
using RestSharp;

namespace NinjaTrader.PostToTwitter
{
[Description("")]
public class PostToTwitter : Strategy
{
[Browsable(false)]
private void PostToTwitter(string msg, string user, string password)
{
try
{
string cmd = "D:\\Curl\\Surge\\9\\bin\\curl.exe";
string args = "-u " + "twitter-username" + ":" + "twitter-pwd" -d status=\"" + msg + "\" http://twitter.com/statuses/update.xml";
System.Diagnostics.Process.Start(cmd, args);
}
catch (Exception ex)
{
Print(ex.Message);
}
}
}
}






shodson View Post
I just coded my automated strategy to post trades, entries, exits, and daily P/L summaries to a Twitter account. I tried using some of the 3rd-part .NET Twitter APIs but I couldn't get one to work (Twitteroo) so I just used the command-line API. You need to have a working copy of curl.exe on your machine and set it's path in the "cmd" string. I've attached a ZIP with the curl.exe I'm using on Vista Ultimate. The "user" and "password" parameters are your Twitter username and password you want to post to.

 
Code
        private void PostToTwitter(string msg, string user, string password)
        {
            try
            {
                string cmd = "C:\\Windows\\System32\\curl.exe";
                string args = "-u " + user + ":" + password -d status=\"" 
                    + msg + "\" http://twitter.com/statuses/update.xml";    
                
                System.Diagnostics.Process.Start(cmd, args);
            }
            catch (Exception ex)
            {
                Print(ex.Message);
            }
        }
You can follow my strategy's Twitter account at @uberBOT1.


Reply With Quote
 
  #29 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,860 since Jun 2009
Thanks: 480 given, 3,255 received

I don't know, you don't even explain what the error message is that you are getting. I wrote this code 8 years ago. I don't post trade updates to Twitter anymore. Maybe Twitter changed their API so that might explain why this doesn't work anymore.


TradingTechnics View Post
Hello Trader,

I have used your code to perform the same function but running into an error, can you share your full code or help in fixing the error, here is my code:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml.Serialization;
using Microsoft.Win32;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Design;
using NinjaTrader.Indicator;
using RestSharp;

namespace NinjaTrader.PostToTwitter
{
[Description("")]
public class PostToTwitter : Strategy
{
[Browsable(false)]
private void PostToTwitter(string msg, string user, string password)
{
try
{
string cmd = "D:\\Curl\\Surge\\9\\bin\\curl.exe";
string args = "-u " + "twitter-username" + ":" + "twitter-pwd" -d status=\"" + msg + "\" http://twitter.com/statuses/update.xml";
System.Diagnostics.Process.Start(cmd, args);
}
catch (Exception ex)
{
Print(ex.Message);
}
}
}
}


Reply With Quote
 
  #30 (permalink)
Elite Member
Brampton, ON
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: futures, forex
 
Posts: 4 since Jan 2010
Thanks: 0 given, 0 received

Error Code


Its erroring at the following code Line:

string args = "-u " + "twitter-username" + ":" + "twitter-pwd" -d status=\"" + msg + "\" http://twitter.com/statuses/update.xml";

Error : ; expected at line 32 column 83
Error : Unexpected Character "\" at line 32 column 90

I tried it several way but the error is not getting resolved, maybe you can help

Also getting error @ Line 24, column 31
Error: NinjaTrader.Strategy is a 'namespace' but is used like 'type'

The is the code line : public class PostToTwitter : Strategy

If you copy the complete code and compile, you will see the errors, just replace twitter username/pwd with yours.



shodson View Post
I don't know, you don't even explain what the error message is that you are getting. I wrote this code 8 years ago. I don't post trade updates to Twitter anymore. Maybe Twitter changed their API so that might explain why this doesn't work anymore.


Reply With Quote

Reply



futures io > > > > > Posting to Twitter

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Twitter-based fund beats the market Big Mike News and Current Events 8 August 19th, 2011 08:13 AM
Shoot the short Big Mike Off-Topic 303 April 13th, 2011 11:11 AM
Posting video on BMT lolu Tech Support 8 June 10th, 2010 10:17 AM
posting charts jdella Traders Hideout 3 July 4th, 2009 09:42 AM
Twitter? shodson Off-Topic 2 July 1st, 2009 07:19 PM


All times are GMT -4. The time now is 09:35 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-17 in 0.15 seconds with 20 queries on phoenix via your IP 54.226.34.209