VIDYA

  • This topic has 1 reply, 2 voices, and was last updated 1 week ago by avatarIván.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #253813

    Buenas, me gustaría tener un proscreener del indicador VIDYA, en el momento que aparece la flecha arriba o abajo, a continuación dejo el código (algo modificado) del que se subió hace unos meses, gracias:

     

    //——————————————//
    //PRC_Volumatic VIDYA
    //version = 0
    //13.11.2024
    //Iván González @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    //——————————————//
    //Inputs
    //——————————————//
    vidyaLength=10
    vidyaMomentum=20
    bandDistance=2
    prd=3
    src=close
    //——————————————//
    // ATR
    //——————————————//
    atrvalue=averagetruerange[200](close)
    //——————————————//
    // VIDYA – Variable INdex Dynamic Average
    //——————————————//
    mom=src-src[1]
    PosMon=mom>=0
    NegMon=mom<0
    sumPosMom=summation[vidyaMomentum](mom*PosMon)
    sumNegMom=summation[vidyaMomentum](-mom*NegMon)
    once vidyaValue=src
    if barindex>20 then
    absCmo=abs(100*(sumPosMom-sumNegMom)/(sumPosMom+sumNegMom))
    alpha=2/(vidyaLength+1)
    vidyaValue=alpha*absCmo/100*src+(1-alpha*abscmo/100)*(vidyaValue[1])
    SMAvidyaValue=average[15](vidyaValue)
    endif
    //——————————————//
    // Upper & Lower Bands
    //——————————————//
    upperBand=SMAvidyaValue+atrvalue*bandDistance
    lowerBand=SMAvidyaValue-atrvalue*bandDistance
    //——————————————//
    // Trend Direction
    //——————————————//
    if src crosses over upperband then
    r=23
    g=233
    b=173
    isTrendUp=1
    elsif src crosses under lowerband then
    r=221
    g=50
    b=107
    isTrendUp=0
    endif
    //Set Trend-based smoothing variable
    if isTrendUp then
    SmoothedValue=lowerBand
    if isTrendUp<>isTrendUp[1] then
    DRAWARROWUP(barindex,SmoothedValue+0.15*tr)coloured(r,g,b)
    endif
    elsif isTrendUp=0 then
    SmoothedValue=upperBand
    if isTrendUp<>isTrendUp[1] then
    DRAWARROWDOWN(barindex,SmoothedValue+0.15*tr)coloured(r,g,b)
    endif
    endif
    //——————————————//
    // Pivot Highs & Low
    //——————————————//
    //Pivot high
    src1=high
    ph1 = src1 < src1[prd]
    ph2 = highest[prd](src1) < src1[prd]
    ph3 = src1[prd] > highest[prd](src1)[prd+1]
    if ph1 and ph2 and ph3 then
    $pivotH[t+1] = src1[prd]
    $pivotHx[t+1] = barindex[prd]
    t=t+1
    endif
    //Pivot Low
    src2=close
    pl1 = src2 > src2[prd]
    pl2 = lowest[prd](src2) > src2[prd]
    pl3 = src2[prd] < lowest[prd](src2)[prd+1]
    if pl1 and pl2 and pl3 then
    $pivotL[z+1] = src2[prd]
    $pivotLx[z+1] = barindex[prd]
    z=z+1
    endif
    //——————————————//
    // Lines for Support Zones
    //——————————————//
    if low[prd]>smoothedValue and z<>z[1] then
    rr=23
    gg=233
    bb=173

    volumeValue=summation[prd+prd](volume)/(prd+prd)
    $LineLowx1[n+1]=barindex[prd]
    $LineLowy1[n+1]=low[prd]
    n=n+1
    endif
    if n>0 then
    for i=0 to n-1 do
    priceCross=smoothedValue>$LineLowy1[i] and smoothedValue[1]<=$LineLowy1[i]
    isShortLine=barindex-$LineLowx1[i]<50
    if priceCross and isShortLine and isTrendUp=isTrendUp[1] then
    $LineLowx2[i]=barindex

    endif

    next
    endif
    //——————————————//
    // Lines for Resistance Zones
    //——————————————//
    if high[prd]<smoothedValue and t<>t[1] then
    rr=221
    gg=50
    bb=107

    volumeValue=summation[prd+prd](-volume)/(prd+prd)
    $LineHighx1[p+1]=barindex[prd]
    $LineHighy1[p+1]=high[prd]
    p=p+1
    endif
    if p>0 then
    for i=0 to p-1 do
    priceCross=smoothedValue<$LineHighy1[i] and smoothedValue[1]>=$LineHighy1[i]
    isShortLine=barindex-$LineHighx1[i]<50
    if priceCross and isShortLine and isTrendUp=isTrendUp[1] then
    $LineHighx2[i]=barindex

    endif

    next
    endif
    colorbetween((high+low)/2,smoothedValue,r,g,b,50)
    //——————————————//
    // Plot Volume and trend on the last bar
    //——————————————//
    trendCrossUp=isTrendUp[1]=0 and isTrendUp
    trendCrossDown=isTrendUp[1] and isTrendUp=0

    if trendCrossUp<>trendCrossUp[1] or trendCrossDown<>trendCrossDown[1] then
    upTrendVolume=0
    downTrendVolume=0
    else
    if close>open then
    upTrendVolume=volume+upTrendVolume
    else
    upTrendVolume=upTrendVolume
    endif
    if close<open then
    downTrendVolume=volume+downTrendVolume
    else
    downTrendVolume=downTrendVolume
    endif
    endif
    avgVolumeDelta=(upTrendVolume+downTrendVolume)/2

    //Calculate delta Volume percentage
    if avgVolumeDelta<>0 then
    deltaVolume=round((upTrendVolume-downTrendVolume)/avgVolumeDelta*100,2)
    endif
    if islastbarupdate then

    drawtext(“Delta Volume: #deltaVolume#%”,-500,-30)anchor(topright,xshift,yshift) coloured (p,p,b)

    endif
    //——————————————//
    return SmoothedValue coloured(r,g,b)style(line,2)

    #253844

    Aquí tienes:

     

    2 users thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login