• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

To add indicator to the chart with specific bar period

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

    To add indicator to the chart with specific bar period

    Hello.

    I use 2 different bar periods in my strategy, Some of indicators are linked to main period, some of them are linked to second period. For example:

    Code:
    protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
    ......
                }
                else if (State == State.Configure)
                {
                    AddDataSeries(Data.BarsPeriodType.Minute, 10);
                }
                else if (State == State.DataLoaded)
                {
                    sma = SMA(BarsArray[0],21); //With default bar period
                    rsi = RSI(BarsArray[1],14,3); //With 10 mins period
    
    
                    AddChartIndicator(sma);
                    AddChartIndicator(rsi); //I expect to see RSI with 10 minutes bar period
                }
            
            }
    Supposedly I must have RSI placed on 10 minutes period. But really I have RSI placed with default bar period. Look at the attachment, please
    Attached Files

    #2
    Hello rfsettling,

    Thanks for your post.

    With reference to the helpguide section on AddChartIndicator there is this note:"An indicator being added via AddChartIndicator() cannot use any additional data series hosted by the calling strategy, but can only use the strategy's primary data series. If you wish to use a different data series for the indicator's input, you can add the series in the indicator itself and explicitly reference it in the indicator code (please make sure though the hosting strategy has the same Add series call included as well)
    o If a secondary or null Bars series is specified by the calling strategy (not the indicator itself), the strategy's primary series will be substituted instead."
    Link: http://ninjatrader.com/support/helpG...tindicator.htm

    The alternatives are as the helpguide advises or you can manually add a hidden data series to the chart itself and then manually add the RSI and point the RSI to the hidden data series. Here is a link to another thread/post where I have detailed the process to add a hidden data series and add an indicator that uses the hidden data series: http://ninjatrader.com/support/forum...28&postcount=2
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sergey_z, Today, 02:34 AM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by frankduc, Today, 05:24 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by shmarola, Today, 01:01 AM
    0 responses
    4 views
    0 likes
    Last Post shmarola  
    Started by CriticalMind, 11-29-2015, 12:39 PM
    3 responses
    1,323 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by novel168, 06-14-2019, 09:20 PM
    2 responses
    10 views
    0 likes
    Last Post novel168  
    Working...
    X