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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        152 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        89 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        131 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        127 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X