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 sjsj2732, Today, 04:31 AM
    0 responses
    20 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    279 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    279 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    130 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    89 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X