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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    71 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    143 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    76 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    47 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    51 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X