Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to find the max value

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

    #16
    Sorry...I had another indicator edit window opened and it was that one that had the errors. My updated SampleCustomDataSeries now works.

    If I wanted to increase the look back period from 256 to 500 would I simply change the value of ForceMaximumBarsLookBack256 to 500.

    Thanks, Steven

    Comment


      #17
      ForceMaximumBarsLookBack256 will ignore UI selection when user selects infinite. You probably don't need this setting right now.

      If any of your calculations require more than 256 bars, you can change to infinite with this setting, available by code or GUI:
      http://www.ninjatrader.com/support/h...rslookback.htm
      Ryan M.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by StevenV View Post
        How do I have a SMA of the above formula.
        Here's a simple way:

        1) Create an indicator (say called BarWickAvg) that plots this formula
        Code:
        protected override void Initialize()
                {
                    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Value"));
        			BarsRequired=0;
                    Overlay				= false;
                }
        
                protected override void OnBarUpdate()
                {
                   Value.Set( ((High[0]-Math.Max(Open[0],Close[0]))+(Math.Min(Open[0],Close[0])-Low[0]))/2);
                }
        2) Getting an SMA of BarWickAvg:
        If you just want an SMA of this on an ad-hoc basis you can simply put an SMA on your chart (new panel) and change its "Input Series" to Indicators/BarWickAvg.

        Or if you want to make this more convenient you can make a new indicator say called SMABarWickAvg with a parameter Period,


        Code:
                protected override void Initialize()
                {
                    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Value"));
        			BarsRequired=0;
                    Overlay				= false;
                }
        
                protected override void OnBarUpdate()
                {
                    Value.Set(SMA(BarWickAvg(),period)[0]);
                }

        Comment


          #19
          Thanks DaveE!

          I did not know I could apply one indicator to another...good to know.

          Your code works great and is simpler.

          Thanks, Steven

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kazisl, Today, 06:41 PM
          0 responses
          4 views
          0 likes
          Last Post kazisl
          by kazisl
           
          Started by einstein, Today, 06:20 PM
          0 responses
          6 views
          0 likes
          Last Post einstein  
          Started by op1031, Today, 05:51 PM
          0 responses
          5 views
          0 likes
          Last Post op1031
          by op1031
           
          Started by nighttrader99, Today, 04:34 PM
          2 responses
          10 views
          0 likes
          Last Post nighttrader99  
          Started by Simon Investimens, Today, 02:51 PM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X