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

Range Indicator Modification

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

    Range Indicator Modification

    Hey guys, I'm trying to modify this NT range indicator to read the range of the last 3 bars from the 3 minute chart. Having some issues with the bars array to read the period type as well as the 3 bar period lookback.

    {
    Add(new Plot(Color.Firebrick, PlotStyle.Bar, "RangeValue"));
    Add(PeriodType.Minute, 3);


    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    Value.Set(High[0] - Low[0]);

    }

    #2
    Try

    Code:
    protected override void OnBarUpdate()
    {            
        Value.Set(MAX(High,3)[0] - MIN(Low,3)[0]);
    }

    Comment


      #3
      Need it to read from the 3 minute chart but this is giving me an error, says High, Low does not exist in current context https://gyazo.com/165f46bc51e41011f8544a5b49146d50


      Value.Set(MAX(High(BarsArray[1],3)[0] - MIN(Low(BarsArray[1],3)[0])));

      Comment


        #4
        Originally posted by brucelevy View Post
        Need it to read from the 3 minute chart but this is giving me an error, says High, Low does not exist in current context https://gyazo.com/165f46bc51e41011f8544a5b49146d50


        Value.Set(MAX(High(BarsArray[1],3)[0] - MIN(Low(BarsArray[1],3)[0])));
        You parenthesis appear to be very misplaced.

        Comment


          #5
          Originally posted by brucelevy View Post
          Need it to read from the 3 minute chart but this is giving me an error, says High, Low does not exist in current context https://gyazo.com/165f46bc51e41011f8544a5b49146d50


          Value.Set(MAX(High(BarsArray[1],3)[0] - MIN(Low(BarsArray[1],3)[0])));
          Value.Set(MAX(High(BarsArray[1],3)[0 ]) - MIN(Low(BarsArray[1],3)[0])));

          try that one in bold.

          Comment


            #6
            Originally posted by brucelevy View Post
            Need it to read from the 3 minute chart but this is giving me an error, says High, Low does not exist in current context https://gyazo.com/165f46bc51e41011f8544a5b49146d50


            Value.Set(MAX(High(BarsArray[1],3)[0] - MIN(Low(BarsArray[1],3)[0])));
            The first problem are the false brackets. The second problem is created because you reference BarsArray[1]. BarsArray[1] is the second BarsArray and would only exist in a multi-timeframe indicator with an added DataSeries.

            Please use the code as I had suggested below. Then apply the indicator to the chart series as needed via indicator dialogue box.
            Last edited by Harry; 11-06-2015, 07:21 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by elirion, Today, 01:36 AM
            0 responses
            3 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by gentlebenthebear, Today, 01:30 AM
            0 responses
            3 views
            0 likes
            Last Post gentlebenthebear  
            Started by samish18, Yesterday, 08:31 AM
            2 responses
            9 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by Mestor, 03-10-2023, 01:50 AM
            16 responses
            389 views
            0 likes
            Last Post z.franck  
            Started by rtwave, 04-12-2024, 09:30 AM
            4 responses
            34 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Working...
            X