Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GLFX005, Today, 03:23 AM
    0 responses
    1 view
    0 likes
    Last Post GLFX005
    by GLFX005
     
    Started by XXtrader, Yesterday, 11:30 PM
    2 responses
    11 views
    0 likes
    Last Post XXtrader  
    Started by Waxavi, Today, 02:10 AM
    0 responses
    6 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by TradeForge, Today, 02:09 AM
    0 responses
    14 views
    0 likes
    Last Post TradeForge  
    Started by Waxavi, Today, 02:00 AM
    0 responses
    3 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Working...
    X