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-time frame indicator problem

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

    Multi-time frame indicator problem

    Hi

    I am trying to develop an indicator like the TTM trend anchor (http://www.tradethemarkets.com/products/item294.cfm). The idea is look at say a daily chart with a heiken ashi and link it to a weekly timeframe. If both the daily and weekly bars are blues, then the indicator is blue, if both are red, the indicator is red, and if one is blue and one is red, the indicator is grey (neutral). This is shown in the attachment. All is going well until I hit the weekly bar of 16/6/12 on AUDUSD as shown in the attachement. I have a blue weekly bar and 5 blue daily bars, but the indicator is grey.

    I have used the print command to get the order of calculations, and everything seems to line up so I am very confused. Code is attached. Call up 2 charts of AUDUSD, one weekly, one daily with heiken ashi on both. Apply the indicator to the daily chart and look at the weekly bar for 16/6/12 and the corresponding 5 daily bars.

    Any help appreciated.
    Attached Files

    #2
    nprince,

    Could you show me a screen shot here? It doesn't look l like it attached.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Sure - I think my original was too big. The chart on the left is the daily AUDUSD with the indicator at the bottom. The chart is linked to the weekly of the AUDUSD. Both charts have Heiken Ashi candles. The cross hair is on the Monday and shows that the entire week was blue bars. The equivalent single bar on the weekly is blue, however, my indicator shows grey bars for the whole week (both charts are blue, so I expect a blue bars on my indicator for the week).

      Hope the screenshot helps and you can shed some light.
      Attached Files

      Comment


        #4
        Hello,

        This mostly looks Ok to me, however there is one thing you may want to change. I would suggest using the overload for the HeikenAshi indicator in the proper place, I am wondering if its calling the HeikenAshi for the same time frames.

        HeikenAshi(Closes[BarsInProgress] ).HAOpen[0] should work as an example.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Hi

          Thanks for the response. I have replaced the code with:

          primarySeries.Set(HeikenAshi(Closes[BarsInProgress] ).HAOpen[0] > HeikenAshi(Closes[BarsInProgress] ).HAClose[0] ? 0 : 1);

          for the primary series and the same for the secondary series. Have I understood this correctly? If so, it hasn't changed the outcome of the indicator. Any other ideas?

          Thanks

          Comment


            #6
            Hello nprince,
            In historical, the weekly bar will form at the end of the week. If you look into the prints you will find the same as.
            20120608 Weekly 0.9842 0.9809 0
            20120611 Daily 0.9870 0.9927 0
            20120612 Daily 0.9899 0.9908 0
            20120613 Daily 0.9903 0.9951 0
            20120614 Daily 0.9927 0.9973 0
            20120615 Daily 0.9950 1.0044 0

            20120615 Weekly 0.9825 0.9998 1
            Thus the daily bars (green) will refer to the weekly bar as highlighted in red and not to the bar of 20120615 which will be formed after the week ends. Thus you will get the plot as grey, and not blue.
            Attached Files
            Last edited by NinjaTrader_Joydeep; 09-12-2012, 09:18 AM.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Hi Joydeep

              Thanks for your response - I'm not sure how I missed that from the prints! If this were a live chart, would it calculate differently? ie would the weekly bar for the 15th start forming and be updated for each bar on and after the 11th?

              Thanks

              Comment


                #8
                Hello nprince,
                If Calculate on Bar Close is set to false then in realtime, both the 1 day bar and the weekly bar will updated tick by tick.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Rapine Heihei, 04-23-2024, 07:51 PM
                2 responses
                30 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by Shansen, 08-30-2019, 10:18 PM
                24 responses
                943 views
                0 likes
                Last Post spwizard  
                Started by Max238, Today, 01:28 AM
                0 responses
                9 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by rocketman7, Today, 01:00 AM
                0 responses
                5 views
                0 likes
                Last Post rocketman7  
                Started by wzgy0920, 04-20-2024, 06:09 PM
                2 responses
                28 views
                0 likes
                Last Post wzgy0920  
                Working...
                X