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
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 ........
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()?
The following user says Thank You to FBJS for this post:
Favorite Futures: Gameplay KlownbineŽ Trading of Globex
Posts: 1,276 since Jul 2009
Thanks: 1,227 given,
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.
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,index);
yHigh = ChartControl.GetYByValue(this,dsHigh.Get(index));
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!!!
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.
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.
The following user says Thank You to MartinS for this post:
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.