Arrays related bugs

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #241950 quote
    LucasBest
    Participant
    Junior

    Look, even if i add an other condition to check if the first array have been updated, it leads to the same error even if i check if the index of the first array is filled with “isset” instruction… That means that the array is temporarly updated then deleted to come back to previous situation according to the real close at the end of the bar!
    => Thus the only way to prevent this bug if to send the variable index into an other variable (temp) which then will occurs only at the end of the bar, preventing the code to reach an index of the first array that have not been permanently filled yet.

    Once RSILen = 14
    Once prd = 1
    Once pBcTi = -1
    Once pBmTi = -1
    
    src = RSI[RSILen](close)
    
    If src[prd] = lowest[2*prd+1](src) then
    pBcTi=pBcTi+1
    $pBcT[pBcTi]= Barindex-1
    
    if pBcTi > 2 and isset($pBcT[pBcTi]) then
    if src[barindex-$pBcT[pBcTi-1]] <= src[barindex-$pBcT[pBcTi-2]] and src[barindex-$pBcT[pBcTi-1]] <= src[barindex-$pBcT[pBcTi]] then
    pBmTi=pBmTi+1
    $pBmT[pBmTi]= $pBcT[pBcTi-1]
    drawpoint($pBcT[pBcTi-1],src[barindex-$pBcT[pBcTi-1]],3) coloured("red",100)
    endif
    endif
    endif
    
    Return src
    #241951 quote
    LucasBest
    Participant
    Junior

    I tried also using Lastset instruction… It does not solve the problem either!

    Once RSILen = 14
    Once prd = 1
    Once pBcTi = -1
    Once pBmTi = -1
    
    src = RSI[RSILen](close)
    
    If src[prd] = lowest[2*prd+1](src) then
    pBcTi=pBcTi+1
    $pBcT[pBcTi]= Barindex-1
    
    if lastset($pBcT) > 2 then
    if src[barindex-$pBcT[pBcTi-1]] <= src[barindex-$pBcT[pBcTi-2]] and src[barindex-$pBcT[pBcTi-1]] <= src[barindex-$pBcT[pBcTi]] then
    pBmTi=pBmTi+1
    $pBmT[pBmTi]= $pBcT[pBcTi-1]
    drawpoint($pBcT[pBcTi-1],src[barindex-$pBcT[pBcTi-1]],3) coloured("red",100)
    endif
    endif
    endif
    
    Return src
    
    #241952 quote
    LucasBest
    Participant
    Junior

    But things get even stranger here below…

    Once RSILen = 14
    Once prd = 1
    Once pBcTi = -1
    Once pBmTi = -1
    
    src = RSI[RSILen](close)
    
    If src[prd] = lowest[2*prd+1](src) then
    pBcTi=pBcTi+1
    $pBcT[pBcTi]= Barindex-1
    temp = pBcTi
    if temp > 2 then
    if src[barindex-$pBcT[pBcTi-1]] <= src[barindex-$pBcT[pBcTi-2]] and src[barindex-$pBcT[pBcTi-1]] <= src[barindex-$pBcT[pBcTi]] then
    pBmTi=pBmTi+1
    $pBmT[pBmTi]= $pBcT[pBcTi-1]
    drawpoint($pBcT[pBcTi-1],src[barindex-$pBcT[pBcTi-1]],3) coloured("red",100)
    endif
    endif
    endif
    
    Return src
    

    Can you explain that ? 🙂

    #242162 quote
    LucasBest
    Participant
    Junior

    Will we have something like PineScript instructions concerning bar state ?

    barstate.isconfirmed for exmple? Because using multiple arrays, with arrays that are updated by other arrays lead to strange results…

    https://www.tradingview.com/pine-script-docs/concepts/bar-states/#introduction

    Thanks

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.

Arrays related bugs


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
LucasBest @lucasbest Participant
Summary

This topic contains 18 replies,
has 3 voices, and was last updated by LucasBest
1 year, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/28/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...