Every Fractal indicator minor bug fix

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • #124162 quote
    Vonasi
    Moderator
    Master

    I have a minor bug fix for the indicator that can be found in the library here:

    Every Fractal trend lines

    The ITF file attached here corrects an issue whereby the indicator crashes if you enter a value for ‘Qty’ that is greater than the number of fractals detected.

    Here is the updated code:

    //Every Fractal
    //PRT v11
    //By Vonasi
    //Date: 20200331
    
    //Qty = 1
    //StartBack = 0
    //Past = 1
    //Future = 1
    //Points = 1
    //Fade = 0
    //BarsBefore = 1
    //BarsAfter = 1
    
    BarsBefore = max(BarsBefore,1)
    BarsAfter = max(BarsAfter,1)
    StartBack = max(0,startback)
              
    BarLookBack  = BarsAfter + 1
    if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THEN
    if low[BarsAfter] = lowest[BarLookBack](low) THEN
    a = a + 1
    $supportbar[a] = barindex[barsafter]
    $supportvalue[a] = low[barsafter]
    endif
    endif
    if high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THEN
    if high[BarsAfter] = highest[BarLookBack](high) THEN
    b = b + 1
    $resistancebar[b] = barindex[barsafter]
    $resistancevalue[b] = high[barsafter]
    endif
    endif
    
    if islastbarupdate then
    myqty = min(min(b,a),qty)
    for z = 0 to myqty-1
    e = (myqty)-z
    if fade then
    c = (255/myqty)*e
    else
    c = 255
    endif
    if support then
    if a >= 2 then
    if future then
    drawray($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],$supportbar[a-z-startback],$supportvalue[a-z-startback])coloured(128,0,0,c)
    endif
    if past then
    drawray($supportbar[a-z-startback],$supportvalue[a-z-startback],$supportbar[a-z-1-startback],$supportvalue[a-z-1-startback])coloured(128,0,0,c)
    endif
    if points then
    drawpoint($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],2)coloured(128,0,0,c)
    drawpoint($supportbar[a-z-startback],$supportvalue[a-z-startback],2)coloured(128,0,0,c)
    endif
    endif
    endif
    
    if resistance then
    if b >= 2 then
    if future then
    drawray($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],$resistancebar[b-z-startback],$resistancevalue[b-z-startback])coloured(0,128,0,c)
    endif
    if past then
    drawray($resistancebar[b-z-startback],$resistancevalue[b-z-startback],$resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback])coloured(0,128,0,c)
    endif
    if points then
    drawpoint($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],2)coloured(0,128,0,c)
    drawpoint($resistancebar[b-z-startback],$resistancevalue[b-z-startback],2)coloured(0,128,0,c)
    endif
    endif
    endif
    next
    endif
    
    return
    
    Every-Fractalv1.3-PRTv11.itf
    #124171 quote
    Vinks_o_7
    Participant
    Master

    Thanks for your feedback.
    Still have an error (see enclosed capture) and yes I downloaded the file(s).

    Capture-1.jpg Capture-1.jpg
    #124188 quote
    Vonasi
    Moderator
    Master

    What is your exact version number? Mine is version 11.1 1.8_0.202. If we are on the same then we can eliminate that as a reason.

    #124197 quote
    Vinks_o_7
    Participant
    Master

    H

    If I click on the About item in PRT: V11.1 – 1.8.0_45 12 March 2020

    #124206 quote
    Nicolas
    Keymaster
    Master

    You should not have this error.. Do you get it on every instrument and timeframe please?

    #124222 quote
    Vinks_o_7
    Participant
    Master

    Hi Nicolas
    Nope only on indicators I downloaded recently from PRCode on a daily timeframe.
    Here’s the code that does not work (line 23): $supportbar[a] = barindex[barsafter] which is why I thought it’s an array issue.
    All other indicators’re working fine (I run them under Windows BTW).
    Thanks

    #124226 quote
    Vonasi
    Moderator
    Master

    At that point in the code even on the first run through a = 1 and barsafter can never be less than 1 so their should never be any error.

    It is quite difficult to bug fix this when I cannot reproduce the error.

    I’ll add something to the code so that it does not start looking for fractals until there are definitely enough bars to have one and post the code here for you to try.

    I know it sounds stupid but have you tried TIOATIBOA. (Turning it off and turning it back on a gain!) I have found that sometimes in the past shutting down the platform and reopening it and some odd errors suddenly disappear.

    #124230 quote
    Vonasi
    Moderator
    Master

    Here is the modified code whereby it only looks for fractals if there are enough bars on the chart to have one. I don’t think it will fix your issue though. Let us know.

    //Every Fractal v1.4
    //PRT v11
    //By Vonasi
    //Date: 20200331
    
    //Qty = 1
    //StartBack = 0
    //Past = 1
    //Future = 1
    //Points = 1
    //Fade = 0
    //BarsBefore = 1
    //BarsAfter = 1
    
    BarsBefore = max(BarsBefore,1)
    BarsAfter = max(BarsAfter,1)
    StartBack = max(0,startback)
    
    if barindex >= barsbefore + barsafter then
    BarLookBack  = BarsAfter + 1
    if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THEN
    if low[BarsAfter] = lowest[BarLookBack](low) THEN
    a = a + 1
    $supportbar[a] = barindex[barsafter]
    $supportvalue[a] = low[barsafter]
    endif
    endif
    if high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THEN
    if high[BarsAfter] = highest[BarLookBack](high) THEN
    b = b + 1
    $resistancebar[b] = barindex[barsafter]
    $resistancevalue[b] = high[barsafter]
    endif
    endif
    
    if islastbarupdate then
    myqty = min(min(b,a),qty)
    for z = 0 to myqty-1
    e = (myqty)-z
    if fade then
    c = (255/myqty)*e
    else
    c = 255
    endif
    if support then
    if a >= 2 then
    if future then
    drawray($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],$supportbar[a-z-startback],$supportvalue[a-z-startback])coloured(128,0,0,c)
    endif
    if past then
    drawray($supportbar[a-z-startback],$supportvalue[a-z-startback],$supportbar[a-z-1-startback],$supportvalue[a-z-1-startback])coloured(128,0,0,c)
    endif
    if points then
    drawpoint($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],2)coloured(128,0,0,c)
    drawpoint($supportbar[a-z-startback],$supportvalue[a-z-startback],2)coloured(128,0,0,c)
    endif
    endif
    endif
    
    if resistance then
    if b >= 2 then
    if future then
    drawray($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],$resistancebar[b-z-startback],$resistancevalue[b-z-startback])coloured(0,128,0,c)
    endif
    if past then
    drawray($resistancebar[b-z-startback],$resistancevalue[b-z-startback],$resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback])coloured(0,128,0,c)
    endif
    if points then
    drawpoint($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],2)coloured(0,128,0,c)
    drawpoint($resistancebar[b-z-startback],$resistancevalue[b-z-startback],2)coloured(0,128,0,c)
    endif
    endif
    endif
    next
    endif
    endif
    
    return
    
    Every-Fractalv1.4-PRTv11.itf
    #124242 quote
    Vinks_o_7
    Participant
    Master

    Hi Vonassi
    I relaunched the platform, deleted the old version and imported your new file but I have a similar error (see enclosed screen capture who asked me to edit the code).
    Anyway, thanks for your help.

    #124362 quote
    Vonasi
    Moderator
    Master

    Are you with IB? If so there has been an update today for their version of PRTv11 so this might fix your issue.

    #124574 quote
    Vinks_o_7
    Participant
    Master

    Hi Vonassi
    Yes I’m with Interactive Broker, will give it a try today 😉

    #124575 quote
    Vinks_o_7
    Participant
    Master

    no more error: it works…ευχαριστώ

    #124591 quote
    Vonasi
    Moderator
    Master

    I’m glad to hear that it was a platform version issue and not an issue with my code. It’s so much easier when someone else fixes the problem 🙂

    I’m actually from the UK by the way but my location is Greece.My Greek is just about up to understanding ‘ευχαριστώ’ so I won’t tell you off for posting in the wrong language!

    #124598 quote
    Vinks_o_7
    Participant
    Master

    Anyway, thanks for your hard work and help !

    #124605 quote
    GraHal
    Participant
    Master

    I’m actually from the UK

    Until you explained (a while back) where Vonasi comes from, I had thought you must be of German origin! 🙂

    But having thought above, I couldn’t understand how you had a UK sense of humour and had even watched ‘Minder’ ! 🙂

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

Every Fractal indicator minor bug fix


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 27 replies,
has 6 voices, and was last updated by parthapersonal
5 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/31/2020
Status: Active
Attachments: 5 files
Logo Logo
Loading...