• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EMA from higher timeframe

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

    #16
    Hello Johnny,

    What is the time and date of the first bar and second bar printed from the script?

    What is the time and date of the first bar and second bar on the chart that has the indicator directly applied?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Hello Chelsea,

      Indicator to chart:
      Bar 1: May, 5th at 3:30 am
      Bar 2: May, 5th at 3:40 am

      Indicator in strategy:
      Bar 1: May, 10th at 02:00 am
      Bar 2: May, 10th at 02:00 am

      playback set to May, 15th

      Best regards,
      Johnny

      Comment


        #18
        Hello Johnny,

        If the first bars printed from the script and the first bar on the chart doesn't match, then the data is not the same.

        Either its a different data series or the time frame is different..

        Different data means different results.

        What is the data series used for the script?
        What is the Days to load or Date range used for the script?
        What is the data series use for the chart?
        What is the Days to load or Date range used for the chart?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          Hi Chelsea,

          steps to reproduce:

          1. Setup playback connection with loaded market replay data
          2. Open NQ Chart on 10 minute timeframe. Set playback to May, 14th.
          3. Set Data series with "Days to load" to 30.
          4. Add Indicator to chart "EMASecondarySeries" with Period 60 and change color to blue.
          5. Add Strategy to chart "EmaSecondaryStrategy" (change Period also to 60 in code behind so the values should be the same).
          6. Set "minimum required bars" to 500 (It doesn't make any differences in calculation)
          6. Activate the strategy to see the result:
          Click image for larger version

Name:	result.png
Views:	1
Size:	38.0 KB
ID:	1059717


          How do I set up the strategy correctly?

          Best regards,
          Johnny




          Comment


            #20
            Hello Johnny90,

            If the data is the same and the indicator parameters are the same, the indicator values will be the same.

            Below is a link to a video that demonstrates.
            https://drive.google.com/file/d/1N-s...w?usp=drivesdk

            Below is a link to a video that demonstrates.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Hello Chelsea,

              1. The sample video is with different indicator without "AddChartIndicator" method used in strategy.
              2. The calculation is based on BarsArray[1] witch is not possible with AddChartIndicator.
              3. Can you please reproduce the issue with my provided steps above? The indicator and sampleStrategy is from your post on Page 1.
              4. or could we do a TeamViewer Session to resolve this? Maybe that's the easiest way to resolve this faster. We could do this tomorrow or on friday.

              Best regards,
              Johnny

              Comment


                #22
                Hello Johnny,

                An indicator that uses BarsArray[1] as the input series cannot be added to the chart with add chart indicator.

                The video I prepared shows that an indicator using BarsArray[1] in post #20 shows that values from an indicator with BarsArray[1] matches a chart that is using the same series.

                The script in Post #10 does not use BarsArray[1]. This simply adds a secondary series to show this does not affect the values of an indicator using the primary series for values.

                What are you wanting me to test?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  Hello Chelsea,

                  here's a video witch describes my problem from post #19. The script and strategy is from your post #10. I don't understand why there is any differences in calculation between the two indicators (same period, chart, etc.). One indicator manually added to the chart shows right values, while the same indicator used from strategy (with AddChartIndicator) generates wrong values.
                  https://drive.google.com/file/d/11En...ew?usp=sharing


                  Comment


                    #24
                    Hello Johnny90,

                    That was my mistake. In the code, I was just making a quick example that uses the secondary series. Its also necessary to change the logic so that the prior value is not from the previous primary bar but from the previous secondary bar.

                    Re-exported with the change.
                    Attached Files
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #25
                      Hello Chelsea,

                      thanks for all your help, the values are correct now and the strategy is working in realtime mode.

                      When backtesting the strategy I encountered that the EMA Indicators need some time till the values are correct are therefore the backtesting results getting incorrect. How can I get rid of this behavior?
                      Click image for larger version

Name:	backtest.png
Views:	1
Size:	88.3 KB
ID:	1062822

                      Best regards,
                      Johnny

                      Comment


                        #26
                        Hello Johnny,

                        Are you referring to the BarsRequiredToPlot?

                        This defaults to 20. You can set it lower.

                        https://ninjatrader.com/support/help...iredtoplot.htm
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #27
                          Hello Chelsea,

                          sorry the problem was related to my custom code.

                          Thanks!

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by ballboy11, Today, 01:04 PM
                          0 responses
                          2 views
                          0 likes
                          Last Post ballboy11  
                          Started by ntbone, Today, 12:15 PM
                          1 response
                          12 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by ballboy11, Today, 12:32 PM
                          1 response
                          2 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by brownsfan019, Today, 12:04 PM
                          1 response
                          6 views
                          0 likes
                          Last Post NinjaTrader_PatrickG  
                          Started by x86231933, Today, 10:48 AM
                          2 responses
                          20 views
                          1 like
                          Last Post TopGunNote  
                          Working...
                          X