Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am trying to search what are the differences between NT7 and C#. I was living all the time with information that NT7 is using C# language for coding but recently I got code coded in C# and NT7 was not able to handle some of the code syntaxes
I was trying to search for some explanation or equivalent by which I can replace C# to Ninja´s C# but no success. Here is part of the code I am trying to convert from C# to NT7(NT8):
this.MCSlope.Set(this.CalcSlopeDegrees(this.MC.get_Value(), base.get_TickSize()));
int direction = 0;
if (this.MCSlope.get_Item(0) > 0.0)
{
this.SlopeUp.Set(this.MCSlope.get_Item(0));
this.SlopeDown.Reset(0);
direction = 1;
}
else
{
this.SlopeUp.Reset(0);
this.SlopeDown.Set(this.MCSlope.get_Item(0));
direction = -1;
}
this.MidLR.Set(0.0);
if (base.get_Close().get_Item(0) > base.get_Open().get_Item(0))
Attepmt to convert it into NT7:
this.MCSlope.Set(this.CalcSlopeDegrees(this.MC.Value, base.TickSize));
int direction = 0;
if (this.MCSlope[0] > 0.0)
{
this.SlopeUp.Set(this.MCSlope[0]);
this.SlopeDown.Reset(0);
direction = 1;
}
else
{
this.SlopeUp.Reset(0);
this.SlopeDown.Set(this.MCSlope[0]);
direction = -1;
}
this.MidLR.Set(0.0);
if (base.Close[0] > base.Open[0])
All help or resources will be appreciated.
Thank you in advance
Can you help answer these questions from other members on NexusFi?
There is no differences between NinjaScript and C#, there is simply a post-compilation step to add required partial classes (after the #region NinjaScript generated code).
You don't have to add the "this." but it should not be a problem.
Let me preface this by saying that i first started programming in cobol. I am self taught and haven't taken a programming course in 40 years. Sometimes it shows as younger programmers with a more formal education will readily tell you after they read what i wrote below lol.
Sometimes I think I have called in extra "libraries". I dunno the correct terminology but thats what I call them.
The way I think of this is like this.
Ninjatrader contains some of what is available in C#. But if you are trying to use some capabilities not covered by Ninjatrader but ideas available from say Stack Overflow, then you end up calling in other functions/definitions etc.
For example here is the current set i am using.....
using System;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
using System.IO;
using System.Runtime.Serialization;
using System.Windows.Forms;
using System.Speech.Synthesis;
Some of these "libraries" contain definitions/names/functions you won't find in Ninjatrader, but perform things you sometimes want to do.
I dunno if this is a consideration for your issue but it is a possibility.
Check the end of each source code, all the lines after the "#region NinjaScript generated code".
@mmaker: you're right but it's bit off-topic in this case. You need to add additional libraries (.dll) if you want to use method/objects which are included in these libraries and not the default ones. This can be common Microsoft libraries (System.IO.Pipes, System.Threading, ...), 3rd party libraries (Xceed.Wpf.Toolkit, ...) or your home made library.