• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 bbdjad, Today, 04:36 AM
        0 responses
        2 views
        0 likes
        Last Post bbdjad
        by bbdjad
         
        Started by mittie3, Today, 03:33 AM
        0 responses
        6 views
        0 likes
        Last Post mittie3
        by mittie3
         
        Started by Againmain1, Today, 03:04 AM
        0 responses
        8 views
        0 likes
        Last Post Againmain1  
        Started by tonytimpa, Today, 01:33 AM
        0 responses
        5 views
        0 likes
        Last Post tonytimpa  
        Started by kiwidtrader, Yesterday, 11:49 PM
        0 responses
        5 views
        0 likes
        Last Post kiwidtrader  
        Working...
        X