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 Max238, Today, 01:28 AM
        1 response
        22 views
        0 likes
        Last Post CactusMan  
        Started by giulyko00, Yesterday, 12:03 PM
        2 responses
        10 views
        0 likes
        Last Post giulyko00  
        Started by r68cervera, Today, 05:29 AM
        0 responses
        4 views
        0 likes
        Last Post r68cervera  
        Started by geddyisodin, Today, 05:20 AM
        0 responses
        7 views
        0 likes
        Last Post geddyisodin  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        6 responses
        38 views
        0 likes
        Last Post JonesJoker  
        Working...
        X