Position d’un indicateur par rapport à un autre

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #199281 quote
    finplus
    Participant
    Master

    Bonjour, j’utilise les deux indicateurs suivants :

    //////////////////////////////// Trend Envelopppes (développé par Nicolas)
    
    timePeriod=14
    Deviation=0.1
     
    price1=customclose
     
    dsma = WeightedAverage[timePeriod](price1)
    
    valuesHigh = (1 + deviation / 100) * dsma
    valuesLow = (1 - deviation / 100) * dsma
     
    inputs=price1
    
    if (inputs > valuesHigh)then
    trend = 1
    elsif (inputs < valuesLow) then
    trend = -1
    endif
     
    if (trend > 0) then
    alpha1 = 0
    if ( valuesLow < valuesLow[1]) then
    valuesLow = valuesLow[1]
    endif
    if trend[1]>0 then
    outputs0 = valuesLow
    outputs1 = valueshigh
    alpha0 = 255
    endif
    else
    alpha0=0
    if (valuesHigh > valuesHigh[1]) then
    valuesHigh = valuesHigh[1]
    endif
    if trend[1]<0 then
    outputs1 = valuesHigh
    outputs0 = valueslow
    alpha1 = 255
    endif
    endif
     
    
    
     
    return outputs0 coloured(65,105,225,alpha0) as "EnvelopUp", outputs1 coloured(255,0,0,alpha1) as "Envelopdn"
    
    
    //PRC_Adaptive-ATR-ADX-Trend-V2 | indicator
    //29.06.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from tradingview code
    
    // --- settings
    atrLen = 21
    m1 = 3.5 //"ATR Multiplier - ADX Rising"
    m2 = 1.75 //"ATR Multiplier - ADX Falling"
    adxLen = 14
    adxThresh = 30 //"ADX Threshold"
    aboveThresh = 1 //true, title = "ADX Above Threshold uses ATR Falling Multiplier Even if Rising?")
    useHeiken = 1 //(false, title = "Use Heiken-Ashi Bars (Source will be ohlc4)")
    // --- end of settings
    
    source = MedianPrice
        
    // DI-Pos, DI-Neg, ADX
    
    hR = high-high[1]
    lR = -(low-low[1])
    
    if hr>lr then
    dmPos=max(hr,0)
    else
    dmPos=0
    endif
    if lr>hr then
    dmNeg=max(lr,0)
    else
    dmNeg=0
    endif
    
    sTR = (sTR[1] - sTR[1]) / adxLen + tr
    
    sDMPos = (sDMPos[1] - sDMPos[1]) / adxLen + dmPos
    sDMNeg = (sDMNeg[1] - sDMNeg[1]) / adxLen + dmNeg
    
    DIP = sDMPos / sTR * 100
    DIN = sDMNeg / sTR * 100
    DX = abs(DIP - DIN) / (DIP + DIN) * 100
    aadx = average[adxLen](DX)
    
    // Heiken-Ashi
    
    if barindex<2 then
    xClose = close
    xOpen = open
    else
    xClose = TotalPrice
    xOpen = (xOpen[1] + close[1]) / 2
    endif
    xHigh = max(high, max(xOpen, xClose))
    xLow = min(low, min(xOpen, xClose))
    
    // Trailing ATR
    
    v1 = abs(xHigh - xClose[1])
    v2 = abs(xLow - xClose[1])
    v3 = xHigh - xLow
    
    trueRange = max(v1, max(v2, v3))
    if useHeiken then
    atr = WilderAverage[atrLen](trueRange)
    else
    atr = AverageTrueRange[atrLen]
    endif
    
    if aadx>aadx[1] and (adx < adxThresh or not aboveThresh) then
    m=m1
    elsif aadx<aadx[1] or (adx > adxThresh and aboveThresh) then
    m=m2
    else
    m = m[1]
    endif
    
    if DIP >= DIN then
    mUp=m
    else
    mUp=m2
    endif
    if DIN >= DIP then
    mDn=m
    else
    mDn=m2
    endif
    
    if useHeiken then
    src=xClose
    c=Xclose
    t=(xHigh+xLow)/2
    else
    src=source
    c=close
    t=MedianPrice
    endif
    
    upATR = t - mUp * atr
    dnATR = t + mDn * atr
    
    if max(src[1], c[1]) > TUp[1] then
    TUp = max(upATR,TUp[1])
    else
    TUp = upATR
    endif
    
    if min(src[1], c[1]) < TDown[1] then
    TDown = min(dnATR, TDown[1])
    else
    TDown = dnATR
    endif
    
    //trend
    if min(src,min(c,close))>TDown[1] then
    trendATR=1
    elsif max(src,max(c,close))<TUp[1] then
    trendATR=-1
    else
    trendATR=trendATR[1]
    endif
    
    if trendATR=1 then
    sstop=TUp
    else
    sstop=TDown
    endif
    
    
    
    
    return sstop as "ATR ADX Trend"

    J’aurai aimé identifié les valeurs dont EnvelopUp est au dessus de l’ATR ADX Trend et les valeurs dont EnvelopDn est au dessous de l’ATR ADX Trend.

    Quelqu’un peut-il m’aider ?

    Merci.

    #199380 quote
    JC_Bywan
    Moderator
    Master

    Bonjour,

    Afin d’éviter les call dans le screener, si les noms de variables de l’un des indicateurs sont tous différents de ceux de l’autre (s’il y en a de même nom, modifier les noms), tu peux recopier chacun des 2 indicateurs sans leur dernière ligne return dans un screener, puis ajouter à la fin du screener:

    cond= outputs0 > sstop // EnvelopUp est au dessus de l’ATR ADX Trend
    
    screener[cond]

    ou pour l’autre screener:

    cond= outputs1 < sstop // EnvelopDn est en dessous de l’ATR ADX Trend
    
    screener[cond]
    #199419 quote
    finplus
    Participant
    Master

    Merci. Juste une confirmation : EnvelopUP = Outputs O ?

    #199420 quote
    JC_Bywan
    Moderator
    Master

    C’est un zéro, pas la lettre O, cf tes lignes 27,38,46 où on voit la barre qui traverse (donc un zéro).

    #199445 quote
    finplus
    Participant
    Master

    Merci. Cela fonctionne parfaitement.

    Bonne journée.

    JC_Bywan thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Position d’un indicateur par rapport à un autre


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by finplus
3 years, 6 months ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 08/20/2022
Status: Active
Attachments: No files
Logo Logo
Loading...