importing .Net into Ninja - NinjaTrader | futures io social day trading
futures io futures trading


importing .Net into Ninja
Updated: Views / Replies:1,075 / 3
Created: by spinnybobo Attachments:0

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 dont 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
 
Thread Tools Search this Thread
 

importing .Net into Ninja

  #1 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received

importing .Net into Ninja

Hello

I currently am trying to write a program to do the following:

On current Bar (using Daily time frame) of the ES, find out which contract is the current contract and then which contract is the next contract.
So, if the last bar is Friday Feb 03 2012, then it would be
 
Code
string currentDate = "03 Feb 2012";
//The first day of trading on March to last day before rollover
     if ((currentDate >= "08 Dec 2011") && currentDate <= "07 March 2012")) 
string currentContract = "201203"; //March 2012 ES contract
Then the next thing I want to do is figure out that the next contract is June
 
Code
string nextContract = "201206"; //so I have to add 3 to the end

Then I want to take the current close of the current bar for 201203 and 201206 and take the difference.
if the currentDate.Close[0] > nextContract.Close[0]
    print Green Dot
else
    print Grey Dot
So, I have like 55 or so ES contracts from 1997 and wanted to figure this out. So, for each bar, it would have to check first which contract is being traded, which is the next contract, and then take the different of the current bar close of each contract, and if the currentContract > nextContract, show that as a bullish sign on the chart.

Also, I went through all 55 or so contracts the other day, and made an excel spread sheet according to contract rollover, and manually put in the Start Date, End Date, Contract Name

So, I have all of that start and stop data. Now I just need to know how to use this in Ninja Trader.
Also, I want to have this be an indicator in the bottom panel and therefore do not care if it is ES, or DJIA, or SPX, or GOOG in the upper panel as it does not depend on the upper panel data

I dont know how hard this would be.

I know that in C# (ASP.Net in this case), you can use something like this:
 
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void btnResults_Click(object sender, EventArgs e)
    {

        DateTime start = Convert.ToDateTime(txtStartDate.Text);
        
        DateTime end = Convert.ToDateTime(txtEndDate.Text);
        DateTime today = DateTime.Today;
        if ((start <= today) && (end >= today))
        {
            lblOutput.Text = "Valid";
        }
        else
            lblOutput.Text = "Not Valid";
    }
}
Also, that leads to the title of this post: I dont see the DateTime class in NinjaTrader.
I thought NinjaTrader included all of the entire .Net Libraries Framework. Maybe I am confused, but if I dont see that DateTime class in Ninja
and it is in Visual Studio 2012, how do I get it into NinjaTrader, so I can develop with it?

thanks
Spencer

Reply With Quote
 
  #2 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,367 since Jun 2009
Thanks: 3,574 given, 3,983 received

???
DateTime in included in "System", so you can use it directly in NinjaScript:
 
Code
                            
System.DateTime   m = new DateTime(20120209224735);; 


Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #3 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received


HI Sam

thanks. I got confused because when I just typed DateTime in NinjaTrader, no intelisense popped up.
However, when I do it in visual studio, it pops up.

So, I am used to Java more than C# and how it works with libraries. Java is very portable and I always have to add the library to eclipse, then just import com.etc.......

In .Net, everything is already in the GAC so does that mean everything accessible by Visual Studio is also accessible by NinjaTrader by default-----no need to install additional .dll's, just word it correctly

Visual Studio:
DateTime start = Convert.ToDateTime("10 May 2010");

Ninja Trader:
System.DateTime start = Convert.ToDateTime("10 May 2010");

Does this sound right since both say using System; in the top?

thanks
Spencer

Reply With Quote
 
  #4 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,367 since Jun 2009
Thanks: 3,574 given, 3,983 received

You can write
 
Code
                            
System.DateTime start Convert.ToDateTime("10 May 2010"); 

or
 
Code
                            
DateTime start Convert.ToDateTime("10 May 2010"); 

it doesn't matter, it's the same thing.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:

Reply



futures io > > > > importing .Net into Ninja

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
Help with importing program into NT7 kayaker NinjaTrader 3 January 3rd, 2012 06:17 PM
Importing and Charting Trade Data horton EasyLanguage Programming 1 May 9th, 2011 05:28 PM
Importing Indicator to NinjaTrader Spudz NinjaTrader 2 April 29th, 2011 02:30 AM
Programming errors while importing Ninja script emini_Holy_Grail NinjaTrader Programming 8 May 20th, 2010 04:09 AM
Importing a ticker from yahoo fiki NinjaTrader 11 September 29th, 2009 01:29 PM


All times are GMT -4. The time now is 08:59 AM.

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-18 in 0.09 seconds with 19 queries on phoenix via your IP 107.20.115.174