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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X