Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to access Additional Instrument in Custom BarsTypes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_ChrisL
    replied
    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.

    Leave a comment:


  • ttzankov
    replied
    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:


  • NinjaTrader_ChrisL
    replied
    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:
    https://ninjatrader.com/support/help...fecycle_of.htm

    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():
    https://ninjatrader.com/support/help...lateminmax.htm

    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:


  • ttzankov
    replied
    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:


  • NinjaTrader_ChrisL
    replied
    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:
    http://www.ninjatrader.com/support/f...d=7&linkid=730

    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:

    https://ninjatrader.com/support/help..._rendering.htm

    https://ninjatrader.com/support/help.../?onrender.htm

    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 ?

    Tzanimir

Latest Posts

Collapse

Topics Statistics Last Post
Started by rufat, Today, 09:24 PM
0 responses
3 views
0 likes
Last Post rufat
by rufat
 
Started by coopgrafik, Today, 07:56 PM
0 responses
3 views
0 likes
Last Post coopgrafik  
Started by MisterGee, Today, 07:55 PM
0 responses
3 views
0 likes
Last Post MisterGee  
Started by yeikson89, Today, 02:53 PM
2 responses
21 views
0 likes
Last Post yeikson89  
Started by sdauteuil, Today, 01:06 PM
1 response
15 views
0 likes
Last Post NinjaTrader_Jim  
Working...
X