



Average Median
This is a technical indicator for cTrader that calculates and plots a dynamic median line with advanced trend management and performance optimization features.
Main Features
1. Smart Median Calculation
Calculates the median of prices over a configurable period
Smart price selection: Uses the high (bullish), low (bearish), or close (doji) based on the candle direction
Support for odd and even periods (average of the two central values)
2. Chart Plotting
Continuous median line with customizable style, color, and thickness
Lines connect the median points between bars
Overlay configuration on the chart
3. Trend Detection
Identifies trend direction based on the median slope
Visual icon: up/down arrows (bullish/bearish) or square (neutral)
Configurable offset for icon positioning
Automatic color based on direction (green/red/grey)
4. Performance Optimization Caching System: Stores median calculations to avoid reprocessing Periodic Cleanup: Automatically removes old graphic objects Memory Control: Keeps only a configurable number of bars Efficient management of graphic objects Configurable Parameters Trend Settings Plot Trend Status: Turns direction icons on/off Previous Direction Offset: Distance of the icon from the line Median Settings Median Period: Number of bars for calculation (minimum 3) Use Smart Price Selection: Enables smart price selection Median Color: Line color Median Line Style: Line style (solid, dashed, etc.) Median Thickness: Line thickness (1-5) Performance Settings Keep Last Bars: Number of bars to keep in memory (50-2000) Enable Caching: Enables caching system for calculations
HOW TO CALCULATE THE MEDIAN – STEP BY STEP
Data Collection For each bar, select the prices of the last N bars (configurable period).
- Sorting the Values Arrange the prices in ascending order: Example: (1.1050), (1.1060), (1.1070), (1.1080), (1.1090)
- Identifying the Central Value
- Case 1: Odd Number of Elements Odd period (e.g., 5, 7, 9...). The median is the value that occupies the central position. Example with 5 values: Sorted: (1.1050), (1.1060), (1.1070), (1.1080), (1.1090) Median = (1.1070)
- Case 2: Even Number of Elements Even period (e.g., 4, 6, 8...). The median is the average of the two central values. Example with 4 values: Sorted: (1.1050), (1.1060), (1.1070), (1.1080) Median = (1.1060 + (1.1070) / 2 = (1.1065)
- Median vs. Simple Moving Average (SMA)
- Simple Moving Average (SMA): Adds all values and divides by the total. It is sensitive to extreme values (outliers).
- Example: (1.1000), (1.1010), (1.1020), (1.1030), (1.2000) SMA = (1.1000 + (1.1010) + (1.1020) + (1.1030) + (1.2000) / 5 = (1.1212) ← Distorted!
- Median: Considers only the central value. It is resistant to outliers.
- Same example: (1.1000), (1.1010), (1.1020), (1.1030), (1.2000) Median = (1.1020) ← A more faithful representation of reality!


.jpg)



![„[CB] Pivot Points Pro“-Logo](https://market-prod-23f4d22-e289.s3.amazonaws.com/8227035a-1386-44e8-8335-c56ee434a8fd_ctrader-pivot-point-indi.png)











