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 Tim-c, Today, 03:54 AM
          0 responses
          3 views
          0 likes
          Last Post Tim-c
          by Tim-c
           
          Started by FrancisMorro, Today, 03:24 AM
          0 responses
          2 views
          0 likes
          Last Post FrancisMorro  
          Started by Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,770 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          31 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          945 views
          0 likes
          Last Post spwizard  
          Working...
          X