How to set values that Ninja Trader does not support.
It seems like the minimum number of api's are exported, documented, and supported. Looking for some way to discover and access some of these values. Any hints or clues how to do this would be greatly appreciated.
I am trying to get the following functionality on NT7. I want to use the fixed scale so that the size of price bars do not change based upon the range of data on the screen. I also want to have the most current price in the middle of the chart.
This is easily achieved manually by using the fixed scale on the right scale and changing the scale min and max values. I want to create a simple indicator that updates the scale min and max values upon bar close.
So on bar close, I would calculate how much the min and max values need to change to keep the scale fixed but shift the price range to keep the close in the middle of the chart by setting min and max.
But I can not find an api for changing the min and max values for the price scale. Is there some way to discover or hack into NinjaTrader to accomplish this.
Well this has been hashed out on the NT forums, and of course since you are looking for a solution it was obviously not implemented.
In terms of API, I can not help you out, but if you check out the following NT Post, you will find a file called FixedScale.cs.
This indicator tries to implement fixed scale, but it has to do it by tricking NT (instead of calling an API). It does so, by using transparent drawing objects that set the autoscale, and these are placed in the Plot() routine. This is really just a hack, and was meant to show the NT guys how it could work, but it worked pretty well.
I have not used in a while, so not sure if it still works, but it might give you some ideas.
If I remember correctly, it does not center the last price, but instead tries to keep the last bar on the screen to maximize the amount of data that was kept on the screen. Probably could be changed to center if that is what you really wanted.
The following 3 users say Thank You to aslan for this post:
They are not documented (at least for us). We can not see all of the internal architecture and calls inside NT. Because the NT arch is extensible though, a certain interface is exposed and documented (what they call supported NinjaScript). Now there are also a number of routines that are called that are exposed name-wise, but are not supported, so are not externally documented. Some items fall in between (i.e. the bar formation code is exposed, but not really documented). If you are nice, and ask the right questions, NT guys will occasionally give you hints to get a little further. There are a lot of undocumented routines that you can find by using reflection to get the names of routines and the parms they take, but not knowing what they do makes it kind of trial and error.
For the min/max, you can not really set them per se, but instead set them by returning them in the Get() routine. Now that will only work, if NT always uses this routine to get the values.
The following user says Thank You to aslan for this post:
Roonius: How do you find out these things? I have asked NT folks if there is any documentatin for developers and was told "NO". What amazes me is that each month they add several new developers with completed add-on systems to their approved list. But we struggle to get simple things done. Thanks, Ken.