OPEN-SOURCE SCRIPT

MTF Fair Value Gap Indicator ULTRA

已更新
FVG Fair Value Gap Indicator

FVG's commonly known as Fair Value Gaps are mostly in use for forex trading, however it’s been widely used in price action trading, even on regular large cap stocks. Think of it as an imbalance area where the price of the stock may actually be under/over valued due to many orders being injected in a short amount of time, ie . a gap caused by an impulse created by the speed of the price movement. In essence, the FVG can become a kind of magnet drawing the price back to that level to attempt to balance out the orders (when? we don't know). Please do research to understand the concept of FVG's.

You can look for an opportunity as price approaches the FVG for entry either long/short because after all, it is an "Area of Interest" so the price will either bounce or blow through the area. No indicator works 100% of the time so take in context as just another indicator. It tends work on larger time frames best.

IMPORTANT TV RELATED LIMITATIONS: You should take the time to understand the following. A MAXIMUM of 500 boxes and labels are allowed, thus if you elect to display many different time frames of FVGs and/or select to not auto delete old Daily FVGs, the oldest FVGs will be deleted and not be seen. Additionally if you are on a smaller chart time frame (1 min), you may not see older FVGs such as Daily ones that occurred and still exist from long ago. This is due to TV limitation of 20,000 candles of history in each chart timeframe. Example: A 1 minute chart supports approximately 14 days worth of data so looking for Daily FVGs would only go back that far, whereas if your chart was set to 5 minutes you'd be able to see 5 times as many, ie . 60 days worth of Daily FVG's. Obviously setting your chart and looking for Daily FVG's would support up to 20,000 days worth.

The Indicator Provides many different features:

*Creation of FVG's for all hours or just during market hours. Currently you can enable FVG’s for the following timeframes: Current chart timeframe, 5Min, 10Min, 15Min, 1Hr, 4Hr, 8Hr, Daily, Weekly, Monthly.

*Text label displays overlaying FVG bands including creation timestamps.

* Bands reflecting FVG's in action (created/deleted) for the current chart time frame, 15min, 1hr, 4hr, 8hr and daily time frames. The FVG's will be overlayed on the chart if enabled.

*Mitigation Action - Normal - When FVG is balanced out by price action, the FVG will disappear. Dynamic - The FVG band will decrease as the price movement eats into it thus only showing the remaining imbalance. None - For those that wish to retain FVG's even if they were mitigated. Half - FVG’s disappear when the price intrudes 50% of the overall FVG band zone.

*Mitigation Type - The elimination or balancing of the FVG is caused by either the candle wick or body passing completely through the FVG.

*Maximum FVGs - A maximum number of FVGs are created for each different enabled time frame (be aware setting a large number could impact system performance).

*All FVG band colors can be customized by the user.

* All FVG bands auto extend to the right.

* Intrusion Alerts - Trading View alerts are supported. You can use the indicator settings to enable an alert if the price intrudes into the FVG zone by a certain percentage. This is not related to mitigation or removal of the FVG, just a warning that price has reached the area of interest.
發布通知
Updated to provide more accurate price incursion into enabled FVG timeframe bands and also correct actual incursion alert reporting.

Again, incursion means the price enters an FVG area (band). Before setting any alert for this, make sure you go to the indicator settings and select the amount (percentage) of penetration of the price into the FVG band that you desire. Incursion alerts are unique so be sure you go to the chart settings and select to set Add an Alert and this indicator name in the Condition Box. Then select "Any alert() function call and press the Create button.

This is different than setting an alert for the creation of a new FVG for the enabled timeframes. For that type of alert (less commonly used), you perform the same steps as above but do NOT select "Any alert()", instead click the drop down arrow and choose either "Bear FVG Creation", "Both Bull or Bear FVG Creations" or "Bull FVG creation" and the press the Create button.

Updated to provide support for requested 30 minute timeframe.

Logic for FVG creation changed to provide more confirmation before creation. This is more in line with the actual definition of an FVG creation instead of displaying a FVG band that may change one candle too early and then disappear.
發布通知
Fixed bug causing occasional duplicate FVG creation.

Added tips for Incursion Alerts, see indicator settings information icon for that area.

Don't forget you can change the FVG fill colors to be more transparent if your chart gets too busy.

This may do it for this indicator as things are pretty busy for me for some time to come. However, if something serious comes up, please let me know.

Thanks to all for the support!
發布通知
Final Corrections, bug causing FVG creation alerts not to work. Fixed. Thanks to Kell81 for pointing it out.
發布通知
v 1.14 06/23/2023 Update required. PineScript changed and broke indicator request.security area, rewrote some lines near end of script to request timeframe high,low etc. differently.
Also implemented 12hr fvg support.
發布通知
IMPORTANT NOTE: Apparently pinescript server platform has been changed to enforce a memory limitation during Replay Mode that didn't used to be there. I've found no way yet around this so this indicator "as is" will not work in the Replay Stepping mode.

Added requested feature option to have fvg boxes display on right side of chart with adjustable widths.
Added requested feature to only draw discovered FVG's that have a height greater than a user input minimum PIP value 0.0001 x user input. ie. don't show FVG's that have a tiny height
Changed UI to attempt better performance for replay mode. However, still getting exceeding max memory error after server platform changes, added warning message to user on settings page top area about this.
發布通知
Fix Bug related to max number of FVG's per timeframe enabled.
Added feature "View Only Last x number of Fvgs" (see settings panel) for short term traders/scalpers.
發布通知

  1. Hopefully final version except for addressing any reported bugs. My time has become much more limited to continue advancing this indicator.
  2. Revamped code to allow replay mode to run without max memory exceeded error (hopefully).
  3. Revamp of Menu settings.
  4. You now have six possible timeframes to set for fvg creations.
  5. Timeframe ranges have expanded and you can set to other timeframes rather than just those provided before.
  6. You can set different fill colors for each timeframe now.
  7. Added option to show only last “x” number of fvgs for each time frame. “View Only Last x Number of Fvgs”.
  8. Added option to display abbreviated fvg boxes showing them on right side of chart along with a width input. “Show FVGs on Right => Box Width”.
  9. You can now enable a mid line to be drawn on each fvg box along with a thickness, style and colors (bull/bear).
  10. Added a simple average true range formula for a “Momentum Filter”. This was added to allow only stronger price movements during an fvg creation to be shown. ie. it prevents smaller fvgs from being drawn. The larger the factor input the more momentum is required to draw an fvg. Number of bars for the formula can be adjusted as a Length field as well.
  11. Can now enable a minimum number of pips for the price movement during the fvg detection such that it must be at least that number of pips for the fvg to be drawn.
  12. Confirm mitigation of fvgs can be enabled to be delayed to the end of the current bar.
  13. Mitigation Actions have a new selected called “Touch”. When this option is selected, an existing fvg box will be mitigated (disappear) when the price touches either the top (for bullish fvg) or bottom (for bearish fvg).

發布通知
Cosmetic correction to last release.
發布通知
Obviously not final version, this release is a bug fix for wrong timeframe labels on fvgs being displayed, had forgotten to incorporate fix code in previous release.
發布通知
Mitigation bug fixes
New at bottom of settings, option to show mitigated fair value gap boxes for a user defined number of candles before they are removed.
發布通知
Add requested option to Mitigation section of settings "Use Timeframes" that allows user ot enable mitigation of fvg's whereby instead of using the current charts timeframe as the source price for mitigation of all enabled fvg timeframes, instead mitigation will use the associated time frame of each fvg (close) to determine the mitigation of fvg's. ie. if chart is on 5min timeframe and 1hr fvg timeframe enabled, an fvg only mitigated if price action from 1hr meets the criteria instead of the price action from the 5min chart itself.
發布通知
Oops, reset default of new setting mitigation "Use Timeframes" to OFF.
發布通知
Last minute update.
Bands and ChannelsCandlestick analysisfairvaluegapfvgmulti-timeframemultitimeframe

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明