Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
How to access Additional Instrument in Custom BarsTypes
Collapse
X
-
Hello,
Thank you for the reply.
The DataSeries autoscale option is for including specifically the DataSeries and is a manual action through the user interface. An indicator cannot set this option but the indicator can be set to Overlay so the AutoScale will not compress the different values.
Please try to set the indicators scale justification to "Overlay" (Indicator menu>Scale Justification). This should fix the scaling issues between price data.
I look forward to hearing of your results.
-
The "Auto scale" option needs to be set on the Main Instrument and not on the Indicator. How to do that programmatically ?
Tzanimir
Leave a comment:
-
Hello,
Thank you for the reply.
IsAutoScale is set in State.SetDefaults. The only way to change the value of IsAutoScale is during the OnStateChange function's SetDefault or Configure states, so it could not be dynamically changed while the script is running
https://ninjatrader.com/support/help...sautoscale.htm - IsAutoScale
Here is an overview of the NinjaScript lifecycle:
However, turning IsAutoScale to false will not allow you to call OnCalculateMinMax() to adjust the scaling when the price goes up or down.
Here is more information on OnCalculateMinMax():
This script was supplied "as is" no further modifications will be made to the source on the forum. You can edit the source code of this indicator and see if you can get it to display the way you wish.
Please let me know if you have any questions.
Leave a comment:
-
Thank you. This works for me. There are 2 issues with this solution:
1. As the base instrument value and the calculated value differ significantly the, "auto scale" option on the base instrument causes improper scaling as the main instrument is not visible but being scaled against. Manually unchecking the "auto scale" option fixes the issue. What will be the programmatic way to switch the "auto scale" off when the indicator is applied. Where will be the place to reenable the "auto scale" when indicator is removed.
2. The example of HeikenAshi8 has an issue with the relative position of the rectangle of the bar with the vertical line marking the high low distance - the vertical line is often not in the middle of the rectangle.
Tzanimir
Leave a comment:
-
Hello,
Thank you for the post.
You will have to use an indicator to render bars if you need more than one data source.
Here is a good example of how this is done:
In this example, there are custom Series<Double> data series objects for the Open, High, Low, and Close. In OnBarUpdate() the actual OHLC values have operations performed on them and are then set in the corresponding custom series.
The other important section of this code is the OnRender() function. This is where you will draw the bars on the chart based on the price data.
More information on the OnRender() function can be found here:
Please let us know if we may be of any further assistance.
Leave a comment:
-
How to access Additional Instrument in Custom BarsTypes
Hi
I am trying to plot as Bars a value of a Instrument adjusted by the values of another instrument i.e. Price of DJIA in Gold, etc. How can I access the gold price in a custom BarsTypes implementation in order to do the recalculation of the open, high, low, close on the DJIA.
Is there another way to create a Data series of DJIA in gold so I can plot it with the standard Candle bar type ?
TzanimirTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
55 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
35 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
7 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Leave a comment: