Crossing Frequency Meter
A trending market spends long stretches on one side of its moving average; a choppy, mean-reverting market crosses back and forth often. Traders already look for this visually, but "does this look choppy" is a judgement call that varies from one look to the next. This indicator counts it directly: for each bar, it walks back InpCountWindow bars and counts how many times price crossed the moving average inside that window, plotting the count as a histogram in a subwindow. A low reading means price has been sitting consistently on one side of the average - a condition many trend-following rules are built to assume. A high reading means price has been whipping across the average repeatedly, the situation where a moving-average crossover signal in particular tends to generate the most false entries. The count is a plain integer, not a percentage or a normalised score, so it is directly comparable bar to bar within the same chart and window setting. Notes and limitations - Counts a crossing as any bar where price sits on the opposite side of the moving average from the bar immediately before it - it does not filter out crossings that only occurred by a tiny margin, so a moving average sitting almost flat against a nearly-flat price can read as more "crossy" than it feels visually. - Needs InpMaPeriod + InpCountWindow + 2 bars of history before it starts plotting. - The count is unscaled - it does not adjust for the moving average period or window length, so comparing counts across two different InpMaPeriod or InpCountWindow settings is not meaningful; only compare readings taken with the same settings.
Indicator · MT4 · v1.0 · Free
About Crossing Frequency Meter
Crossing Frequency Meter is an indicator for MetaTrader 4 based on Moving Average. It has 3 settings, such as Ma period, Ma method and Count window. MQL source code included.
Files in the download: CrossingFrequencyMeter.ex4, CrossingFrequencyMeter.mq4, CrossingFrequencyMeter.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Ma period | 20 | Period of the moving average price is compared against |
| Ma method | MODE_SMA | MA method (0=SMA, 1=EMA, 2=SMMA, 3=LWMA) |
| Count window | 50 | Bars scanned backwards for each crossing count |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · Trend · Trailing Stop & Break-even · MT4 Indicator · MQL4 Source Code