Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 20:37:32 +0000



[User Discussion] - Fair Value Gap indicator

View Count: 13278

[2022-11-08 15:39:29]
User641398 - Posts: 19
exactly.
[2022-12-06 18:38:35]
User467500 - Posts: 26
is there a possibility of adding the timeframe in text form into to the drawn gaps? this is so that when we project the gapd onto another chart with a different timeframe, we can get even further insight. thanks
[2022-12-17 16:46:02]
User484554 - Posts: 3
Do you understand price imbalances, single prints and the difference between them? If you do you'll realise that is what the fellow is trying to describe but wants to sound like he invented something new so gives what has always been around a "new name"
[2022-12-17 16:53:55]
SabikiSensei - Posts: 74
that's cool bro i'll keep calling them FVG
[2022-12-19 23:33:27]
al-right - Posts: 24
Hello guys. I just saw this thread but it looks like the FVG shared above is not available anymore. Can anyone who managed to download it post it here again please? Thank you
[2022-12-20 09:50:52]
al-right - Posts: 24
Lovely. Thank you very much
[2022-12-22 14:45:31]
al-right - Posts: 24
@GC150
Hello again. I'm experiencing the problem as in the pic https://www.sierrachart.com/image.php?Image=1671720187826.png
The rectangle marked by the arrow should not show as the gap was filled already (all settings are default). Any suggestions? Thank you.
[2023-02-08 00:24:56]
User585104 - Posts: 115
Hello,

is there a way to create an alert when an FVG forms?

Thanks
[2023-02-27 19:32:58]
User573977 - Posts: 8
Hello everyone
I am new here.
This is the most used FVG script on TradingView. It is in the "Edito's Pick" list of TradingView.
It is open source.
https://www.tradingview.com/script/erbzoVY8-Fair-Value-Gap/

Hope it helps!




// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © spacemanbtc

//@version=5
indicator("Fair Value Gap",shorttitle= "Fair Value Gap SpaceManBTC", overlay = true, max_boxes_count = 500, max_lines_count = 500, max_labels_count = 500)



//Fair Value Gap
//V1, 2022.4.12

//This indicator displays the fair value gap of the current timeframe AND an optional higher time frame.

//What the script does is take into account the values of the current bar high/low and compare with 2 bars previous
//The "gap" is generated from the lack of overlap between these bars
//Bearish or Bullish gaps determined via whether the gap is above or below price, as they tend to be filled gaps can be used as targets.


// ———————————————————— Inputs {

// Standard practice declared input variables with i_ easier to identify
i_tf = input.timeframe("D", "MTF Timeframe", group = "MTF Settings")
i_mtf = input.string(defval = "Current TF",group = "MTF Settings", title = "MTF Options", options = ["Current TF", "Current + HTF", "HTF"])
i_tfos = input.int(defval = 10,title = "Offset", minval = 0, maxval = 500 ,group = "MTF Settings", inline = "OS")
i_mtfos = input.int(defval = 20,title = "MTF Offset", minval = 0, maxval = 500 ,group = "MTF Settings", inline = "OS")
i_fillByMid = input.bool(false, "MidPoint Fill",group = "General Settings", tooltip = "When enabled FVG is filled when midpoint is tested")
i_deleteonfill = input.bool(true, "Delete Old On Fill",group = "General Settings")
i_labeltf = input.bool(true,"Label FVG Timeframe",group = "General Settings")


i_bullishfvgcolor = input.color(color.new(color.green,90), "Bullish FVG", group = "Coloring", inline = "BLFVG")
i_mtfbullishfvgcolor = input.color(color.new(color.lime,80), "MTF Bullish FVG", group = "Coloring", inline = "BLFVG")
i_bearishfvgcolor = input.color(color.new(color.red,90), "Bearish FVG", group = "Coloring", inline = "BRFVG")
i_mtfbearishfvgcolor = input.color(color.new(color.maroon,80), "MTF Bearish FVG", group = "Coloring", inline = "BRFVG")
i_midPointColor = input.color(color.new(color.white,85), "MidPoint Color", group = "Coloring")
i_textColor = input.color(color.white, "Text Color", group = "Coloring")

// }

// ———————————————————— Global data {
//Using current bar data for HTF highs and lows instead of security to prevent future leaking
var htfH = open
var htfL = open

if close > htfH
htfH:= close
if close < htfL
htfL := close


//Security Data, used for HTF Bar Data reference


sClose = request.security(syminfo.tickerid, i_tf, close[1], barmerge.gaps_off, barmerge.lookahead_on)
sHighP2 = request.security(syminfo.tickerid, i_tf, high[2], barmerge.gaps_off, barmerge.lookahead_on)
sLowP2 = request.security(syminfo.tickerid, i_tf, low[2], barmerge.gaps_off, barmerge.lookahead_on)
sOpen = request.security(syminfo.tickerid, i_tf, open[1], barmerge.gaps_off, barmerge.lookahead_on)
sBar = request.security(syminfo.tickerid, i_tf, bar_index, barmerge.gaps_off, barmerge.lookahead_on)


// }




//var keyword can be used to hold data in memory, with pinescript all data is lost including variables unless the var keyword is used to preserve this data
var bullishgapholder = array.new_box(0)
var bearishgapholder = array.new_box(0)
var bullishmidholder = array.new_line(0)
var bearishmidholder = array.new_line(0)
var bullishlabelholder = array.new_label(0)
var bearishlabelholder = array.new_label(0)
var transparentcolor = color.new(color.white,100)



// ———————————————————— Functions {

//function paramaters best declared with '_' this helps defer from variables in the function scope declaration and elsewhere e.g. close => _close
f_gapCreation(_upperlimit,_lowerlimit,_midlimit,_bar,_boxholder,_midholder,_labelholder,_boxcolor,_mtfboxcolor, _htf)=>
timeholder = str.tostring(i_tf)
offset = i_mtfos
boxbgcolor = _mtfboxcolor
if _htf == false
timeholder := str.tostring(timeframe.period)
offset := i_tfos
boxbgcolor := _boxcolor
array.push(_boxholder,box.new(_bar,_upperlimit,_bar+1,_lowerlimit,border_color=transparentcolor,bgcolor = boxbgcolor, extend = extend.right))
if i_fillByMid
array.push(_midholder,line.new(_bar,_midlimit,_bar+1,_midlimit,color = i_midPointColor, extend = extend.right))
if i_labeltf



array.push(_labelholder,label.new(_bar+ offset,_midlimit * 0.999, text = timeholder + " FVG", style =label.style_none, size = size.normal, textcolor = i_textColor))

//checks for gap between current candle and 2 previous candle e.g. low of current candle and high of the candle before last, this is the fair value gap.
f_gapLogic(_close,_high,_highp2,_low,_lowp2,_open,_bar,_htf)=>

if _open > _close

if _high - _lowp2 < 0

upperlimit = _close - (_close - _lowp2 )
lowerlimit = _close - (_close-_high)
midlimit = (upperlimit + lowerlimit) / 2
f_gapCreation(upperlimit,lowerlimit,midlimit,_bar,bullishgapholder,bullishmidholder,bullishlabelholder,i_bullishfvgcolor,i_mtfbullishfvgcolor,_htf)

else

if _low - _highp2 > 0
upperlimit = _close - (_close-_low)
lowerlimit = _close- (_close - _highp2),
midlimit = (upperlimit + lowerlimit) / 2
f_gapCreation(upperlimit,lowerlimit,midlimit,_bar,bearishgapholder,bearishmidholder,bearishlabelholder,i_bearishfvgcolor,i_mtfbearishfvgcolor,_htf)



//Used to remove the gap from its relevant array as a result of it being filled.
f_gapDeletion(_currentgap,_i,_boxholder,_midholder,_labelholder)=>

array.remove(_boxholder,_i)
if i_fillByMid
currentmid=array.get(_midholder,_i)
array.remove(_midholder,_i)

if i_deleteonfill
line.delete(currentmid)
else
line.set_extend(currentmid, extend.none)
line.set_x2(currentmid,bar_index)
if i_deleteonfill
box.delete(_currentgap)


else
box.set_extend(_currentgap,extend.none)
box.set_right(_currentgap,bar_index)
if i_labeltf
currentlabel=array.get(_labelholder,_i)
array.remove(_labelholder,_i)
if i_deleteonfill
label.delete(currentlabel)


//checks if gap has been filled either by 0.5 fill (i_fillByMid) or SHRINKS the gap to reflect the true value gap left.
f_gapCheck(_high,_low)=>

if array.size(bullishgapholder) > 0

for i = array.size(bullishgapholder)-1 to 0
currentgap = array.get(bullishgapholder,i)
currenttop = box.get_top(currentgap)
if i_fillByMid
currentmid = array.get(bullishmidholder,i)
currenttop := line.get_y1(currentmid)


if _high >= currenttop
f_gapDeletion(currentgap,i,bullishgapholder,bullishmidholder,bullishlabelholder)
if _high > box.get_bottom(currentgap) and _high < box.get_top(currentgap)

box.set_bottom(currentgap,_high)

if array.size(bearishgapholder) > 0

for i = array.size(bearishgapholder)-1 to 0
currentgap = array.get(bearishgapholder,i)
currentbottom = box.get_bottom(currentgap)
if i_fillByMid
currentmid = array.get(bearishmidholder,i)
currentbottom := line.get_y1(currentmid)
if _low <= currentbottom
f_gapDeletion(currentgap,i,bearishgapholder,bearishmidholder,bearishlabelholder)

if _low < box.get_top(currentgap) and _low > box.get_bottom(currentgap)

box.set_top(currentgap,_low)


// pine provided function to determine a new bar
is_newbar(res) =>
t = time(res)
not na(t) and (na(t[1]) or t > t[1])

if is_newbar(i_tf)
htfH := open
htfL := open

// }



// User Input, allow MTF data calculations
if is_newbar(i_tf) and (i_mtf == "Current + HTF" or i_mtf == "HTF")
f_gapLogic(sClose,htfH,sHighP2,htfL,sLowP2,sOpen,bar_index,true)

// Use current Timeframe data to provide gap logic
if (i_mtf == "Current + HTF" or i_mtf == "Current TF")
f_gapLogic(close[1],high,high[2],low,low[2],open[1],bar_index,false)

f_gapCheck(high,low)



[2023-02-28 01:51:30]
User897008 - Posts: 48
gc5150 on github and twitter all disappeared. Incredible!
[2023-02-28 11:37:52]
User573977 - Posts: 8
Yeah, what a pity! If somebody can share his study about FVG please, the link he published doesn't work.
There was another one too, super cool, about Forex Factory Calendar, would be appreciate it too if you can share it.
[2023-02-28 11:52:23]
al-right - Posts: 24
I hope I'm not breaking any rule by making available the FVG study I managed to get previously. It includes the FF calendary as well. Uploaded here https://mega.nz/file/zlpWXZZa#MM8TQFPb4UyNDvRie4elSPOnTGf4z5cturuz96TeFcE
Date Time Of Last Edit: 2023-02-28 11:57:45
[2023-03-01 04:52:06]
User90125 - Posts: 715
Is the .cpp source code available for this?
[2023-03-01 08:43:17]
al-right - Posts: 24
Is the .cpp source code available for this?
As for me, I shared all I have, I'm afraid.
[2023-04-11 11:51:25]
divinasion - Posts: 6
al-right, thank you so much. 😊
It was really uncalled for to just remove the links from every source like that. I don't know what would possess someone to make such a decision.
[2023-04-11 12:06:17]
divinasion - Posts: 6
Do you understand price imbalances, single prints and the difference between them? If you do you'll realise that is what the fellow is trying to describe but wants to sound like he invented something new so gives what has always been around a "new name"

Do you understand that FVGs are actually different from SPs and imbalances because they are revisited and hold as support/resistance even weeks later despite price having already filled them? Do you know that wicks can also count as fair value gaps? Is that also ancient knowledge that ICT slapped a new name on?

Sounds like you want to sound smart by disparaging a good man and his work that you know little about.😕
Date Time Of Last Edit: 2023-04-11 19:38:07
[2023-04-11 12:10:24]
gcUserStudies - Posts: 91
Here are all of the source files. They have been provided to Sierra chart in hopes they are eventually included in the default user studies.
attachmentsierrachart-master.zip - Attached On 2023-04-11 12:09:29 UTC - Size: 586.73 KB - 296 views
[2023-04-16 01:36:18]
User708541 - Posts: 56
Is there a trick to getting the FVG's to show up on small time frames? They show up fine on a Daily chart but anything smaller than that, they don't show up (for me). Thanks for any assistance.
I figured it out. I was looking at a portion of the chart that exceeded the look back period of the indicator. FVG's are showing up.
Date Time Of Last Edit: 2023-04-16 01:57:03
[2023-04-26 21:00:41]
gcUserStudies - Posts: 91

Here are all of the source files. They have been provided to Sierra chart in hopes they are eventually included in the default user studies.

Not sure if/when this may happen. Trying to fix the rug pull I did. So set crap back up. Anyway, apologize. Please don't ask :) Life just sucks sometimes and you do rash things. Had to rename some junk since all was nuked before. But all should be the same other than name adjustments. Will update and add to if/when I can.


https://gcuserstudies.github.io
[2023-05-05 13:37:55]
gabetradesoil - Posts: 1
Has anyone tried this new link? I scanned it and one of them said Malicious (moderate Confidence). so not sure if it legit
[2023-05-05 15:11:59]
gcUserStudies - Posts: 91

Has anyone tried this new link? I scanned it and one of them said Malicious (moderate Confidence). so not sure if it legit

I can't get this to go away. It's listed as moderate confidence for one of the 69 (or 70?) tests. I've scanned it locally and can't find any issues. If anyone else has an alterative they can list besides virus total I would be glad to have it checked elsewhere.
[2023-05-05 15:43:16]
gcUserStudies - Posts: 91
You can also just use the previous version as there have been no changes to the gap study since. It passes 100%.
[2023-05-05 15:48:12]
al-right - Posts: 24
If that's any use, I just checked it out with Norton 360 and no problems were found.
[2023-05-08 18:08:39]
divinasion - Posts: 6
Thanks for re-sharing. Life can be very tough. I downloaded the file "sierrachart-master.zip" - it had all the custom studies in and rest assured, no viruses AFAIK :)
[2023-05-16 00:54:03]
awakef - Posts: 53
gcUserStudies Can you add a setting to filter when the fair value gap has been filled?

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account