Guten Morgen,
ich reiche noch die getestete Final-Version ergänzt um den DisplayMod nach:
DisplayMod 1 = nur offene Gaps
DisplayMod 2 = geschlossene Gaps
DisplayMod 3 = offene und geschlossene Gaps
Die übrigen Variablen sind ja ohnehin selbsterklärend, dennoch der Hinweis, das ggf. bei TimeFrame-Änderung die Uhrzeiten logischer Weise anglichen werden müssen, denn z.B. im 1 Hour TimeFrame kann natürlich kein Barindex mit 173000 gefunden werden….usw.
Ich denke, dass es eher ein Tool, als Indikator ist und daher wohl nicht so recht in die Library passt.
Schönen erfolgreichen Tag und GESUNDHEIT!
Liebe Grüße
Rainer
// Rainer-Franz Wirth Rainer FW(RFW) @ prorealcode.com
//********************************************************************************************************************************************************************
Defparam Drawonlastbaronly = True
Defparam Calculateonlastbars = 3000
//********************************************************************************************************************************************************************
//LookBack = 3000
//MinGap = 10
GFCT = DayCloseTime // 173000
GFOT = DayOpenTime // 90000
//********************************************************************************************************************************************************************
For FOS = 0 To 20 Do
If Time[FOS] = GFOT Then
LOX = Barindex[FOS]
LOXC = Open[FOS]
Break
EndIf
Next
LBI = Barindex-LOX[FOS] // Last Open
//********************************************************************************************************************************************************************
If IsLastBarupdate Then
For LBX1 = LookBack DownTo LBI+1 Do
If Time[LBX1] = GFCT Then
CloseBarX = Barindex[LBX1]
ClosePrice = Close[LBX1]
If CloseBarX > 0 Then
For LBX2 = LBX1-1 DownTo LBI Do
If Time[LBX2] = GFOT Then
OpenBarX = Barindex[LBX2]
OpenPrice = Open[LBX2]
Break
EndIf
Next
EndIf
If ((OpenPrice - ClosePrice) > MinGap*PointSize) Then
UpGap = 1
For UpGapCSx = Max(1,(LBX2-1)) DownTo 0 Do
If Low[UpGapCSx]-Spread*PointSize =< ClosePrice Then
UpGapCloseX = BarIndex[UpGapCSx]
UpGap = 2
Break
EndIf
Next
If UpGap = 2 Then
If (DisplayMod = 2) Or (DisplayMod = 3) Then
DRAWPOINT(CloseBarX,ClosePrice,2)Coloured(255,255,0)Bordercolor(255,255,0)
DRAWPOINT(OpenBarX,OpenPrice,2)Coloured(0,255,255)Bordercolor(0,255,255)
DRAWSEGMENT(OpenBarX, ClosePrice, OpenBarX, OpenPrice)Coloured(255,0,0)Style(Line,2)
DRAWSEGMENT(CloseBarX, ClosePrice, OpenBarX, ClosePrice)Coloured(255,0,0)Style(Line,2)
DRAWPOINT(UpGapCloseX,ClosePrice,2)Coloured(255,0,0)Bordercolor(255,0,0)
DRAWSEGMENT(OpenBarX, ClosePrice, UpGapCloseX, ClosePrice)Coloured(255,0,0)Style(Line,2)
EndIf
EndIf
If UpGap = 1 Then
If (DisplayMod = 1) Or (DisplayMod = 3) Then
DRAWPOINT(CloseBarX,ClosePrice,2)Coloured(255,255,0)Bordercolor(255,255,0)
DRAWPOINT(OpenBarX,OpenPrice,2)Coloured(0,255,255)Bordercolor(0,255,255)
DRAWSEGMENT(OpenBarX, ClosePrice, OpenBarX, OpenPrice)Coloured(255,0,0)Style(Line,2)
DRAWSEGMENT(CloseBarX, ClosePrice, OpenBarX, ClosePrice)Coloured(255,0,0)Style(Line,2)
DRAWSEGMENT(OpenBarX, ClosePrice, BarIndex+5, ClosePrice)Coloured(255,0,0)Style(Dottedline,2)
EndIf
EndIf
EndIf
If ((ClosePrice - OpenPrice) > MinGap*PointSize) Then
DownGap = 1
For DownGapCSx = Max(1,(LBX2-1)) DownTo 0 Do
If High[DownGapCSx]+Spread*PointSize >= ClosePrice Then
DownGapCloseX = BarIndex[DownGapCSx]
DownGap = 2
Break
EndIf
Next
If DownGap = 2 Then
If (DisplayMod = 2) Or (DisplayMod = 3) Then
DRAWPOINT(CloseBarX,ClosePrice,2)Coloured(255,255,0)Bordercolor(255,255,0)
DRAWPOINT(OpenBarX,OpenPrice,2)Coloured(0,255,255)Bordercolor(0,255,255)
DRAWSEGMENT(OpenBarX, ClosePrice, OpenBarX, OpenPrice)Coloured(0,255,0)Style(Line,2)
DRAWSEGMENT(CloseBarX, ClosePrice, OpenBarX, ClosePrice)Coloured(0,255,0)Style(Line,2)
DRAWPOINT(DownGapCloseX,ClosePrice,2)Coloured(0,255,0)Bordercolor(0,255,0)
DRAWSEGMENT(OpenBarX, ClosePrice, DownGapCloseX, ClosePrice)Coloured(0,255,0)Style(Line,2)
EndIf
EndIf
If DownGap = 1 Then
If (DisplayMod = 1) Or (DisplayMod = 3) Then
DRAWPOINT(CloseBarX,ClosePrice,2)Coloured(255,255,0)Bordercolor(255,255,0)
DRAWPOINT(OpenBarX,OpenPrice,2)Coloured(0,255,255)Bordercolor(0,255,255)
DRAWSEGMENT(OpenBarX, ClosePrice, OpenBarX, OpenPrice)Coloured(0,255,0)Style(Line,2)
DRAWSEGMENT(CloseBarX, ClosePrice, OpenBarX, ClosePrice)Coloured(0,255,0)Style(Line,2)
DRAWSEGMENT(OpenBarX, ClosePrice, BarIndex+5, ClosePrice)Coloured(0,255,0)Style(Dottedline,2)
Endif
EndIf
Endif
Endif
Next
EndIf
Return