Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using GetMedian()

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

    Using GetMedian()

    The syntax GetMedian() seems to include the current bar in the calculation, which might skew the result if the bar is early in development. One might assume that you could use calculate = OnBarClose to resolve this (but unsure).

    However, is there any other technique to exclude the current bar from the calculation? Specifically, I am looking at applying this to an Indicator, not just a single Price point (i.e. Open, High, Low, Close).

    #2
    Hello tradeologist,

    Unfortunately, there is not a barsAgo index that can be used with this.

    What you could do though, is save the median value to a variable on each update except for when IsFirstTickOfBar is true, and when true, the value would be for the previous bar.

    You might also consider creating your own method that does not include the current bar.
    A community member has shared a general formula in the thread below.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    547 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    323 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    99 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    543 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    545 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X