Créer une Alerte sur test IFVG

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #248317 quote
    Alai-n
    Participant
    Veteran

    Bonjour, comment serait-il possible de créer une alerte du type (+1/-1) lors du test du point médian de l’IFVG dans le code joint?

    Du genre low[1] <= MedianIFVG and high[1]>=MedianIFVG (OU) low[1] <= MedianIFVG and close[1]>MedianIFVG

    Merci

    defparam drawonlastbaronly=true
    //dispNum=7
    //atrMult=0.25
    //showbrokenFvg=0
    //-----------------------------------------------//
    // Atr calculation
    //-----------------------------------------------//
    if barindex<=200 and barindex>1 then
    atr=averagetruerange[barindex](close)*atrMult
    else
    atr=averagetruerange[200](close)*atrMult
    endif
    //-----------------------------------------------//
    // FVG Detection
    //-----------------------------------------------//
    fvgUp=low>high[2] and close[1]>high[2]
    fvgDown=high<low[2] and close[1]<low[2]
    ctop=max(close,open)
    cbot=min(close,open)
    
    if fvgUp and abs(low-high[2])>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high[2]
    $fvgMid[n+1]=(low+high[2])/2
    $fvgDir[n+1]=1
    $State[n+1]=0
    n=n+1
    endif
    
    if fvgDown and abs(low[2]-high)>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low[2]
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high
    $fvgMid[n+1]=(low[2]+high)/2
    $fvgDir[n+1]=-1
    $State[n+1]=0
    n=n+1
    endif
    
    if islastbarupdate then
    t1=0
    FOR i = n DOWNTO 0 DO
    t1=$fvgLeft[i]+1
    if t1<barindex then
    for j=barindex-t1 downto 0 do
    IF $fvgDir[i] = 1 AND cbot[j] < $fvgBot[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    IF $fvgDir[i] = -1 AND ctop[j] > $fvgTop[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    next
    endif
    NEXT
    count2=0
    t2=0
    for i=n downto 0 do
    t2=$invRight[i]+1
    if t2<barindex then
    for j=barindex-t2 downto 0 do
    if $fvgDir[i] = 1 and $State[i] = 1 and close[j] > $invTop[i] THEN
    if count2<dispNum and showbrokenFvg then
    drawrectangle($invLeft[i],$invTop[i],$invRight[i],$invBot[i])coloured("green",0)fillcolor("green",10)
    drawsegment($invRight[i],$invTop[i],barindex[j],$invTop[i])coloured("yellow",100)style(dottedline)
    endif
    count2=count2+1
    $State[i] = -1
    break
    endif
    if $fvgDir[i] = -1 and $State[i] = 1 and close[j] < $invBot[i] THEN
    if count2<dispNum and showbrokenFvg then
    drawrectangle($invLeft[i],$invTop[i],$invRight[i],$invBot[i])coloured("red",0)fillcolor("red",10)
    drawsegment($invRight[i],$invTop[i],barindex[j],$invTop[i])coloured("yellow",100)style(dottedline)
    endif
    count2=count2+1
    $State[i] = -1
    break
    endif
    next
    endif
    next
    
    count=0
    for i=n downto 0 do
    if $State[i] = 1 and count < dispNum then
    count=count+1
    if $fvgDir[i]=1 then
    //drawrectangle($invLeft[i],$invTop[i],$invRight[i],$invBot[i])coloured("green",0)fillcolor("green",50)
    drawrectangle($invRight[i],$invTop[i],barindex+10,$invBot[i])coloured("red",0)fillcolor("red",50)
    drawsegment($invLeft[i],($invBot[i]+$invTop[i])/2,barindex+10,($invBot[i]+$invTop[i])/2)coloured("white",150)style(dottedline3)
    
    elsif $fvgDir[i]=-1 then
    //drawrectangle($invLeft[i],$invTop[i],$invRight[i],$invBot[i])coloured("red",0)fillcolor("red",50)
    drawrectangle($invRight[i],$invTop[i],barindex+10,$invBot[i])coloured("green",0)fillcolor("green",50)
    drawsegment($invLeft[i],($invBot[i]+$invTop[i])/2,barindex+10,($invBot[i]+$invTop[i])/2)coloured("white",150)style(dottedline3)
    endif
    endif
    next
    
    endif
    
    //-----------------------------------------------//
    return
    #248403 quote
    Iván González
    Moderator
    Master

    Bonjour. Voici un exemple de screener.
    J’ai créé un niveau de référence et l’ai stocké dans un tableau.

    dispNum=7
    atrMult=0.25
    //-----------------------------------------------//
    // Atr calculation
    //-----------------------------------------------//
    if barindex<=200 and barindex>1 then
    atr=averagetruerange[barindex](close)*atrMult
    else
    atr=averagetruerange[200](close)*atrMult
    endif
    //-----------------------------------------------//
    // FVG Detection
    //-----------------------------------------------//
    fvgUp=low>high[2] and close[1]>high[2]
    fvgDown=high<low[2] and close[1]<low[2]
    ctop=max(close,open)
    cbot=min(close,open)
    // detectamos y almacenamos los fvg válidos alcistas
    if fvgUp and abs(low-high[2])>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high[2]
    $fvgMid[n+1]=(low+high[2])/2
    $fvgDir[n+1]=1
    $State[n+1]=0
    n=n+1
    endif
    // detectamos y almacenamos los fvg válidos bajistas
    if fvgDown and abs(low[2]-high)>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low[2]
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high
    $fvgMid[n+1]=(low[2]+high)/2
    $fvgDir[n+1]=-1
    $State[n+1]=0
    n=n+1
    endif
    
    if islastbarupdate then
    t1=0
    FOR i = n DOWNTO 0 DO
    t1=$fvgLeft[i]+1
    if t1<barindex then
    for j=barindex-t1 downto 0 do
    IF $fvgDir[i] = 1 AND cbot[j] < $fvgBot[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    IF $fvgDir[i] = -1 AND ctop[j] > $fvgTop[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    next
    endif
    NEXT
    count2=0
    t2=0
    for i=n downto 0 do
    t2=$invRight[i]+1
    if t2<barindex and $State[i] = 1 then
    for j=barindex-t2 downto 0 do
    if $fvgDir[i] = 1 and close[j] > $invTop[i] THEN
    count2=count2+1
    $State[i] = -1
    break
    endif
    if $fvgDir[i] = -1 and close[j] < $invBot[i] THEN
    count2=count2+1
    $State[i] = -1
    break
    endif
    next
    endif
    next
    count=0
    for i=n downto 0 do
    if $State[i] = 1 and count < dispNum then
    $levelPriceRef[count]=($invBot[i]+$invTop[i])/2
    $levelIdxRef[count]=$invRight[i]
    $DirRef[count]=$fvgDir[i]
    count=count+1
    endif
    next
    setup=0
    for i=count downto 0 do
    t3=$levelIdxRef[i]
    if t3<barindex then
    if high>$levelPriceRef[i] and low<$levelPriceRef[i] then
    setup=1
    dir=$DirRef[i]
    break
    endif
    endif
    next
    endif
    
    screener[setup ](dir)
    
    robertogozzi thanked this post
    #248425 quote
    Alai-n
    Participant
    Veteran

    Bonjour Iván

    Super le Screener, un outil vraiment très bien…!

    Mais ma demande initiale portait sur un déclenchement d’ALERTE SONORE (+1/-1) sur un Indicateur dans une fenêtre sous le prix comme sur la photo jointe. Je viens de tenter quelque chose en m’inspirant de ton Screener, mais le résultat n’est pas satisfaisant.

    Du coup si tu avais une idée?

    (Il s’agirait de déclencher sur le CLOSE[1], pour éviter de nombreux déclenchements d’ALERTE durant la vie de le bougie en cours)

    #248437 quote
    Iván González
    Moderator
    Master

    Vous pouvez utiliser cet indicateur pour détecter des signaux dans le prix :

    defparam drawonlastbaronly=true
    dispNum=7
    atrMult=0.25
    showbrokenFvg=0
    //-----------------------------------------------//
    // Atr calculation
    //-----------------------------------------------//
    if barindex<=200 and barindex>1 then
    atr=averagetruerange[barindex](close)*atrMult
    else
    atr=averagetruerange[200](close)*atrMult
    endif
    //-----------------------------------------------//
    // FVG Detection
    //-----------------------------------------------//
    fvgUp=low>high[2] and close[1]>high[2]
    fvgDown=high<low[2] and close[1]<low[2]
    ctop=max(close,open)
    cbot=min(close,open)
    
    if fvgUp and abs(low-high[2])>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high[2]
    $fvgMid[n+1]=(low+high[2])/2
    $fvgDir[n+1]=1
    $State[n+1]=0
    n=n+1
    endif
    
    if fvgDown and abs(low[2]-high)>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low[2]
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high
    $fvgMid[n+1]=(low[2]+high)/2
    $fvgDir[n+1]=-1
    $State[n+1]=0
    n=n+1
    endif
    
    if islastbarupdate then
    t1=0
    FOR i = n DOWNTO 0 DO
    t1=$fvgLeft[i]+1
    if t1<barindex then
    for j=barindex-t1 downto 0 do
    IF $fvgDir[i] = 1 AND cbot[j] < $fvgBot[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    IF $fvgDir[i] = -1 AND ctop[j] > $fvgTop[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    next
    endif
    NEXT
    count2=0
    t2=0
    for i=n downto 0 do
    t2=$invRight[i]+1
    if t2<barindex then
    for j=barindex-t2 downto 0 do
    if $fvgDir[i] = 1 and $State[i] = 1 and close[j] > $invTop[i] THEN
    count2=count2+1
    $State[i] = -1
    break
    endif
    if $fvgDir[i] = -1 and $State[i] = 1 and close[j] < $invBot[i] THEN
    count2=count2+1
    $State[i] = -1
    break
    endif
    next
    endif
    next
    
    count=0
    for i=n downto 0 do
    if $State[i] = 1 and count < dispNum then
    $levelPriceRef[count]=($invBot[i]+$invTop[i])/2
    $levelIdxRef[count]=$invRight[i]
    $DirRef[count]=$fvgDir[i]
    count=count+1
    endif
    next
    setup=0
    for i=count downto 0 do
    t3=$levelIdxRef[i]
    if t3<barindex then
    for j=barindex-(t3+1) downto 0 do
    if high[j]>$levelPriceRef[i] and low[j]<$levelPriceRef[i] and $DirRef[i]=1 then
    drawarrowdown(barindex[j],high[j])
    elsif high[j]>$levelPriceRef[i] and low[j]<$levelPriceRef[i] and $DirRef[i]=-1 then
    drawarrowup(barindex[j],low[j])
    endif
    next
    endif
    next
    endif
    
    //-----------------------------------------------//
    return

    Et celui-ci pour créer une variable de configuration. Le seul problème est que seul le dernier jour est calculé.

    defparam drawonlastbaronly=true
    dispNum=7
    atrMult=0.25
    showbrokenFvg=0
    //-----------------------------------------------//
    // Atr calculation
    //-----------------------------------------------//
    if barindex<=200 and barindex>1 then
    atr=averagetruerange[barindex](close)*atrMult
    else
    atr=averagetruerange[200](close)*atrMult
    endif
    //-----------------------------------------------//
    // FVG Detection
    //-----------------------------------------------//
    fvgUp=low>high[2] and close[1]>high[2]
    fvgDown=high<low[2] and close[1]<low[2]
    ctop=max(close,open)
    cbot=min(close,open)
    
    if fvgUp and abs(low-high[2])>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high[2]
    $fvgMid[n+1]=(low+high[2])/2
    $fvgDir[n+1]=1
    $State[n+1]=0
    n=n+1
    endif
    
    if fvgDown and abs(low[2]-high)>atr then
    $fvgLeft[n+1]=barindex[1]
    $fvgTop[n+1]=low[2]
    $fvgRight[n+1]=barindex
    $fvgBot[n+1]=high
    $fvgMid[n+1]=(low[2]+high)/2
    $fvgDir[n+1]=-1
    $State[n+1]=0
    n=n+1
    endif
    
    if islastbarupdate then
    t1=0
    FOR i = n DOWNTO 0 DO
    t1=$fvgLeft[i]+1
    if t1<barindex then
    for j=barindex-t1 downto 0 do
    IF $fvgDir[i] = 1 AND cbot[j] < $fvgBot[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    IF $fvgDir[i] = -1 AND ctop[j] > $fvgTop[i] THEN
    $invLeft[i] = $fvgLeft[i]
    $invTop[i] = $fvgTop[i]
    $invRight[i] = barindex[j]
    $invBot[i] = $fvgBot[i]
    $State[i] = 1
    break
    ENDIF
    next
    endif
    NEXT
    count2=0
    t2=0
    for i=n downto 0 do
    t2=$invRight[i]+1
    if t2<barindex then
    for j=barindex-t2 downto 0 do
    if $fvgDir[i] = 1 and $State[i] = 1 and close[j] > $invTop[i] THEN
    count2=count2+1
    $State[i] = -1
    break
    endif
    if $fvgDir[i] = -1 and $State[i] = 1 and close[j] < $invBot[i] THEN
    count2=count2+1
    $State[i] = -1
    break
    endif
    next
    endif
    next
    
    count=0
    for i=n downto 0 do
    if $State[i] = 1 and count < dispNum then
    $levelPriceRef[count]=($invBot[i]+$invTop[i])/2
    $levelIdxRef[count]=$invRight[i]
    $DirRef[count]=$fvgDir[i]
    count=count+1
    endif
    next
    setup=0
    for i=count downto 0 do
    t3=$levelIdxRef[i]
    if t3<barindex then
    for j=barindex-(t3+1) downto 0 do
    if high[j]>$levelPriceRef[i] and low[j]<$levelPriceRef[i] and $DirRef[i]=1 then
    setup=-1
    elsif high[j]>$levelPriceRef[i] and low[j]<$levelPriceRef[i] and $DirRef[i]=-1 then
    setup=1
    else
    setup=0
    endif
    next
    endif
    next
    endif
    
    //-----------------------------------------------//
    return 0 as "zero", setup
    
    Alai-n thanked this post
    #248443 quote
    Alai-n
    Participant
    Veteran

    Tout a l’air de fonctionner parfaitement comme tu le décris.

    Mais en effet c’est un problème que le deuxième code ne déclenche seulement que sûr le dernier IFVG. J’imagine que tu n’as pas d’autres solutions, sinon tu l’aurais mise en place. Encore merci

    #249162 quote
    slimanb
    Participant
    New

    bonjour

    marci pour la reponse rapide

    quand j’active l’in dicateur je recois le signal erreur : définir les variabled:atrMult,dispNum,ShowbrokenFvg

    cordialement

    #249166 quote
    robertogozzi
    Moderator
    Master

    Ces variables sont définies sur les lignes 2, 3 et 4.

    Iván González thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Créer une Alerte sur test IFVG


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Alai-n @alai-n Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by robertogozzi
6 months, 1 week ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 06/17/2025
Status: Active
Attachments: 3 files
Logo Logo
Loading...