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

Daily WMA

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

    #16
    I know you guys are correct but just need to figure out. back tomorrow.

    Thanks for being patient.

    Comment


      #17
      I think we're getting there ...

      "The last historical value on the daily chart was calculated on the daily chart, so querying its value today will return the value on the daily chart, calculated at the close of yesterday."

      does this mean that if yesterdays close on the daily chart was 1.35 then Closes[1][0] = 1.35 (so you cannot reference the last (incomplete) close of the last daily bar?)

      also does this mean that if the day before yesterdays close on the daily chart was 1.34 then Closes[1][1] = 1.34?

      I'll re-check tomorrow but I think Print output matched the values on the daily chart.

      "Any intraday historical bar would be a bar calculated today"

      does this mean that if the last (incomplete) close on the intraday chart was 1.36 then Closes[1][0] = 1.36?

      Thanks again.
      Last edited by futurenets; 02-16-2015, 04:33 PM.

      Comment


        #18
        Originally posted by futurenets View Post
        I think we're getting there ...

        "The last historical value on the daily chart was calculated on the daily chart, so querying its value today will return the value on the daily chart, calculated at the close of yesterday."

        does this mean that if yesterdays close on the daily chart was 1.35 then Closes[1][0] = 1.35 (so you cannot reference the last (incomplete) close of the last daily bar?)

        also does this mean that if the day before yesterdays close on the daily chart was 1.34 then Closes[1][1] = 1.34?

        I'll re-check tomorrow but I think Print output matched the values on the daily chart.

        "Any intraday historical bar would be a bar calculated today"

        ...

        Thanks again.
        Actually, given how you have it coded, I may have misled you. You are calculating everything from the same indicator, and you do have CalculateOnBarClose = false;. That means that all calculations will, in fact, be up to the moment. So Close[1][0] should match Close[0][0] at all times, as they are being read from the same equity.

        As COBC = false, yesterday's close will actually be Close[1][1] and so on.

        My apologies. Next time, I shall read more carefully before responding, and not just assume, from a speed read glance, that I know what is being asked.
        does this mean that if the last (incomplete) close on the intraday chart was 1.36 then Closes[1][0] = 1.36?
        Actually, your intraday chart is the parent timeframe, so is indexed as "0". That means that the most current last price is Close[0][0]. Which should match Close[1][0], per my explanation above. It so happens that these values are the same, but it is still best practice to refer to the correct datum, even if it matches another datum.

        Comment


          #19
          ok thanks again. I know you're busy and I appreciate this effort to help me understand.

          sorry but now I'm not sure why DailyWMA is one day out when compared with WMA?

          (when I don't set "WMADaily.Set(dailyWMA1)" in BarsInProgress 1)
          Last edited by futurenets; 02-17-2015, 01:44 AM.

          Comment


            #20
            I'm in need of some details of what is actually happening.

            The intraday switches to a new day at 18:30 (UK Time) on the current day and 22:00 all others.

            ... not one of the easiest solutions to plotting daily data on intraday charts?

            Comment


              #21
              Hello futurenets,

              Thank you for your response.

              You will need to match your intra-bar series Session Template (right click in chart > Data Series > Session Template) to the proper hours used for the Daily bars from your provider. For information on Session Templates please visit the following link: http://www.ninjatrader.com/support/h...on_manager.htm

              Comment


                #22
                ok thanks Patrick

                currently set on "Use Instrument Settings" so can I check what these are for EURUSD? If this falls into "Forex" category (see attached) then a new day should start at 17:00 (22:00 in UK) which is what happens when loading historical data.

                Yesterday the intraday switched to a new day at 18:30 (17Feb UK real-time) this morning it's now 22:00 (17Feb) - will try again this evening using Forex Session and see what happens in real-time.

                We've been discussing this for a while now and, while I appreciate all your help, so far I have absolutely no idea what's happening?

                This is a great product but should I reach the conclusion that mixing daily bar objects with intraday bar objects is not a good idea in NT7? If so I can find other ways round this problem.

                Or perhaps you have a working solution that combines daily & intra-day bar objects?
                Attached Files
                Last edited by futurenets; 02-18-2015, 07:35 AM.

                Comment


                  #23
                  Hello futurenets,

                  Thank you for your response.

                  There shouldn't be any problem with setting an indicator to pull daily values. Can you advise what data feed provider you are using for the Forex data?

                  Comment


                    #24
                    ok thanks Patrick

                    using FXCM data (set session to Forex in NT) and watching/waiting for new day.

                    yesterday that started at real-time at 16:30 (UK Time) 17Feb

                    this morning when I looked historically it started at 22:00 (UK Time) 17Feb

                    so not sure what happening.

                    My only concern is there are no working samples of daily bar objects working alongside intraday bar objects and we can't go on discussing this indefinately.
                    Last edited by futurenets; 02-18-2015, 09:50 AM.

                    Comment


                      #25
                      Hello futurenets,

                      Please try the code below instead, this code works perfectly to show the daily value of the WMA for a 5 period on a minute chart with 365 days to load:
                      Code:
                              protected override void Initialize()
                              {
                      			Add(new Plot(Color.Gray, "plot"));
                      			Add(PeriodType.Day, 1);
                              }
                      
                              /// <summary>
                              /// Called on each bar update event (incoming tick)
                              /// </summary>
                              protected override void OnBarUpdate()
                              {
                      			if(CurrentBars[0] <= 5
                      				|| CurrentBars[1] <= 5)
                      				return;
                      			
                      			Value.Set(WMA(BarsArray[1], 5)[0]);
                      			
                      		}
                      		public override string FormatPriceMarker(double price)
                      		{
                      			// Formats price values to 4 decimal places
                      			return price.ToString("N4");
                      		}

                      Comment


                        #26
                        thank you very much Patrick, starting to come together. Sorry it took me so long and thank you for your patience.
                        Last edited by futurenets; 02-19-2015, 02:53 AM.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by ScottWalsh, Today, 04:52 PM
                        0 responses
                        1 view
                        0 likes
                        Last Post ScottWalsh  
                        Started by ScottWalsh, Today, 04:29 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post ScottWalsh  
                        Started by rtwave, 04-12-2024, 09:30 AM
                        2 responses
                        22 views
                        0 likes
                        Last Post rtwave
                        by rtwave
                         
                        Started by tsantospinto, 04-12-2024, 07:04 PM
                        5 responses
                        70 views
                        0 likes
                        Last Post tsantospinto  
                        Started by cre8able, Today, 03:20 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post cre8able  
                        Working...
                        X