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

How Do You Make a Timeframe Constant to Whatever Strategy It is Being Used in?

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

    How Do You Make a Timeframe Constant to Whatever Strategy It is Being Used in?

    I realize the title may be misleading but, allow me to explain.


    Most of strategies are trading in the minutes timeframe. However, I would like to develop an indicator that looks at the weekly and daily timeframe.

    How do I make a line like this:

    Code:
    if (CrossAbove(SMA(5), SMA(15), 1))
    look specifically at five periods on the WEEKLY chart, crossing above fifteen periods on the WEEKLY chart, even though the trade will be happening at the minutes "level,"

    Thanks in advance for any help.

    #2
    Originally posted by outstretchedarm View Post
    I realize the title may be misleading but, allow me to explain.


    Most of strategies are trading in the minutes timeframe. However, I would like to develop an indicator that looks at the weekly and daily timeframe.

    How do I make a line like this:

    Code:
    if (CrossAbove(SMA(5), SMA(15), 1))
    look specifically at five periods on the WEEKLY chart, crossing above fifteen periods on the WEEKLY chart, even though the trade will be happening at the minutes "level,"

    Thanks in advance for any help.
    Use a multi-timeframe strategy.

    Comment


      #3
      Sorry for the slow reply but, how exactly does one do that?

      Comment


        #4
        Originally posted by outstretchedarm View Post
        Sorry for the slow reply but, how exactly does one do that?
        In the strategy section of where you edit ninjascript, look at the sample:

        [Description("This is a sample multi-time frame strategy.")]
        public class SampleMultiTimeFrame : Strategy



        You'll want to add a series with Period.Type of week.

        Then uses BarsArray properly

        if (SMA(BarsArray[1], 5)[0] > SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] > SMA(BarsArray[2], 50)[0])

        Comment


          #5
          Ok, it'll take me a while to digest it. I have a lot to learn!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PhillT, 04-19-2024, 02:16 PM
          4 responses
          30 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by ageeholdings, 05-01-2024, 05:22 AM
          5 responses
          36 views
          0 likes
          Last Post ageeholdings  
          Started by reynoldsn, Today, 02:34 PM
          0 responses
          7 views
          0 likes
          Last Post reynoldsn  
          Started by nightstalker, Today, 02:05 PM
          0 responses
          12 views
          0 likes
          Last Post nightstalker  
          Started by llanqui, Yesterday, 09:59 AM
          8 responses
          29 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Working...
          X