Announcement

Collapse
No announcement yet.

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 CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          173 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          91 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          130 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          209 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          186 views
          0 likes
          Last Post CarlTrading  
          Working...
          X