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

Signals from Different Time frames

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

    Signals from Different Time frames

    So...

    I've understood how to use the add additional data series in order to link different indicators or prices to different time frames.
    For example MACD on 'Weekly' Data, Stock on 'Daily' data etc etc...

    But even If each of the indicator is linked to a specific data series, if I change the Data series input on the Strategy Analyser...I get different results/signals. I was expecting the result indifferent to the Data series selected on the Strategy Analyser since all was referenced to a specific series in the Strategy Builder.

    Any help would be appreciated!

    Mp

    #2
    Hello percma,

    Thank you for your note.

    What syntax are you using for your add data series calls?

    For example,
    Code:
    AddDataSeries(BarsPeriodType periodType, int period)


    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      AddDataSeries(Data.BarsPeriodType.Week, 1);
      AddDataSeries(Data.BarsPeriodType.Day, 1);
      AddDataSeries(Data.BarsPeriodType.Minute, 60);

      I use Strategy Builder. This is what I find on the Script Editor but is not compiled by me.

      Comment


        #4
        Hello percma,

        This is expected and relates to the feature request SFT 882, which has considerable interest, for which I will add your vote to. This SFT would allow dynamic loading of additional data series.

        Each time you wish to change the instrument you will have to remove and re-add the instance of the strategy. This is because your adddataseries are not guaranteed to be called on an instrument change.

        The third warning at the following link relates to your issue,


        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hey Alan,

          this is getting a bit complicated for my level...

          so:
          Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables

          I don't understand the above...but mostly what should I do (I use strategy builder) if I want to have a multi timeframes signals?
          Would it be different if I use just 1 adddataseries additionally to the Default Input?

          Comment


            #6
            Hello percma,

            You would not need to modify your code but instead when you want to change the instrument you're testing you should remove the strategy and readd it with the desired instrument. Start with a fresh strategy each time.

            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              ok. but would the data series input that I choose for the chart have an effect on the way the strategy operates? even if each indicator is linked to a specific data series (and each data series is uploaded as additional data)?

              I'm asking this because if I use different time frames in the in the strategy analyser ...I get different results even if all my indicator should be de-correlated from the instrument input time frame (since they are never linked to that in the code).

              Comment


                #8
                Hello percma,

                I might suggest adding the following print statements for each bar series, BarsArray[2] for the third series, BarsArray[1] for second series, etc. Open an output window, and check the prints on each run.

                Code:
                Print(BarsArray[1].Instrument.ToString());
                Print(BarsArray[1].BarsPeriod.ToString());
                The prints above will allow you to know exactly which instrument are being referenced as well as the period of that series.

                Please let us know if you need further assistance.
                Alan P.NinjaTrader Customer Service

                Comment


                  #9
                  Sample code request

                  Hi Alan


                  Do you have sample code that I can modify? I simply wish to have an indicator that gives an alert when price is above a 3 minute MA and also a 10 minute MA. I'm using NT7.



                  Thanks.

                  Comment


                    #10
                    Hello Slide588,

                    I do not have a sample which does this however this could be achieved with alerts in NT7,


                    Or via a script using the following,

                    Alert,


                    Close,


                    SMA,


                    And this could be built using the strategy builder,


                    Going forward if you could please avoid posting NT7 questions in the NT8 section of the forum that would be appreciated.

                    Please let us know if you need further assistance.
                    Alan P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Radano, 06-10-2021, 01:40 AM
                    19 responses
                    604 views
                    0 likes
                    Last Post Radano
                    by Radano
                     
                    Started by KenneGaray, Today, 03:48 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post KenneGaray  
                    Started by thanajo, 05-04-2021, 02:11 AM
                    4 responses
                    470 views
                    0 likes
                    Last Post tradingnasdaqprueba  
                    Started by aa731, Today, 02:54 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post aa731
                    by aa731
                     
                    Started by Christopher_R, Today, 12:29 AM
                    0 responses
                    11 views
                    0 likes
                    Last Post Christopher_R  
                    Working...
                    X