Loading…

Close Location Value Study

Close Location Value (CLV) is (Close-Low) / (High-Low): a value near 1.0 means the bar closed at, or near, its own high; near 0.0 means it closed at its own low. On its own, an average CLV is a curiosity. What makes it useful is whether it predicts anything, so this script goes one step further than a plain average: bars are split into "closed near the high" and "closed near the low" groups (controlled by InpExtremeThreshold), and each group's average NEXT-bar log return is reported alongside the plain average CLV, per session. Sessions are read directly from the bar's own open hour in the terminal's time base (broker/server time, whatever the chart already shows) - there is no separate timezone conversion, and the three session start hours are configurable inputs rather than fixed assumptions about which broker's clock is in use. Notes and limitations A bar with zero range (High equals Low) is skipped - CLV is undefined for it. The next-bar return figures are averages over the whole studied window; they describe what happened on this symbol and sample, not a prediction. A near-zero average for a group simply means that closing near the extreme had, on average, no measurable follow-through in the next bar over the studied history. Session assignment is purely hour-of-day based on the chart's own clock. If your broker's server time shifts with daylight saving and the studied window spans both sides of a transition, session boundaries will shift by an hour partway through the sample - this is not corrected for.

Script · MT5 · v1.0 · Free

About Close Location Value Study

Close Location Value Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Timeframe, Bars to study and Asian start hour. MQL source code included.

Files in the download: CloseLocationValueStudy.ex5, CloseLocationValueStudy.mq5, CloseLocationValueStudy.txt.

Settings

SettingDefaultWhat it does
TimeframePERIOD_M15Intraday timeframe the CLV is measured on
Bars to study5000Completed bars to include
Asian start hour0Asian session start hour (terminal time, 0-23)
London start hour8London session start hour (terminal time, 0-23)
New york start hour13New York session start hour (terminal time, 0-23)
Extreme threshold0.20CLV within this of 0 or 1 counts as "near the low/high"
Save csvtrueWrite the per-session table to a CSV file

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Trading Sessions · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria