What it does
Gap Levels highlights the price space between the new session open and the prior close when the opening move is large enough to matter. It is useful when you want gap context for fills, rejections, and trend continuation decisions.
Who this is for
This page is a good fit for traders who want a readable Gap Levels workflow without having to reverse-engineer the setup from forum posts or screenshots.
Key terms for this tool
Review the core trading and platform terms tied to this page before changing settings or using the study in a live workspace.
What it is not
Gap Levels is a chart-context tool. It does not place trades, manage risk automatically, or promise that a specific pattern will resolve in one direction. Use it to organize decisions, not to outsource them.
Chart examples
This chart capture shows the study on a real NinjaTrader workspace. Use it as visual reference, then confirm behavior on your own instrument, session, and timeframe.
Gap structure mapped on chart
A chart capture showing Gap Levels framing the space between the prior close and the new session open.
Best fit
- Tracking the boundaries of an opening gap during the session.
- Watching whether price fills, rejects, or accepts back into the gap.
- Adding context to early-session trend continuation or reversal decisions.
Before using it live
- Import the NinjaTrader 8 ZIP through NinjaTrader's normal import flow.
- Use it on charts where session opens matter.
- Set the minimum gap size high enough to avoid clutter from tiny opens.
- Review how the tool behaves on your actual session template, chart type, and instrument.
Settings to review
Defines how large the opening gap must be before it is drawn.
Displays the midpoint of the active gap.
Controls the colors used for the gap boundaries and midpoint.
Installation notes
- Import the NinjaTrader 8 ZIP through NinjaTrader's normal import flow.
- Use it on charts where session opens matter.
- Set the minimum gap size high enough to avoid clutter from tiny opens.
Downloads
Source code
These source examples are provided for copy/paste workflows on other charting platforms. Review and test any script in a simulator before using it on a live chart.
{
Gap Levels
FreeIndicators.com source example.
Works as a starting point for TradeStation EasyLanguage and MultiCharts PowerLanguage.
}
Inputs: MinimumTicks(4);
Vars: GapHigh(0), GapLow(0);
If Date <> Date[1] And AbsValue(Open - Close[1]) >= MinimumTicks * MinMove / PriceScale Then Begin
GapHigh = MaxList(Open, Close[1]);
GapLow = MinList(Open, Close[1]);
End;
Plot1(GapHigh, "GapHigh");
Plot2(GapLow, "GapLow");
Plot3((GapHigh + GapLow) / 2, "GapMid"); // Gap Levels
// FreeIndicators.com source example for MetaTrader 4.
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Crimson
#property indicator_color3 SeaGreen
double Buffer1[];
double Buffer2[];
double Buffer3[];
int init() {
SetIndexBuffer(0, Buffer1);
SetIndexBuffer(1, Buffer2);
SetIndexBuffer(2, Buffer3);
return(0);
}
int start() {
int counted = IndicatorCounted();
int limit = Bars - counted - 1;
double minimumTicks = 4.0 * Point;
for(int i = limit; i >= 0; i--) {
double priorClose = Close[i + 1];
double sessionOpen = Open[i];
if(MathAbs(sessionOpen - priorClose) >= minimumTicks) {
Buffer1[i] = MathMax(sessionOpen, priorClose);
Buffer2[i] = MathMin(sessionOpen, priorClose);
Buffer3[i] = (Buffer1[i] + Buffer2[i]) / 2.0;
}
}
return(0);
} // Gap Levels
// FreeIndicators.com source example for MetaTrader 5.
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_plots 3
double Buffer1[];
double Buffer2[];
double Buffer3[];
int OnInit() {
SetIndexBuffer(0, Buffer1, INDICATOR_DATA);
SetIndexBuffer(1, Buffer2, INDICATOR_DATA);
SetIndexBuffer(2, Buffer3, INDICATOR_DATA);
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]) {
int start = prev_calculated > 1 ? prev_calculated - 1 : 1;
double minimumTicks = 4.0 * _Point;
for(int i = start; i < rates_total; i++) {
if(i == 0) continue;
double priorClose = close[i - 1];
double sessionOpen = open[i];
if(MathAbs(sessionOpen - priorClose) >= minimumTicks) {
Buffer1[i] = MathMax(sessionOpen, priorClose);
Buffer2[i] = MathMin(sessionOpen, priorClose);
Buffer3[i] = (Buffer1[i] + Buffer2[i]) / 2.0;
}
}
return(rates_total);
} //@version=5
indicator("Gap Levels", overlay=true)
minimumTicks = input.int(4, "Minimum ticks", minval=1)
gap = open - close[1]
hasGap = math.abs(gap) >= minimumTicks * syminfo.mintick
gapHigh = hasGap ? math.max(open, close[1]) : na
gapLow = hasGap ? math.min(open, close[1]) : na
plot(gapHigh, "Gap high", color=color.red)
plot(gapLow, "Gap low", color=color.green)
plot((gapHigh + gapLow) / 2.0, "Gap midpoint", color=color.gray) After the download
Keep the next step tied to this exact tool
Install it cleanly, subscribe for future updates if this workflow matters, or move straight into a structured request if the tool needs another platform or a custom version.
Install guide
Keep the workspace stable
Use the clean import flow before a promising download turns into a platform cleanup project.
Open install guideEmail follow-up
Get updates if this tool changes
Use the email signup if you want future indicator and workflow updates without checking back manually.
Join updatesCustom NT8 work
Turn this into a custom NinjaTrader build
Use Moore Tech when the free indicator needs a private modification, NT8 repair, platform port, alert upgrade, or strategy version built around your exact rules.
Paid next step
Get the Daily Trading Plan PDF after the download
Use the $29.99 PDF when you want the key levels, scenarios, and invalidation points mapped before the session instead of building the day from scratch.
Daily Trading Plan PDF - $29.99Limitations
- It depends on markets and sessions where opening gaps are meaningful.
- Small gaps can create noise if the minimum threshold is too low.
- The indicator maps the gap but does not tell you whether it will fill.
Frequently asked questions
Does it repaint?
This indicator is designed as a chart reference tool, not as a hindsight-only backfitted signal. Even so, you should still test it bar by bar on your chart type to confirm how it behaves on the active bar.
Which platforms are covered?
NinjaTrader 8, TradeStation EasyLanguage, MultiCharts PowerLanguage, MetaTrader 4, MetaTrader 5, TradingView Pine Script are currently represented through downloads or source pages.
Is source code included?
Yes. This page includes source examples or links to platform-specific source pages where applicable.