Home / Settings
SettingsFVG indicator settings, input by input
The table below is the list of inputs in fvg.pine and fvg.mq5. A test in this repository checks that the names match the source files.
Source provided, not yet tested on a platform. Nobody has compiled or run this code on TradingView or in MetaTrader 5. It was written to follow the rule on this site line by line, and a test in this repository checks its inputs and its comparisons as text. That is not the same as running it. Do not trade on it before you have tested it yourself on a demo or on history.
| Input | Type | Default | Pine | MQL5 | What it does |
|---|---|---|---|---|---|
| minSize | float | 0.0 | yes | yes | Gaps whose height (top minus bottom) is below this are ignored. In price units, not pips. 0 applies the plain rule. |
| lookback | int | 300 | yes | yes | Only gaps whose candle 3 is within this many bars of the last bar are drawn. |
| showFilled | bool | true | yes | yes | On: a filled gap stays drawn and its box stops at the bar that filled it. Off: a filled gap is not shown. |
| extendOpen | bool | true | yes | yes | On: a gap that is not filled keeps growing to the right, to the last closed bar. Off: its box covers candles 1 to 3 only. |
| bullColor | color | blue (20% opaque in Pine) | yes | yes | Colour of bullish gap boxes. |
| bearColor | color | red (20% opaque in Pine) | yes | yes | Colour of bearish gap boxes. |
| alertOnNew | bool | false | no | yes | MQL5 only. Raises a terminal alert when a gap is completed by the last closed bar. In Pine the same job is done by two alertcondition lines you switch on from TradingView's alert dialog. |
minSize
The height of a gap is its top minus its bottom, in price units. A gap is kept when its height is at least minSize. On a pair quoted to five decimals, 0.0001 is one pip. A good value depends on the market and the timeframe, and these pages give no recommended value. The home page's slider uses a share of the sample window's average candle range instead, so you can see the count change. That is a demonstration, not an input of either file.
lookback
It limits how far back gaps are drawn. In Pine, a gap is drawn only if candle 3 is within lookback bars of the last bar when the script runs over it. Boxes already drawn stay until TradingView's limit of 500 boxes removes the oldest. In MQL5 the pass runs again on every new bar and deletes everything first, so a gap that has fallen outside the range disappears.
showFilled and extendOpen
A gap is filled when a later closed bar trades through its far edge: for a bullish gap its low is at or below the bottom, for a bearish gap its high is at or above the top. A bar that only trades back into the gap does not fill it. With showFilled on, the filled box is kept and ends at the bar that filled it. With it off, the box is removed (Pine) or not drawn (MQL5). With extendOpen on, a box that is not filled runs to the last closed bar; with it off, it covers candles 1 to 3 only.
Colours and alerts
In Pine the default colours carry 80 percent transparency. In MQL5 the colour is solid and the rectangle is drawn behind the candles. alertOnNew exists only in the MQL5 file. The Pine file has two alertcondition lines instead, which you switch on from TradingView's alert dialog. See alerts.
What is not a setting
- The rule itself: wicks only, strict comparison, three candles.
- Which fill rule is used. There is one, the far edge. Other definitions exist, and where an educator or another indicator differs, that is a difference of definition and not of correctness.
- Whether a gap is "touched". The browser detector reports it; the indicator files do not draw it.
You can try the rule and a minimum size on real candles in the browser detector.