Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot Mult-Time Frame Indicators

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

    Plot Mult-Time Frame Indicators

    Looking at a 30 minute chart, I'm using the indicators from a different time frame than the chart's and they don't plot at all or not correctly. Is this expected behavior? Is there a way to force the plots to be correct for the expected time frame? My main concern is the accuracy when interrogating their values to make decisions.

    Code:
    AddDataSeries(Data.BarsPeriodType.Minute, 60);
    AddDataSeries(Data.BarsPeriodType.Minute, 240);
    AddDataSeries(Data.BarsPeriodType.Day, 1);
    
    _240Minute20SMA = SMA(Typicals[2], 20);
    _240Minute20SMA.Plots[0].Brush = Brushes.Lime;
    _240Minute50SMA = SMA(Typicals[2], 50);
    _240Minute50SMA.Plots[0].Brush = Brushes.DarkRed;
    _1DayPSAR = ParabolicSAR(Closes[3], 0.02, 0.2, 0.02);
    _1DayPSAR.Plots[0].Brush = Brushes.White;
    
    AddChartIndicator(_240Minute20SMA);
    AddChartIndicator(_240Minute50SMA);
    AddChartIndicator(_1DayPSAR);

    #2
    Hello Herrworlf1,

    Thank you for your post.

    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 AddDataSerie() call included as well).

    Please refer to the SyncSeriesAsInputSeries example in the NinjaTrader forum link below which demonstrates plotting an indicator that calculates from an added timeframe.
    https://ninjatrader.com/support/foru...ame#post820196

    The example script will sync the plots to the primary series so that if a timeframe is higher and no value is produced, it will set to the previous bar's value.

    Let us know if we may further assist.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X