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 pechtri, 06-22-2023, 02:31 AM
          9 responses
          122 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by frankthearm, 04-18-2024, 09:08 AM
          16 responses
          64 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by habeebft, Today, 01:18 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by benmarkal, Today, 12:52 PM
          2 responses
          13 views
          0 likes
          Last Post benmarkal  
          Started by f.saeidi, Today, 01:38 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X