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

100 Day Moving Average on a 5 Minute Chart

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

    100 Day Moving Average on a 5 Minute Chart

    apologies in advance for raising this issue again

    previously Daily WMA

    but I need a 100 day moving average on a 10 minute chart and I wanted to ask

    1) has anyone written an indicator doing something similar?

    2) has anything changed in NT7 or NT8 which affects the required code?

    useful reference Multi-Time Frame & Instruments

    out of interest in FXCM/LUA you can

    register a daily stream on your 10 minute chart:
    dStream = registerStream(1, "D1");

    and then simply index the daily values to create a moving average:
    DO = dStream.open[dStream:size()-x];
    DH = dStream.high[dStream:size()-x];
    DL = dStream.low[dStream:size()-x];
    DC = dStream.close[dStream:size()-x];

    perhaps NT now has something similar?
    Last edited by futurenets; 03-02-2016, 10:42 AM.

    #2
    Hello,

    Thank you for the question.

    To directly answer your questions, I am unsure of a specific indicator that fits the description but these concepts can be utilized in NinjaScript. Regarding changes between NT7 and NT8, yes there have been changes. While developing you would need to check the code you are using against the Code Breaking Changes guide to see the differences or utilize the NT8 help guide to learn the new concepts.

    For what you are asking, adding a 1 Day series to a indicator is certainly possible as shown in the link you had provided: Multi-Time Frame & Instruments.

    Instead of using the examples 1 Minute you would use 1 Day.


    The NinjaTrader equivelants of what you have provided would be simply the following:

    dStream = registerStream(1, "D1");
    would be the Add() syntax.

    DO = dStream.open[dStream:size()-x];
    DH = dStream.high[dStream:size()-x];
    DL = dStream.low[dStream:size()-x];
    DC = dStream.close[dStream:size()-x];
    I am unsure of what x equals to know the number you are using here, but if this is the CurrentBars value it would be the following:

    Open[0]
    High[0]
    Low[0]
    Close[0]

    You can find more about these concepts here: https://ninjatrader.com/support/help...properties.htm


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      ok thanks Jesse

      just to make sure I'm not mistaken, how many 5 minute bars would I need to access 100 daily bars? re. Multi-Time Frame & Instruments

      in the FXCM/LUA (and TradeStation/EasyLanguage below) example the number of 5 minute bars on the chart and the number of daily bars that can be accessed (and vice versa) are independent, is this the case with NT?

      unless I've missed something I don't see anything relevant in Code Breaking Changes?

      again out of interest, TradeStation/EasyLanguage has useful OpenD(x), HighD(x), LowD(x), CloseD(x), VolumeD(x) series functions to easily access daily data.

      see CloseD and CloseD Suggestion
      Last edited by futurenets; 03-03-2016, 07:53 AM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        For 100 Daily bars, you would need 100 days to load. The amount of 5 minute bars in that time would be unknown as that would rely on the instrument and its session to determine how many total 5 minute bars would be in that period of time.

        In NinjaTrader all series are on the same amount of days to load meaning that if you choose 5 days to load, you will get 5 days of data on all added series. This may or may not be enough for calculations though, depending on the series and how many bars that is that could be as little as 5 bars or many many bars depending on the time frame.

        Regarding the post you had linked, there is the PriorDayOHLC which can get prior daily values. Otherwise using Logic and Added series you could just use the BarsAgo.

        For example if you wanted the Close of 5 days ago, on a daily series that would be simply Close[5]. if you had added a Daily series to a script, you could instead use Closes[1][5] assuming that the Daily series is the only series being added.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          ok Jesse thanks - NT8 looks really good.
          Last edited by futurenets; 03-03-2016, 09:41 AM.

          Comment


            #6
            does PriorDayOHLC really help me calculate 100 day moving average on a 5 minute chart? if so how?

            or am I back to my original problem i.e. to calculate a 100 day moving average would require 90000+ 5 minute bars?

            again I may have misunderstood.

            avoiding 90000+ bars was the reason for my CloseD Suggestion

            this is why CloseD exists in TradeStation.

            Again, apologies if I have misunderstood but starting to feel like this is a problem?
            Last edited by futurenets; 03-04-2016, 05:31 AM.

            Comment


              #7
              Hello,

              I wanted to check as you said NT8 looks good, was this a NT8 or NT7 question? If NT8, this is currently not in the correct forum and was answered in respect to NT7.

              In NT7 the data series added would require that you have X DaysToLoad for all series. If you are using a 5 minute chart and need 100 daily bars, you would need to load at least 100 days on the chart.

              Can you confirm which platform you are referring to?

              Please let me know if I may be of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                I'll use 8 or 7 whichever will give me a solution.

                Currently we're going round in circles so I DO need 90000+ 5 minute bars to plot a 100 day moving average on a 5 minute chart (my initial question) ?

                the only solution I can see so far is to maintain a daily OHLC text file and have the indicator look-up a value which is a bit old hat in 2016?

                forgive me but this has been a difficult and frustrating discussion which could have been clarified at the outset?
                Last edited by futurenets; 03-04-2016, 09:09 AM.

                Comment


                  #9
                  Hello,

                  To not confuse the forums, the answers in this thread are for NT7.

                  In NT7 the answer has been provided in post #4 and post #7 already, you would need to load the amount of days you want to use. As an alternative you could review how the Pivots uses GetBars, unfortunately there is no documentation on this method so I would be unable to provide any other information on this other that letting you know it exists.

                  In NT8 there is BarsRequest: http://ninjatrader.com/support/helpG...arsrequest.htm
                  For this, if you have questions please do not reply to this thread but instead utilize the correct forum for NT8 items. http://ninjatrader.com/support/forum...splay.php?f=57

                  Please let me know if I may be of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    accessing a single value (in this case previous days closing price) on another chart once during each trading session is my solution (albeit unsupported by NT).

                    As far as I'm concerned this is my equivalent of CloseD with very little effort (and much better than relying on 57,000 bars arriving without any problems).

                    I'll probably create a GLOBALS indicator until such time a formal solution is introduced by NT.

                    Comment


                      #11
                      for future reference:

                      How to make two charts share variable values

                      Why would I wish to do this? Lets say I have a Weekly chart with a 50EMA on it and I wish to know the current value to plot on my 100 tick chart. I do not wish of course to take the usual course of adding at least 50 weeks of data onto my 100 tick chart ...

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by quantismo, 04-17-2024, 05:13 PM
                      3 responses
                      25 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by ScottWalsh, 04-16-2024, 04:29 PM
                      7 responses
                      34 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by cls71, Today, 04:45 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post cls71
                      by cls71
                       
                      Started by mjairg, 07-20-2023, 11:57 PM
                      3 responses
                      214 views
                      1 like
                      Last Post PaulMohn  
                      Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                      4 responses
                      547 views
                      0 likes
                      Last Post PaulMohn  
                      Working...
                      X