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

Multi Timeframe

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

    Multi Timeframe

    I am creating an indicator using multiple timeframes and need a little help. Let's say I am using 10 Renko and a 2 Renko. I need to get the bar number for the 2 Renko of the last swing high/low on the 10 Renko timeframe.

    If I am using a 2 bar setting for the swing I know the 10 Renko bar was 2 bars ago when the swing occurred. How would I know what bar it happened on the 2 Renko?

    Since the swing is not known until a few bars have passed on the higher timeframe, what is the best way to go back and figure out what bar it happened at on the lower timeframe?

    Thanks!
    Last edited by PDT123; 05-13-2013, 10:52 AM.

    #2
    Hello PDT123,

    Thank you for your note.

    In a multi-time frame script each on bar update call will have a BarsInProgress value that will let you know which data series is processing.

    For example:

    if (BarsInProgress == 1)
    {
    Print(Close[1].ToString());
    }

    The code above will only print the bar close price of the second data series of one bar ago.

    Below is a link to the help guide on BarsInProgress.
    http://www.ninjatrader.com/support/h...inprogress.htm


    You may also call an indicator using the data series of another time frame.

    For example:

    if (BarsInProgress == 0)
    {
    Print(SMA(BarsArray[1], 14)[0].ToString());

    This code will print the SMA of the second data series while the first data series is processing.

    Below is a link to the help guide on BarsArray.
    http://www.ninjatrader.com/support/h.../barsarray.htm


    Please let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      How can I find out the "bar number" for the lower timeframe dataseries for a swing high that happened 2 bars ago on the larger timeframe?

      Comment


        #4
        Hello PDT123,

        One method would be to use Bars.GetBar with the time of the bar from the larger time frame used in the BarsInProgress of the primary data series.

        For example:

        if (BarsInProgress != 0)
        return;

        if (Closes[1][0] > Opens[1][0])
        {
        DrawArrowUp("arrow"+CurrentBar, false, CurrentBar-Bars.GetBar(Times[1][0]), Low[0]-2*TickSize, Color.Blue);
        }

        This code will place an arrow under every green bar in the larger secondary data series.

        You would replace Closes[1][0] > Opens[1][0] with the criteria of your condition.

        Below is a link to the help guide on Bars.GetBar().
        http://www.ninjatrader.com/support/h...nt7/getbar.htm


        Please let me know if this does not give you what you need to move forward.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rocketman7, Today, 02:12 AM
        5 responses
        23 views
        0 likes
        Last Post rocketman7  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        7 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by samish18, 04-17-2024, 08:57 AM
        17 responses
        66 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by briansaul, Today, 05:31 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PaulMohn, Today, 03:49 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X