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 lorem, Yesterday, 09:18 AM
        4 responses
        13 views
        0 likes
        Last Post lorem
        by lorem
         
        Started by Spiderbird, Today, 12:15 PM
        0 responses
        5 views
        0 likes
        Last Post Spiderbird  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        12 responses
        42 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by FrazMann, Today, 11:21 AM
        0 responses
        6 views
        0 likes
        Last Post FrazMann  
        Started by geddyisodin, Yesterday, 05:20 AM
        8 responses
        52 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X