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 multi-timeframe in one chart

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

    Plot multi-timeframe in one chart

    Hi,

    I'm using a 1-min stock chart. In my script I have added a second time-frame, namely the daily. I would like to see the ATR of the daily-timeframe on the 1min chart. Is this possible?

    I have added this in the Initialize():

    Add(PeriodType.Day, 1);

    Add(ATR(Closes[1],5));
    ATR(Closes[1],5).Plots[0].Pen.Color = Color.Black;
    ATR(Closes[1],5).Plots[0].Pen.Width = 1;

    So I would think the Closes[1] would mean I'm talking to the first added timeframe, namely the daily. But it still shows the 1min values.

    Any help is appreciated.

    #2
    Hi siroki, the Add() method would be meant to add complete indicators for display in strategies. You could not use this way in an indicator or pass a BarsArray to work on in. What you could do is Add in the daily and then calculate the ATR value in the OnBarUpdate in your 1 min chart.

    So for example -

    if (BarsInProgress == 0 && (CurrentBars[0] > 0 && CurrentBars[1] > 0))
    Plot0.Set(ATR(BarsArray[1], 14)[0]);
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply. I'll give it a try.

      Comment


        #4
        Awesome, it works. Didn't get the plot to work because I'm not fully familiar with custom adding plots and adding indicators to it. But I want to perform calculcations with it anyway, so for now i'm happy.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by swestendorf, Today, 11:14 AM
        2 responses
        5 views
        0 likes
        Last Post NinjaTrader_Kimberly  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        4 responses
        12 views
        0 likes
        Last Post xiinteractive  
        Started by Mupulen, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post Mupulen
        by Mupulen
         
        Started by Sparkyboy, Today, 10:57 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by TheMarlin801, 10-13-2020, 01:40 AM
        21 responses
        3,917 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Working...
        X