Bonjour à tous,
J’essaie en vain de coder un FGV sur 3 bougies et de me les afficher tous tant qu’ils ne sont pas comblés.
J’ai de code qui ne m’affiche rien du tout :
// ———- Paramètres ———-
MinGapPts = 1
ExtendBars = 30 // si ExtendUntilFill = 0
ExtendUntilFill = 1 // 1 = rectangle disparaît quand comblé
minGap = MinGapPts * pointsize
// ———- Etats persistants ———-
ONCE bullActive = 0
ONCE bearActive = 0
ONCE bullTop = 0.0
ONCE bullBot = 0.0
ONCE bearTop = 0.0
ONCE bearBot = 0.0
ONCE bullStart = 0
ONCE bearStart = 0
// ———- Détection ———-
bullCond = (low > high[2]) AND (low – high[2] >= minGap)
bearCond = (high < low[2]) AND (low[2] – high >= minGap)
IF bullCond THEN
bullTop = high[2] // haut du rectangle = high de la 1ère bougie
bullBot = low[0] // bas du rectangle = low de la 3ème bougie
bullStart = barindex
bullActive = 1
ENDIF
IF bearCond THEN
bearTop = high[0] // haut du rectangle = high de la 3ème bougie
bearBot = low[2] // bas du rectangle = low de la 1ère bougie
bearStart = barindex
bearActive = 1
ENDIF
// ———- Gestion persistance ———-
IF ExtendUntilFill = 1 THEN
IF bullActive = 1 AND low <= bullBot THEN
bullActive = 0
ENDIF
IF bearActive = 1 AND high >= bearTop THEN
bearActive = 0
ENDIF
ENDIF
// ———- Dessin ———-
IF bullActive = 1 THEN
bullEnd = barindex
IF ExtendUntilFill = 0 THEN
bullEnd = bullStart + ExtendBars
IF barindex > bullEnd THEN
bullActive = 0
ENDIF
ENDIF
IF bullEnd <= bullStart THEN
bullEnd = bullStart + 1
ENDIF
DRAWRECTANGLE(bullStart, bullTop, bullEnd, bullBot) COLOURED(0,180,0,60)
ENDIF
IF bearActive = 1 THEN
bearEnd = barindex
IF ExtendUntilFill = 0 THEN
bearEnd = bearStart + ExtendBars
IF barindex > bearEnd THEN
bearActive = 0
ENDIF
ENDIF
IF bearEnd <= bearStart THEN
bearEnd = bearStart + 1
ENDIF
DRAWRECTANGLE(bearStart, bearTop, bearEnd, bearBot) COLOURED(220,0,0,60)
ENDIF
// ———- Séries pour RETURN ———-
bullTopPlot = undefined
bullBotPlot = undefined
bearTopPlot = undefined
bearBotPlot = undefined
IF bullActive = 1 THEN
bullTopPlot = bullTop
bullBotPlot = bullBot
ENDIF
IF bearActive = 1 THEN
bearTopPlot = bearTop
bearBotPlot = bearBot
ENDIF
RETURN bullTopPlot AS “FVG+ Haut”, bullBotPlot AS “FVG+ Bas”, bearTopPlot AS “FVG- Haut”, bearBotPlot AS “FVG- Bas”
Avez-vous une idée ?
Merci par avance,
Bien Cordialement,