JSParticipant
Master
//@version=5
//indicator("Fair Value Gap (FVG)", overlay=true)
// Parameters
fvgLookback = 2//input.int(1, title="Lookback (candle before and after)", minval=1)
// Données des bougies
prevHigh = high[fvgLookback]
prevLow = low[fvgLookback]
nextHigh = high[0]
nextLow = low[0]
// Calcul du FVG
bullishFVG = low > prevHigh
bearishFVG = high < prevLow
// Affichage des FVGs
If bullishFVG then
DrawRectangle((BarIndex-fvgLookback),prevHigh,BarIndex,low)Coloured("Green",255)FillColor(0,50,0)
Median=prevHigh+(Low-prevHigh)/2
DrawSegment(BarIndex-fvgLookback,Median,BarIndex,Median)Coloured("Green")
DrawText("#Median#",BarIndex-1,Median,SansSerif,Bold,16)Coloured("Yellow")
EndIf
If bearishFVG then
DrawRectangle(BarIndex,High,(BarIndex-fvgLookback),prevLow)Coloured("Red",255)FillColor(50,0,0)
Median=High+(prevLow-High)/2
DrawSegment(BarIndex-fvgLookback,Median,BarIndex,Median)Coloured("Red")
DrawText("#Median#",BarIndex-1,Median,SansSerif,Bold,16)Coloured("Yellow")
EndIf
Return
voila ça donne ça.
//@version=5
//indicator(“Fair Value Gap (FVG)”, overlay=true)
// Parameters
fvgLookback = 2//input.int(1, title=”Lookback (candle before and after)”, minval=1)
// Données des bougies
prevHigh = high[fvgLookback]
prevLow = low[fvgLookback]
nextHigh = high[0]
nextLow = low[0]
// Calcul du FVG
bullishFVG = low > prevHigh
bearishFVG = high < prevLow
// Affichage des FVGs
If bullishFVG then
DrawRectangle((BarIndex-fvgLookback),prevHigh,BarIndex,low)Coloured(“YELLOW”,255)FillColor(0,0,250)
Median=prevHigh+(Low-prevHigh)/2
DrawSegment(BarIndex-fvgLookback,Median,BarIndex,Median)Coloured(“BLACK”)
DrawText(“#Median#”,BarIndex-1,Median,dialog,bold,15)
EndIf
If bearishFVG then
DrawRectangle(BarIndex,High,(BarIndex-fvgLookback),prevLow)Coloured(“YELLOW”,255)FillColor(0,0,250)
Median=High+(prevLow-High)/2
DrawSegment(BarIndex-fvgLookback,Median,BarIndex,Median)Coloured(“BLACK”)
DrawText(“#Median#”,BarIndex-1,Median,dialog,bold,15)
EndIf
Return
Pour completer , l idée serait en effet de faire une extension à droite pour les 50% de FVG qui n’ont pas été atteint. Dés que le niveaux est touché , il faudrait que le trait disparaisse.
JSParticipant
Master
Ce sera difficile, alors vous devrez travailler avec des « arrays »…
Malheureusement, les « arrays » ne sont pas pour moi…
Voici un itf qui trace des traits vers la droite sur chaque 50% de bougies non retracées. Dés que le cours revient sur ce prix, le trait disparait. C’est possible de s’en inspirer pour l’ ITF du FVG
defparam drawonlastbaronly=true
Mid=low+(High-low)/2
if(islastbarupdate) then
lo=low[0]
hi=high[0]
for i=1 to 1000
if (Mid[i]>hi or Mid[i]<lo) then
DRAWRAY(barindex-i, Mid[i], barindex+5, Mid[i]) coloured(0,250,250)style(line, 2)
endif
lo=min(lo,low[i])
hi=max(hi,high[i])
next
endif
return Mid
JSParticipant
Master
Je m’y intéresserai demain…
sur le NQ visualisation des TP =50% de FVG
JSParticipant
Master
Ce que vous voulez comme dernière option n’est pas possible sans utiliser des « arrays »…