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

DOW EMA200 @ YM minute chart

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

    DOW EMA200 @ YM minute chart

    My strategy needs ( amongst other things ) the ema 200 from the DOW Index 1 h data serie at a 1 minute YM Future chart.

    So i ad :

    AddDataSeries("^DJIA", BarsPeriodType.Minute, 60);

    .....

    ema60min200dow = EMA(Closes[1],200)[0];

    That works, but for 200 hours dow i need about 4 weeks back data for getting the correct ema200 .

    This first 4 weeks i can't start the strategy algo so i just wait 200 dow bars...

    barsdow = CurrentBars[1];
    if (barsdow < 200) return;


    But i can`t stop ploting the chart and some other ym 1 min chart indicators.
    So the first 4 weeks the strategy Analyser plots Tausends of 1 Minute YM bars and Tausends other YM 1 min indicators values for no reason. This makes the strategy Analyser very slow...

    So, how can i get this Dow 60 min EMA 200 without ploting about 400 h of 1 min ym chart in the Strategy ?
    Last edited by jr123; 04-08-2018, 01:06 PM.

    #2
    Hello jr123,

    The AddDataSeries() method allows for a barsToLoad overload parameter.

    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

    Below is a public link to the help guide.


    Or you would need to use a BarsRequest and do all calculations custom.

    Below is a public link to the help guide.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello jr123,

      The AddDataSeries() method allows for a barsToLoad overload parameter.

      AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

      ....[/url]
      Thank you very much.
      This seems working.


      But there is a small difference beetween the result.
      The DJIA Chart with 60 min (200 Days back ) shows EMA200
      on the END of 04/05/2018 : 24502


      AddDataSeries("^DJIA", new BarsPeriod {BarsPeriodType = BarsPeriodType.Minute, Value = 60},1400,"US Equities RTH",false);

      if (BarsInProgress == 1 )
      {
      ema60min200dow = EMA(Closes[1],200)[0];
      Print(Time[0] + " ema60min200dow " + ema60min200dow );
      }

      this code shows at the same time :
      05.04.2018 22:00:00 ema60min200dow 24508,3080877318

      Why this (small) difference ?

      Comment


        #4
        Hello jr123,

        I'm still testing this but on my end I'm not getting correct bar times with AddDataSeries().

        In the script, bars are ending on the hour and not the half hour which would not match the trading hours template applied. I should be seeing bar closes every half hour.

        Once I have more information I will update this thread.

        I appreciate your patience.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello jr123,

          I'm still testing this but on my end I'm not getting correct bar times with AddDataSeries().

          In the script, bars are ending on the hour and not the half hour which would not match the trading hours template applied. I should be seeing bar closes every half hour.

          Once I have more information I will update this thread.

          I appreciate your patience.
          OK, this seems the reason.

          With 30 min chart DJIA and ema400 the chart EMA is
          identical to the script EMA 400. So for now i will use ema400 / 30 min.
          Seems the same as 60min / ema200 .

          Comment


            #6
            Hello jr123,

            The issue is with the IsResetOnNewTradingDay bool.

            You have this set to false which means it will not create a new bar on the new session.

            You can have your chart match this by disabling Break EOD in the data series section of the chart.

            (Or you can set this to true in the AddDataSeries() call)
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rtwave, 04-12-2024, 09:30 AM
            4 responses
            29 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Started by yertle, Yesterday, 08:38 AM
            7 responses
            28 views
            0 likes
            Last Post yertle
            by yertle
             
            Started by bmartz, 03-12-2024, 06:12 AM
            2 responses
            21 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by funk10101, Today, 12:02 AM
            0 responses
            6 views
            0 likes
            Last Post funk10101  
            Started by gravdigaz6, Yesterday, 11:40 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X