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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    54 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    34 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    94 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    56 views
    0 likes
    Last Post PaulMohn  
    Working...
    X