Go Back   NinjaTrader Support Forum > NinjaTrader 8 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 06-13-2018, 09:07 AM   #1
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default Coding Help Needed

Hello,
Could anyone please let me know the NT8 equivalents of the following NT7 namespace/statements/declarations?

1. NinjaTrader.Indicator;
2. NinjaTrader.Gui.Design;
3. NinjaTrader.Strategy;

4.Data.BarsType.Supported.Length;
5.BarsType.GetInstance(type).DisplayName;
6.Class MyClass: BarData
7.base.Plots[0].Pen.Width = 3f;
8.Font TextFont = new Font("Arial", 8f, FontStyle.Bold);

I'm trying to convert NT7 indicators to NT8 ones. Your assistance is highly appreciated.

Rubel
Mukaddim is offline  
Reply With Quote
Old 06-13-2018, 10:18 AM   #2
NinjaTrader_AlanP
NinjaTrader Customer Service
 
NinjaTrader_AlanP's Avatar
 
Join Date: Apr 2016
Location: Denver, CO
Posts: 2,264
Thanks: 176
Thanked 478 times in 458 posts
Default

Hello Mukaddim,

Thank you for your note.

1. NinjaTrader.Indicator == NinjaTrader.NinjaScript.Indicators
2. NinjaTrader.Gui.Design is not documented, perhaps you can provide more information on what you’re trying to do, where you’re calling it, and I will try to provide some guidance.
3. NinjaTrader.Strategy; == NinjaTrader.NinjaScript.Strategies
4. Not documented need more info.
5. Not documented need more info.
6. Not documented need more info.
7. https://ninjatrader.com/support/help...-us/?plots.htm
8. https://ninjatrader.com/support/help...font_class.htm

There is not an official indicator/strategy converter which takes scripts from NT7 and converts them to NT8 however on the forum there is a post which provides script for conversion.

http://ninjatrader.com/support/forum...ad.php?t=79551

I’d like to mention its best to do a manual conversion for accuracy as not all scripts are simple enough to be converted directly.

Also below I’ve provided a link to code breaking changes which you should consider when converting your scripts:

http://ninjatrader.com/support/helpG...ng_changes.htm

I look forward to your reply.
NinjaTrader_AlanP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AlanP for this post:
Old 06-13-2018, 11:20 AM   #3
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

Thank you AlanP, Will provide you the snippets for undocumented ones. I am doing the manual conversion. The conversion script gives me an error which I asked about here https://ninjatrader.com/support/forum/newreply.php?do=newreply&p=543775, unfortunately it prodeced nothing for me.
Mukaddim is offline  
Reply With Quote
Old 06-13-2018, 01:25 PM   #4
NinjaTrader_AlanP
NinjaTrader Customer Service
 
NinjaTrader_AlanP's Avatar
 
Join Date: Apr 2016
Location: Denver, CO
Posts: 2,264
Thanks: 176
Thanked 478 times in 458 posts
Default

Hello Mukaddim,

There is no documented source of unsupported or undocumented methods.

The link you provided does not provide any information, if you'd like to provide another link I will take a look.

Please let us know if you need further assistance.
NinjaTrader_AlanP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AlanP for this post:
Old 06-13-2018, 10:57 PM   #5
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

Hi AlanP,
No worries, I'll get you the details of 4, 5 and 6 queries. I'm not much into that script either. Would like to do manual conversion.
Thanking
Mukaddim
Mukaddim is offline  
Reply With Quote
Old 06-14-2018, 12:13 AM   #6
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by Mukaddim View Post
Hello,
Could anyone please let me know the NT8 equivalents of the following NT7 namespace/statements/declarations?

1. NinjaTrader.Indicator;
2. NinjaTrader.Gui.Design;
3. NinjaTrader.Strategy;

4.Data.BarsType.Supported.Length;
5.BarsType.GetInstance(type).DisplayName;
6.Class MyClass: BarData
7.base.Plots[0].Pen.Width = 3f;
8.Font TextFont = new Font("Arial", 8f, FontStyle.Bold);

I'm trying to convert NT7 indicators to NT8 ones. Your assistance is highly appreciated.

Rubel
Hi AlanP, please find below the NT7 codes for queries no. 4, 5 and 6

4. & 5.
private MyPeriodTypeSupported()
{
this.miAddIndicator = this.AddPeriodMethodInfo(typeof(IndicatorBase));
this.miAddStrategy = this.AddPeriodMethodInfo(typeof(StrategyBase));
this.dictionaryPeriodTypes = new Dictionary<string, PeriodType>
(BarsType.Supported.Length);

foreach (PeriodType type in BarsType.Supported)
{
try
{
string displayName = BarsType.GetInstance(type).DisplayName;
this.dictionaryPeriodTypes.Add(displayName, type);

}
catch (Exception)
{
}
}
}


6.

namespace NinjaTrader.Gui.Chart
{
public class MyBarsDataPeriod : BarsData
{
protected PropertyDescriptorCollection adjustedProps;
private BarsPeriodType previousId = PeriodType.Minute;
private static ExpandableObjectConverter cv = BarsDataConverter;

}

Appreciate your help
Mukaddim
Mukaddim is offline  
Reply With Quote
Old 06-14-2018, 03:27 PM   #7
NinjaTrader_AlanP
NinjaTrader Customer Service
 
NinjaTrader_AlanP's Avatar
 
Join Date: Apr 2016
Location: Denver, CO
Posts: 2,264
Thanks: 176
Thanked 478 times in 458 posts
Default

Hello Mukaddim,

So I may best answer your questions, it would be helpful if you could provide a use case for each example as there may be a different/better approach to achieving what you’re looking to do in NT8.

I look forward to your reply.
NinjaTrader_AlanP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AlanP for this post:
Old 06-14-2018, 09:12 PM   #8
bltdavid
Senior Member
 
Join Date: Dec 2013
Location: Silicon Valley, California
Posts: 709
Thanks: 28
Thanked 240 times in 204 posts
Default

Quote:
Originally Posted by Mukaddim View Post
I'm trying to convert NT7 indicators to NT8 ones. Your assistance is highly appreciated.
This thread might help get you started,
https://ninjatrader.com/support/foru...ad.php?t=79551
bltdavid is offline  
Reply With Quote
The following user says thank you to bltdavid for this post:
Old 06-16-2018, 02:11 AM   #9
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by bltdavid View Post
This thread might help get you started,
https://ninjatrader.com/support/foru...ad.php?t=79551
Hi, Thanks for pointing out to the conversion script.
It gives me the following error. Any work around the issue?



Thanking
Mukaddim
Attached Images
File Type: png Untitled.png (4.2 KB, 12 views)
Mukaddim is offline  
Reply With Quote
Old 06-16-2018, 02:16 AM   #10
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_AlanP View Post
Hello Mukaddim,

So I may best answer your questions, it would be helpful if you could provide a use case for each example as there may be a different/better approach to achieving what you’re looking to do in NT8.

I look forward to your reply.
Hi AlanP,
What do I have to do? I'm trying to convert a .cs class file that is required for a set of indicators. So would you like to look at the NT7 code for it?
Thanking
Mukaddim
Mukaddim is offline  
Reply With Quote
Old 06-16-2018, 12:51 PM   #11
bltdavid
Senior Member
 
Join Date: Dec 2013
Location: Silicon Valley, California
Posts: 709
Thanks: 28
Thanked 240 times in 204 posts
Default

Quote:
Originally Posted by Mukaddim View Post
Hi, Thanks for pointing out to the conversion script.
It gives me the following error. Any work around the issue?
I'm not familiar with that error. You can try asking in that script conversion thread.

Quote:
Originally Posted by Mukaddim View Post
What do I have to do? I'm trying to convert a .cs class file that is required for a set of indicators. So would you like to look at the NT7 code for it?
I'll be in the same boat myself soon, I have some abstract class files used by a family of indicators that I must convert first -- which sounds very similar to your situation.

If you are comfortable posting your .cs class file here, I'll try to convert it with the above conversion script and see how far I can get.
bltdavid is offline  
Reply With Quote
The following user says thank you to bltdavid for this post:
Old 06-16-2018, 01:02 PM   #12
bltdavid
Senior Member
 
Join Date: Dec 2013
Location: Silicon Valley, California
Posts: 709
Thanks: 28
Thanked 240 times in 204 posts
Default

Quote:
Originally Posted by Mukaddim View Post
Hi, Thanks for pointing out to the conversion script.
It gives me the following error. Any work around the issue?
Also, here's an interesting tip:
Whenever you get an error message like this, copy & paste the entire error message (or most of it) into Google search, you'd be surprised what Google will turn up.

For example, Google found this,
https://stackoverflow.com/questions/...retrieve-the-l

In other words, treat arcane error messages as research questions and start Googling & then read anything that turns up. Sounds simple, but this tip is not completely obvious, it wasn't obvious to me until I saw a colleague do it. Give it a try!

Good luck!
bltdavid is offline  
Reply With Quote
The following user says thank you to bltdavid for this post:
Old 06-17-2018, 12:12 AM   #13
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

Hi bltdavid,
Can we skype to do the sharing? I can't post in that conversion thread, no idea why. I posted the error details in another thread. It didn't turn up any fruitful solutions, since it's undocumented.

Thanks for your guidance, Appreciate it.
Mukaddim
Mukaddim is offline  
Reply With Quote
Old 06-17-2018, 06:01 PM   #14
NinjaTrader_AlanP
NinjaTrader Customer Service
 
NinjaTrader_AlanP's Avatar
 
Join Date: Apr 2016
Location: Denver, CO
Posts: 2,264
Thanks: 176
Thanked 478 times in 458 posts
Default

Hello Mukaddim,

There would not be enough information to determine what that error is.

Converting customer code is out of the scope of NinjaScript support however if you’d like I could have someone from our business development team pass over a list of third party developers that you could contact about debugging your code.

The following link on conversion may be of interest to you,
http://ninjatrader.com/support/forum...ad.php?t=79551

Please let us know if you need further assistance.
NinjaTrader_AlanP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AlanP for this post:
Old 06-19-2018, 10:51 PM   #15
Mukaddim
Junior Member
 
Join Date: Feb 2015
Location: Bangladesh
Posts: 13
Thanks: 11
Thanked 0 times in 0 posts
Default

No worries AlanP, thanks for your responses. Would you please tell me what the following error means and the way to solve it? Can't find any documentation on it.

int barsAgo = iBar - sPoints.bOfHigh;

HighDot.Set(barsAgo, sPoints.hPoint); //on NT7 is converted to
HighDot[0] = (barsAgo, sPoints.hPoint); //on NT8

It gives errors with codes CS1026, CS1525, CS1002 along with "; expected", ")
expected". It also gives a red squiggly under the COMMA after barsAgo. The codes
doesn't provide enough info on solving the error, have no clue what might be the
issue.
Any assistance will be highly appreciated.

Thanking,
Mukaddim
Last edited by Mukaddim; 06-20-2018 at 08:08 AM.
Mukaddim is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
coding help Metal15 Indicator Development 8 10-30-2017 07:52 AM
Coding help please KennyK General Development 14 08-27-2014 11:25 PM
Help needed with a coding problem kw123 Strategy Development 3 01-11-2010 04:08 AM
Help needed with this coding problem rp088 General Development 4 12-11-2009 05:30 PM
coding help please zhaofang8898 General Development 6 03-25-2009 03:50 PM


All times are GMT -6. The time now is 09:32 AM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.