Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trend Indicator Based on another time period

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

    Trend Indicator Based on another time period

    I am trying to use an trend filter to enter a trade.

    The primary data is a 1 minute chart and I want to use indicators and price date based on an hourly chart. I also want to ensure the following before entering a long trade (for example):

    1) Low of the current session is above 8 period SMA on the hour chart
    2) 8 period SMA on hourly chart is above 20 SMA on hourly chart

    I've tried a range of methods but keep getting the problem of not being allowed to use relationional operators with strings (error CS0019)

    Does anyone have any ideas how I might acheive my objective here?

    Many thanks

    Mark

    #2
    Mark, could you please post the code you're using? I'll take a look and see if anything looks out of place.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Austin View Post
      Mark, could you please post the code you're using? I'll take a look and see if anything looks out of place.
      Hi Austin,

      This is what i'm using first to activate the other time period;

      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      Add(PeriodType.Day, 1);
      }
      Then this is one of several entry requirements

      && SMA(BarsArray[1], 8) > SMA(BarsArray[1], 20)
      It is giving me the CS0019 error when I try to compile it.

      I can't seem to find a function that would log the low of the session either, do you have any thoughts on this?

      Many thanks

      Mark

      Comment


        #4
        MJUK10, you would need to compare a double value from your series, i.e. SMA(BarsArray[1], 8)[0] > SMA(BarsArray[1], 20)[1]

        You can work with CurrentDayOHL for accessing the highs, lows of the day as defined by your session begin / end times (session template if you're working with NT7 beta).

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 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