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 SMA indicator

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

    Daily SMA indicator

    I use Wealth-Lab for charting but Im looking to migrate to Ninja Trader 7.
    Basically I want to draw the same chart from the picture attached.

    Notes:
    - There is daily SMAs / EMAs drawn on intraday charts, intraday can be 15min 5min or ticks
    - The main problem with this type of multitimeframe is that I want to draw for example daily SMA(200) on tick based charts, so I need like 5 years of daily data to process that SMA
    - Its not viable to load 5 years of tick data, I just need 1 week of tick data and 5 years of daily data

    So how to do this ?

    Thanks
    Attached Files

    #2
    stormze, If you look to code an indicator for this task, there would be unfortunately no way to load different lookback intervals as the it would load whatever the primary series uses.

    You should be able to create this setup directly on a MultiSeries chart though, as you could then specify the lookback lengths desired for each series -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      I would be a nice and easy to implement feature the posibility to add a dataseries to a chart but dont draw it on the chart, instead of that make it input of some other indicator, thanks btw

      Comment


        #4
        This is doable now already, just drop them in the same panel and assign transparent color for the to be 'blanked out' series, effectively making it invisible.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          The problem with the transparent color hack is that the bar spacing on primary series is modified based on the secondary series

          Comment


            #6
            Can you tell me why the Add method doesnt have the AMMOUNT OF BARS TO LOAD ?
            When you add a dataseries via the GUI you have that parameter but adding them programatically you cant specify that, is it so hard to add this ? what is the problem

            Comment


              #7
              Unfortunately you're correct - if you use multiple series in the UI you cannot use equidistant bars spacing.

              Thanks also for your suggestion on enhancing the Add() method with a lookback paramter, we'll add it to our list of feedback.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Thanks, yes pls give priority to that enhancement on the Add method, its vital to have that to work with multitimeframe indicators !

                Comment


                  #9
                  does anyone have a daily sma indicator for an intraday chart?

                  Comment


                    #10
                    the attached daily SMA on a 60min chart compares well to a Daily chart + SMA at the end of the chart but comparison doesn't hold going back in time?

                    also ...

                    move 1 hour chart scroll fully to left and then move cursor to daily chart.

                    return to 1 hour chart and no Daily SMA values in data box.

                    move 1 hour chart scroll fully to right, reload script and values return.
                    Attached Files
                    Last edited by futurenets; 02-12-2015, 08:23 AM.

                    Comment


                      #11
                      Hello futurenets,

                      Thank you for your post.

                      You would need to make sure you have enough bars on the minute chart to load the full moving average, as it uses an underlying Day bar series that needs to be the same as your Daily charts number of days to load. Right click in your minute chart > select Data Series > change the DaysToLoad to 365 or what ever value you set your Daily chart to (default is 365) and then click OK.

                      Most providers limit the available minute data during market hours so you may need to load the 365 days of minute data after hours.

                      Comment


                        #12
                        ok thanks Patrick

                        but I think I had more days on intraday than daily but will take a second look after hours.

                        Comment


                          #13
                          my daily chart has 365 days of data and 1 hour chart 365 days

                          move 1 hour chart scroll fully to left and then move cursor to daily chart.

                          return to 1 hour chart and no Daily SMA values in data box.

                          move 1 hour chart scroll fully to right, reload script and values return.

                          problem also occurs when 1 hour has 500 days (but no problem on a daily chart).

                          Any ideas?

                          Also:

                          DailySMA on Hourly Chart (Right) = DailySMA on Daily Chart (Right)

                          but

                          DailySMA on Hourly Chart (Left) != DailySMA on Daily Chart (Left)

                          is this because 1 daily bar is loaded for each 1 hour bar so at CurrentBar=0 on 1 hour I'm trying to look back say 20 daily bars to calculate daily SMA but there are no bars there? if so why doesn't this happen on a daily chart?

                          or

                          You only get 1 (daily) data bar for every 24 (1 hour) data bars?

                          something like ...

                          1hr bar[0-23] = daily bar[0]
                          1hr bar[24-47] = daily bar[1]
                          1hr bar[48-71] = daily bar[2]
                          etc.
                          Last edited by futurenets; 02-13-2015, 10:16 AM.

                          Comment


                            #14
                            Hello,

                            Thank you for providing the script.

                            What you are experiencing is a double number of Infinity.

                            The math that is being used, during the first couple of bars is causing an infinity rather than a value.

                            To resolve this, without changing your existing logic I just added a check for infinity.

                            You would only need to modifiy this line:

                            Code:
                            Value.Set((sum + Close[0]) / curPeriod);
                            to:

                            Code:
                            double total = (sum + Close[0]) / curPeriod;
                            if(!Double.IsInfinity(total))
                            Value.Set(total);
                            To test items like this, all you need is a Print() statement.

                            I had created the variable total, and then printed it by using Print(total);

                            This instantly told me the value was infinity which would cause a error.

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

                            Comment


                              #15
                              ok thanks for help will go figure

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by proptrade13, Today, 11:06 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by quantismo, 04-17-2024, 05:13 PM
                              4 responses
                              32 views
                              0 likes
                              Last Post quantismo  
                              Started by love2code2trade, 04-17-2024, 01:45 PM
                              4 responses
                              32 views
                              0 likes
                              Last Post love2code2trade  
                              Started by cls71, Today, 04:45 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post eDanny
                              by eDanny
                               
                              Started by kulwinder73, Today, 10:31 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X