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 jaybedreamin, Today, 05:56 PM
            0 responses
            7 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            13 views
            0 likes
            Last Post bltdavid  
            Working...
            X