Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Different timeframes

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

    Different timeframes

    Hello,

    referring to a thread last year I know how to use 2 timeframes with "simple" indicators eg EMA so that I can write eg
    if (CrossAbove(RSI(3,1), SMA(RSI(3,1), 14), 1) && Rising(EMA(BarsArray[1], 14)))

    but I can not code (in words) " ...&& if Stochastics (7,14,3)D of Array[1] is rising" then do.....

    I´m not able to bring in the Stochastics (or MACD) because of their setup numbers.

    And I can not code " if Stochastics (7,14,3)D of Array[1] is below 50" then do...

    Thanks for any help.

    Best regards
    Tony

    #2
    Hello,

    Does this help?:

    double x = Stochastics(BarsArray[1],7,14,3).D[0];

    Check out these links:




    If not, show me your attempt at it and I will assist if I can.
    DenNinjaTrader Customer Service

    Comment


      #3
      Different timeframes

      Ben,

      thank you very much for your reply. But I´m sorry, I don´t know what you mean. I understand the links as there are samples with indicators with 1 variable, but I don´t find an example how to do with an indicator as MACD or Stochastics with more variables and I don´t understand where to write here "double x = ..." There is an example with "...print... stochastics..." but I do not understand this for the coding here. Sorry and thanks for your help:

      My attempt is to substitute
      "Rising(HMA(BarsArray[1],21))"
      by "Rising(Stochastics(BarsArray[1],7,14,3.D)". (Why D[0]?)
      and by "Stochastics(BarsArray[1],7,14,3.K) crossabove Stochastics(BarsArray[1]7,14,3,D)".

      If I write this in my conditionset it doesn´t compile. Do I have to write also something in the initialize-section?

      Thanks in advance.

      Best regards
      Tony
      Last edited by tonynt; 05-23-2010, 01:45 AM.

      Comment


        #4
        Hello,

        Does that help?

        if(Rising(Stochastics(BarsArray[1],7,14,3).D))
        {
        //do something
        }
        if(CrossAbove(Stochastics(BarsArray[1],7,14,3).K,Stochastics(BarsArray[1],7,14,3).D,1))
        {
        //do something
        }

        This may help:

        DenNinjaTrader Customer Service

        Comment


          #5
          Different Timeframes

          Hello Ben,

          thank you very much for your help! Great support! It works with this coding. But at this opportunity I want to ask you one question more with the BarsArray. When I do now write eg

          if(Stochastics(BarsArray[1],7,14,3).D < 50)

          I get the error message at compiling "... < can not be used ..." (message appears in my language)

          I don´t understand why can not be used "<" here.

          Thank you again and have a great day!

          PS: Great software, Great support! Hope I can purchase NinjaTrader already next month for live trading.

          Best
          Tony

          Comment


            #6
            Hello,

            You need to understand an important concept that you are missing.

            Notice that this returns a double (a number) value:
            Stochastics(BarsArray[1],7,14,3).D[0]

            This returns a series of values called an IDataSeries:
            Stochastics(BarsArray[1],7,14,3).D

            So here:


            When it says:
            Stochastics(IDataSeries inputData, int periodD, int periodK, int smooth).D[int barsAgo]

            And you use:
            Stochastics(Close,3, 14, 7).D[0];

            "Close" is an IDataSeries:


            Because we included "[0]" after the method, it returns a double value.

            You will have to research it a bit to understand. Sometimes you need a value and sometimes you need an IDataSeries.
            DenNinjaTrader Customer Service

            Comment


              #7
              Different Timeframes

              Ben,

              thanks again for your reply. It works. Thank you. I try to understand it. Referring to the link with "Close" (printing sample) how would I then write eg

              "if close (BarsArray[1],[0]<EMA(BarsArray[1],34)"

              How do I refer to Close (or High,Ask....) in this case?

              Then we´ll got it. Thank you!

              Best regards
              Tony

              Comment


                #8
                Hello,

                I'm not sure what you mean, but maybe this will help:

                if(Closes[1][0] < EMA(Closes[1],34)[0])
                {
                //do something
                }

                You will find Highs[][] here, which will help:
                http://www.ninjatrader-support.com/H...struments.html
                DenNinjaTrader Customer Service

                Comment


                  #9
                  Different instruments

                  Hello,

                  thank you again. When thinking about this and coding - all works with your help! - there appears one question more. Can you please show me in on example how to include 2 different instruments in a strategy?

                  EG "if rising EMA(15) of 6E in Timeframe 1Min" AND "if rising EMA(15) of CL in Timeframe 5Min" then do.... How do I have to add the second instrument (in the different timeframe) and how do I refer in the condition set?

                  THANK YOU for your help.

                  PS: In every room I am - and I do a lot of webinars and trials - I mention Ninjatrader as the best software for charting, trading and strategy-development with the best support!

                  Best
                  Tony

                  Comment


                    #10
                    Tony,

                    To do multi-time frames please see this article: http://www.ninjatrader-support.com/H...ameInstruments

                    Basically you want to use if(Rising(Closes[0])) for the first bar series and if(Rising(Closes[1])) for the second series. Or you can filter your logic based on BarsInProgress.

                    Thank you for mentioning us in your webinar rooms! We really appreciate it.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    646 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    367 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    107 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    569 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X