NexusFi: Find Your Edge


Home Menu

 





C# programing vs. NT7(NT8)


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sam028 with 2 posts (3 thanks)
    2. looks_two fxtraders with 1 posts (0 thanks)
    3. looks_3 mmaker with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,287 views
    2. thumb_up 3 thanks given
    3. group 6 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

C# programing vs. NT7(NT8)

  #1 (permalink)
 harcesis 
Prague/Czech Republic
 
Experience: Intermediate
Platform: Ninjatrader
Trading: YM, RTY
Posts: 13 since Sep 2011
Thanks Given: 2
Thanks Received: 0

Hello everybody,

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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


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.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
fxtraders
connaught, DL
 
Posts: 11 since Sep 2016
Thanks Given: 1
Thanks Received: 0


sam028 View Post
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.

Thanks .

post-compilation step to add required partial classes

Can you show one example ?
regards

Reply With Quote
  #5 (permalink)
 
mmaker's Avatar
 mmaker 
Toronto Canada
 
Experience: Intermediate
Platform: ninjatrader
Trading: es
Frequency: Several times daily
Duration: Minutes
Posts: 400 since Feb 2011
Thanks Given: 1,178
Thanks Received: 508

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.

Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


fxtraders View Post
Thanks .

post-compilation step to add required partial classes

Can you show one example ?
regards

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.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on October 6, 2016


© 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