Fibonacci conversión indicador

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #232636 quote
    MaricarmenMaricarmen
    Participant
    Veteran

    Estoy enfrascado en un pequeño estudio aplicando extensiones  Fibonacci, y con este indicador espero ver algo de luz en lo que estoy buscando.

    Se podría hacer la conversión del mismo del siguiente enlace: https://www.tradingview.com/script/JU3WaXGC-Order-Blocks-W-Realtime-Fibs-QuantVue/

    Gracias anticipadas,

    #232766 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Buenas

    Aquí tienes el indicador:

     

    defparam drawonlastbaronly = true
    //-----Inputs---------------------------------------------//
    barsReq=6//Consecutive Bars Required
    percGain=0.0//Percent Gain Required
    opposites=0//Boolean//Require Opposite Order Block
    //--------------------------------------------------------//
    gainBull=abs(low[barsReq]-close)/low[barsReq]*100
    gainBear=abs(high[barsReq]-close)/high[barsReq]*100
    gainCheck=gainBull >= percGain or gainBear >= percGain
    
    lastDown=close[barsReq]<open[barsReq]
    lastUp=close[barsReq]>open[barsReq]
    
    barsCount1=0
    if lastDown then
    for i=0 to barsReq do
    if close[i]>open[i] then
    barsCount1=barsCount1+1
    endif
    next
    endif
    barsCount=0
    if lastUp then
    for j=0 to barsReq do
    if close[j]<open[j] then
    barsCount=barsCount+1
    endif
    next
    endif
    //--------------------------------------------------------//
    if opposites then
    bullish=lastDown and barsCount1>=barsReq and gainCheck and not bu
    bearish=lastUp and barsCount>=barsReq and gainCheck and not be
    else
    bullish=lastDown and barsCount1>=barsReq and gainCheck and (not bu or bu)
    bearish=lastUp and barsCount>=barsReq and gainCheck and (not be or be)
    endif
    //--------------------------------------------------------//
    once bu=0
    once be=0
    if bullish then
    bu=1
    be=0
    $Bull[z+1]=1
    $Bear[t]=0
    $ObBullTop[z+1]=high[barsReq]
    $ObBullBot[z+1]=low[barsReq]
    $ObBullX[z+1]=barindex[barsReq]
    $ObBullX2[z+1]=barindex[barsReq]
    z=z+1
    endif
    
    if bearish then
    bu=0
    be=1
    
    $Bull[z]=0
    $Bear[t+1]=1
    $ObBearTop[t+1]=High[barsReq]
    $ObBearBot[t+1]=Low[barsReq]
    $ObBearX[t+1]=barindex[barsReq]
    $ObBearX2[t+1]=barindex[barsReq]
    t=t+1
    endif
    
    if islastbarupdate then
    for i=z downto 0 do
    for k=barindex downto 0 do
    if barindex[k]>$ObBullX[i]+barsReq and close[k] < $ObBullTop[i] then
    $ObBullX2[i]=barindex[k]
    break
    else
    $ObBullX2[i]=barindex//$ObBullX[i]+150
    endif
    next
    drawrectangle($ObBullX[i],$ObBullBot[i],$ObBullX2[i],$ObBullTop[i])fillcolor("green",35)coloured("green")
    next
    
    for j=t downto 0 do
    for w=barindex downto 0 do
    if barindex[w]>$ObBearX[j]+barsReq and close[w] > $ObBearTop[j] then
    $ObBearX2[j]=barindex[w]
    break
    else
    $ObBearX2[j]=barindex//$ObBearX[j]+150
    endif
    next
    drawrectangle($ObBearX[j],$ObBearBot[j],$ObBearX2[j],$ObBearTop[j])fillcolor("red",35)coloured("red")
    next
    
    if $ObBullX[z]>$ObBearX[t] then
    
    barsfibBull=barindex-$ObBullX[z]
    lev0bu=highest[barsfibBull](high)
    lev1bu=$ObBullBot[z]
    
    fibTotalbu=lev0bu-lev1bu
    lev236bu=lev0bu-(fibTotalbu*0.236)
    lev382bu=lev0bu-(fibTotalbu*0.382)
    lev50bu=lev0bu-(fibTotalbu*0.500)
    lev618bu=lev0bu-(fibTotalbu*0.618)
    lev786bu=lev0bu-(fibTotalbu*0.786)
    
    drawsegment($ObBullX[z],lev0bu,$ObBullX2[z]+20,lev0bu)style(line)
    drawsegment($ObBullX[z],lev1bu,$ObBullX2[z]+20,lev1bu)style(line)
    drawsegment($ObBullX[z],lev236bu,$ObBullX2[z]+20,lev236bu)style(dottedline2)
    drawsegment($ObBullX[z],lev382bu,$ObBullX2[z]+20,lev382bu)style(dottedline2)
    drawsegment($ObBullX[z],lev50bu,$ObBullX2[z]+20,lev50bu)style(dottedline2,2)coloured("blue")
    drawsegment($ObBullX[z],lev618bu,$ObBullX2[z]+20,lev618bu)style(dottedline2,2)coloured("red")
    drawsegment($ObBullX[z],lev786bu,$ObBullX2[z]+20,lev786bu)style(dottedline2)
    else
    barsfib=barindex-$ObBearX[t]
    lev0be=lowest[barsfib](low)
    lev1be=$ObBearTop[t]
    
    fibTotalbe=lev1be-lev0be
    lev236be=lev0be+(fibTotalbe*0.236)
    lev382be=lev0be+(fibTotalbe*0.382)
    lev50be=lev0be+(fibTotalbe*0.500)
    lev618be=lev0be+(fibTotalbe*0.618)
    lev786be=lev0be+(fibTotalbe*0.786)
    
    drawsegment($ObBearX[t],lev0be,$ObBearX2[t],lev0be)style(line)
    drawsegment($ObBearX[t],lev1be,$ObBearX2[t],lev1be)style(line)
    drawsegment($ObBearX[t],lev236be,$ObBearX2[t],lev236be)style(dottedline2)
    drawsegment($ObBearX[t],lev382be,$ObBearX2[t],lev382be)style(dottedline2)
    drawsegment($ObBearX[t],lev50be,$ObBearX2[t],lev50be)style(dottedline2,2)coloured("blue")
    drawsegment($ObBearX[t],lev618be,$ObBearX2[t],lev618be)style(dottedline2,2)coloured("red")
    drawsegment($ObBearX[t],lev786be,$ObBearX2[t],lev786be)style(dottedline2)
    endif
    endif
    //--------------------------------------------------------//
    //--------------------------------------------------------//
    //--------------------------------------------------------//
    //--------------------------------------------------------//
    return
    
    #232779 quote
    MaricarmenMaricarmen
    Participant
    Veteran

    No tengo palabras para mostrarles todo mi agradecimiento por todo lo que nos proporcionan para que podamos aprender algo.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Fibonacci conversión indicador


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
Maricarmen @maricarmen Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 05/14/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...