Problems Converting NT 6.5 indicators to NT7 - NinjaTrader Programming | futures io social day trading
futures io futures trading


Problems Converting NT 6.5 indicators to NT7
Updated: Views / Replies:13,651 / 68
Created: by Zondor Attachments:16

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

Problems Converting NT 6.5 indicators to NT7

  #11 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received


lolu View Post
It never did.

Can you compile this in NT7Beta without those two parameters ? Please let me know.

Lolu

What I said in the post was they would compile in 6.5 with or without those parameters, not in NT7. Most of my DrawText() code would compile ok in NT7 because I had always used the bool and pixel offset. NT7 had other issues which prevented compiling. Dan

Reply With Quote
 
  #12 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: ib
Favorite Futures: Electric Guitar
 
Mindset's Avatar
 
Posts: 355 since Sep 2009
Thanks: 88 given, 285 received

Menu Items

Roonius posted some very valuable code here if you want to use Menu Items

Biggest problem I have had is understanding the GetXByBarIdx and GetY methods.
Below is a little sample code that shows the problem - click the line on and off over a bar.
Two errors -
1. sometimes the bar is one bar off - and then magically it will just start working perfectly
2. if you put a second chart in the panel - it goes all wrong.

I have battled with it for about 3 weeks and it's unsupported obviously so if anyone here can show me the path to enlightenment ........

Attached Files
Register to download File Type: zip Mouseline.zip (2.8 KB, 21 views)
Reply With Quote
 
  #13 (permalink)
Elite Member
Toronto
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 108 since Sep 2009
Thanks: 30 given, 183 received



Zondor View Post
In NT7, rows must be added to a list before attempting to read from or write into those rows. Otherwise, "index out of range" runtime errors are generated.

Thanks Zondor, this was very useful. It helped me to solve part of the problem with Ed's Level 2 indicator, where I described an issue here:

https://futures.io/programmers-paradise/2509-can-someone-try-make-indicator-work-ninjatrader-7-a.html#post24181

All I did was add the following code in the Initialize() section:

for (int rowCount = 0; rowCount < 50; rowCount++)
{
askRows.Add(new DOMRow(0,0));
bidRows.Add(new DOMRow(0,0));
}


This pre-populated all the rows for the bid/ask for level 2, and avoided throwing errors.

However, I do have one question if you might have an idea about it:

Even with this fix, it still requires an actual OnMarketDepth() event to occur before real data shows up for the bid/ask row. In other words, the indicator starts out blank, and then as OnMarketDepth() events occur, it populates the level 2. It didn't work this way in 6.5... do you know of any code changes that might be causing this, and/or how to force a complete refresh of level 2 data right on Initialize()?

Thanks!

Reply With Quote
The following user says Thank You to FBJS for this post:
 
  #14 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received


FBJS View Post

Even with this fix, it still requires an actual OnMarketDepth() event to occur before real data shows up for the bid/ask row. In other words, the indicator starts out blank, and then as OnMarketDepth() events occur, it populates the level 2. It didn't work this way in 6.5... do you know of any code changes that might be causing this, and/or how to force a complete refresh of level 2 data right on Initialize()?

Thanks!


Nice work with Ed's Level 2, FBJS! I don't know of any way to get around the problem you mentioned above, because the OnMarketDepth events are the only way I know to get the Level 2 data. There is Level 2 historical data in the database, and if we could access it we would be able to get around this problem, as well as give persistence to indicators such as DOM_bands. This is something we might need to ask on the Ninjatrader forums.

Reply With Quote
 
  #15 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

GetXByBarIdx doesn't work in NT7: Try this!


Mindset View Post
Roonius posted some very valuable code here if you want to use Menu Items

Biggest problem I have had is understanding the GetXByBarIdx and GetY methods.
Below is a little sample code that shows the problem - click the line on and off over a bar.
Two errors -
1. sometimes the bar is one bar off - and then magically it will just start working perfectly
2. if you put a second chart in the panel - it goes all wrong.

I have battled with it for about 3 weeks and it's unsupported obviously so if anyone here can show me the path to enlightenment ........

The syntax is a little different in NT7. In the GOMCD indicator there is code for both versions of GetXByBar and for the NT7 version of GetY starting on Line 359. See if this works, thanks as usual, Gomi. Here are the variations:

For NT6.5: x=ChartControl.GetXByBarIdx(index);
yHigh = (bounds.Y + bounds.Height) - Convert.ToInt32((dsHigh.Get(index) - min) * scalingfactor);
For NT7: x=ChartControl.GetXByBarIdx(BarsArray[0],index);
yHigh = ChartControl.GetYByValue(this,dsHigh.Get(index));

Reply With Quote
 
  #16 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: ib
Favorite Futures: Electric Guitar
 
Mindset's Avatar
 
Posts: 355 since Sep 2009
Thanks: 88 given, 285 received

Getx and Y

Gomi

Thanks - I had already downloaded your code and saw your different versions.
However I cannot get them to work in my little mouseline code.
The error I think is in how I call the index bar - I used to trade with TS and so easylanguage labels all it's bars already so you don't have to bother with all this computation.
My brain is exploding as the code basically works on a single chart but not when you add another chart to the same panel.

I have used GetXByBarIndex in 6.5 and didn't have any issues there which is why I am so stumped this code doesn't work.

Seems easy and the answer will be when... if... someone provides the answer!!!

Reply With Quote
 
  #17 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: ib
Favorite Futures: Electric Guitar
 
Mindset's Avatar
 
Posts: 355 since Sep 2009
Thanks: 88 given, 285 received

Detail

Here is how I see it.

This is straight from the regression channel indicator provided by NT - so that must be ok
 
Code
private int GetXPos(int barsBack)
{
int idx = (Bars.Count - 1) + Math.Max(0, Bars.Count - 1 - ChartControl.LastBarPainted) - barsBack;
return ChartControl.GetXByBarIdx(BarsArray[0], idx) + 1 - ChartControl.ChartStyle.GetBarPaintWidth(Bars.BarsData.ChartStyle.BarWidthUI) / 2;
}

private int GetYPos(double price, Rectangle bounds, double min, double max)
{	
return ChartControl.GetYByValue(this, price);
}
So the only thing to worry about is the barsback business which I do via this

barsback = (Bars.Count -1) - ((int) (e.X/Chartcontrol.BarSpace);

Which does work on a single chart but doesn't on multiple charts - so where is the error?

Reply With Quote
 
  #18 (permalink)
Elite Member
Aberdeen + UK
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradeStation
Favorite Futures: NQ
 
Posts: 6 since Dec 2009
Thanks: 0 given, 3 received


Mindset View Post
So the only thing to worry about is the barsback business which I do via this

barsback = (Bars.Count -1) - ((int) (e.X/Chartcontrol.BarSpace);

Which does work on a single chart but doesn't on multiple charts - so where is the error?

On a multi series chart, I don't think the bars are spaced according to ChartControl.BarSpace - they can be spaced unevenly when using non time based bars, and can overlap. The x-axis is then always time based, so maybe caculating the time difference per mouse increment is the way to go? But then what to do when there is a session break? I'll need to think some more about that, if someone else doesn't work it out first.

Reply With Quote
 
  #19 (permalink)
Elite Member
Aberdeen + UK
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradeStation
Favorite Futures: NQ
 
Posts: 6 since Dec 2009
Thanks: 0 given, 3 received

find the bar number with mouse click

Mindset,
This works in my testing so far with tick charts. I have not used your code as I already had my own that worked on equidistant charts (one dataseries). Hold Ctrl key and click mouse on bar and it will draw vertical lines and show the bar time. Mouse click with no Ctrl key will clear it.

On a multiseries chart it calculates the time scale on the x-axis and uses that to find the bar you clicked on, or the bar closest to where you clicked.
However, when there is a session break on the chart it will not work so well as the time scale is then wrong. It should be possible to allow for that time gap, but I'm not sure yet if its worth the extra work.

Attached Files
Register to download File Type: zip aaTestGetBar.zip (2.9 KB, 19 views)
Reply With Quote
The following user says Thank You to MartinS for this post:
 
  #20 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: ib
Favorite Futures: Electric Guitar
 
Mindset's Avatar
 
Posts: 355 since Sep 2009
Thanks: 88 given, 285 received

GetX


I will try your code out MartinS once I have my machine up and running again.
However it doesn't 'feel' right that Ninja would use 1 function GetXByBarIdx on a single chart yet require you to change your code for multiple charts??
Also the GetXByBarIdx has a parameter of which BarArray you are referencing so it shouldn't need time?? I do wish support would support ChartControl.
I think they have a GetXByTime function line as well FYI but it's not something I have looked at yet.

Reply With Quote

Reply



futures io > > > > > Problems Converting NT 6.5 indicators to NT7

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade NT 6.5 to NT 7..BIG PROBLEMS! turkmay NinjaTrader 36 May 18th, 2011 10:48 AM
converting an NT6.5 indicator to NT7 aligator Traders Hideout 3 March 2nd, 2011 07:01 PM
Converting your Indicator for free --> NT 6.5 to NT 7 Druid The Elite Circle 21 September 27th, 2010 09:49 AM
Problems with GOM CD and NT 7 spx_tdr The Elite Circle 12 July 9th, 2010 01:32 AM
Problems with importing indicators into NT7Beta 16 ZTR The Elite Circle 1 May 25th, 2010 07:49 PM


All times are GMT -4. The time now is 11:26 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-12 in 0.14 seconds with 20 queries on phoenix via your IP 54.234.255.29